OFFSET
1,2
COMMENTS
Graph consists of two branches, the upper one corresponds to cases (q-p) = 2 (mod 4), and the lower one to cases (q-p) = 0 (mod 4).
If prime(n+k) = prime(n)+4*k^2 for k=1..m, then a(n)=...=a(n+m-1)=2*prime(n)+1. - Robert Israel, Jan 20 2022
LINKS
Zak Seidov, Table of n, a(n) for n = 1..1000
FORMULA
From Robert Israel, Jan 20 2022: (Start)
If prime(n+1)-prime(n) = 4*k+2 with k^2 <= prime(n)/2, then a(n) = 2*prime(n)-4*k^2+1.
If prime(n+1)-prime(n) = 4*k with 4*k^2+2*k<prime(n), then a(n) = prime(n) - 4*k^2 + 2*k. (End)
MAPLE
f:= proc(n) local p, q;
p:= ithprime(n); q:= nextprime(p);
(p*q) mod (p+q)
end proc:
map(f, [$1..100]); # Robert Israel, Jan 20 2022
MATHEMATICA
Mod[Times@@#, Total[#]]&/@Partition[Prime[Range[60]], 2, 1] (* Harvey P. Dale, Feb 21 2022 *)
PROG
(PARI) a(n) = (prime(n)*prime(n+1)) % (prime(n)+prime(n+1)); \\ Michel Marcus, Oct 19 2013
(PARI) a(n)=my(p=prime(n), q=nextprime(p+1)); (p*q)%(p+q) \\ Charles R Greathouse IV, Oct 19 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, May 26 2012
STATUS
approved