OFFSET
1,1
LINKS
Jens Kruse Andersen, Table of n, a(n) for n = 1..10000
EXAMPLE
The 11th prime is 31. The 12th prime is 37. 37-31 = 6. The smallest integer > 31 that is coprime to 6 is 35, which is a(11).
MATHEMATICA
f[n_] := Block[{k, p = Prime@n, q = Prime[n + 1]}, k = p + 1; While[ GCD[q - p, k] > 1, k++ ]; k]; Array[f, 59] (* Robert G. Wilson v, Apr 08 2009 *)
sicp[n_]:=Module[{k=n[[1]]+1, d=n[[2]]-n[[1]]}, While[!CoprimeQ[k, d] , k++]; k]; sicp/@Partition[Prime[Range[60]], 2, 1] (* Harvey P. Dale, Dec 23 2018 *)
PROG
(PARI) a(n) = d=prime(n+1)-prime(n); k=prime(n)+1; while(gcd(k, d)>1, k++); k \\ Jens Kruse Andersen, Jul 31 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Feb 22 2009
EXTENSIONS
More terms from Robert G. Wilson v, Apr 08 2009
STATUS
approved