![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
integer partition golfby jimt (Chaplain) |
on Oct 18, 2006 at 17:52 UTC ( #579156=obfuscated: print w/replies, xml ) | Need Help?? |
Yes, yes, this has been done before (hasn't everything?), but I think this still comes out to be the most compact method to actually calculate and display partitions of integers. The previous thread had people just trying to calculate them in memory. This one takes a single integer on the command line and goes to town.
90 characters! woo hoo! I only beat tilly's solution by 1 character, once I appended print@$_,$/for P(shift) to it. A more compact printer added on to it would render that one the winner. Update: Ya know, one of these days, my golf game'll be good enough that I'll post and someone won't immediately respond and say "I can shave off another character!" heh. Props to liverpole and blazar. I incorporated their suggestions, plus another one I thought of to drop down to 83.
Update 2: And 80
<Reveal this spoiler or all in this thread>
Back to
Obfuscated Code
|
|