[구현 - 4673번]셀프 넘버

numbers = set(range(1, 10001))
remove_set = set()

for number in numbers:
    for num in str(number):
        number += int(num)
    remove_set.add(number)

self_numbers = numbers-remove_set
for self_num in sorted(self_numbers):
    print(self_num)

좋은 웹페이지 즐겨찾기