Last active
July 16, 2025 08:11
-
-
Save Nemikolh/e21104bb8d9a2ae5d2607081c9210219 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // first version | |
| f=(a)=>a<2?a:f(a-1)+f(a-2);for(i=0;i<31;i++)print(f(i)) | |
| // didn't work | |
| f=(a,b)=>(c=a<2?a:f(a-1,b&1)+f(a-2),b&print(c),c);f(31) | |
| // let's use a loop | |
| b=1;for(a=i=0;i<31;i++){print(a);t=b;b=a+b;a=t} | |
| // oops same size | |
| b=1;for(a=i=0;i<31;(i++,t=b,b=a+b,a=t))print(a) | |
| // oh parenthesis are optional | |
| b=1;for(a=i=0;i<31;i++,t=b,b=a+b,a=t)print(a) | |
| // oh this can be simpler | |
| b=1;for(a=i=0;i<31;i++,b=a+b,a=b-a)print(a) | |
| // 1 byte saved | |
| b=1;for(a=0;a<=832040;b=a+b,a=b-a)print(a) | |
| // thanks @kirjavascript :) | |
| b=1;for(a=i=0;i++<31;b+=a,a=b-a)print(a) | |
| // 37! | |
| b=1;for(a=0;a<1e6;b+=a,a=b-a)print(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment