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!)
A341130 a(n) = abs(a(n-1) - a(n-2)) if a(n-1) and a(n-2) are both prime or both composite. a(n) = a(n-1) + a(n-2) otherwise, where a(1) = 1 and a(2) = 2 and n > 2. 1

%I #22 Apr 28 2021 03:18:52

%S 1,2,3,1,4,5,9,14,5,19,14,33,19,52,71,123,194,71,265,336,71,407,478,

%T 71,549,620,71,691,620,1311,691,2002,2693,4695,7388,2693,10081,12774,

%U 2693,15467,12774,28241,15467,43708,59175,15467,74642,90109,15467,105576,121043

%N a(n) = abs(a(n-1) - a(n-2)) if a(n-1) and a(n-2) are both prime or both composite. a(n) = a(n-1) + a(n-2) otherwise, where a(1) = 1 and a(2) = 2 and n > 2.

%H Rémy Sigrist, <a href="/A341130/b341130.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A341130/a341130.png">Colored logarithmic scatterplot of the first 2500 terms</a> (where the color is function of the last prime number encountered) [A remarkable graph. - _N. J. A. Sloane_, Feb 13 2021]

%t Block[{a = {1, 2}}, Do[AppendTo[a, Which[MemberQ[{##}, 1], Abs[#1 + #2], SameQ @@ PrimeQ[{##}], Abs[#1 - #2], True, Abs[#1 + #2]]] & @@ a[[-2 ;; -1]], {i, 49}]; a] (* _Michael De Vlieger_, Feb 05 2021 *)

%Y Cf. A096062.

%K nonn,look

%O 1,2

%A _Brian Beard_, Feb 05 2021

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:02 EDT 2024. Contains 371235 sequences. (Running on oeis4.)