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!)
A362272 a(1) = 1, then multiply, subtract, and add 2, 3, 4; 5, 6, 7; ... in that order. 6
1, 2, -1, 3, 15, 9, 16, 128, 119, 129, 1419, 1407, 1420, 19880, 19865, 19881, 337977, 337959, 337978, 6759560, 6759539, 6759561, 155469903, 155469879, 155469904, 4042217504, 4042217477, 4042217505, 117224307645, 117224307615, 117224307646, 3751177844672, 3751177844639 (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 = 2;
a(3) = 2 - 3 = -1;
a(4) = -1 + 4 = 3.
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 A362272_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)
A362272_list = list(islice(A362272_gen(), 20)) # Chai Wah Wu, Apr 19 2023
CROSSREFS
Other operation orders: A077382, A077383, A362269, A362270, A362271.
Sequence in context: A366591 A007447 A153189 * A095852 A283748 A209365
KEYWORD
sign
AUTHOR
James C. McMahon, Apr 19 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 July 3 16:42 EDT 2024. Contains 373982 sequences. (Running on oeis4.)