A125147 a(0)=1; for n >= 1, a(n) is the smallest positive integer not occurring earlier in the sequence such that Sum_{k=0..n} a(k) is a multiple of n.
1, 2, 3, 6, 4, 9, 5, 12, 14, 7, 17, 8, 20, 22, 10, 25, 11, 28, 30, 13, 33, 35, 15, 38, 16, 41, 43, 18, 46, 19, 49, 51, 21, 54, 56, 23, 59, 24, 62, 64, 26, 67, 27, 70, 72, 29, 75, 77, 31, 80, 32, 83, 85, 34, 88, 90, 36, 93, 37, 96, 98, 39, 101, 40, 104, 106, 42, 109, 111, 44
Offset: 0
Keywords
Examples
a(5) = 9 because 9 is the smallest positive integer m which does not occur earlier in the sequence and which is such that 5 divides m + Sum_{k=0..4} a(k). So Sum_{k=0..5} a(k) = 25, which is divisible by 5.
Links
- Ivan Neretin, Table of n, a(n) for n = 0..10000
- J. Shallit, Proving properties of some greedily-defined integer recurrences via automata theory, arXiv:2308.06544 [cs.DM], August 12 2023.
Crossrefs
Cf. A019444.
Programs
-
Mathematica
f[l_List] := Block[{k = 1, n = Length[l], s = Plus @@ l},While[MemberQ[l, k] || Mod[s + k, n] > 0, k++ ];Append[l, k]];Nest[f, {1}, 70] (* Ray Chandler, Jan 23 2007 *)
Extensions
Extended by Ray Chandler, Jan 23 2007
Comments