Generate the Fibonacci sequence in the fewest amount of characters possible. Any language is OK, except for one that you define with one operator, f
, which prints the Fibonacci numbers.
Starting point: 25 14 characters in Haskell:
f=0:1:zipWith(+)f(tail f)
f=0:scanl(+)1f
Ruby (30 characters):
Microsoft Batch - 15 characters
Old challenge, but the world must know it is possible:
Output is to stderr in unary, counting only the # characters. Depending on the host system's space restrictions, it may produce only the first 14 numbers or so.
F#:
44 Chars
C#
I'm seeing a lot of answers that don't actually generate the sequence, but instead give you only the fibonacci number at position *n using recursion, which when looped to generate the sequence gets increasingly slower at higher values of n.
33 characters in C:
Perl 6 - 22 characters: