Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #31 Feb 03 2021 23:38:56
%S 1,3,4,7,8,13,12,19,16,25,24,29,32,35,36,41,44,49,48,57,54,61,62,67,
%T 70,77,76,81,82,85,88,101,94,109,98,121,102,129,110,135,118,143,122,
%U 155,126,161,130,175,144,181,148,187,156,191,168,199,176,207,180,215
%N a(n+1) = prime(n) + 2*n - a(n). a(1) = 1.
%F a(n+1) = A078916(n) - a(n). - _Michel Marcus_, Jan 31 2021
%e a(1) + a(2) - 2*1 = 1st prime; 1 + 3 - 2*1 = 2.
%e a(13) + a(14) - 2*13 = 13th prime; 32 + 35 - 2*13 = 41.
%p a:= proc(n) option remember; `if`(n=1, 1,
%p ithprime(n-1)-a(n-1)+2*n-2)
%p end:
%p seq(a(n), n=1..60); # _Alois P. Heinz_, Jan 31 2021
%t a[1] = 1; a[n_] := a[n] = Prime[n - 1] + 2*(n - 1) - a[n - 1]; Array[a, 60] (* _Amiram Eldar_, Feb 01 2021 *)
%o (Python)
%o from sympy import prime
%o S=[1]
%o nomb=100
%o for n in range(1,nomb):
%o derterm=S[-1]
%o terme= prime(n)-derterm+2*(len(S))
%o S.append(terme)
%o print(S)
%o (PARI) a(n) = if (n==1, 1, prime(n-1) + 2*(n-1) - a(n-1)); \\ _Michel Marcus_, Jan 31 2021
%Y Cf. A000040, A001223, A036467, A078916.
%K nonn,easy
%O 1,2
%A _Carole Dubois_, Jan 31 2021