Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Decimal Gray Code in 31 chars

by ikegami (Pope)
on Jan 18, 2010 at 22:25 UTC ( #818062=note: print w/replies, xml ) Need Help??

in reply to Decimal Gray Code in 31 chars

From your 35

perl -e'print(($_^$_>>1).$/)for(0..pop)' 15 12345678901234567890123456789012345

I shave 6 off

perl -le'print$_^$_>>1 for 0..pop' 15 12345678901234567890123456789

3 more if 5.10+

perl -E'say$_^$_>>1 for 0..pop' 15 12345678901234567890123456

Replies are listed 'Best First'.
Re^2: Decimal Gray Code in 31 chars
by mtve (Deacon) on Jan 19, 2010 at 10:46 UTC

    two more:

    print$_^$_/2for 0..pop
      I swear I tried removing that space and got an error. But yeah, it works.
Re^2: Decimal Gray Code in 31 chars
by ambrus (Abbot) on Jan 19, 2010 at 11:13 UTC

    It's funny how some people still post nodes with such titles despite the warning on the top of Obfuscated code: Word of warning, though: Don't be too cocky with your post almost inevitably someone will post a reply that does the exact same thing in even fewer characters!

      My guess is because by saying "simplest as possible", it challenges others to improve on it ;). Do you think this many comments would be gathered otherwise?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://818062]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-10-19 08:43 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (107 votes). Check out past polls.