A296806 Take a prime, convert it to base 2, remove its most significant digit and its least significant digit and convert it back to base 10. Sequence lists primes that generate another prime by this process.
13, 23, 31, 37, 43, 47, 59, 71, 79, 103, 127, 139, 151, 163, 167, 191, 211, 223, 251, 263, 271, 283, 331, 379, 463, 523, 547, 571, 587, 599, 607, 619, 631, 647, 659, 691, 719, 727, 739, 787, 811, 827, 839, 859, 907, 911, 967, 971, 991, 1031, 1039, 1051, 1063, 1087
Offset: 1
Examples
13 in base 2 is 1101 and 10 is 2; 23 in base 2 is 10111 and 011 is 3; 31 in base 2 is 11111 and 111 is 7.
Links
- Iain Fox, Table of n, a(n) for n = 1..10000
- Ken Abbott, Prime Cores, Number Theory group on LinkedIn.
Crossrefs
Programs
-
Maple
with(numtheory): P:=proc(q) local a,b,c,j,n,ok,x; x:=5; for n from x to q do ok:=1; a:=convert(ithprime(n),base,2); b:=nops(a)-1; while a[b]=0 do b:=b-1; od; c:=0; for j from b by -1 to 2 do c:=2*c+a[j]; od;if isprime(c) then x:=n; print(ithprime(n)); fi; od; end: P(10^6); # simpler alternative: select(t -> isprime(t) and isprime((t - 2^ilog2(t) - 1)/2), [seq(i,i=3..10^4,2)]); # Robert Israel, Dec 28 2017
-
Mathematica
Select[Prime[Range[200]],PrimeQ[FromDigits[Most[Rest[IntegerDigits[ #,2]]],2]]&] (* Harvey P. Dale, Jul 19 2020 *)
-
PARI
lista(nn) = forprime(p=13, nn, if(isprime((p - 2^logint(p, 2) - 1)/2), print1(p, ", "))) \\ Iain Fox, Dec 28 2017
-
Python
from itertools import islice from sympy import isprime, nextprime def agen(): # generator of terms p = 7 while True: if isprime(int(bin(p)[3:-1], 2)): yield p p = nextprime(p) print(list(islice(agen(), 54))) # Michael S. Branicky, May 16 2022
Formula
Primes q such that C(q) = (q - 2^floor(log_2(q)) - 1)/2 is prime too.
Comments