This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A371220 #12 Mar 16 2024 17:26:36 %S A371220 1,3,2,10,4,52,5,43,6,54,7,65,8,76,9,103,11,99,12,110,13,121,14,132, %T A371220 15,143,16,154,17,165,18,176,19,187,20,198,21,209,22,220,23,231,24, %U A371220 242,25,253,26,264,27,275,28,286,29,297,30,308,31,319,32,330,33,341 %N 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. %C A371220 To build the sequence: %C A371220 - we start with a(1) = 1, %C A371220 - once we have n terms, let v be the least value not yet in the sequence, %C A371220 - if a(1) + ... a(n) + v is a multiple of n+1, then a(n+1) = v, %C A371220 - 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). %C A371220 The construction is similar to that of A367288. %C A371220 This sequence is a variant of A019444 and, by design, is guaranteed to be a permutation of the nonnegative integers (with inverse A371221). %H A371220 Rémy Sigrist, <a href="/A371220/b371220.txt">Table of n, a(n) for n = 1..10000</a> %H A371220 Rémy Sigrist, <a href="/A371220/a371220.gp.txt">PARI program</a> %H A371220 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A371220 The first terms, alongside the average of the first terms, are: %e A371220 n a(n) (a(1)+...+a(n))/n %e A371220 -- ---- ----------------- %e A371220 1 1 1 %e A371220 2 3 2 %e A371220 3 2 2 %e A371220 4 10 4 %e A371220 5 4 4 %e A371220 6 52 12 %e A371220 7 5 11 %e A371220 8 43 15 %e A371220 9 6 14 %e A371220 10 54 18 %e A371220 11 7 17 %e A371220 12 65 21 %o A371220 (PARI) See Links section. %Y A371220 Cf. A019444, A367288, A371221 (inverse). %K A371220 nonn %O A371220 1,2 %A A371220 _Rémy Sigrist_, Mar 15 2024