Thursday, May 9, 2024

A362271 Contribution to the OEIS

 

A362271a(1) = 1, then add, subtract and multiply 2, 3, 4; 5, 6, 7; ... in that order.6
1, 3, 0, 0, 5, -1, -7, 1, -8, -80, -69, -81, -1053, -1039, -1054, -16864, -16847, -16865, -320435, -320415, -320436, -7049592, -7049569, -7049593, -176239825, -176239799, -176239826, -4934715128, -4934715099, -4934715129, -152976168999, -152976168967, -152976169000 (listgraphrefslistenhistoryedittextinternal format)
OFFSET
1,2
LINKS
FORMULA
a(1)=1; for n > 1,
a(n) = a(n-1) + n if n mod 3 = 2,
a(n-1) - n if n mod 3 = 0,
a(n-1) * n if n mod 3 = 1.
EXAMPLE
a(2) = 1 + 2 = 3;
a(3) = 3 - 3 = 0;
a(4) = 0 * 4 = 0.
MATHEMATICA
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 *)
PROG
(Python)
from itertools import count, islice
def A362271_gen(): # generator of terms
yield (a:=1)
for n in count(2, 3):
yield (a:=a+n)
yield (a:=a-n-1)
yield (a:=a*(n+2))
A362271_list = list(islice(A362271_gen(), 20)) # Chai Wah Wu, Apr 19 2023
CROSSREFS
Other operation orders: A077382, A077383, A362269, A362270, A362272.
Sequence in context: A092669 A255986 A011400 * A115013 A072736 A135090
KEYWORD
sign
AUTHOR
James C. McMahon, Apr 13 2023
STATUS
approved

No comments:

Post a Comment

An Open Message to the Blog's Fans in Singapore

(Image:  Free 12 singapore icons - Iconfinder ) This past week, more views of this blog were made from Singapore than other country. To ackn...

Popular in last 30 days