A213187 a(n) = (p+1)/2 if 4 | p+1, and p otherwise, where p is the least prime > n with 2(n+1)-p prime.
2, 2, 5, 5, 4, 4, 6, 6, 13, 6, 13, 13, 17, 17, 10, 17, 10, 10, 12, 12, 16, 12, 29, 16, 29, 16, 37, 29, 16, 16, 41, 37, 37, 41, 41, 37, 24, 41, 22, 41, 22, 22, 24, 24, 61, 24, 53, 61, 53, 30, 61, 53, 61, 34, 30, 61, 73, 30, 61, 61, 36, 34, 34, 36, 36, 34, 42, 36, 73, 36, 73, 73, 89, 40, 40, 42, 42, 40, 89, 42, 97, 42, 89, 97, 89, 101, 97, 89, 97, 52, 101, 97, 109, 101, 52, 97, 54, 101, 52, 101
Offset: 1
Keywords
Examples
a(8)=6 since 2(8+1)=11+5 with (11+1)/2=6; a(9)=13 since 2(9+1)=13+7.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Zhi-Wei Sun, Conjectures involving primes and quadratic forms, arXiv:1211.1588.
Programs
-
Mathematica
Do[Do[If[PrimeQ[2n+2-Prime[k]]==True,Print[n," ",If[Mod[Prime[k],4]==3,(Prime[k]+1)/2,Prime[k]]];Goto[aa]],{k,PrimePi[n]+1,PrimePi[2n]}]; Label[aa];Continue,{n,1,100}] nxt[{n_,a_}]:=Module[{p=NextPrime[n]},While[!PrimeQ[2(n+1)-p],p = NextPrime[ p]];{n+1,If[Divisible[p+1,4],(p+1)/2,p]}]; Rest[ Transpose[ NestList[ nxt,{1,2},110]][[2]]] (* Harvey P. Dale, May 30 2016 *)
-
PARI
a(n)=my(q=nextprime(n+1)); while(!isprime(2*n+2-q),q=nextprime(q+1)); if(q%4<3,q,(q+1)/2) \\ Charles R Greathouse IV, Feb 28 2013
Comments