This is the revision history for sieve in <matrix.org:#DYJOMClZbVOMHnzPQt:matrix.org>
factoid_id | subject | copula | predicate | author | namespace |
---|---|---|---|---|---|
10334 | sieve | is | my %sieve; my @primes = (2,3); my ($p_i, $p, $q, $n)=(1,3,9,3); push @primes, do { { $n += 2; if ( my $s = delete $sieve{$n} ) { push @{$sieve{$n + $_}}, $_ for @$s; redo } elsif ( $n < $q ) { $n } else { push @{$sieve{$q + $p*2}}, $p * 2; $p = $primes[++$p_i]; $q = $p*$p; redo } } } while @primes < 100; \@primes | bengoldberg | <*:##NULL> |