Project Euler #197: Investigating the behaviour of a recursively defined sequence

  • + 1 comment

    This code passes for test0 and fails fro all of others I didn't understand the reason.

    import math 
    
    un, b = map(int, input().split() )
    
    def function(x,b): 
            return math.floor(2**(b-x**2))*10**(-9) 
    
    for _ in range(10**5):
            un1 = un
            un = function( un1, b)
    
    print(un + un1)