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!)
A113050 a(1) = a(2) = 1; for n>2, a(n+1) = a(n) + a(n-1) iff n is prime, otherwise a(n+1) = a(n) + 1. 4
1, 1, 2, 3, 4, 7, 8, 15, 16, 17, 18, 35, 36, 71, 72, 73, 74, 147, 148, 295, 296, 297, 298, 595, 596, 597, 598, 599, 600, 1199, 1200, 2399, 2400, 2401, 2402, 2403, 2404, 4807, 4808, 4809, 4810, 9619, 9620, 19239, 19240, 19241, 19242, 38483, 38484, 38485 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
EXAMPLE
a(3) = 2 because 3-1 = 2 is prime, hence a(3) = a(2) + a(1) = 1 + 1 = 2.
a(4) = 3 because 4-1 = 3 is prime, hence a(4) = a(3) + a(2) = 2 + 1 = 3.
a(5) = 4 because 5-1 = 4 is not prime, hence a(5) = a(4) + 1 = 3 + 1 = 4.
a(6) = 7 because 6-1 = 5 is prime, hence a(6) = a(5) + a(4) = 4 + 3 = 7.
a(7) = 8 because 7-1 = 6 is not prime, hence a(7) = a(6) + 1 = 7 + 1 = 8.
a(8) = 15 because 8-1 = 7 is prime, hence a(8) = a(7) + a(6) = 8 + 7 = 15.
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = If[ PrimeQ[n - 1], a[n - 1] + a[n - 2], a[n - 1] + 1]; Table[ a[n], {n, 50}] (* Robert G. Wilson v, Oct 14 2005 *)
CROSSREFS
Sequence in context: A084541 A240690 A339593 * A278180 A368448 A015927
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Oct 12 2005
EXTENSIONS
Corrected and extended by Robert G. Wilson v, Oct 14 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 23 15:20 EDT 2024. Contains 371916 sequences. (Running on oeis4.)