|
|
A330347
|
|
a(1)=1, a(2)=2; for n > 2, a(n) = (sum0 * sum1) mod n, where sum0 is the sum of all previous even terms, sum1 is the sum of all previous odd terms.
|
|
0
|
|
|
1, 2, 2, 0, 4, 2, 3, 0, 4, 6, 3, 8, 1, 0, 14, 0, 13, 0, 8, 10, 0, 6, 6, 0, 12, 22, 12, 14, 17, 6, 5, 14, 2, 26, 5, 0, 19, 14, 11, 12, 37, 2, 12, 0, 10, 0, 36, 14, 7, 10, 37, 38, 0, 42, 35, 44, 3, 10, 43, 0, 12, 46, 12, 32, 10, 6, 33, 66, 39, 66, 57, 18, 67, 14, 16, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
MATHEMATICA
|
f[s_] := Join[s, {Mod[Total @ Select[s, EvenQ] * Total @ Select[s, OddQ], Length[s] + 1]}]; Nest[f, {1, 2}, 100] (* Amiram Eldar, Mar 01 2020 *)
|
|
PROG
|
(Python)
a = [1, 2]
s0 = 2
s1 = 1
for n in range(3, 1000):
v = s0 * s1 % n
a.append(v)
if v&1: s1 += v
else: s0 += v
print(a)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|