#WEEKLY Fibonacci Sequence!
CodingCactus (3034)

The Fibonacci sequence is where the next number in the sequence is the previous two numbers added together. So: 0,1,1,2,3,5 is part of it for example.

But the problem is, how do you do this without using a loop?
Well, if I'm honest I had no clue until I saw someone else do some clever string manipulation and then eval(). And that is pretty much what I have done except I have turned it into js and then sent that with the template and then that js is run. it uses bigints so that you can get massive numbers (but I've capped it at nth = 1,000,000 because once it gets that big, memory and overflow start complaining. It has a loading circle thingy for when it takes a while to compute as well.

As well as just using the form, you can go to /<nth> (e.g. https://fib.codingcactus.repl.co/500000). Seems pretty useless but it means that you can share a certain nth with someone easier rather than having them type it in. Yeah I guess it is pretty useless actually.


You are viewing a single comment. View All