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-2 of 2 results.

A309280 T(n,k) is (1/k) times the sum of the elements of all subsets of [n] whose sum is divisible by k; triangle T(n,k), n >= 1, 1 <= k <= n*(n+1)/2, read by rows.

Original entry on oeis.org

1, 6, 1, 1, 24, 6, 4, 1, 1, 1, 80, 20, 9, 4, 4, 2, 2, 1, 1, 1, 240, 60, 30, 14, 12, 7, 5, 3, 3, 3, 2, 2, 1, 1, 1, 672, 168, 84, 42, 29, 20, 15, 10, 9, 7, 5, 5, 4, 4, 4, 3, 2, 2, 1, 1, 1, 1792, 448, 202, 112, 71, 49, 40, 27, 23, 17, 15, 12, 10, 10, 8, 8, 7, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1
Offset: 1

Views

Author

Alois P. Heinz, Jul 20 2019

Keywords

Comments

T(n,k) is defined for all n >= 0, k >= 1. The triangle contains only the positive terms. T(n,k) = 0 if k > n*(n+1)/2.
The sequence of column k satisfies a linear recurrence with constant coefficients of order 3*A000593(k).

Examples

			The subsets of [4] whose sum is divisible by 3 are: {}, {3}, {1,2}, {2,4}, {1,2,3}, {2,3,4}.  The sum of their elements is 0 + 3 + 3 + 6 + 6 + 9 = 27.  So T(4,3) = 27/3 = 9.
Triangle T(n,k) begins:
    1;
    6,  1,  1;
   24,  6,  4,  1,  1, 1;
   80, 20,  9,  4,  4, 2, 2, 1, 1, 1;
  240, 60, 30, 14, 12, 7, 5, 3, 3, 3, 2, 2, 1, 1, 1;
  ...
		

Crossrefs

Row sums give A309281.
Row lengths give A000217.
T(n,n) gives A309128.
Rows reversed converge to A000009.

Programs

  • Maple
    b:= proc(n, m, s) option remember; `if`(n=0, [`if`(s=0, 1, 0), 0],
          b(n-1, m, s) +(g-> g+[0, g[1]*n])(b(n-1, m, irem(s+n, m))))
        end:
    T:= (n, k)-> b(n, k, 0)[2]/k:
    seq(seq(T(n, k), k=1..n*(n+1)/2), n=1..10);
    # second Maple program:
    b:= proc(n, s) option remember; `if`(n=0, add(s/d *x^d,
          d=numtheory[divisors](s)), b(n-1, s)+b(n-1, s+n))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..degree(p)))(b(n, 0)):
    seq(T(n), n=1..10);
  • Mathematica
    b[n_, m_, s_] := b[n, m, s] = If[n == 0, {If[s == 0, 1, 0], 0}, b[n-1, m, s] + Function[g, g + {0, g[[1]] n}][b[n-1, m, Mod[s+n, m]]]];
    T[n_, k_] := b[n, k, 0][[2]]/k;
    Table[T[n, k], {n, 1, 10}, {k, 1, n(n+1)/2}] // Flatten (* Jean-François Alcover, Oct 04 2019, after Alois P. Heinz *)

Formula

T(n+1,n*(n+1)/2+1) = A000009(n) for n >= 0.

A309122 Sum of the sizes of all subsets of [n] whose sum is divisible by n.

Original entry on oeis.org

1, 1, 6, 6, 20, 34, 70, 124, 270, 516, 1034, 2060, 4108, 8198, 16440, 32760, 65552, 131142, 262162, 524312, 1048740, 2097162, 4194326, 8388856, 16777300, 33554444, 67109418, 134217764, 268435484, 536872072, 1073741854, 2147483632, 4294969404, 8589934608
Offset: 1

Views

Author

Alois P. Heinz, Jul 13 2019

Keywords

Comments

The bivariate g.f. of array T(n,k) = A267632(n,k) is Sum_{n, k >= 1} T(n,k) * x^n * y^k = -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x*y)^s). Differentiating w.r.t. y and setting y = 1, we get the g.f. of a(n) = k * Sum_{1 <= k <= n} T(n,k) (see below). - Petros Hadjicostas, Jul 13 2019

Examples

			a(5) = 20 = 0 + 1 + 2 + 2 + 3 + 3 + 4 + 5 = |{}| + |{5}| + |{1,4}| + |{2,3}| + |{1,4,5}| + |{2,3,5}| + |{1,2,3,4}| + |{1,2,3,4,5}|.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, m, s) option remember; `if`(n=0, [`if`(s=0, 1, 0), 0],
          b(n-1, m, s) +(g-> g+[0, g[1]])(b(n-1, m, irem(s+n, m))))
        end:
    a:= proc(n) option remember; forget(b); b(n$2, 0)[2] end:
    seq(a(n), n=1..40);
  • Mathematica
    b[n_, m_, s_] := b[n, m, s] = If[n == 0, {If[s == 0, 1, 0], 0},
         b[n-1, m, s] + Function[g, g + {0, g[[1]]}][b[n-1, m, Mod[s+n, m]]]];
    a[n_] := b[n, n, 0][[2]];
    Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)

Formula

a(n) = Sum_{k=1..n} k * A267632(n,k).
From Petros Hadjicostas, Jul 13 2019: (Start)
G.f.: Sum_{s >= 1} phi(s) * (-x)^(s-1)/(1 - x^s + (-x)^s) = -Sum_{m >= 1} phi(2*m) * x^(2*m-1) + Sum_{m >= 0} phi(2*m+1) * x^(2*m)/(1 - 2*x^(2*m+1)).
a(2*m + 1) = A053636(2*m + 1)/2 = (1/2) * Sum_{d|2*m+1} phi(d) * 2^((2*m+1)/d) for m >= 0.
a(2*m) = -phi(2*m) + A053636(2*m)/2 for m >= 1.
(End)
Showing 1-2 of 2 results.