DEV Community

Discussion on: Let's Get Clever #1: Fibonacci Sequence

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

+1 for one-upping yourself, mate! ;)

I wonder how long n=(2^63)−1 would take. It may not even be achievable. My own code won't even manage it.

...I should tweak the spec to limit it to (2^16)-1 ;)

Thread Thread
 
jasman7799 profile image
Jarod Smith

given 1e6 is 88s, and 2e63/1e6 = 9.223e12, I would guess 8.116e14 seconds or 25,737,466.3636 years

Thread Thread
 
codemouse92 profile image
Jason C. McDonald

So, not long at all. ;)

Thread Thread
 
jasman7799 profile image
Jarod Smith • Edited

though JavaScript's Big Int library should allow for a number as big as your memory can hold. I think 4GB = 16gb = 16e+9 bits or digits, so theoretically if I could get absolute precision working with the closed form solution mentioned by edA‑qa mort‑ora‑y. Then the largest theoretical number I can handle would be 9.99999...e+16,000,000,000.