First-n Fibonacci sequence elements There is a well known question here that asks for a short (least characters) fibonacci sequence generator.

I would like to know if someone can generate the first N elements only, of the fibonacci sequence, in very short space.   I am trying to do it in python, but I'm interested in any short answer, in any language.  Function F(N) generates the first N elements of the sequence, either returns them as the return of the function or prints them.

Interestingly it seems that the code-golf answers start with 1 1 2, instead of 0 1 1 2. Is that a convention in code-golf or programming-in-general?  (Wikipedia says the fibonacci sequence starts with zero.). 

Python Sample (First 5 Elements):

def f(i,j,n):
    if n&gt;0:
        print i;
        f(j,i+j,n-1)
f(1,1,5)
C

Didn't bother counting, but here's a fun example:

f(n){return n&lt;4?1:f(--n)+f(--n);}
main(a,b){for(scanf("%d",&amp;b);a++&lt;=b;printf("%d ",f(a)));}


Proof it works.



I'm quite proud of this: I got bored, so I rearranged my code (with a few small additions) to make it where each line represents a value in the Fibonacci sequence.

                         #                                // 1
                         f                                // 1
                         //                               // 2
                        (n)                               // 3
                       {/**/                              // 5
                      return n                            // 8
                    &lt;2 ? 1:f(--n)                         // 13
                +f(--n); } main(a, b)                     // 21
          {a = 0, b = 0;scanf("%d",&amp;b); for(              // 34
;a &lt; b; a+=1) { int res = f(a); printf("%d ", res); } }   // 55


Proof it works.