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.

A340312 Triangle read by rows: T(n,k) is the number of subsets of {0..2^n-1} with k elements such that the bitwise-xor of all the subset members gives zero, 0 <= k <= 2^n.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 7, 14, 7, 0, 1, 1, 1, 1, 0, 35, 140, 273, 448, 715, 870, 715, 448, 273, 140, 35, 0, 1, 1, 1, 1, 0, 155, 1240, 6293, 27776, 105183, 330460, 876525, 2011776, 4032015, 7063784, 10855425, 14721280, 17678835, 18796230, 17678835, 14721280, 10855425, 7063784, 4032015, 2011776, 876525, 330460, 105183, 27776, 6293, 1240, 155, 0, 1, 1
Offset: 0

Views

Author

Jianing Song, Jan 04 2021

Keywords

Comments

Sum_{k=0..2^n} T(n, k) gives the total number of subsets with bitwise-xor of all the subset members zero. There are in total 2^(2^n - n) such subsets of {0, 1, ..., 2^n-1}, see A300361 and the Mathematics Stack Exchange link below.
Equivalently, T(n, k) is the number of subsets of the vector space (F_2)^n such that the sum of elements in the subset is the zero vector.
T(n, k) is symmetric, that is, T(n, k) = T(n, 2^n-k) for k = 0..2^n, since if the bitwise-xor of the members in S is zero, then the complement of S in {0, 1, ..., 2^n-1} also has this property.

Examples

			Triangle begins:
[0]  1, 1;
[1]  1, 1, 0;
[2]  1, 1, 0, 1, 1;
[3]  1, 1, 0, 7, 14, 7, 0, 1, 1;
[4]  1, 1, 0, 35, 140, 273, 448, 715, 870, 715, 448, 273, 140, 35, 0, 1, 1;
[5]  1, 1, 0, 155, 1240, 6293, 27776, 105183, 330460, 876525, 2011776, 4032015, 7063784, 10855425, 14721280, 17678835, 18796230, 17678835, 14721280, 10855425, 7063784, 4032015, 2011776, 876525, 330460, 105183, 27776, 6293, 1240, 155, 0, 1, 1;
T(n,0) = 1 since the bitwise-xor of all the elements in the empty set is the identity of bitwise-xor (0), hence the empty set meets the requirement.
T(n,1) = 1 since the only such subset is {0}.
T(n,2) = 0 since no distinct a, b have a ^ b = 0.
T(n,3) = A006095(n): if distinct a, b, c have a ^ b ^ c = 0, then c = a ^ b, and a, b must both be nonzero since a = 0 implies b = c. On the other hand, if a, b are nonequal and are both nonzero, then c = a ^ b has c != a and c != b since c = a implies b = 0. So the total number of triples (a, b, c) is (2^n-1)*(2^n-2), and the total number of subsets {a, b, c} is (2^n-1)*(2^n-2)/3! = A006095(n).
T(n,4) = A016290(n-2): if distinct a, b, c, d have a ^ b ^ c ^ d = 0, then d = a ^ b ^ c. On the other hand, if a, b, c are distinct, then d = a ^ b ^ c has d != a, d != b, d != c since d = a implies b = c. So the total number of quadruples (a, b, c, d) is 2^n*(2^n-1)*(2^n-2), and the total number of subsets {a, b, c, d} is 2^n*(2^n-1)*(2^n-2)/4! = A016290(n-2).
		

Crossrefs

Cf. A000120 (hamming weight of n), A300361 (row sums).
Cf. A340263 (irreducible (?) factor if T(n,k) is seen as representing polynomials).
Cf. A340259(n) = T(n, 2^(n-1)), the central term of row n.
Cf. A340030 (case that only nonzero elements allowed).
Cf. A006095 (k=3 column), A016290 (k=4 column); cf. also A010080-A010084 and A281123. - Jon E. Schoenfield, Jan 06 2021

