Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Code Golf: Four is magic

by TedPride (Priest)
on Jul 15, 2010 at 06:32 UTC ( #849708=note: print w/ replies, xml ) Need Help??


in reply to Code Golf: Four is magic

@d=split//,'4335443554366887798866555766';$n=int<STDIN>;while($n!=4){p +rint"$n is ";$n=$n<20?$d[$n]:$d[$n/10+18]+($n%10==0?0:$d[$n%10]);prin +t"$n.\n";}print"4 is magic.\n";
125 characters, or 123 if you eliminate that last line break. Looks remarkably like some of the other submissions here, but I didn't cheat and look at anyone else's solutions first - guess there just aren't many ways to do this while keeping it short.


Comment on Re: Code Golf: Four is magic
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-07-29 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls