login
A077384
a(1) = 1, then add, multiply, subtract, multiply 2, 3, 4, 5; 6, 7, 8, 9; ... in that order.
2
1, 3, 9, 5, 25, 31, 217, 209, 1881, 1891, 20801, 20789, 270257, 270271, 4054065, 4054049, 68918833, 68918851, 1309458169, 1309458149, 27498621129, 27498621151, 632468286473, 632468286449, 15811707161225, 15811707161251
OFFSET
1,2
FORMULA
a(1) = 1, a(2n+1) = (2n+1)*a(2n), a(4n) = a(4n-1)-4n, a(4n+2) = a(4n+1) + 4n+2.
MATHEMATICA
FoldList[If[Mod[#2, 4]==2, #1+#2, If[Mod[#2, 4]==3, #1*#2, If[Mod[#2, 4] ==0, #1-#2, #1*#2]]]&, 1, Range[2, 26]] (* James C. McMahon, Oct 09 2023 *)
PROG
(Python)
from itertools import count, islice
def A077384_gen(): # generator of terms
yield (a:=1)
for n in count(2, 4):
yield (a:=a+n)
yield (a:=a*(n+1))
yield (a:=a-n-2)
yield (a:=a*(n+3))
A077384_list = list(islice(A077384_gen(), 20)) # Chai Wah Wu, Apr 19 2023
CROSSREFS
Other operation orders: A077382, A077383, A362269, A362270, A362271, A362272.
Sequence in context: A103934 A365203 A186814 * A122943 A276148 A182946
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Nov 06 2002
EXTENSIONS
More terms from Sascha Kurz, Jan 04 2003
STATUS
approved