Thursday, May 9, 2024

A362272 Contribution to the OEIS

 

A362272a(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 (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 = 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

No comments:

Post a Comment

1679 - One important message sent from Earth 31 years ago

In 1974 an interstellar radio transmission was broadcast to the  globular cluster   Messier 13   from the Arecibo radio telescope in Puerto ...

Popular in last 30 days