%I #12 Mar 02 2020 11:04:38
%S 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,
%T 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,
%U 3,10,43,0,12,46,12,32,10,6,33,66,39,66,57,18,67,14,16,0
%N 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.
%t 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 *)
%o (Python)
%o a = [1, 2]
%o s0 = 2
%o s1 = 1
%o for n in range(3,1000):
%o v = s0 * s1 % n
%o a.append(v)
%o if v&1: s1 += v
%o else: s0 += v
%o print(a)
%Y Cf. A332581, A329681.
%K nonn,easy
%O 1,2
%A _Alex Ratushnyak_, Feb 29 2020
|