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

A003042 Number of directed Hamiltonian cycles (or Gray codes) on n-cube.

Original entry on oeis.org

1, 2, 12, 2688, 1813091520, 71676427445141767741440
Offset: 1

Views

Author

Keywords

Comments

Finding a(6) is Problem 43 in the Knuth reference.

References

  • Martin Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 24.
  • Donald E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, (to appear), section 7.2.1.1.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Equals A006069 divided by 2^n.

Formula

a(n) = 2 * A066037(n).

Extensions

a(6) from Michel Deza, Mar 28 2010
a(6) corrected by Haanpaa and Östergård, 2012. - N. J. A. Sloane, Sep 06 2012

A091299 Number of (directed) Hamiltonian paths (or Gray codes) on the n-cube.

Original entry on oeis.org

2, 8, 144, 91392, 187499658240
Offset: 1

Views

Author

N. J. A. Sloane, Feb 20 2004

Keywords

Comments

More precisely, this is the number of ways of making a list of the 2^n nodes of the n-cube, with a distinguished starting position and a direction, such that each node is adjacent to the previous one. The final node may or may not be adjacent to the first.

Examples

			a(1) = 2: we have 1,2 or 2,1. a(2) = 8: label the nodes 1, 2, ..., 4. Then the 8 possibilities are 1,2,3,4; 1,3,4,2; 2,3,4,1; 2,1,4,3; etc.
		

References

  • M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 24.

Crossrefs

Equals A006069 + A006070. Divide by 2^n to get A003043.

Programs

  • Python
    # A function that calculates A091299[n] from Janez Brank.
    def CountGray(n):
        def Recurse(unused, lastVal, nextSet):
            count = 0
            for changedBit in range(0, min(nextSet + 1, n)):
                newVal = lastVal ^ (1 << changedBit)
                mask = 1 << newVal
                if unused & mask:
                    if unused == mask:
                        count += 1
                    else:
                        count += Recurse(
                            unused & ~mask, newVal, max(nextSet, changedBit + 1)
                        )
            return count
        count = Recurse((1 << (1 << n)) - 2, 0, 0)
        for i in range(1, n + 1):
            count *= 2 * i
        return max(1, count)
    [CountGray(n) for n in range(1, 4)]

Extensions

a(5) from Janez Brank (janez.brank(AT)ijs.si), Mar 02 2005

A085452 Triangle T(n,k) read by rows: T(n,k) = number of cycles of length 2k in the binary n-cube, for n >= 2, k = 2, 3, ..., 2^(n-1).

Original entry on oeis.org

1, 6, 16, 6, 24, 128, 696, 2112, 5024, 5376, 1344, 80, 640, 6720, 68736, 591200, 4652160, 32146800, 185285120, 865894848, 3136412160, 8315531200, 14800412160, 15448366080, 7413471744, 906545760, 240, 2560, 39840, 698112, 12226560, 203258880, 3257746560
Offset: 2

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Aug 12 2003

Keywords

Comments

Row n contains 2^(n-1)-1 terms.
Also the triangle of even-order coefficients (odd coefficients are all 0) of the hypercube graph cycle polynomials ordered from smallest to largest exponent starting with x^4. - Eric W. Weisstein, Feb 05 2014

Examples

			Triangle begins:
1,
6, 16, 6,
24, 128, 696, 2112, 5024, 5376, 1344,
80, 640, 6720, 68736, 591200, 4652160, 32146800, 185285120, 865894848, 3136412160, 8315531200, 14800412160, 15448366080, 7413471744, 906545760,
....
In terms of cycle polynomials:
x^4
6*x^4 + 16*x^6 + 6*x^8
24*x^4 + 128*x^6 + 696*x^8 + 2112*x^10 + 5024*x^12 + 5376*x^14 + 1344*x^16
...
		

References

  • Initial terms computed by Daniele Degiorgi (danieled(AT)inf.ethz.ch).

Crossrefs

Cf. A066037, A001788. Row sums give A085408.

Programs

  • Mathematica
    Table[Table[Length[FindCycle[HypercubeGraph[n], {k}, All]], {k, 4, 2^n, 2}], {n, 4}] // Flatten (* Eric W. Weisstein, Mar 23 2020 *)

Extensions

Corrected by Andrew Weimholt, Nov 14 2009
Initial terms of T(6,k) from Eric W. Weisstein, Mar 23 2020

A091302 Number of equivalence classes of directed Hamiltonian cycles (or Gray codes) in the binary n-cube with one node marked.

Original entry on oeis.org

1, 1, 2, 112, 15109096, 99550593673808010752
Offset: 1

Views

Author

N. J. A. Sloane, following a suggestion of Gordon Royle, Feb 20 2004

Keywords

Comments

Equals A066037(n)/(n!/2). See A006069, A003042, A066037 for more information.

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, (to appear), section 7.2.1.1.

