🌀

Fibonacci spiral

Compute the Fibonacci sequence — and discover the golden ratio.

Maker· ages 12–1425 minwhile loopslistsindexingdivision
fib.py

First load pulls ~10 MB of Python. Only happens once — the browser caches it after.

What should the output look like?

You should see the sequence printed with bars, and a golden-ratio calculation at the end.

📖

How this works

Each Fibonacci number is the sum of the two before. Shows up everywhere in nature — flowers, seashells, pineapples. As the sequence grows, the ratio of consecutive numbers gets closer to the golden ratio (1.618).

Your turn — try these

  • 1Compute the 100th Fibonacci number. How many digits does it have?
  • 2Make it print only Fibonacci numbers that are also prime.
  • 3Print the sequence "in reverse" — from the biggest back to 0.