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

%I #15 Oct 09 2023 14:26:55

%S 1,-1,-3,1,-4,-24,-17,-25,-225,-215,-226,-2712,-2699,-2713,-40695,

%T -40679,-40696,-732528,-732509,-732529,-15383109,-15383087,-15383110,

%U -369194640,-369194615,-369194641,-9968255307,-9968255279,-9968255308,-299047659240,-299047659209,-299047659241,-9868572754953

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

%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 = -3;

%e a(4) = -3 + 4 = 1.

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

%o (Python)

%o from itertools import count, islice

%o def A362270_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 A362270_list = list(islice(A362270_gen(),20)) # _Chai Wah Wu_, Apr 19 2023

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

%K sign

%O 1,3

%A _James C. McMahon_, Apr 13 2023