login
Lexicographically earliest sequence of distinct positive integers with a(1) multiples of a number b(1) followed by a(2) multiples of a number b(2) etc.
4

%I #13 Oct 19 2024 08:36:02

%S 1,2,4,3,6,9,12,5,10,15,7,14,21,28,35,42,8,16,24,32,40,48,56,64,72,11,

%T 22,33,44,55,66,77,88,99,110,121,132,13,26,39,52,65,17,34,51,68,85,

%U 102,119,136,153,170,18,36,54,90,108,126,144,162,180,198,216

%N Lexicographically earliest sequence of distinct positive integers with a(1) multiples of a number b(1) followed by a(2) multiples of a number b(2) etc.

%C This sequence combines features of Golomb's sequence (A001462) and A361748.

%C This sequence is a permutation of the positive integers with inverse A376904.

%C This sequence can also be seen as an irregular table whose n-th row contains a(n) multiples of its leading term.

%H Rémy Sigrist, <a href="/A376905/b376905.txt">Table of n, a(n) for n = 1..10063</a>

%H Rémy Sigrist, <a href="/A376905/a376905.gp.txt">PARI program</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%e The first terms/rows are:

%e n a(n) b(n) n-th row

%e - ---- ---- -------------------------------------------------

%e 1 1 1 1

%e 2 2 2 2, 4

%e 3 4 3 3, 6, 9, 12

%e 4 3 5 5, 10, 15

%e 5 6 7 7, 14, 21, 28, 35, 42

%e 6 9 8 8, 16, 24, 32, 40, 48, 56, 64, 72

%e 7 12 11 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132

%e 8 5 13 13, 26, 39, 52, 65

%e 9 10 17 17, 34, 51, 68, 85, 102, 119, 136, 153, 170

%o (Python)

%o from itertools import count, islice

%o def A376905gen(): # generator of terms

%o aset, alst, m = {1, 2, 4}, [1, 2, 4], 3

%o yield from [1, 2, 4]

%o for n in count(3):

%o nlst = []

%o for k in count(m, m):

%o if k not in aset:

%o nlst.append(k)

%o if len(nlst) == alst[n-1]:

%o break

%o yield from nlst

%o alst.extend(nlst)

%o aset.update(nlst)

%o while m in aset: m += 1

%o print(list(islice(A376905gen(), 70))) # _Michael S. Branicky_, Oct 16 2024

%o (PARI) \\ See Links section.

%Y Cf. A001462, A361748, A376903, A376906 (inverse), A377093.

%K nonn,tabf

%O 1,2

%A _Rémy Sigrist_, Oct 08 2024