Husk, 20 18 17 13 bytes
Thanks a lot @Zgarb for telling me about İf which is a built-in for Fibonacci numbers, this saved me 4 bytes:
´o↓=3↔`↑§↓=1ȯ↔`↑:0İf≤ Ungolfed/Explanation
-- implicit input N İf -- get all Fibonacci numbers, :0 -- prepend 0, `↑ ≤ -- take as as long as the number is ≤ N, ↔ȯ↔ -- reverse and § =1 =3 -- if length of resultinput == 31: ´o↓ ↓ -- drop first1 element else no element Old answer without built-in (17 bytes)
The old answer is quite similar to shooqie's Haskell answer:
´o↓=3↔`↑ȯƒo§↓=1ȯ↔`↑ȯƒo:0G+1≤ Ungolfed/Explanation
A really short way to compute Fibonacci numbers in Haskell is to define a recursive function like this (also see the Haskell answer):
fibos = 0 : scanl (+) 1 fibos Essentially that code computes the fixpoint of the function \f -> 0 : scanl (+) 1 f, so you can rewrite fibos in an anonymous way like this:
fix (\f -> 0 : scanl (+) 1 f) This corresponds to the Husk code (ƒo:0G+1), here's the remaining code annotated:
-- implicit input N ȯƒo:0G+1 -- generate Fibonacci numbers (ȯ is to avoid brackets), `↑ ≤ -- take as as long as the number is ≤ N, ↔ȯ↔ -- reverse and § =1 =3 -- if length of resultinput == 31: ´o↓ ↓ -- drop first1 element else no element