Fibratio

Shell function to calculate the ratio of neighboring Fibonacci numbers (φ) with recursion without exponential blow-up:

fibratio ()
{
echo "define f(n){auto a,b,t,i;a=0;b=1;for(i=2;i<=n;i++){t=a+b;a=b;b=t};if(n==0)return 0;return b};for(i=2;i<=$1;i++) print f(i)/f(i-1),\"\n\"" | bc -l
}

Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply