Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

(tye)Re: (Golf): Sieve of Eratosthenes

by tye (Cardinal)
on May 19, 2001 at 12:00 UTC ( #81697=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub sieve {
    my%p=(2,2);for my$n(3..pop){grep$n==($p{$_}+=$_*($p{$_}<$n)),keys%p
    or$p{$n}=$n}keys%p
    ...
    for( @ARGV ) {
        print "$_: ",join(" ",sort{$a<=>$b}sieve($_)),$/;
    }
    
  2. or download this
    1: 2
    2: 2
    3: 2 3
    ...
    701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821
    823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937
    941 947 953 967 971 977 983 991 997
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (17)
As of 2014-07-22 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (117 votes), past polls