[go: up one dir, main page]

login
A371220
Lexicographically earliest sequence of distinct positive integers such that for any n > 0, a(1) + ... + a(n) is a multiple of n, and the least value not yet in the sequence appears as soon as possible.
2
1, 3, 2, 10, 4, 52, 5, 43, 6, 54, 7, 65, 8, 76, 9, 103, 11, 99, 12, 110, 13, 121, 14, 132, 15, 143, 16, 154, 17, 165, 18, 176, 19, 187, 20, 198, 21, 209, 22, 220, 23, 231, 24, 242, 25, 253, 26, 264, 27, 275, 28, 286, 29, 297, 30, 308, 31, 319, 32, 330, 33, 341
OFFSET
1,2
COMMENTS
To build the sequence:
- we start with a(1) = 1,
- once we have n terms, let v be the least value not yet in the sequence,
- if a(1) + ... a(n) + v is a multiple of n+1, then a(n+1) = v,
- otherwise a(n+2) = v and a(n+1) is chosen as small as possible so as to meet the required conditions (this is always possible as n+1 and n+2 are coprime).
The construction is similar to that of A367288.
This sequence is a variant of A019444 and, by design, is guaranteed to be a permutation of the nonnegative integers (with inverse A371221).
EXAMPLE
The first terms, alongside the average of the first terms, are:
n a(n) (a(1)+...+a(n))/n
-- ---- -----------------
1 1 1
2 3 2
3 2 2
4 10 4
5 4 4
6 52 12
7 5 11
8 43 15
9 6 14
10 54 18
11 7 17
12 65 21
PROG
(PARI) See Links section.
CROSSREFS
Cf. A019444, A367288, A371221 (inverse).
Sequence in context: A090780 A184174 A277821 * A318280 A057977 A063549
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Mar 15 2024
STATUS
approved