%I #31 Jan 31 2021 22:28:00
%S 0,13,14,15,16,17,18,19,20,2,40,1,3,4,21,6,33,8,51,53,60,11,80,9,100,
%T 7,120,5,140,10,160,12,157,41,163,39,23,37,31,35,49,73,67,71,85,29,
%U 103,27,121,47,141,25,137,43,143,61,144,59,145,57,45,55,63,93
%N Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, A033307(n + a(n)) = A033307(n).
%C This sequence is a permutation of the nonnegative integers: repunits induce runs of consecutive equal terms of arbitrary size in A033307, thus allowing any value to eventually occur.
%H Rémy Sigrist, <a href="/A337159/b337159.txt">Table of n, a(n) for n = 0..10000</a>
%H Rémy Sigrist, <a href="/A337159/a337159.png">Scatterplot of the first 10000 terms</a>
%H Rémy Sigrist, <a href="/A337159/a337159.gp.txt">PARI program for A337159</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%o (PARI) See Links section.
%o (Python)
%o def aupton(terms):
%o alst, A033307, last, used, n, an = [], '1', 1, set(), 0, 0
%o while n <= terms:
%o while an in used: an += 1
%o while len(A033307) <= n + an: last += 1; A033307 += str(last)
%o if A033307[n + an] == A033307[n]:
%o alst += [an]; used.add(an); n += 1; an = 0
%o else: an += 1
%o return alst
%o print(aupton(63)) # _Michael S. Branicky_, Jan 30 2021
%Y Cf. A033307, A340490.
%K nonn,look,base
%O 0,2
%A _Rémy Sigrist_, Jan 30 2021
|