OFFSET
1,1
COMMENTS
The sum of the reciprocals converges by the Kraft-McMillan inequality.
Odd primes p such that iterating the map A029578 on p reaches 2 without going through a prime. - Ya-Ping Lu, Oct 20 2021
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Dan Brumleve, Does the sum of reciprocals of all prime-prefix-free numbers converge?, Math StackExchange, May 20 2017.
Wikipedia, Kraft-McMillan inequality
EXAMPLE
4663 is an odd prime with proper binary prefixes 2331, 1165, 582, 291, 145, 72, 36, 18, 9, 4, 2, 1, and none of these are odd primes.
MATHEMATICA
Select[Prime@ Range[2, 800], Function[w, NoneTrue[Array[FromDigits[w[[1 ;; #]], 2] &, Length[w] - 1], And[PrimeQ[#], # != 2] &]]@ IntegerDigits[#, 2] &] (* Michael De Vlieger, Oct 20 2021 *)
PROG
(Perl)
sub isp {
my $x = shift;
return 0 if $x < 2;
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] // 8000) {
my @np = grep isp($_), rots($i);
push @z, $i if isp($i) && $i % 2 && @np == 0;
}
print join(", ", @z) . "\n";
(PARI) is(n)=if(!isprime(n) || n<3, return(0)); while(n>3, if(isprime(n>>=1), return(n==2))); 1 \\ Charles R Greathouse IV, Jun 12 2017
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Dan Brumleve, May 28 2017
STATUS
approved