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

%I #17 Sep 03 2021 01:53:26

%S 1,1,2,3,4,7,8,15,16,17,18,35,36,71,72,73,74,147,148,295,296,297,298,

%T 595,596,597,598,599,600,1199,1200,2399,2400,2401,2402,2403,2404,4807,

%U 4808,4809,4810,9619,9620,19239,19240,19241,19242,38483,38484,38485

%N 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.

%H Ivan Neretin, <a href="/A113050/b113050.txt">Table of n, a(n) for n = 1..1000</a>

%e a(3) = 2 because 3-1 = 2 is prime, hence a(3) = a(2) + a(1) = 1 + 1 = 2.

%e a(4) = 3 because 4-1 = 3 is prime, hence a(4) = a(3) + a(2) = 2 + 1 = 3.

%e a(5) = 4 because 5-1 = 4 is not prime, hence a(5) = a(4) + 1 = 3 + 1 = 4.

%e a(6) = 7 because 6-1 = 5 is prime, hence a(6) = a(5) + a(4) = 4 + 3 = 7.

%e a(7) = 8 because 7-1 = 6 is not prime, hence a(7) = a(6) + 1 = 7 + 1 = 8.

%e a(8) = 15 because 8-1 = 7 is prime, hence a(8) = a(7) + a(6) = 8 + 7 = 15.

%t 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 *)

%Y Cf. A000040, A000045, A113051.

%K easy,nonn

%O 1,3

%A _Jonathan Vos Post_, Oct 12 2005

%E Corrected and extended by _Robert G. Wilson v_, Oct 14 2005

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 16 16:52 EDT 2024. Contains 371749 sequences. (Running on oeis4.)