OFFSET
2,1
COMMENTS
The growth of a(n) is very slow. It seems that 3 < log_10(n)/log_10(a(n)) < 4 when n tends into infinity.
a(n) = 1 for n = 12 and 19 (initial p = 37 and 67) for n < 10^5. Are there other values of n for which a(n) = 1?
We observe long subsequences of consecutive identical numbers. For example, a(115) = a(116) = ... = a(132) = 9.
EXAMPLE
a(15) = 5 because prime(15) = 47, and we obtain the following trajectory: 47 -> 29 -> 17 -> 11 -> 7 -> 5. The prime 5 is the last term because 5 -> 11 with 11 = (5+17)/2 is already present in the trajectory. The elements of the trajectory are: 29 = (47+11)/2; 17 = (29+5)/2; 11 = (17+5)/2; 7 = (11+3)/2; 5 = (7+3)/2.
MAPLE
for n from 2 to 50 do:
p0:=ithprime(n) :lst:={p0}:
for it from 1 to 50 do :
ii:=0:
for m from 2 to 1000 while(ii=0) do:
p:=ithprime(m):q:=(p0+p)/2:
if type(q, prime)=true and q<>p
then
ii:=1:lst:=lst union {q}:
else
fi:
od:
p0:=q:
od:
n0:=nops(lst):printf(`%d, `, n0-1):
od:
MATHEMATICA
Table[Length@ Union@ NestList[Function[p, (p + SelectFirst[Prime@ Range[10^4], PrimeQ[(p + #)/2] && p != # &])/2], Prime@ n, 10] - 1, {n, 2, 88}] (* Michael De Vlieger, May 09 2016, Version 10 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, May 09 2016
STATUS
approved