Problem Description:
Given is the function f(x) = ⌊230.403243784-x2⌋ × 10-9 ( ⌊ ⌋ is the floor-function), the sequence un is defined by u0 = -1 and un+1 = f(un). Find un + un+1 for n = 1012. Give your answer with 9 digits after the decimal point.
Solution:
def u(n): f = lambda x: int(2 ** (30.403243784 - x*x)) * 1e-9 return -1 if n==0 else f(u(n-1)) i = 0 while abs(u(i) - u(i+2)) > 1e-10: i += 51 print "Project Euler 197 Solution =", u(i) + u(i+1)
Morover the person in his analysis says:
” Instead of 10^12 iterations only a few hundred are required. “
Can someone please help me understand the code & logic and also the text in bold. Is the person using Floyd loop detection algorithm?
I have taken the above problem and solution from following this link.