Project Euler (2) 썸네일형 리스트형 [EP 092] T(n) = n의 각 자리수의 제곱의 합. T(T(T(..(n)...))) = n 이 되는 n은 1과 89 # http://projecteuler.net # Problem 92 # 2 2 2 2 2 # 89 -> 8 + 9 = 145 -> 1 + 4 + 5 = 42 -> 20 -> 16 -> 37 -> 58 -> 89 -> ... -> 89 # 1 -> 1 -> 1 from functools import lru_cache import time from tqdm import tqdm BIGN = 10 ** 7 sol_dict = dict() sol_dict[0] = 0 sol_dict[1] = 1 sol_dict[89] = 89 digit_sq = [i * i for i in range(10)] @lru_cache def arrives_at_89_recur(n: int): if n == 0 or n == 1 o.. [EP 005] least common multiple for a list of numbers #################################################### # http://projecteuler.net # # Problem 5 # # 2520 is the smallest number that can be divided # by each of the numbers from 1 to 10 without any # remainder. # # What is the smallest number that is evenly # divisible by all of the numbers from 1 to 20? #################################################### # Author : DwYoon # Date : 2007 04 12 N = .. 이전 1 다음