From: Ryan Davis Date: 2008-07-14T16:05:39+09:00 Subject: Re: [QUIZ] Symbolify (#169) On Jul 13, 2008, at 18:45 , Rick DeNatale wrote: > The basic approach is to generate an expression which works like a > lexical > scan of the decimal representation of the (positive) integer, i.e. > it's the > closed form of My first version did roughly the same thing, but against the binary representation: 15 = 0b1111 = "2**3+4+2+1".encode encode would substitute + for -- and gsub numbers in from the table. Powers of 2 were precalculated as were 0-9. I also benchmarked and figured out that it was more often (roughly 55% of the time) faster and a smaller result if I subtract the difference between the next higher power of two and the number in question. Regardless, answers got messy...