The fibonacci sequence is a very popular sequence made by Fibonacci in Italy. This sequence is seen time and time again in nature.

### For more info on this facinating sequence go here

Why can't you just do this?

`print("0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377")`

O(1) time and space complexity. Fast and simple

@DynamicSquid With this method you can decide how many numbers you want. In theory, you can have infinite with this.

@PowerCoder yeah, same with my method. but mine's much faster

@DynamicSquid But you have to hand-write it

@PowerCoder Unfortunately, it wouldn't be infinite because you'd run out of memory after some point.

@DynamicSquid you could use list comprehensions they are faster

@DynamicSquid @PowerCoder im losing brains cells trying to understand you guys bruh

nice

Thats only in one line...

I feel scammed give me back my money >:(

`fib = lambda n: n if n < 2 else fib(n-2) + fib(n-1)`

```
f=lambda x:f(x-1)+f(x-2) if x>1 else x
print([f(x) for x in range(int((input("How many numbers of the fibonacci sequence would you like?\n"))))])
```

Another version, using recursion. (Hey, that rhymed)

123

@PowerCoder Can I make this in Fortran or C or C++ to make this faster?

@PowerCoder Thanks, you are posiedon on Discord right?

the problem with this is that Python is SLOW, Use fortran or a C language for the SPEEEEEEED

@lightningrock It crashed RIP. It was too many numbers

*cough* list comprehensions *cough*

One line:

`past = [0, 1];for i in range(2, int(input("How many numbers of the fibonacci sequence would you like?\n"))):past.append(past[i-2] + past[i-1]);print(past)`

@HENRYMARTIN4 Python doesn't support semi-colons. It's identation-reliant

@PowerCoder huh i thought that worked

list comprehensions @HENRYMARTIN4

@PowerCoder python does support semicolons, actually

I did it in just 2 lines

```
import math
print(list(map(lambda x:math.floor(((1+5**.5)/2)**x/5**.5), range(int(input())))))
```

it's possible to do it in 1 line if I didn't import math.

@AtticusKuhn list comprehensions

I can make that into 1 line, one sec @AtticusKuhn

1 line:

`print(list(map(lambda x:__import__('math').floor(((1+5**.5)/2)**x/5**.5), range(int(input())))))`

oops i killed it welp xD

@Bookie0 LOL

@Bookie0 it can go up to 5 digits lol try it

Yea lol @OctagonalT