login
Irregular triangle T(n,k), n>=1, 1<=k<=A186971(n), read by rows: T(n,k) is the number of k-element subsets of {1, 2, ..., n} containing n and having pairwise coprime elements.
18

%I #29 Oct 04 2018 19:27:02

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

%T 5,2,1,10,31,42,26,6,1,4,6,4,1,1,12,45,79,72,33,6,1,6,14,16,9,2,1,8,

%U 21,25,14,3,1,8,24,36,29,12,2,1,16,79,183,228,157,56,8,1,6,15,20,15,6,1

%N Irregular triangle T(n,k), n>=1, 1<=k<=A186971(n), read by rows: T(n,k) is the number of k-element subsets of {1, 2, ..., n} containing n and having pairwise coprime elements.

%C T(n,k) = 0 for k>A186971(n). The triangle contains all positive values of T.

%H Alois P. Heinz, <a href="/A186972/b186972.txt">Rows n = 1..220, flattened</a>

%e T(5,3) = 5 because there are 5 3-element subsets of {1,2,3,4,5} containing 5 and having pairwise coprime elements: {1,2,5}, {1,3,5}, {1,4,5}, {2,3,5}, {3,4,5}.

%e Irregular Triangle T(n,k) begins:

%e 1;

%e 1, 1;

%e 1, 2, 1;

%e 1, 2, 1;

%e 1, 4, 5, 2;

%e 1, 2, 1;

%e 1, 6, 11, 8, 2;

%p with(numtheory):

%p s:= proc(m,r) option remember; mul(`if`(i<r, i, 1), i=factorset(m)) end:

%p a:= proc(n) option remember; `if`(n<4, n, pi(n)-nops(factorset(n))+2) end:

%p b:= proc(t,n,k) option remember; local c, d, h;

%p if k=0 or k>n then 0

%p elif k=1 then 1

%p elif k=2 and t=n then `if`(n<2, 0, phi(n))

%p else c:= 0;

%p d:= 2-irem(t,2);

%p for h from 1 to n-1 by d do

%p if igcd(t, h)=1 then c:= c +b(s(t*h, h), h, k-1) fi

%p od; c

%p fi

%p end:

%p T:= proc(n,k) option remember; b(s(n,n),n,k) end:

%p seq(seq(T(n, k), k=1..a(n)), n=1..20);

%t s[m_, r_] := s[m, r] = Product[If[i < r, i, 1], {i, FactorInteger[m][[All, 1]]}]; a[n_] := a[n] = If[n < 4, n, PrimePi[n] - Length[FactorInteger[n]]+2]; b[t_, n_, k_] := b[t, n, k] = Module[{c, d, h}, Which[k == 0 || k > n, 0, k == 1, 1, k == 2 && t == n, If[n < 2, 0, EulerPhi[n]], True, c = 0; d = 2-Mod[t, 2]; For[h = 1, h <= n-1, h = h+d, If[GCD[t, h] == 1, c = c+b[s[t*h, h], h, k-1]]]; c]]; t[n_, k_] := t[n, k] = b[s[n, n], n, k]; Table[Table[t[n, k], {k, 1, a[n]}], {n, 1, 20}] // Flatten (* _Jean-François Alcover_, Dec 17 2013, translated from Maple *)

%Y Columns k=1-10 give: A000012, A000010 (for n>1), A185953, A185348, A186976, A186977, A186978, A186979, A186980, A186981.

%Y Rightmost elements of rows give A186994.

%Y Row sums are A186973.

%Y Cf. A186971.

%K nonn,tabf,look

%O 1,5

%A _Alois P. Heinz_, Mar 01 2011