login
Irregular triangle read by rows: row n lists the elements of the set S_n in increasing order, where S_1 = {1}, and S_{n+1} is the union of S_n, 2*S_n, and 3*S_n.
3

%I #25 Jun 02 2022 09:07:35

%S 1,1,2,3,1,2,3,4,6,9,1,2,3,4,6,8,9,12,18,27,1,2,3,4,6,8,9,12,16,18,24,

%T 27,36,54,81,1,2,3,4,6,8,9,12,16,18,24,27,32,36,48,54,72,81,108,162,

%U 243,1,2,3,4,6,8,9,12,16,18,24,27,32,36,48,54,64,72,81,96,108,144,162,216,243,324,486,729

%N Irregular triangle read by rows: row n lists the elements of the set S_n in increasing order, where S_1 = {1}, and S_{n+1} is the union of S_n, 2*S_n, and 3*S_n.

%C S_n contains n*(n+1)/2 elements.

%C The rows converge to A003586.

%H Alois P. Heinz, <a href="/A350604/b350604.txt">Rows n = 1..50, flattened</a>

%e The first few sets S_n are:

%e [1],

%e [1, 2, 3],

%e [1, 2, 3, 4, 6, 9],

%e [1, 2, 3, 4, 6, 8, 9, 12, 18, 27],

%e [1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 36, 54, 81],

%e [1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 72, 81, 108, 162, 243],

%e ...

%p T:= proc(n) option remember; `if`(n=1, 1, sort(

%p [map(k-> [k, 2*k, 3*k][], {T(n-1)})[]])[])

%p end:

%p seq(T(n), n=1..7); # _Alois P. Heinz_, Jan 12 2022

%t S[1] = {1};

%t S[n_] := S[n] = Union[S[n-1], 2*S[n-1], 3*S[n-1]];

%t Table[S[n], {n, 1, 7}] // Flatten (* _Jean-François Alcover_, Jun 02 2022 *)

%o (Python)

%o from itertools import chain, islice

%o def A350604_gen(): # generator of terms

%o s = {1}

%o while True:

%o yield from sorted(s)

%o s = set(chain.from_iterable((x,2*x,3*x) for x in s))

%o A350604_list = list(islice(A350604_gen(),30)) # _Chai Wah Wu_, Jan 12 2022

%Y Cf. A003586, A350603.

%K nonn,look,tabf

%O 1,3

%A _N. J. A. Sloane_, Jan 12 2022