Programs

  • C
    /* Generating program for T(4,k), see link. */
    
  • Maple
    A340312_row := proc(n) local a, b, c; c := 2^(n-1);
    if n = 0 then return [1, 1] fi;
    b := n -> add(binomial(2^n, 2*k)*x^(2*k), k = 0..2^n);
    a := n -> x*mul(b(k), k = 0..n);
    (x + 1)^c*(b(n-1) - (c-1)*a(n-2));
    [seq(coeff(expand(%), x, j), j = 0..2*c)] end:
    for n from 0 to 6 do A340312_row(n) od; # Peter Luschny, Jan 06 2021
  • Mathematica
    T[n_, k_] := Binomial[2^n, k]/2^n + If[EvenQ[k], (-1)^(k/2)*(1-1/2^n)* Binomial[2^(n-1), k/2], 0];
    Table[T[n, k], {n, 0, 5}, {k, 0, 2^n}] // Flatten (* Jean-François Alcover, Jan 14 2021, after Andrew Howroyd *)
  • PARI
    T(n, k)={binomial(2^n, k)/2^n + if(k%2==0, (-1)^(k/2)*(1-1/2^n)*binomial(2^(n-1), k/2))} \\ Andrew Howroyd, Jan 09 2021
    
  • SageMath
    def A340312():
        a, b, c = 1, 1, 1
        yield [1, 1]
        yield [1, 1, 0]
        while True:
            c *= 2
            a *= b
            b = sum(binomial(c, 2 * k) * x^(2 * k) for k in range(c + 1))
            p = (x + 1)^c * (b - (c - 1) * x * a)
            yield expand(p).list()
    A340312_row = A340312()
    for _ in range(6):
        print(next(A340312_row)) # Peter Luschny, Jan 07 2021

Formula

T(n, k) = [x^k] p(n; x) where p(n; x) = (x + 1)^c*(b(n-1) - (c-1)*a(n-2)), b(n) = Sum_{k=0..2^n} binomial(2^n, 2*k)*x^(2*k), a(n) = x*Product_{k=0..n} b(k) and c = 2^(n-1), for n >= 1. - Peter Luschny, Jan 06 2021
T(n+1, k) = [x^k] (x+1)^(2^n)*p_n(x) where p_n(x) are the polynomials defined in A340263. - Peter Luschny, Jan 06 2021
From Andrew Howroyd, Jan 09 2021: (Start)
First take any subset of k-1 elements and append the bitwise-xor of the elements. The final element will either be a duplicate or not and consideration of the two cases leads to a formula linking T(n,k) and T(n,k-2) with binomial(2^n,k-1).
T(n, k) = (1/k)*(binomial(2^n,k-1) - (2^n-(k-2))*T(n,k-2)) for k >= 2.
T(n, k) = binomial(2^n, k)/2^n for odd k.
T(n, k) = binomial(2^n, k)/2^n + (-1)^(k/2)*(1-1/2^n)*binomial(2^(n-1), k/2) for even k.
T(n, k) = [x^k] ((1+x)^(2^n) + (2^n-1)*(1-x^2)^(2^(n-1)))/2^n.
T(n, k) = A340030(n,k-1) + A340030(n,k).
(End)

Extensions

More terms from Andrew Howroyd and Jon E. Schoenfield.

A058878 Triangle T(n,k) is the number of labeled graphs of even degree with n nodes and k edges (n >= 0, 0 <= k <= n(n-1)/2).

Original entry on oeis.org

1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 4, 3, 0, 0, 1, 0, 0, 10, 15, 12, 15, 10, 0, 0, 1, 1, 0, 0, 20, 45, 72, 160, 240, 195, 120, 96, 60, 15, 0, 0, 0, 1, 0, 0, 35, 105, 252, 805, 1935, 3255, 4515, 5481, 5481, 4515, 3255, 1935, 805, 252, 105, 35, 0, 0, 1, 1, 0, 0, 56
Offset: 0

Views

Author

N. J. A. Sloane, Jan 07 2001

Keywords

Comments

