# Tag Info

63

Mathematica, 10 bytes Fibonorial Another Mathematica built-in soundly beaten by a golfing language without the built-in.

58

Actually, 1 byte f Yes, there's a builtin for this, since November 16, 2015. Try it online For fun, without the builtin, it's 9 bytes: ╗1F╜=╓i Try it online! Explanation: ╗1F╜=╓i ╗ push input to register 0 1F╜=╓ push list containing first value x (starting with x = 0) where: F fib(x) ╜= is equal to the input ...

48

Perl 6, 10 chars: Anonymous infinite fibonacci sequence list: ^2,*+*...* Same as: 0, 1, -> $x,$y { $x +$y } ... Inf; So, you can assign it to an array: my @short-fibs = ^2, * + * ... *; or my @fibs = 0, 1, -> $x,$y { $x +$y } ... Inf; And get the first eleven values (from 0 to 10) with: say @short-fibs[^11]; or with: say @fibs[^11]; ...

45

Python 2, 62 bytes a=b=1;exec"print~a%2*'Fibo'+~a%3/2*'Nacci'or a;a,b=b,a+b;"*100 Not much different from the standard FizzBuzz, really.

42

Mathematica, 25 bytes InverseFunction@Fibonacci Function. Pretty self-explanatory if you ask me.

38

