Thursday, May 9, 2024

A362270 Contribution to the OEIS

 

A362270a(1) = 1, then subtract, multiply, and add 2, 3, 4; 5, 6, 7; ... in that order.6
1, -1, -3, 1, -4, -24, -17, -25, -225, -215, -226, -2712, -2699, -2713, -40695, -40679, -40696, -732528, -732509, -732529, -15383109, -15383087, -15383110, -369194640, -369194615, -369194641, -9968255307, -9968255279, -9968255308, -299047659240, -299047659209, -299047659241, -9868572754953 (listgraphrefslistenhistoryedittextinternal format)
OFFSET
1,3
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 = -1;
a(3) = -1 * 3 = -3;
a(4) = -3 + 4 = 1.
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 A362270_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)
A362270_list = list(islice(A362270_gen(), 20)) # Chai Wah Wu, Apr 19 2023
CROSSREFS
Other operation orders: A077382, A077383, A362269, A362271, A362272.
Sequence in context: A112668 A016734 A272473 * A125846 A318382 A340190
KEYWORD
sign
AUTHOR
James C. McMahon, Apr 13 2023
STATUS
approved

No comments:

Post a Comment

An Open Message to the Blog's Fans in Singapore

(Image:  Free 12 singapore icons - Iconfinder ) This past week, more views of this blog were made from Singapore than other country. To ackn...

Popular in last 30 days