Skip to main content
added 2 characters in body
Source Link
Neil
  • 185.9k
  • 12
  • 77
  • 295

JavaScript (ES6), 3739 3133 bytes

f=(n,j=0,k=1)=>n>j?f(n,k,j+k)+1:0

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0

JavaScript (ES6), 37 31 bytes

(n,j=0,k=1)=>n>j?f(n,k,j+k)+1:0

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0

JavaScript (ES6), 39 33 bytes

f=(n,j=0,k=1)=>n>j?f(n,k,j+k)+1:0

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0
added 4 characters in body
Source Link
Neil
  • 185.9k
  • 12
  • 77
  • 295

JavaScript (ES6), 3737 31 bytes

(n,i=0,j=0,k=1)=>n>j?f(n,i+1,k,j+k)+1:i0

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0

JavaScript (ES6), 37 bytes

(n,i=0,j=0,k=1)=>n>j?f(n,i+1,k,j+k):i

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0

JavaScript (ES6), 37 31 bytes

(n,j=0,k=1)=>n>j?f(n,k,j+k)+1:0

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0
Source Link
Neil
  • 185.9k
  • 12
  • 77
  • 295

JavaScript (ES6), 37 bytes

(n,i=0,j=0,k=1)=>n>j?f(n,i+1,k,j+k):i

Even with ES7, the inverse Binet formula takes 47 bytes:

x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0