OFFSET
1,4
COMMENTS
Conjecture: every integer appears infinitely many times.
From Rémy Sigrist, Mar 30 2018: (Start)
The sequence is 2-periodic in the interval n = 669..717: in this interval, a(2*k) = 176 and a(2*k+1) = 264.
The sequence is 2-periodic in the interval n = 585469..588887: in this interval, a(2*k) = 146528 and a(2*k+1) = 219792.
The sequence is 2-periodic 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(n-2)) end:
a:= proc(n) a(n):= `if`(n<2, n, irem(max(s(n-1), s(n-2)), 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[n-2]];
a[n_] := a[n] = If[n < 2, n, Mod[Max[s[n-1], s[n-2]], n]];
Array[a, 100] (* Jean-Franç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
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Mar 05 2018
STATUS
approved