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 A367288 #12 Nov 13 2023 17:53:44 %S A367288 0,1,5,2,18,3,39,4,60,6,106,7,151,8,204,9,265,10,334,11,411,12,496,13, %T A367288 589,14,690,15,799,16,916,17,1009,19,1175,20,1316,21,1465,22,1622,23, %U A367288 1787,24,1960,25,2141,26,2330,27,2527,28,2732,29,2945,30,3166,31 %N A367288 Lexicographically earliest sequence of distinct nonnegative integers such that for any n > 0, a(n-1) and a(n) are congruent modulo n, and the least value not yet in the sequence appears as soon as possible. %C A367288 To build the sequence: %C A367288 - we start with a(0) = 0, and repeatedly: %C A367288 - let a(n) be the last known term and v the least value not yet in the sequence, %C A367288 - if a(n) and v are congruent modulo n+1 then a(n+1) = v, %C A367288 - otherwise a(n+2) = v and a(n+1) is chosen as small as possible in such a way as to satisfy the required congruences (this is always possible as n+1 and n+2 are coprime). %C A367288 This construction is similar to that of A352713. %C A367288 This sequence is a variant of A125717 and, by design, is guaranteed to be a permutation of the nonnegative integers (with inverse A367289). %H A367288 Rémy Sigrist, <a href="/A367288/b367288.txt">Table of n, a(n) for n = 0..10000</a> %H A367288 Rémy Sigrist, <a href="/A367288/a367288.gp.txt">PARI program</a> %H A367288 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a> %H A367288 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A367288 The first terms are: %e A367288 n a(n) a(n-1) mod n a(n) mod n %e A367288 -- ---- ------------ ---------- %e A367288 0 0 N/A N/A %e A367288 1 1 0 0 %e A367288 2 5 1 1 %e A367288 3 2 2 2 %e A367288 4 18 2 2 %e A367288 5 3 3 3 %e A367288 6 39 3 3 %e A367288 7 4 4 4 %e A367288 8 60 4 4 %e A367288 9 6 6 6 %e A367288 10 106 6 6 %e A367288 11 7 7 7 %e A367288 12 151 7 7 %e A367288 13 8 8 8 %o A367288 (PARI) See Links section. %Y A367288 Cf. A005132, A125717, A352713, A367289 (inverse), A367290. %K A367288 nonn %O A367288 0,3 %A A367288 _Rémy Sigrist_, Nov 12 2023