login
Lexicographically earliest sequence of positive integers with the property that the distance between the first appearance of n and the first appearance of n+1 is a(n).
2

%I #55 Feb 28 2020 14:56:41

%S 1,2,1,3,4,1,1,5,1,1,1,6,7,8,1,1,1,1,9,10,11,12,1,1,1,1,1,13,1,1,1,1,

%T 1,1,14,1,1,1,1,1,1,1,15,16,17,18,19,1,1,1,1,1,1,1,1,20,1,1,1,1,1,1,1,

%U 1,1,21,1,1,1,1,1,1,1,1,1,1,22,1,1,1,1,1,1,1,1,1,1,1,23,24,25,26,27,28

%N Lexicographically earliest sequence of positive integers with the property that the distance between the first appearance of n and the first appearance of n+1 is a(n).

%H Samuel B. Reid, <a href="/A332864/b332864.txt">Table of n, a(n) for n = 1..10000</a>

%H Samuel B. Reid, <a href="/A332864/a332864.c.txt">C program for A332864</a>

%H Samuel B. Reid, <a href="/A332864/a332864_1.png">Graph of 10000 terms</a>

%o (C) See Links section.

%o (Python)

%o a = [1]

%o for n in range(1, 30):

%o a += [1] * (a[n-1]-1)

%o a.append(n+1)

%o print(a)

%o # _Andrey Zabolotskiy_, Feb 28 2020

%Y Cf. A309681, A331910.

%K nonn

%O 1,2

%A _Samuel B. Reid_, Feb 27 2020