Hacker News new | past | comments | ask | show | jobs | submit login

Wait Im confused. Wouldnt the point of using the analytic approach be that i could start at any n besides 0? Because of course if im just taking the sums from 0 to n it'd be faster to do it the tail recursive way because thats just simple addition.



The post didn't go into this, but the sum has a lovely closed form as well. The sum of the (phi^n-psi^n) terms is the difference of two geometric series, so you can apply sum(r^i, i=0..n)=(r^(n+1)-1)/(r-1) to get a formula that evaluates the sum exactly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: