Calculate the nth Fibonacci number F[n]

The script is limited only by your machine and browser.

My Firefox will go up to F[1,510,300], after which the BigInt integer is too large to allocate.

My Chromium takes 43 seconds to calculate F[1,546,639,205], but crashes trying to write over about 97 MB/97,000,000 digits to the page.

As you enter n values, the expected number of digits and the memory requirement for the output string are displayed (one byte per UTF-8 digit).  To prevent a crash, you may select how many digits to display, and navigate through the digits in blocks.

The conversion from integer to string takes much longer than the calculation itself, 246 seconds for my F[1,546,639,205].  (It is possible to do it in blocks recursively so the progress can be displayed, but then it takes a lot longer.)

To avoid the long-running script notification in Firefox, go to about:config, search for dom.max_script_run_time, and set the time to a greater number of seconds.  For Chromium or Chrome, launch the browser with the --disable-hang-monitor flag.

get Fibonacci number   


display digits   «« first | « previous | next » | last »»  

about the script

Please visit | blog