From Petros Hadjicostas, Feb 18 2021: (Start)
Harary and Palmer (1973, p. 11) define an Euler graph to be a connected even graph (i.e., a connected graph where each vertex/node has an even degree). On the other hand, Mallows and Sloane (1975) and Cameron (1977) define an Euler graph to be an even one (i.e., a non-necessarily connected graph where each node has an even degree).
Read (1962) uses both of the above terminologies, although in his Introduction, he indicates that the second usage (calling an even graph Euler) "is not, strictly speaking, correct."
The name of this irregular triangular array T(n,k) does not assume that the graphs are necessarily connected. Thus, according to Harary and Palmer (1973, p. 11), T(n,k) here would be the number of labeled even graphs with n nodes and k edges, but not the number of labeled Euler graphs with n nodes and k edges. (According to these authors, the total number of labeled Euler graphs with n nodes would be A033678(n).)
On the other hand, according to Cameron (1977, pp. 116-117), T(n,k) here gives the number of labeled Euler graphs with n nodes and k edges. (According to Mallows and Sloane (1975) and Cameron (1977), the total number of labeled connected Euler graphs with n nodes would be A033678(n).)
See the links below for more discussion about this confusing topic.
We have T(n, n*(n-1)/2) = 1, if n is odd, because the complete graph on n nodes is even (each node has degree n-1) and has only one non-isomorphic labeling.
We have T(n, n*(n-1)/2 - s) = 0 for s = 0, 1, 2, ..., (n/2)-1 when n is even, because in an even graph with n nodes we cannot have more than n*(n-2)/2 = n*(n-1)/2 - n/2 edges.
Finally, we have T(n, n*(n-1)/2 - n/2) = A001147(n/2), if n is even, because any labeling in an even graph with n nodes and n*(n-1)/2 - n/2 = n*(n-2)/2 edges corresponds to a perfect matching in a complete graph with n nodes (by considering the pairs of vertices that are not connected). See the link on perfect matchings below. (End)
From Petros Hadjicostas, Feb 20 2021: (Start)
To prove that T(n, n*(n-1)/2 - k) = T(n,k) for 0 <= k <= n*(n-1)/2, if n is odd, note that the complement of an even graph is also even. Any even graph counted by T(n,k) has a complement counted by T(n, n*(n-1)/2 - k) and vice versa.
Alternatively, we might use the o.g.f. of the n-th row given by Harary and Palmer (1973) (see the Formula section below) to easily prove that Sum_{k=0..n*(n-1)/2} T(n, n*(n-1)/2 - k)*y^k = Sum_{k=0..n*(n-1)/2} T(n,k)*y^k when n is odd. The proof fails when n is even. (End)

Examples

			Irregular triangle T(n,k) (with rows n >= 0 and columns k = 0..n*(n-1)/2) begins
  1;
  1,
  1, 0,
  1, 0, 0,  1;
  1, 0, 0,  4,  3,  0,   0;
  1, 0, 0, 10, 15, 12,  15,  10,   0,   0,  1;
  1, 0, 0, 20, 45, 72, 160, 240, 195, 120, 96, 60, 15, 0, 0, 0;
  ...
		

References

  • F. Harary and E. M. Palmer, Graphical Enumeration, Academic Press, NY, 1973, p. 13, Eq. (1.4.7).

Crossrefs

Row sums give A006125(n-1) for n>0.

Programs

  • Maple
    w := p->expand(simplify(2^(-p)*(1+x)^(p*(p-1)/2)*add(binomial(p,n)*( (1-x)/(1+x))^(n*(p-n)), n=0..p))); T := (n,k)->coeff(w(n),x,k);
  • Mathematica
    w[p_] := 2^-p*(1+x)^(p*(p-1)/2)*Sum[Binomial[p, n]*((1-x)/(1+x))^(n*(p-n)), {n, 0, p}]; T[n_, k_] := SeriesCoefficient[w[n], {x, 0, k}]; Table[T[n, k], {n, 0, 8}, {k, 0, n(n-1)/2}] // Flatten (* Jean-François Alcover, Jan 12 2015, translated from Maple *) (* Edited by Petros Hadjicostas, Feb 18 2021 to make sure the lengths of rows n = 0, 1, 2 are n*(n-1)/2 + 1 = 1, 1, 2, respectively. *)

Formula

T(n,k) = [x^k] (2^(-n) * (1+x)^(n*(n-1)/2) * Sum_{s=0..n} binomial(n, s)*((1 -x)/(1+x))^(s*(n-s))).
From Petros Hadjicostas, Feb 18 2021: (Start)
T(n,k) = (1/2^n) * Sum_{s=0..n} binomial(n,s) * Sum_{t=0..k} (-1)^t * binomial(s*(n-s), t) * binomial(binomial(s,2) + binomial(n-s, 2), k-t) for n >= 0 and 0 <= k <= n*(n-1)/2.
T(n, n*(n-1)/2) = 1 if n is odd.
T(n, k) = 0 if n is even and n*(n-1)/2 - n/2 + 1 <= k < n*(n-1)/2.
T(n, n*(n-1)/2 - n/2) = A001147(n/2) if n is even.
T(n,k) = A054669(n,k) for n >= 0 and 0 <= k <= n*(n-1)/2 - (n/2)*[0 == n mod 2].
T(n, n*(n-1)/2 - k) = T(n,k) for 0 <= k <= n*(n-1)/2 if n is odd. (End)

Extensions

Rows 0-2 modified by Petros Hadjicostas, Feb 17 2021 so that row n has n*(n-1)/2 numbers
Showing 1-2 of 2 results.