1
0
www.mikescher.com/www/statics/euler/Euler_Problem-064_explanation.md

9 lines
598 B
Markdown
Raw Normal View History

2017-11-08 17:39:50 +01:00
For this I had to re-use my old [integer-squareroot](https://en.wikipedia.org/wiki/Integer_square_root) implementation
and I ported an [algorithm](http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html#section7) for calculating the continued fraction to befunge.
The rest is just iterating through all the values and trying to optimize for speed.
Here two useful snippets I made while solving this puzzle:
- Calculating the **sum** of an zero-terminated array on the stack: `>\# :#+_+`
- Calculating the **count** of an zero-terminated array on the stack: `0>\#+ #1:#$_$`