I run it with Python 2.7, too, and it works fine. I runs in Ideone, too: http://ideone.com/NrOjA
Is it possible that your text editor has a limit on line length or such?
Oh, and yes, your version is by far more efficient (and in many ways far more elegant) than mine, which is, to be honest, not even properly golfed (I think I would have been better off without all those lambdas and functional programming stuff). I'm just brute-forcing: To find a Fibonacci number i that fits into a (the number that I want in base Zeckendorf), try every Fibonacci number between 0 and a that was not yet used or consecutive to a number that was already used, and then return any such Fibonacci number that equals a or for that a number is returned if you recurse and repeat with it (try to find a-i). That's grossly inefficient.
I'm thinking: As the Zeckendorf base system turns out to be so systematically, shouldn't there be a O(1) algorithm? May try this later, too busy right now
BTW I'm somewhat staggered by this magic of yours:
- Code: Select all
What are you doing here, great master?