in reply to Fibonacci golf with one state variable

Just one state variable? Re: Fibo Golf challenge on 3 monkeys has such an example:

ruby '-wep 1,x=1;18.times{p x=(x/0.618).round}'

It's not much longer than yours especially if you count that the second one needs a -l switch and fancy quoting to quote the apostrophes and double quotes.

Replies are listed 'Best First'.
Re^2: Fibonacci golf with one state variable
by aufflick (Deacon) on Oct 05, 2008 at 11:56 UTC

    Except is that exactly the Fibonaci question, using an approximation golden ratio? I'll have to check on that...

      That's why it only prints the first few terms, with 18 hard-coded it. If you used the golden ratio more precisely, you'd get more terms. Two examples are the first snippet in Re: Fibonacci Numbers or the last one in Re: Fibonacci numbers (again).

      (By the way, if you want to know about the mathematics of this, I recommend Graham–Knuth–Patashnik: Concrete mathematics.)