Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,22 @@
sub is_pernicious {
my $n = shift;
my $c = 2693408940; # primes < 32 as set bits
while ($n) { $c >>= 1; $n &= ($n - 1); }
$c & 1;
}
my ($i, @p) = 0;
while (@p < 25) {
push @p, $i if is_pernicious($i);
$i++;
}
print join ' ', @p;
print "\n";
($i, @p) = (888888877,);
while ($i < 888888888) {
push @p, $i if is_pernicious($i);
$i++;
}
print join ' ', @p;

View file

@ -0,0 +1,5 @@
use ntheory qw/is_prime hammingweight/;
my $i = 1;
my @pern = map { $i++ while !is_prime(hammingweight($i)); $i++; } 1..25;
print "@pern\n";
print join(" ", grep { is_prime(hammingweight($_)) } 888888877 .. 888888888), "\n";