A231725 Least positive integer k < n such that n + k + 2^k is prime, or 0 if such an integer k does not exist.
0, 1, 0, 1, 2, 3, 2, 1, 4, 1, 2, 3, 2, 1, 10, 1, 2, 3, 6, 1, 4, 5, 2, 5, 2, 1, 4, 1, 8, 3, 2, 3, 4, 1, 2, 3, 2, 1, 4, 1, 2, 3, 6, 1, 12, 5, 2, 3, 8, 1, 4, 5, 2, 11, 2, 1, 6, 1, 4, 3, 2, 3, 4, 1, 2, 5, 2, 1, 4, 1, 22, 3, 2, 57, 10, 1, 2, 3, 6, 1, 4, 11, 2, 11, 8, 1, 4, 7, 4, 3, 2, 3, 4, 1, 2, 3, 2, 1, 16, 1
Offset: 1
Keywords
Examples
a(3) = 0 since 3 + 1 + 2^1 = 6 and 3 + 2 + 2^2 = 9 are both composite. a(5) = 2 since 5 + 1 + 2^1 = 8 is not prime, but 5 + 2 + 2^2 = 11 is prime.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Z.-W. Sun, On a^n+ bn modulo m, arXiv preprint arXiv:1312.1166 [math.NT], 2013-2014.
Programs
-
Mathematica
Do[Do[If[PrimeQ[n+k+2^k],Print[n," ",k];Goto[aa]],{k,1,n-1}]; Print[n," ",0];Label[aa];Continue,{n,1,100}]
-
PARI
a(n)=for(k=1,n-1,if(ispseudoprime(n+k+2^k),return(k)));0 \\ Charles R Greathouse IV, Nov 13 2013
Comments