Crossrefs

Extensions

a(6) from Michel Deza, Mar 28 2010
a(6) corrected by Haanpaa and Östergård, 2012, who also provided a more precise definition. - N. J. A. Sloane, Sep 06 2012

A003043 Number of Hamiltonian paths (or Gray codes) on n-cube with a marked starting node.

Original entry on oeis.org

1, 2, 18, 5712, 5859364320
Offset: 1

Views

Author

Keywords

Comments

More precisely, this is the number of ways of making a list of the 2^n nodes of the n-cube, with a distinguished starting position and a direction, such that each node is adjacent to the previous one. The final node may or may not be adjacent to the first. Finally, divide by 2^n since the starting node really doesn't matter.
Also, the number of strings s of length 2^n - 1 over the alphabet {1,2,...,n} with the property that every contiguous subblock has some letter that appears an odd number of times.

References

  • M. Gardner, Mathematical Games, Sci. Amer. Vol. 228 (No. 4, Apr. 1973), p. 111.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Formula

a(n) = A091299(n)/2^n.

Extensions

a(5) (from A091299) from Max Alekseyev, Jul 09 2006
Alternative description added by Jeffrey Shallit, Feb 02 2013

A236602 Number of canonical Gray cycles of length 2n.

Original entry on oeis.org

1, 1, 1, 6, 4, 22, 96, 1344, 672, 3448, 12114, 158424, 406312, 4579440, 37826256, 906545760, 362618304, 1784113248, 5576251408, 68998853808, 154939065862
Offset: 1

Views

Author

Stanislav Sykora, Feb 01 2014

Keywords

Comments

By a canonical Gray cycle (CGC) of length 2n is intended a monocyclic permutation of the integers {0,1,2,...,2n-1} such that (i) it starts with "0", (ii) the binary expansions of any two adjacent terms of the cycle differ by exactly one bit, and (iii) the last term is larger than the second. Note: there are no CGC's of odd length.
For n>1, a(n) is also the number of all distinct Hamiltonian circuits in a simple graph with 2n vertices, labeled 0,1,2,...,(2n-1), in which two vertices are connected by an edge only if the binary expansions of their labels differ by exactly one bit.
The sequence is a superset of A066037.

Examples

			a(5) = 4 since there are only these 4 CGC's of length 10:
{0 2 3 7 6 4 5 1 9 8}
{0 2 6 4 5 7 3 1 9 8}
{0 4 5 7 6 2 3 1 9 8}
{0 4 6 2 3 7 5 1 9 8}
		

Crossrefs

Cf. A066037 (subset), A236603, A350784.