C Didn't bother counting, but here's a fun example: f(n){return n<4?1:f(--n)+f(--n);} main(a,b){for(scanf("%d",&b);a++<=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. ...

36

Neim, 2 bytes f𝕚 Explanation: f Push an infinite fibonacci list 𝕚 Is the input in that list? Works the same as my It's Hip to be Square answer, but uses a different infinite list: f, for fibonacci. Try it!

34

Python 2 + sympy, 72 bytes from sympy import* n=sqrt(5) print'7'+((.5+n/2)**1e9/n).evalf(1e3)[2:] Try it online! -10 bytes by removing the practically-0 term thanks to Jeff Dege -1 byte (1000 -> 1e3 thanks to Zacharý) -2 bytes by removing the unnecessary variable thanks to Erik the Outgolfer -2 bytes by moving to Python 2 thanks to Zacharý -3 bytes by ...

28

JavaScript (ES6), 45 bytes f=(n,x=0,y=1)=>n?f(n-1,y,(x%9||x)+(y%9||y)):x <input type=number min=0 oninput=o.textContent=f(this.value)><pre id=o> x and y can't both be 9, since that would require the previous number to be 0, so their digital sum can't exceed 17. This means that the digital root for numbers greater than 9 is the same ...

28

Python 2, 106 bytes a,b=0,1 for c in bin(10**9): a,b=2*a*b-a*a,a*a+b*b if'1'==c:a,b=b,a+b while a>>3340:a/=10;b/=10 print a Try it online! No libraries, just integer arithmetic. Runs almost instantly. The core is the divide-and-conquer identity: f(2*n) = 2*f(n)*f(n+1) - f(n)^2 f(2*n+1) = f(n)^2 + f(n+1)^2 This lets us update (a,b) = (f(n),f(...

27

Windows Command Prompt - 34, 8, 5 chars, (2 below) *These ones may or may not be breaking rule 2, but here it is anyway %~099 Name the file: &start call echo Hello world!!!&exit -b .cmd Now lets corrupt the file-system a little - 2 chars (or less if you want) A1 Name the file (using your preferred unorthodox method): "&start call echo ...

27

Jelly, 6 bytes +Ð¡1ḊP Input 100 finishes in 500 ms locally. Try it online! How it works +Ð¡1ḊP Niladic link. No input. Since the link doesn't start with a nilad, the argument 0 is used. 1 Yield 1. + Add the left and right argument. Ð¡ Read a number n from STDIN. Repeatedly call the dyadic link +, updating the right ...

26

Oasis, 4 bytes c-21 Try it online! 0-indexed. I saw this language used for a similar challenge once, and immediately I knew I should try it here. Can't say I'm disappointed. Explanation 1 a(0) = 1 2 a(1) = 2 c a(n) = a(n - 2) - - a(n - 1)

24

Boolfuck, 6 bytes ,,[;+] You can safely assume no N-Bonacci numbers will exceed the default number type in your language. The default number type in Boolfuck is a bit. Assuming this also extends to the input numbers N and X, and given that N>0, there are only two possible inputs - 10 (which outputs nothing) and 11 (which outputs 1). , reads a bit into ...

22

Mathematica, 9 bytes Fibonacci Yes, this built-in function supports negative numbers.

22

Python 2, 30 bytes f=lambda n:n<1or f(n/4)-f(n/2) Try it online! One-indexed. The sequence felt like a puzzle, something that Dennis generated by having a short way to express it. The power-of-two repetitions suggest recursing by bit-shifting (floor-dividing by 2). The alternating-sign Fibonacci recursion f(n)=f(n-2)-f(n-1) can be adapted to bitshift ...

21

J, 10 chars Using built-in calculation of Taylor series coefficients so maybe little cheaty. Learned it here. (%-.-*:)t. (%-.-*:)t. 0 1 2 3 4 5 10 100 0 1 1 2 3 5 55 354224848179261915075

21

Hexagony, 18 14 12 Thanks Martin for 6 bytes! 1="/}.!+/M8; Expanded: 1 = " / } . ! + / M 8 ; . . . . . . . Try it online Old, answer. This is being left in because the images and explanation might be helpful to new Hexagony users. !).={!/"*10;$.[+{] Expanded: ! ) . = { ! / " * 1 0 ;$ . [ + { ] . This prints the Fibonacci sequence ...

21

C++11 metaprogramming, 348 bytes #include<iostream> #define D static const unsigned long long v= template<int L>struct F{D F<L-1>::v+F<L-2>::v;};template<>struct F<2>{D 1;};template<>struct F<1>{D 1;};template<int Z>struct S:S<Z-1>{S(){auto&s=std::cout;auto l=F<Z>::v;s<<(l%2?"":"...

21

Actually, 4 bytes Runs the input 100 within 0.2 seconds. Code: R♂Fπ Explanation: R # Get the range [1, ..., input]. ♂F # Map over the array with the fibonacci command. π # Take the product. Uses the CP-437 encoding. Try it online!.

21

Python 2, 43 bytes f=lambda n,a=0,b=1:a*(2*n<a+b)or f(n,b,a+b) Try it online! Iterates through pairs of consecutive Fibonacci numbers (a,b) until it reaches one where the input n is less than their midpoint (a+b)/2, then returns a. Written as a program (47 bytes): n=input() a=b=1 while 2*n>a+b:a,b=b,a+b print a Same length: f=lambda n,a=0,b=1:b/...

21

x86 32-bit machine code (with Linux system calls): 106 105 bytes changelog: saved a byte in the fast version because an off-by-one constant doesn't change the result for Fib(1G). Or 102 bytes for an 18% slower (on Skylake) version (using mov/sub/cmc instead of lea/cmp in the inner loop, to generate carry-out and wrapping at 10**9 instead of 2**32). Or 101 ...

20

MySQL, 34 x'48656C6C6F20776F726C642121'||'!' This is a MySQL expression that evaluates to Hello world!!!, assuming the sql_mode setting includes PIPES_AS_CONCAT. It contains exactly 21 digits and 13 non-digits. Whether this qualifies as a valid entry, I leave it to the jury. Example mysql> select x'48656C6C6F20776F726C642121'||'!'; +------------------...

20

Haskell, 83 61 bytes p(a,b)(c,d)=(a*d+b*c-a*c,a*c+b*d) t g=g.g.g t(t\$t=<<t.p)(1,1) Outputs (F1000000000,F1000000001). On my laptop, it correctly prints the left paren and the first 1000 digits within 133 seconds, using 1.35 GiB of memory. How it works The Fibonacci recurrence can be solved using matrix exponentiation: [Fi − 1, Fi; Fi, Fi + 1] = [...

19

05AB1E, 3 bytes Code: ÅFg Explanation: ÅF # Generate all Fibonacci numbers <= input. g # Get the length of this list. Uses the CP-1252 encoding. Try it online!.

19

Taxi, 1987 1927 bytes -60 bytes due to the realization that linebreaks are optional. Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.[B]Switch to plan C if no one is waiting.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Narrow Path Park.Pickup a passenger ...

18

COW, 108 MoO moO MoO mOo MOO OOM MMM moO moO MMM mOo mOo moO MMM mOo MMM moO moO MOO MOo mOo MoO moO moo mOo mOo moo

18

Pyth, 37 bytes I loop through the Fibonacci numbers instead of generating them beforehand, since it's really short to do. K1V100|+*"Fibo"!%=+Z~KZ2*"Nacci"!%Z3Z Try it online.

18

JavaScript (ES6), 34 bytes f=(n,x=0,y=1)=>x<n?f(n,y,x+y):x==n Recursively generates the Fibonacci sequence until it finds an item greater than or equal to the input, then returns item == input.

Only top voted, non community-wiki answers of a minimum length are eligible