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

%I #18 Sep 03 2021 01:52:58

%S 1,1,2,3,5,8,9,10,11,21,22,23,45,46,47,93,94,95,96,97,193,290,291,292,

%T 293,585,586,587,1173,1174,1175,1176,1177,1178,1179,1180,1181,2361,

%U 2362,2363,2364,2365,2366,2367,2368,2369,2370,2371,4741,4742,4743,4744,4745

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

%H Ivan Neretin, <a href="/A113051/b113051.txt">Table of n, a(n) for n = 1..10000</a>

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

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

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

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

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

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

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

%t nxt[{a_,b_}]:={b,If[PrimeQ[b],a+b,b+1]}; NestList[nxt,{1,1},60][[All,1]] (* _Harvey P. Dale_, Dec 23 2020 *)

%Y Cf. A000040, A000045, A113050.

%K easy,nonn

%O 1,3

%A _Jonathan Vos Post_, Oct 12 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 25 10:43 EDT 2024. Contains 371967 sequences. (Running on oeis4.)