A123128 Add n to the n-th difference between consecutive primes.
2, 4, 5, 8, 7, 10, 9, 12, 15, 12, 17, 16, 15, 18, 21, 22, 19, 24, 23, 22, 27, 26, 29, 32, 29, 28, 31, 30, 33, 44, 35, 38, 35, 44, 37, 42, 43, 42, 45, 46, 43, 52, 45, 48, 47, 58, 59, 52, 51, 54, 57, 54, 63, 60, 61, 62, 59, 64, 63, 62, 71, 76, 67, 66, 69, 80, 73, 78, 71, 74, 77
Offset: 1
Keywords
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
- A. Frank & P. Jacqueroux, International Contest, 2001. Item 20.
Programs
-
Magma
[n + NthPrime(n+1) - NthPrime(n): n in [1..80]]; // G. C. Greubel, Aug 03 2021
-
Mathematica
With[{nn=80},Total/@Thread[{Differences[Prime[Range[nn]]],Range[nn-1]}]] (* Harvey P. Dale, Jun 02 2014 *)
-
PARI
for(n=1,100,print1(prime(n+1)-prime(n)+n,","))
-
Sage
[n + nth_prime(n+1) - nth_prime(n) for n in (1..80)] # G. C. Greubel, Aug 03 2021
Formula
a(n) = n + (prime(n+1) - prime(n)) = n + A001223(n).
From G. C. Greubel, Aug 03 2021: (Start)
a(n) = prime(n+1) - A014689(n). (End)