OFFSET
1,1
COMMENTS
From an idea of Ken Abbott (see link).
From Paolo Iachia, Dec 21 2017: (Start)
Let us call these numbers "core of a prime".
Let C(q) be the core of a prime q.
Then C(q) = (q - 2^floor(log_2(q)) - 1)/2.
Examples: C(59) = (59 - 2^5 - 1)/2 = 13; C(71) = (71 - 2^6 - 1)/2 = 3; C(73) = (73 - 2^6 - 1)/2 = 4; C(251) = (251 - 2^7 - 1)/2 = 61.
0 <= C(q) <= 2^(floor(log_2(q)) - 1) - 1. The minimum (0) occurs when q = 2^n+1, with n > 2. Example: 17 = 2^4+1, C(17) = (17 - 2^4 - 1)/2 = 0. The maximum is reached when q = 2^n-1 is a Mersenne prime. Example: 127 = 2^7 - 1, C(127) = (127 - 2^6 - 1)/2 = 31 = 2^5 - 1.
The last example is particularly interesting, as both the prime q and its core are Mersenne primes. The same holds for C(31) = 7 and for C(524247) = 131071, with 524247 = 2^19-1 and 131071 = 2^17-1, both Mersenne primes. Are there more such cases?
Note that the core of Mersenne number (prime or not) is a Mersenne number by definition. Counterexamples include C(8191) = 2047, with 8191 = 2^13 - 1, a Mersenne prime, but 2047 = 2^11 - 1 = 23*89, a Mersenne number not prime, and C(131071) = 32767 = 2^15 - 1 = 7*31*151, with 2 of its factors being Mersenne primes.
Primes whose binary expansion is of the form q = 1 0 ... 0 c_1 c_2 ... c_k 1 - with none or any number of consecutive 0's and with binary core c_1 c_2 ... c_k, k >= 0 - share the same core value. Let p = C(q), then we can write, in decimal form, q = (2p+1) + 2^n, for an appropriate n. While the property is true for p prime, it can be generalized to any positive integer.
Conjecture: for any positive integer p, there are infinitely many primes q for which there exists an integer n such that q-(2p+1) = 2^n. (End)
LINKS
Iain Fox, Table of n, a(n) for n = 1..10000
Ken Abbott, Prime Cores, Number Theory group on LinkedIn.
FORMULA
Primes q such that C(q) = (q - 2^floor(log_2(q)) - 1)/2 is prime too.
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Paolo P. Lava, Paolo Iachia, Dec 21 2017
STATUS
approved