OFFSET
1,2
FORMULA
a(n+1) = A078916(n) - a(n). - Michel Marcus, Jan 31 2021
EXAMPLE
a(1) + a(2) - 2*1 = 1st prime; 1 + 3 - 2*1 = 2.
a(13) + a(14) - 2*13 = 13th prime; 32 + 35 - 2*13 = 41.
MAPLE
a:= proc(n) option remember; `if`(n=1, 1,
ithprime(n-1)-a(n-1)+2*n-2)
end:
seq(a(n), n=1..60); # Alois P. Heinz, Jan 31 2021
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Prime[n - 1] + 2*(n - 1) - a[n - 1]; Array[a, 60] (* Amiram Eldar, Feb 01 2021 *)
PROG
(Python)
from sympy import prime
S=[1]
nomb=100
for n in range(1, nomb):
derterm=S[-1]
terme= prime(n)-derterm+2*(len(S))
S.append(terme)
print(S)
(PARI) a(n) = if (n==1, 1, prime(n-1) + 2*(n-1) - a(n-1)); \\ Michel Marcus, Jan 31 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Carole Dubois, Jan 31 2021
STATUS
approved