Fibonacci sequence

Enter how many numbers you want and generate the Fibonacci sequence (each number is the sum of the two before).

What it is

A sequence in which every number is the sum of the two before it: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55… You start from two ones and nothing else is needed. It appears in a book from 1202, the Liber Abaci by Leonardo of Pisa, known as Fibonacci, inside a problem about breeding rabbits, and it has become the most famous sequence in mathematics.

The numbers are exact, even the enormous ones

The terms grow fast: the 50th passes twelve billion, the 100th has twenty-one digits. Above a certain point a computer's ordinary numbers lose their final digits without saying so, and the result looks right but isn't. Here arbitrary-precision integers are used, so even term number five hundred is written with all its digits, not rounded.

The golden ratio comes out by itself

Dividing each number by the one before gives a sequence that gets closer and closer to 1.6180339…, the golden ratio: 5/3 = 1.666…, 8/5 = 1.6, 13/8 = 1.625, 21/13 = 1.615… It isn't a coincidence nor a mystical property: it happens for any sequence built by adding the two previous terms, whatever pair of numbers you start from.

Where it really is in nature, and where it isn't

It is there, verifiably, in the arrangement of leaves and seeds: the spirals of a sunflower nearly always count in pairs of Fibonacci numbers (34 and 55, or 55 and 89), and the same goes for pine cones and pineapples. The reason is geometric: that angle of rotation is the most efficient way to lay out seeds without overlapping them.

It isn't there, though, in many of the things it gets cited for. The nautilus shell is a logarithmic spiral but not the golden one; the Parthenon, the Mona Lisa and credit cards «with golden proportions» are largely a nineteenth-century invention, repeated ever since. The sequence is interesting enough not to need legends.

Nearby tools

For the factorial, the other sequence that grows like an avalanche, there is Factorial (n!). For random numbers Random number generator, and for expressions with powers and roots Scientific calculator.