login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A083236
First order recursion: a(0)=2; a(n) = prime(n) - a(n-1).
6
2, 0, 3, 2, 5, 6, 7, 10, 9, 14, 15, 16, 21, 20, 23, 24, 29, 30, 31, 36, 35, 38, 41, 42, 47, 50, 51, 52, 55, 54, 59, 68, 63, 74, 65, 84, 67, 90, 73, 94, 79, 100, 81, 110, 83, 114, 85, 126, 97, 130, 99, 134, 105, 136, 115, 142, 121, 148, 123, 154, 127, 156, 137, 170, 141, 172, 145
OFFSET
0,1
LINKS
FORMULA
a(n-1) + a(n) = prime(n).
a(n+1)-a(n-1) = A001223(n).
EXAMPLE
n=6: a(6)+a(7) = 7+10 = prime(7) = 17 and a(7)+a(8) = 10+9 = 19 = prime(8);
MAPLE
A083236 := proc(n)
option remember ;
if n = 0 then
2 ;
else
ithprime(n)-procname(n-1) ;
end if;
end proc:
seq(A083236(n), n=0..100) ; # R. J. Mathar, Jun 20 2021
MATHEMATICA
RecursionLimit$=10000; f[x_] := Prime[x]-f[x-1]; f[0]=2; Table[f[w], {w, 1, 100}]
Join[{0}, Abs[Accumulate[Table[Prime[n](-1)^n, {n, 2, 70}]]]] (* Harvey P. Dale, Nov 20 2013 *)
PROG
(PARI) lista(nn) = {my(last = 2, new, v=vector(nn)); for (n=1, nn, v[n] = prime(n) - last; last = v[n]; ); v; } \\ Michel Marcus, Mar 27 2020
CROSSREFS
Sequence in context: A241830 A151929 A266691 * A345421 A348959 A007492
KEYWORD
nonn
AUTHOR
Labos Elemer, Apr 23 2003
EXTENSIONS
a(0) prepended. - R. J. Mathar, Jun 20 2021
STATUS
approved