OFFSET
1,2
LINKS
Dan Brumleve, Does the sum of reciprocals of all prime-prefix-free numbers converge?, Math StackExchange, May 20 2017.
EXAMPLE
131, while prime itself, has proper binary prefixes 65, 32, 16, 8, 4, 2, 1, none of which are odd primes.
MATHEMATICA
Select[Range@535, AllTrue[ Floor[#/2 ^ Range@Log2@#], ! (# > 2 && PrimeQ[#]) &] &] (* Giovanni Resta, May 20 2017 *)
PROG
(Perl)
sub isp {
my $x = shift;
for my $d (2 .. $x - 1) {
return 0 if $x % $d == 0;
}
return 1;
}
sub rots {
my $x = shift;
my @x;
while ($x > 5) {
$x = int($x / 2);
push @x, $x;
}
@x
}
for my $i (1 .. $ARGV[0] // 200) {
my @np = grep isp($_), rots($i);
push @z, $i if @np == 0;
}
print join(", ", @z) . "\n";
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Dan Brumleve, May 20 2017
STATUS
approved