login
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
1, 2, 3, 1, 4, 5, 9, 14, 5, 19, 14, 33, 19, 52, 71, 123, 194, 71, 265, 336, 71, 407, 478, 71, 549, 620, 71, 691, 620, 1311, 691, 2002, 2693, 4695, 7388, 2693, 10081, 12774, 2693, 15467, 12774, 28241, 15467, 43708, 59175, 15467, 74642, 90109, 15467, 105576, 121043
OFFSET
1,2
LINKS
Rémy Sigrist, Colored logarithmic scatterplot of the first 2500 terms (where the color is function of the last prime number encountered) [A remarkable graph. - N. J. A. Sloane, Feb 13 2021]
MATHEMATICA
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 *)
CROSSREFS
Cf. A096062.
Sequence in context: A257681 A338240 A265755 * A330139 A349358 A046671
KEYWORD
nonn,look
AUTHOR
Brian Beard, Feb 05 2021
STATUS
approved