

A300392


a(1)=1, a(n) = max(sum0,sum1) mod n, where sum0 is the sum of previous terms with even indices, sum1 with odd indices.


2



1, 1, 1, 2, 3, 5, 1, 0, 8, 4, 3, 5, 4, 7, 9, 14, 4, 2, 2, 0, 19, 11, 9, 16, 17, 3, 0, 25, 8, 5, 7, 4, 5, 2, 1, 34, 29, 26, 10, 6, 8, 4, 4, 0, 41, 10, 6, 8, 4, 4, 0, 48, 34, 30, 1, 52, 43, 38, 12, 6, 6, 0, 57, 52, 34, 28, 50, 44, 13, 6, 5, 70, 61, 54, 26, 18, 28
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,4


COMMENTS

Conjecture: every integer appears infinitely many times.
From Rémy Sigrist, Mar 30 2018: (Start)
The sequence is 2periodic in the interval n = 669..717: in this interval, a(2*k) = 176 and a(2*k+1) = 264.
The sequence is 2periodic in the interval n = 585469..588887: in this interval, a(2*k) = 146528 and a(2*k+1) = 219792.
The sequence is 2periodic in the interval n = 481689629..481728001: in this interval, a(2*k) = 120425588 and a(2*k+1) = 180638382.
(End)
The sequence of indices of zeros begins: 8, 20, 27, 44, 51, 62, 319, 836, 1280, 2216, 2320, 4318, 24075, 94832, 125815, 155635, 459384, 471600, 683516, 6870325...  Alex Ratushnyak, Feb 21 2020


LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..20000 (first 2000 terms from Rémy Sigrist)
Rémy Sigrist, Colored scatterplot of the sequence for n = 1..1000000
Rémy Sigrist, Scatterplot of the sequence for n = 550000..600000


EXAMPLE

a(8) = max(5+2+1,1+3+1+1) mod 8 = 0.


MAPLE

s:= proc(n) s(n):= `if`(n<1, 0, a(n)+s(n2)) end:
a:= proc(n) a(n):= `if`(n<2, n, irem(max(s(n1), s(n2)), n)) end:
seq(a(n), n=1..100); # Alois P. Heinz, Mar 31 2018


MATHEMATICA

s[n_] := s[n] = If[n < 1, 0, a[n] + s[n2]];
a[n_] := a[n] = If[n < 2, n, Mod[Max[s[n1], s[n2]], n]];
Array[a, 100] (* JeanFrançois Alcover, May 31 2019, from Maple *)


PROG

(Python)
a = [1]
s0 = 0
s1 = 1
for n in range(2, 1000):
v = max(s1, s0) % n
a.append(v)
if n&1: s1 += v
else: s0 += v
print(a)
(PARI) lista(nn) = {my(va = [], na = 1, s0 = 0, s1 = 0); print1(na, ", "); va = concat(va, na); for (n=2, nn, if (n % 2, s1 += na, s0 += na); na = max(s0, s1) % n; print1(na, ", "); va = concat(va, na); ); } \\ Michel Marcus, Mar 05 2018


CROSSREFS

Cf. A332581.
Sequence in context: A171034 A062007 A031067 * A335706 A339640 A031027
Adjacent sequences: A300389 A300390 A300391 * A300393 A300394 A300395


KEYWORD

nonn


AUTHOR

Alex Ratushnyak, Mar 05 2018


STATUS

approved



