PlayXP

새로운 사이트를 준비하는 동안
여러분의 이야기가 이어질 작은 공간을 마련했습니다.

PlayXP 서비스를 준비하며 함께 작업하고 있는 운영진 일러스트

이거 코드 넘모 막막합니다. 셀프 넘버라는데 멀로 접근해야 할 지 모르게썽용

조회 수 824
We define a ‘self-number’ denoted by d(n), which is a function that adds n and its each digit. For example, d(75) = 75 + 7 + 5 = 87. We can start from this number to create an infinite series such as n, d(n), d(d(n)), … For example, if you start with 33, the next number is 33 + 3 + 3 = 39, 39 + 3 + 9 = 51, and 51 + 5 + 1 = 57. This way we can make the following sequence: 33, 39, 51, 57, 69, 84, 96, 111, 114, 120, 123, 129, 141, ... Given a natural number N, write a program that prints the self-numbers less than 5N.
목록으로

댓글

댓글을 불러오는 중...