cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A186972 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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Alois P. Heinz, Mar 01 2011

Keywords

Comments

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

Examples

			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}.
Irregular Triangle T(n,k) begins:
  1;
  1, 1;
  1, 2,  1;
  1, 2,  1;
  1, 4,  5, 2;
  1, 2,  1;
  1, 6, 11, 8, 2;
		

Crossrefs

Columns k=1-10 give: A000012, A000010 (for n>1), A185953, A185348, A186976, A186977, A186978, A186979, A186980, A186981.
Rightmost elements of rows give A186994.
Row sums are A186973.
Cf. A186971.

Programs

  • Maple
    with(numtheory):
    s:= proc(m,r) option remember; mul(`if`(in then 0
        elif k=1 then 1
        elif k=2 and t=n then `if`(n<2, 0, phi(n))
        else c:= 0;
             d:= 2-irem(t,2);
             for h from 1 to n-1 by d do
               if igcd(t, h)=1 then c:= c +b(s(t*h, h), h, k-1) fi
             od; c
          fi
    end:
    T:= proc(n,k) option remember; b(s(n,n),n,k) end:
    seq(seq(T(n, k), k=1..a(n)), n=1..20);
  • Mathematica
    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 *)

A187106 Number of nonempty subsets of {1, 2, ..., n} having pairwise coprime elements.

Original entry on oeis.org

1, 3, 7, 11, 23, 27, 55, 71, 103, 115, 231, 247, 495, 543, 615, 727, 1455, 1519, 3039, 3231, 3615, 3871, 7743, 7999, 11167, 11903, 14655, 15487, 30975, 31231, 62463, 69887, 76159, 80255, 89855, 91647, 183295, 192639, 208639, 214271, 428543
Offset: 1

Views

Author

Alois P. Heinz, Mar 06 2011

Keywords

Examples

			a(4) = 11 because there are 11 nonempty subsets of {1,2,3,4} having pairwise coprime elements: {1}, {2}, {3}, {4}, {1,2}, {1,3}, {1,4}, {2,3}, {3,4}, {1,2,3}, {1,3,4}.
		

Crossrefs

Cf. A036234. Row sums of triangle A186974. Partial sums of A186973. Rightmost elements in rows of triangle A187262.
Cf. A084422.

Programs

  • PARI
    f(n,k=1)=if(n==1, return(2)); if(gcd(k,n)==1, f(n-1,n*k)) + f(n-1,k)
    a(n)=f(n)-1 \\ Charles R Greathouse IV, Aug 24 2016

Formula

a(n) = Sum_{k=1..A036234(n)} A186974(n,k).
a(n) = Sum_{i=1..n} A186973(i).
a(n) = A187262(n,A036234(n)).
a(n) = A084422(n) - 1.

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

Original entry on oeis.org

1, 1, 2, 1, 3, 4, 1, 3, 4, 1, 5, 10, 12, 1, 3, 4, 1, 7, 18, 26, 28, 1, 5, 11, 15, 16, 1, 7, 19, 29, 32, 1, 5, 10, 12, 1, 11, 42, 84, 110, 116, 1, 5, 11, 15, 16, 1, 13, 58, 137, 209, 242, 248, 1, 7, 21, 37, 46, 48, 1, 9, 30, 55, 69, 72, 1, 9, 33, 69, 98, 110, 112
Offset: 1

Views

Author

Alois P. Heinz, Mar 02 2011

Keywords

Comments

T(n,k) = T(n,k-1) for k>A186971(n). The triangle contains all values of T up to the last element of each row that is different from its predecessor.

Examples

			T(5,3) = 10 because there are 10 subsets of {1,2,3,4,5} containing n and having <=3 pairwise coprime elements: {5}, {1,5}, {2,5}, {3,5}, {4,5}, {1,2,5}, {1,3,5}, {1,4,5}, {2,3,5}, {3,4,5}.
Triangle T(n,k) begins:
  1;
  1, 2;
  1, 3, 4;
  1, 3, 4;
  1, 5, 10, 12;
  1, 3, 4;
  1, 7, 18, 26, 28;
		

Crossrefs

Columns k=1-9 give: A000012, A039649 for n>1, A186987, A186988, A186989, A186990, A186991, A186992, A186993.
Rightmost elements of rows give A186973.

Programs

  • Maple
    with(numtheory):
    s:= proc(m,r) option remember; mul(`if`(in then 0
        elif k=1 then 1
        elif k=2 and t=n then `if`(n<2, 0, phi(n))
        else c:= 0;
             d:= 2-irem(t, 2);
             for h from 1 to n-1 by d do
               if igcd(t, h)=1 then c:= c +b(s(t*h, h), h, k-1) fi
             od; c
          fi
        end:
    T:= proc(n, k) option remember;
           b(s(n, n), n, k) +`if`(k=0, 0, T(n, k-1))
        end:
    seq(seq(T(n, k), k=1..a(n)), n=1..20);
  • Mathematica
    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]+If[k == 0, 0, t[n, k-1]]; Table[Table[t[n, k], {k, 1, a[n]}], {n, 1, 20}] // Flatten (* Jean-François Alcover, Dec 19 2013, translated from Maple *)

Formula

T(n,k) = Sum_{i=1..k} A186972(n,i).
Showing 1-3 of 3 results.