login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A277263 a(1)=2, a(n+1)=a(n)+p, where p is the largest prime <a(n) if a(n) is odd or the smallest prime >a(n) if a(n) is even. 2
2, 5, 8, 19, 36, 73, 144, 293, 576, 1153, 2304, 4613, 9216, 18437, 36870, 73741, 147468, 294949, 589896, 1179799, 2359596, 4719199, 9438390, 18876787, 37753544, 75507097, 151014174, 302028365, 604056726, 1208113469, 2416226932, 4832453865, 9664907704, 19329815417, 38659630806 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
a(2)=2+3=5 since 2 is even and 3 the smallest prime >2.
a(3)=5+3=8 since 5 is odd and 3 is the largest prime <5.
a(4)=8+11 since 8 is even and 11 is the smallest prime >8. Etc.
MAPLE
A[1]:= 2:
for k from 1 to 50 do
A[2*k]:= A[2*k-1] + nextprime(A[2*k-1]);
A[2*k+1]:= A[2*k] + prevprime(A[2*k]);
od:
seq(A[i], i=1..100); # Robert Israel, Nov 20 2016
MATHEMATICA
NestList[# + If[OddQ@ #, NextPrime[#, -1], NextPrime@ #] &, 2, 34] (* ~~~ *)
PROG
(PARI) lista(nn) = {print1(a = 2, ", "); for (n=2, nn, if (a % 2, a += precprime(a-1), a += nextprime(a+1)); print1(a, ", "); ); } \\ Michel Marcus, Oct 07 2016
CROSSREFS
Cf. A277224.
Sequence in context: A218937 A192780 A320295 * A055614 A243094 A076870
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Michel Marcus, Oct 07 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 05:39 EDT 2024. Contains 371235 sequences. (Running on oeis4.)