login
Triangle read by rows: T(n,k) = Sum_{c in C(n,k)} lcm(c) where C(n,k) is the set of all k-subsets of {1,2,...,n}.
5

%I #39 Sep 05 2023 21:23:57

%S 1,1,1,1,3,2,1,6,11,6,1,10,31,34,12,1,15,81,189,182,60,1,21,141,393,

%T 494,282,60,1,28,288,1380,3245,3740,2034,420,1,36,456,2716,8293,13268,

%U 11338,4908,840,1,45,726,5578,22207,47351,57598,40602,15564,2520

%N Triangle read by rows: T(n,k) = Sum_{c in C(n,k)} lcm(c) where C(n,k) is the set of all k-subsets of {1,2,...,n}.

%C The C(n,k) are also called combinations of n with size k (see A181842).

%C Main diagonal gives: A003418. Lower diagonal gives: A094308. Column k=1 gives: A000217. - _Alois P. Heinz_, Jul 29 2013

%H Alois P. Heinz, <a href="/A181853/b181853.txt">Rows n = 0..46, flattened</a>

%e [0] 1

%e [1] 1 1

%e [2] 1 3 2

%e [3] 1 6 11 6

%e [4] 1 10 31 34 12

%e [5] 1 15 81 189 182 60

%e [6] 1 21 141 393 494 282 60

%p with(combstruct):

%p a181853_row := proc(n) local k,L,l,R,comb;

%p R := NULL;

%p for k from 0 to n do

%p L := 0;

%p comb := iterstructs(Combination(n),size=k):

%p while not finished(comb) do

%p l := nextstruct(comb);

%p L := L + ilcm(op(l));

%p od;

%p R := R,L;

%p od;

%p R end:

%p # second Maple program:

%p b:= proc(n, k) option remember; `if`(k=0, [1],

%p [`if`(k<n, b(n-1, k), [])[], seq(ilcm(c, n), c=b(n-1, k-1))])

%p end:

%p T:= (n, k)-> add(c, c=b(n, k)):

%p seq(seq(T(n, k), k=0..n), n=0..10); # _Alois P. Heinz_, Jul 29 2013

%p # third Maple program:

%p b:= proc(n, m) option remember; expand(`if`(n=0, m,

%p b(n-1, ilcm(m, n))*x+b(n-1, m)))

%p end:

%p T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n, 1)):

%p seq(T(n), n=0..10); # _Alois P. Heinz_, Sep 05 2023

%t t[_, 0] = 1; t[n_, k_] := Sum[LCM @@ c, {c, Subsets[Range[n], {k}]}]; Table[t[n, k], {n, 0, 8}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Jul 29 2013 *)

%o (Sage) # (After Alois P. Heinz)

%o @CachedFunction

%o def b(n, k):

%o if k == 0: return [1]

%o w = b(n-1, k) if k<n else [0]

%o return w + [lcm(c,n) for c in b(n-1, k-1)]

%o def T(n, k): return add(b(n, k))

%o flatten([[T(n, k) for k in (0..n)] for n in (0..10)])

%o # _Peter Luschny_, Jul 29 2013

%Y Row sums give A226037.

%Y Cf. A065567, A096179, A181854.

%K nonn,tabl

%O 0,5

%A _Peter Luschny_, Dec 06 2010