Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by tye (Sage)
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?
[Discipulus]: good morning shmem
[Discipulus]: test for pmcbtk
[Discipulus]: sometimes the client dies for extra content </chatter><span class="error" style="color: #cc0000">Server Error (Error ID 9162
[Discipulus]: the span is considered extra content by the parser
[Corion]: Mhmm - that would be some internal error, but I can't look into that right now as I don't have access to the logs from here ;)
[Discipulus]: ah, but it can be skipped by the client (?)
[Corion]: I think so, but I wonder what error might be there...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2017-07-25 08:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (365 votes). Check out past polls.