I often have to generate Fibonacci numbers so I created this simple online utility that does it for me. It lets you generate however many Fibonacci numbers you need starting from any position or value. It works in the browser and is powered by alien technology from the future.
Fibonacci Number Generator Options
Fibonacci Number Generator Examples (click to try!)
55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229
21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162
6342062245603453530175035701476270173705761625 12330336622373426073156312316453553176124653042 20672421070177101623353350220152043372032634667 33222757712572527716531662536625616570157507731 54115401002771631542105232756777662162212344620 107340360715564361460637115515625500752372054551 163455761720556213222744350474625363134604421371 273016342636342574703603466212453064107176476142 456474324557121010126550036707300447244003117533 751512667415463605032353525121753533353201615675
How Does This Fibonacci Number Generator Work?
bignumber.js, which lets it calculate Fibonacci numbers with arbitrary precision. It starts by defining two initial values
var first = 0 and
var second = 1, and creating an
array that will hold all computed Fibonacci numbers. Depending on the
count values (starting value or position and Fibonacci sequence length; specified in options) it adds the initial values to the
array. Then, it starts a simple
for loop that runs as long as
array.length (number of currently calculated Fibonacci numbers) is less than
count (number of values to compute; specified in options). In every loop iteration, it calculates the
current Fibonacci number as a sum of
first + second members, then it checks if
start (starting value or position; specified in options) is equal or greater than
current and if it is, it calls the
push(current) function to add the
current value to the
array. After this, it redefines
second variables as follows:
first = second,
second = current, and repeats the loop. Finally, when the loop ends, it converts all the numbers in
array to the
base (Fibonacci number base; specified in options) by calling
toString(base) function, and then formats all numbers by using a
join(separator) function and prints them to the screen.
Created by Browserling
This fibonacci number generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by our programmer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!
Secret message: If you love my tools, then I love you, too! Use coupon code TOOLLING to get a discount at my company.