OFFSET
1,1
COMMENTS
No other terms < 10^9.
If x = (p+r)/2 and d = (r-p)/2, p*r = x^2 - d^2 == -d^2 (mod x), while x-d < q < x+d. We can't have q = x-d^2, so it must be that q >= 2 x - d^2, and thus d^2 >= 2x-q > x-d. Cramér's conjecture implies d^2 = o(x), so that implies the sequence is finite.
LINKS
Wikipedia, Cramér's conjecture
EXAMPLE
For n=1: a(1) = p = 2, q = 3, r = 5, (2*5) mod (2+5) = 10 mod 7 = 3.
For n=2: a(2) = p = 5, q = 7, r = 11, (5*11) mod (5+11) = 55 mod 16 = 7.
For n=3: a(3) = p = 7, q = 11, r = 13, (7*13) mod (7+13) = 91 mod 20 = 11.
For n=4: a(4) = p = 19, q = 23, r = 29, (19*29) mod (19+29) = 551 mod 48 = 23.
MAPLE
N:= 10^6: # for terms <= N
p:= 1: q:= 2: r:= 3: R:= NULL:
while p < N do
p:= q; q:= r; r:= nextprime(r);
if p*r mod (p+r) = q then R:=R, p fi;
od:
R;
CROSSREFS
KEYWORD
nonn,fini,bref
AUTHOR
J. M. Bergot and Robert Israel, Feb 08 2021
STATUS
approved