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))
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Nov 06 2002
EXTENSIONS
More terms from Sascha Kurz, Jan 04 2003
STATUS
approved