# 1λΆν° 10000κΉμ§ μ«μ μ μ₯ num_set = set(range(1, 10001)) # μ ν λλ²κ° μλ μλ₯Ό μ μ₯ not_self_num= set() for i in range(1, 10001): for j in str(i): # μ«μλ₯Ό λ¬Έμμ΄λ‘ λ³ννμ¬ 102μ΄λ©΄ 1, 0, 2λ‘ μ κ·Ό i += int(j) # d(i) = i + j1 + j2 + j3 + .. = 102 + 1 + 0 + 2 not_self_num.add(i) # μ ν λλ²κ° μλ μ μ μ₯ # μ ν λλ²λ§ μλ set = μ 체 μ set - μ ν λλ²κ° μλ μ set self_num = num_set - not_self_num # μ€λ¦μ°¨μμΌλ‘ μ λ ¬ ν μΆλ ₯ for i in sorted(self_num): print(i)