login
A296807
Take a prime, convert it to base 2. Consider it as a string of digits and delete its leftmost and rightmost digit. Leading zeros are kept. Repeat the process. a(n) is the least prime that, in the first n steps of this process, generates a string that is a prime read in base 2.
3
2, 13, 43, 151, 2143, 2143, 12479, 57727, 246527, 4267455487, 276009615632383, 4469780781584383, 576406542684520447
OFFSET
0,1
COMMENTS
a(n) >= 2*4^n + 3*2^n - 1 = A297928(n) >= 2*(4^n + 2^n) + 1 = A085601(n), n > 0. - Iain Fox, Dec 29 2017 (edited by Iain Fox, Jan 08 2018)
a(17) <= 2^163 + 361736822347711983585853439 (probably much smaller), building on a Cunningham chain of length 17 found by Jaroslaw Wroblewski. a(n) exists for n <= 17, and probably for all n. - Jens Kruse Andersen, Jan 21 2018
EXAMPLE
a(1) = 13 because 13 in base 2 is 1101 and 10 is 2 and 13 is the least number with this property;
a(2) = 43 because 43 in base 2 is 101011 while 0101 is 5 and 10 is 2 and 43 is the least number with this property;
a(3) = 151 because 151 in base 2 is 10010111 while 001011 is 11, 0101 is 5 and 10 is 2 and 151 is the least number with this property.
MAPLE
with(numtheory): P:=proc(q) local a, b, c, i, j, k, n, ok, x; x:=5; for k from 1 to q do for n from x to q do a:=convert(ithprime(n), base, 2); ok:=1; for i from 1 to k do b:=nops(a)-i; while a[b]=0 do b:=b-1; od;
c:=0; for j from b by -1 to i+1 do c:=2*c+a[j]; od; if not isprime(c) then ok:=0; break; fi; od; if ok=1 then x:=n; print(ithprime(n)); break; fi; od; od; end: P(10^20);
MATHEMATICA
Table[SelectFirst[Prime@ Range[#, # + 10^5] &@ PrimePi[2 (4^n + 2^n) + 1], AllTrue[Map[FromDigits[#, 2] &, Rest@ NestWhileList[Most@ Rest@ # &, IntegerDigits[#, 2], Length@ # > 2 &]], PrimeQ] &], {n, 8}] (* Michael De Vlieger, Dec 29 2017 *)
PROG
(PARI) a(n) = if(!n, return(2)); forprime(p=2*4^n + 3*2^n - 1, , my(b=p); for(x=1, n, b = (b - (b>=4*2^(logint(p, 2) - 2*x))*4*2^(logint(p, 2) - 2*x) - 1)/2; if(!isprime(b) || (b==2 && x!=n), next(2))); return(p)) \\ Iain Fox, Dec 29 2017 (corrected by Iain Fox, Oct 26 2019)
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
EXTENSIONS
Definition corrected, a(10)-a(12) by Jens Kruse Andersen, Jan 21 2018
STATUS
approved