| sub f{@_?($_[0],f(grep$_%$_[0],@_)):()}print for f 2..pop |
I used a recursive filtering approach to make it much more concise. In fact, the sub that does the work is only 39 characters.
Update: I noticed an easy way to shave a stroke (grep EXPR vs grep BLOCK), so now it's at 57. I also added code tags which I stupidly omitted.
blokhead
In reply to Re: Sieve of Eratosthenes Golf?
by blokhead
in thread Sieve of Eratosthenes Golf?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |