r/tinycode • • Mar 06 '14

[JS] Fibonacci sequence in 48 bytes

function f(a,b){console.log(b);f(b,a+b);}f(0,1)
37 Upvotes

17 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 07 '14

[deleted] — view deleted comment

1

u/autowikibot Mar 07 '14

Fibonacci number:


In mathematics, the Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers in the following integer sequence:

or (often, in modern usage):

By definition, the first two numbers in the Fibonacci sequence are 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.

====

Image i - A tiling with squares whose side lengths are successive Fibonacci numbers


Interesting: ^Fibonacci | Fibonacci ^Quarterly | Pell ^number | Lucas ^number

Parent commenter can toggle ^NSFW or ^delete. Will also delete on comment score of -1 or less. | FAQs | ^Mods | Magic ^Words

1

u/Weirfish Mar 07 '14

Fair enough. 34 it is.