Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Javascript (ES6), 151 60 bytes

New version, credits to @Leaky Nun

x=i=>console.log('x='+x+';x('+(i*(5**.5+1)/2+.5|0)+')');x(2)

Old version :

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

Based on thisthis.

Javascript (ES6), 151 60 bytes

New version, credits to @Leaky Nun

x=i=>console.log('x='+x+';x('+(i*(5**.5+1)/2+.5|0)+')');x(2)

Old version :

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

Based on this.

Javascript (ES6), 151 60 bytes

New version, credits to @Leaky Nun

x=i=>console.log('x='+x+';x('+(i*(5**.5+1)/2+.5|0)+')');x(2)

Old version :

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

Based on this.

added LEaky Nun's suggestion
Source Link
rbntd
  • 111
  • 3

Javascript (ES6), 151151 60 bytes

New version, credits to @Leaky Nun

x=i=>console.log('x='+x+';x('+(i*(5**.5+1)/2+.5|0)+')');x(2)

Old version :

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

EDIT: Added the quine part that my very concentrated self forgot. I thought this was too simple...

Based on this.

Javascript (ES6), 151 bytes

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

EDIT: Added the quine part that my very concentrated self forgot. I thought this was too simple...

Based on this.

Javascript (ES6), 151 60 bytes

New version, credits to @Leaky Nun

x=i=>console.log('x='+x+';x('+(i*(5**.5+1)/2+.5|0)+')');x(2)

Old version :

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

Based on this.

now with the quine part...
Source Link
rbntd
  • 111
  • 3

Javascript (ES6), 116151 bytes

x=i=>{var s=Math.sqrt(5),i=2,a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log(f'x='+String(x)+';x('+f(a)+')');};x(2)

Just change i=2 to whatever you want. This isEDIT: Added the quine part that my first attempt at golfing, so I warmly welcome suggestions becausevery concentrated self forgot. I am surethought this can be further golfed !was too simple...

Based on this.

Javascript (ES6), 116 bytes

var s=Math.sqrt(5),i=2,a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log(f(a))

Just change i=2 to whatever you want. This is my first attempt at golfing, so I warmly welcome suggestions because I am sure this can be further golfed !

Based on this.

Javascript (ES6), 151 bytes

x=i=>{var s=Math.sqrt(5),a=1;f=n=>{return Math.ceil((((1+s)/2)**n-((1-s)/2)**n)/s)};while(f(++a)<=i);console.log('x='+String(x)+';x('+f(a)+')');};x(2)

EDIT: Added the quine part that my very concentrated self forgot. I thought this was too simple...

Based on this.

Post Undeleted by rbntd
Post Deleted by rbntd
Source Link
rbntd
  • 111
  • 3
Loading