OFFSET
1,1
COMMENTS
Conjecture: If b(1)>2 is an integer, and b(k+1)=a(b(k)) for k=1,2,3,..., then b(n)=4 for some n>0.
For example, if we start from b(1)=45 then we get the sequence 45, 61, 36, 37, 24, 16, 17, 10, 6, 4, 5, 4, ...
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.
EXAMPLE
a(8)=6 since 2(8+1)=11+5 with (11+1)/2=6;
a(9)=13 since 2(9+1)=13+7.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Feb 28 2013
STATUS
approved