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!)
A113051 a(1) = a(2) = 1; for n>2, a(n+1) = a(n) + a(n-1) iff a(n) is prime, otherwise a(n+1) = a(n) + 1. 4
1, 1, 2, 3, 5, 8, 9, 10, 11, 21, 22, 23, 45, 46, 47, 93, 94, 95, 96, 97, 193, 290, 291, 292, 293, 585, 586, 587, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 4741, 4742, 4743, 4744, 4745 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
EXAMPLE
a(3) = 2 because a(3-1) = 1 = 1 is not prime, hence a(3) = a(2) + 1 = 1 + 1 = 2.
a(4) = 3 because a(4-1) = 2 is prime, hence a(4) = a(3) + a(2) = 2 + 1 = 3.
a(5) = 5 because a(5-1) = 3 is prime, hence a(5) = a(4) + a(3) = 3 + 2 = 5.
a(6) = 8 because a(6-1) = 5 is prime, hence a(6) = a(5) + a(4) = 5 + 3 = 8.
a(7) = 9 because a(7-1) = 8 is not prime, hence a(7) = a(6) + 1 = 8 + 1 = 9.
a(8) = 10 because a(8-1) = 9 is not prime, hence a(8) = a(7) + 1 = 9 + 1 = 10.
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = If[ PrimeQ[ a[n - 1]], a[n - 1] + a[n - 2], a[n - 1] + 1]; Table[ a[n], {n, 53}] (* Robert G. Wilson v, Oct 14 2005 *)
nxt[{a_, b_}]:={b, If[PrimeQ[b], a+b, b+1]}; NestList[nxt, {1, 1}, 60][[All, 1]] (* Harvey P. Dale, Dec 23 2020 *)
CROSSREFS
Sequence in context: A286489 A002153 A047607 * A047372 A308469 A247547
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Oct 12 2005
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 April 19 02:04 EDT 2024. Contains 371782 sequences. (Running on oeis4.)