[go: up one dir, main page]

login
A077382
a(1) = 1, then multiply, add and subtract 2, 3, 4; 5, 6, 7; ... in that order.
6
1, 2, 5, 1, 5, 11, 4, 32, 41, 31, 341, 353, 340, 4760, 4775, 4759, 80903, 80921, 80902, 1618040, 1618061, 1618039, 37214897, 37214921, 37214896, 967587296, 967587323, 967587295, 28060031555, 28060031585, 28060031554, 897921009728
OFFSET
1,2
EXAMPLE
a(2) = a(1) *2 = 2, a(3) = a(2) +3= 5, a(4) = a(3) -4 = 1,a(5) = 1*5 = 5, a(6) = a(5)+6 = 11, a(7) = 11-7 = 4, a(8) = 4*8 = 32, etc.
MATHEMATICA
FoldList[If[Mod[#2, 3]==2, #1*#2, If[Mod[#2, 3]==0, #1+#2, #1-#2]]&, 1, Range[2, 32]] (* James C. McMahon, Oct 10 2023 *)
PROG
(Python)
from itertools import count, islice
def A077382_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)
A077382_list = list(islice(A077382_gen(), 20)) # Chai Wah Wu, Apr 19 2023
CROSSREFS
Other operation orders: A077383, A077384 A362269, A362270, A362271, A362272.
Sequence in context: A258020 A021803 A356273 * A046527 A008343 A257264
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Nov 06 2002
EXTENSIONS
More terms from Franklin T. Adams-Watters, May 12 2006
STATUS
approved