

A332581


a(0)=0, a(1)=1; for n>1, a(n) = max(sum0,sum1) mod n, where sum0 is the sum of all previous even terms, sum1 is the sum of all previous odd terms.


3



0, 1, 1, 2, 2, 4, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 5, 9, 17, 9, 16, 14, 12, 10, 16, 0, 28, 22, 8, 12, 20, 0, 32, 22, 0, 34, 22, 38, 27, 20, 33, 26, 45, 38, 20, 32, 5, 48, 35, 26, 43, 34, 2, 52, 36, 2, 54, 36, 61, 50, 24, 36, 60, 40, 67, 54, 24, 34, 54, 20, 25, 10, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,4


COMMENTS

For n > 2842, sum0 > sum1.
For all n > 54388, a(n) = 9514.
Indices of zeros: 0, 30, 36, 39, 3552, 8526, 9156, 11143, 12775, 36077, 38141.


LINKS

Table of n, a(n) for n=0..77.


EXAMPLE

a(10) = max(2+2+4+2+2, 1+1+3+3) mod 10 = 12 mod 10 = 2.


PROG

(Python)
a = [0, 1]
s0, s1 = 0, 1
for n in range(2, 1000):
v = max(s0, s1) % n
a.append(v)
if (v & 1): s1 += v
else: s0 += v
print(a)


CROSSREFS

Cf. A300392.
Sequence in context: A127796 A131287 A102640 * A328059 A123674 A238745
Adjacent sequences: A332578 A332579 A332580 * A332582 A332583 A332584


KEYWORD

nonn


AUTHOR

Alex Ratushnyak, Feb 16 2020


STATUS

approved



