0

s(i+1) = ((si)^2 + 45) mod 1,000,000,007 this is one series for which my program works fine

s = [0,0] 
i = 1 
for i in range(1,5):
    s.append((pow(s[i],2) + 45) % 1000000007)
print s

values we are getting here are S = 0, 45, 2070, 4284945, 753524550, 478107844, 894218625 i.e. F(2) = 45, F(4) = 4284990 ..

Now we have F(10^2) = 26365463243, F(10^4) = 2495838522951.

By putting value of F(2) in equation (based on program), I am able to get value for F(4). But not same for F(10^2) to get value for F(10^4). Any hint for this?

puncrazy
  • 349
  • 2
  • 14

1 Answers1

1

Giving you hints will be dangerous... the project euler group might not be happy.

But I hope saying something like "Birthday paradox" won't be considered cheating... (anyway this is not even a hint to the best answer).

Enjoy your problem~

WhatsUp
  • 1,618
  • 11
  • 21