Scripting competition results

Mark Wieder mwieder at ahsoftware.net
Mon May 11 23:11:40 EDT 2009


Well, the correct answer to "what is the 211th Fibonacci number is, of
course, 55835073295300465536628086585786672357234389. This is way
beyond the limits of integer arithmetic on a poor little digital
computer, and you will, as Sarah Reichelt pointed out, start to
overflow the accumulators at around Fibonacci number 79. Unfortunately
there's no warning about the overflow, and as Colin Holgate found out,
you can't calculate this the easy way. So you have to do the Long
Addition yourself, pretending that you're the digital computer.

So here are the standings:

Colin Holgate came in first with the right answer but couldn't show
how to do it in xtalk. Apparently he looked the answer up on the web,
so he gets the Fundamentalist award for getting the literal answer to
the question first. It *is* what I asked.

Alex Tweedly also came in with the right answer by screen-scraping an
existing web page. So Alex gets the James Kirk "I couldn't win the
game so I reprogrammed the computer" award. It's not exactly what I
had in mind, but I should have phrased the question differently.

Sarah Reichelt gets the Coolness award for doing this on on-rev, but
ran into the overflow problem and so came up with the wrong answer.

I went out for a walk, came back, and found that both Brian Yennie and
Jerry Jensen had come in with the right solution. Brian beat Jerry by
18 minutes because Jerry's on digest mode (Jerry- I got off digest
mode last year and I'm *really* glad I did). They're both pretty close
to the approach I took: managing the carry bit yourself and creating a
numeric text string for the result.

But somehow Brian's code is about 20% faster than either Jerry's or
mine. So Brian gets the Elegance award for fast and accurate code. I
went back to look at Sarah's code, but I see she's already modified
her web page to use Brian's algorithm, with a nice twist.

http://troz.on-rev.com/fib.irev

(I would have given more extra credit points but nobody declared their
variables <g>)
  
-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list