From: Ryan Davis Date: 2008-07-13T11:30:43+09:00 Subject: Re: [QUIZ] Symbolify (#169) On Jul 11, 2008, at 12:25 , Alex LeDonne wrote: > After clearing a "duh" moment, I've improved these encoded lengths... > symbolify(999).length == 127 > symbolify(9999).length == 127 > symbolify(999999).length == 337 > symbolify(12345678901234567890).length == 1112 > symbolify(("9"*2100).to_i).length == 350265 I'm not a good golfer by any means... Hell, I preach against it. My original solution is a LOT longer than any of the numbers (size of code) given here, it doesn't cheat... I suspect it is faster than any of the golfed solutions tho. But seeing Ara and James and folks mention the size of their solutions just blew me away. I knew I was doing something terribly wrong. Or not. I dunno... That said, I just wrote a version that cheats heavily and came up with: p symbolify(999).length # => 5 p symbolify(9999).length # => 6 p symbolify(999999).length # => 9 p symbolify(12345678901234567890).length # => 28 p symbolify(("9"*2100).to_i).length # => 3005 and the total size for 0..10k is 56101. I still think my other solution is better, despite being much much bigger and having much bigger output. It'll be a ton faster for wide ranges of values, and it doesn't cheat.