A287638 Odd primes with no other odd primes as prefixes in binary.
3, 5, 17, 19, 37, 67, 73, 131, 257, 521, 523, 577, 1033, 1039, 1061, 1063, 1069, 1153, 1163, 2053, 2069, 2081, 2083, 2089, 2113, 2129, 2131, 2137, 2141, 2143, 2333, 4099, 4111, 4129, 4153, 4177, 4229, 4231, 4241, 4243, 4261, 4271, 4273, 4637, 4639, 4643, 4649, 4651, 4657, 4663
Offset: 1
Examples
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.
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
Programs
-
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 *)
-
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
-
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";
Comments