login
a(1) = 1, then subtract, add, and multiply 2, 3, 4; 5, 6, 7; ... in that order.
7

%I #29 Oct 09 2023 12:54:57

%S 1,-1,2,8,3,9,63,55,64,640,629,641,8333,8319,8334,133344,133327,

%T 133345,2533555,2533535,2533556,55738232,55738209,55738233,1393455825,

%U 1393455799,1393455826,39016763128,39016763099,39016763129

%N a(1) = 1, then subtract, add, and multiply 2, 3, 4; 5, 6, 7; ... in that order.

%H Delbert L. Johnson, <a href="/A362269/b362269.txt">Table of n, a(n) for n = 1..1143</a>

%F a(1)=1; for n > 1,

%F a(n) = a(n-1) - n if n mod 3 = 2,

%F a(n-1) + n if n mod 3 = 0,

%F a(n-1) * n if n mod 3 = 1.

%e a(2) = 1 - 2 = -1;

%e a(3) = -1 + 3 = 2;

%e a(4) = 2 * 4 = 8.

%t FoldList[If[Mod[#2,3]==2,#1-#2,If[Mod[#2,3]==0,#1+#2,#1*#2]]&,1,Range[2,30]] (* _James C. McMahon_, Oct 08 2023 *)

%o (Python)

%o from itertools import count, islice

%o def A362269_gen(): # generator of terms

%o yield (a:=1)

%o for n in count(2,3):

%o yield (a:=a-n)

%o yield (a:=a+n+1)

%o yield (a:=a*(n+2))

%o A362269_list = list(islice(A362269_gen(),20)) # _Chai Wah Wu_, Apr 19 2023

%Y Other operation orders: A077382, A077383, A362270, A362271, A362272.

%K sign

%O 1,3

%A _James C. McMahon_, Apr 13 2023