OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
a(n) appears to be asymptotic to (zeta(2)-1)*n*log(n) where zeta(2)-1 = Pi^2/6-1 = 0.6449... . Example: a(10^5)/10^5/log(10^5) = 0.6449(1)... .
MATHEMATICA
f[n_] := Module[{k = 1}, While[!PrimeQ[k*n + 1], k++]; k]; Accumulate[Table[f[n], {n, 1, 100}]] (* Amiram Eldar, May 05 2022 *)
PROG
(PARI) f(n) = if(n<0, 0, s=1; while(isprime(s*n+1)==0, s++); s); \\ A034693
a(n) = sum(k=1, n, f(k)); \\ Michel Marcus, May 05 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Aug 11 2002
STATUS
approved