Programs

  • Mathematica
    A236602[n_] := Count[Map[lpf, Map[j0f, Permutations[Range[2 n - 1]]]], 0]/2;
    j0f[x_] := Join[{0}, x, {0}];
    btf[x_] := Module[{i},
       Table[DigitCount[BitXor[x[[i]], x[[i + 1]]], 2, 1], {i,
         Length[x] - 1}]];
    lpf[x_] := Length[Select[btf[x], # != 1 &]];
    Join[{1}, Table[A236602[n], {n, 2, 5}]]
    (* OR, a less simple, but more efficient implementation. *)
    A236602[n_, perm_, remain_] := Module[{opt, lr, i, new},
       If[remain == {},
         If[DigitCount[BitXor[First[perm], Last[perm]], 2, 1] == 1, ct++];
         Return[ct],
         opt = remain; lr = Length[remain];
         For[i = 1, i <= lr, i++,
          new = First[opt]; opt = Rest[opt];
          If[DigitCount[BitXor[Last[perm], new], 2, 1] != 1, Continue[]];
          A236602[n, Join[perm, {new}],
           Complement[Range[2 n - 1], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Join[{1}, Table[ct = 0; A236602[n, {0}, Range[2 n - 1]]/2, {n, 2, 8}] ](* Robert Price, Oct 25 2018 *)

Formula

a(2^(n-1)) = A066037(n).
a(n) = A350784(n)/2 for n >= 2. - Martin Ehrenstein, Feb 16 2022

Extensions

a(17)-a(18) from Fausto A. C. Cariboni, May 13 2017
a(19)-a(20) from Martin Ehrenstein, Feb 16 2022
a(21) from Martin Ehrenstein, Feb 21 2022

A159344 Number of Hamiltonian cycles in the n-hypercube up to automorphism.

Original entry on oeis.org

1, 1, 1, 9, 237675, 777739016577752714
Offset: 1

Views

Author

Keywords

Comments

Here we count equivalence classes under the full automorphism group of the n-cube. - N. J. A. Sloane, Sep 06 2012
a(4) is due to Gilbert and a(5) is due to Dejter & Delgado.
Comments on Abbott's (1966) lower bound, from Charles R Greathouse IV and David Applegate (Sequence Fans Mailing List, Dec 06 2012: (Start)
a(n) is, in Abbott's terminology, h*(n); see (2) and (3) which yield a(n) >= sqrt(294)^(2^n-4)/(n! * 2^n) [Note that we have written sqrt(294) for 7 sqrt(6)].
Unfortunately, the lower bound seems incompatible with the known values of a(n), even for a(3) and a(4) which were known to Abbott.
Looking at Abbot's paper, at least one error is the claim "it is easy to verify that (12) implies (3)."
(12) is h(m+3) >= 6^2^m h(m), which implies h(m) >= 6^2^(m-3) for m >= 4, or h(m) >= 2/5 * (6^2^(m-3)) for m >= 1, but certainly doesn't imply (3) h(m) >= (7 sqrt(6))^(2^n-4). (End)

Examples

			There are six Hamiltonian cycles in the cube, but they are isomorphic so a(3) = 1.
		

Crossrefs

Formula

a(n) < n^(2^n).
a(n) >= sqrt(294)^(2^n-4)/(n! * 2^n) and a(n) >= A066037(n)/A000165(n) due to Abbott 1966. [Warning: see Comments above!]

Extensions

a(6) from Haanpaa & Ostergard 2012. - N. J. A. Sloane, Sep 06 2012
Edited by N. J. A. Sloane, Dec 16 2012

A059783 Number of paths (without loops) in graph of n-dimensional hypercube starting at point (0,0,0,...,0) and ending at (1,1,1,...,1).

Original entry on oeis.org

1, 2, 18, 6432, 18651552840
Offset: 1

Views

Author

Avi Peretz (njk(AT)netvision.net.il), Feb 22 2001

Keywords

Comments

Terms up to a(5)=18651552840 confirmed by independent computation. [Joerg Arndt, Aug 07 2012]

Examples

			a(2) = 2 because there are 2 paths: 00,01,11 and 00,10,11
		

Crossrefs

Extensions

Added a(5), based on http://teamikaria.com/4dforum/viewtopic.php?f=5&t=1211 Dmitry Kamenetsky, Aug 28 2009
Corrected offset Alex Ratushnyak, Aug 07 2012

A085408 Total number of cycles in the binary n-cube.

Original entry on oeis.org

0, 1, 28, 14704, 51109385408
Offset: 1

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Aug 12 2003

Keywords

References

  • Computed by Daniele Degiorgi (danieled(AT)INF.ETHZ.CH).

Crossrefs

Cf. A066037, A001788. Row sums of A085452.

Programs

  • Mathematica
    Table[Total[Table[Length[FindCycle[HypercubeGraph[n], {k}, All]], {k, 4, 2^n, 2}]], {n, 4}] (* Eric W. Weisstein, Mar 24 2020 *)

A259839 Number of order-preserving Hamiltonian paths in the n-cube (Gray codes); see the comments for the precise definition of order-preserving.

Original entry on oeis.org

1, 1, 1, 1, 1, 10, 123, 1492723
Offset: 0

Views

Author

Torsten Muetze, Jul 06 2015

Keywords

Comments

An order-preserving Hamiltonian path in the n-cube is a listing S_1,...,S_N of all N:=2^n many subsets of [n]:={1,2,...,n}, such that if S_j is a subset of S_i then j <= i+1. For the counting we ignore paths that differ only by renaming elements of the ground set (=automorphisms of the n-cube), i.e., without loss of generality every such path starts as follows: S_1={}, S_2={1}, S_3={1,2}, S_4={2}, S_5={2,3}, S_6={3}, S_7={3,4}, S_8={4},..., S_{2n-2}={n-1}, S_{2n-1}={n-1,n}, S_{2n}={n} (after visiting the set {n}, there are multiple ways to proceed).
It is shown in [Felsner, Trotter 95] that an order-preserving Hamiltonian path is level-accurate in the following sense: After visiting a set of size k, the path will never visit a set of size (k-2) (*).
For odd n we will have S_N={1,2,...,n} (i.e., |S_N|=n) and for even n we will have |S_N|=n-1.
Hamiltonian paths that have property (*) have been constructed in [Savage, Winkler 95] for all n (but these paths are not order-preserving).
For n=8,9,10 we know that a(n)>=1. It is unknown whether a(n)>=1 for n>=11 (i.e., it is not known whether such order-preserving paths exist). Some partial results have been obtained in [Biro, Howard 09].

Examples

			For n=4 the a(4)=1 solution is S_1={}, S_2={1}, S_3={1,2}, S_4={2}, S_5={2,3}, S_6={3}, S_7={3,4}, S_8={4}, S_9={2,4}, S_10={1,2,4}, S_11={1,4}, S_12={1,3,4}, S_13={1,3}, S_14={1,2,3}, S_15={1,2,3,4}, S_16={2,3,4}.
		

Crossrefs

Showing 1-10 of 10 results.