OFFSET
2,2
COMMENTS
a(n) = inverse of (prime(n)-prime(n-1)) mod prime(n). This is the least k such that prime(n)|k*((prime(n)-prime(n-1))-1). Since prime(n)|k*prime(n), it must divide (k*prime(n-1)+1), so k = a(n). Also, a(n) = prime(n) - (x*prime(n)+1)/prime(n-1) for the least such x. - David James Sycamore, Oct 05 2018
FORMULA
a(n) = prime(n) - A069830(n - 1). - Emmanuel Vantieghem, Aug 12 2018 [Corrected by Georg Fischer, Sep 21 2024]
EXAMPLE
a(4) = 3 as prime(5) = 11 divides 3*7 + 1, where 7 = prime(4).
MATHEMATICA
sk[a_, b_]:=Module[{k=1}, While[!Divisible[k*a+1, b], k++]; k]; sk@@@ Partition[ Prime[Range[70]], 2, 1] (* Harvey P. Dale, Jun 23 2013 *)
PROG
(PARI) a(n) = {my(k = 1, p = prime(n-1), q = prime(n)); while ((k*p+1) % q, k++); k; } \\ Michel Marcus, Aug 14 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy, Oct 26 2002
EXTENSIONS
More terms from Ralf Stephan, Oct 31 2002
More terms from Ray Chandler, Oct 24 2003
STATUS
approved