Looping extremely large iteration numbers Python

This sum is the Euler 2 but the hacker ranks requires this to be done in less than 10 seconds at the same time with an extraordinarily large value of N = 4 * 10^16 which is not supported in python with xrange() function.

Thus our savior is itertools which is an inbuilt library that we have in handy.

The algorithm does not calculate Fibonacci numbers explicitly but calculate them directly within the loop in function fibo(n)

This is the code for the simulation

Comments

Popular Posts