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!)
A362271 a(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 (list; graph; refs; listen; history; text; internal 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

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 May 3 19:22 EDT 2024. Contains 372222 sequences. (Running on oeis4.)