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.

Previous Showing 11-17 of 17 results.

A242530 Number of cyclic arrangements of S={1,2,...,2n} such that the binary expansions of any two neighbors differ by one bit.

Original entry on oeis.org

0, 0, 1, 0, 2, 8, 0, 0, 224, 754, 0, 26256, 0, 0, 22472304, 0, 90654576, 277251016, 0, 7852128780
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

Here, a(n)=NPC(2n;S;P) is the count of all neighbor-property cycles for a specific set S of 2n elements and a pair-property P. For more details, see the link and A242519.
In this case the property P is the Gray condition. The choice of the set S is important; when it is replaced by {0,1,2,...,2n-1}, the sequence changes completely and becomes A236602.

Examples

			The two cycles for n=5 (cycle length 10) are:
C_1={1,3,7,5,4,6,2,10,8,9}, C_2={1,5,4,6,7,3,2,10,8,9}.
		

Crossrefs

Programs

  • Mathematica
    A242530[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, 2 n]]]], 0]/2;
    j1f[x_] := Join[{1}, x, {1}];
    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 &]];
    Table[A242530[n], {n, 1, 5}]
     (* OR, a less simple, but more efficient implementation. *)
    A242530[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[]];
          A242530[n, Join[perm, {new}],
           Complement[Range[2, 2 n], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Table[ct = 0; A242530[n, {1}, Range[2, 2 n]]/2, {n, 1, 10}] (* Robert Price, Oct 25 2018 *)

Extensions

a(16)-a(20) from Fausto A. C. Cariboni, May 10 2017, May 15 2017

A242531 Number of cyclic arrangements of S={1,2,...,n} such that the difference of any two neighbors is a divisor of their sum.

Original entry on oeis.org

0, 1, 1, 1, 1, 4, 3, 9, 26, 82, 46, 397, 283, 1675, 9938, 19503, 10247, 97978, 70478, 529383, 3171795, 7642285, 3824927, 48091810, 116017829, 448707198, 1709474581, 6445720883, 3009267707, 51831264296
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(n;S;P) is the count of all neighbor-property cycles for a specific set S of n elements and a specific pair-property P. For more details, see the link and A242519.

Examples

			The only such cycle of length n=5 is {1,2,4,5,3}.
For n=7 there are three solutions: C_1={1,2,4,5,7,6,3}, C_2={1,2,4,6,7,5,3}, C_3={1,2,6,7,5,4,3}.
		

Crossrefs

Programs

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

Extensions

a(24)-a(28) from Fausto A. C. Cariboni, May 25 2017
a(29) from Fausto A. C. Cariboni, Jul 09 2020
a(30) from Fausto A. C. Cariboni, Jul 14 2020

A242532 Number of cyclic arrangements of S={2,3,...,n+1} such that the difference of any two neighbors is greater than 1, and a divisor of their sum.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 20, 39, 0, 0, 0, 0, 319, 967, 0, 0, 1464, 6114, 16856, 44370, 0, 0, 0, 0, 2032951, 8840796, 12791922, 101519154, 0, 0
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(n;S;P) is the count of all neighbor-property cycles for a specific set S of n elements and a specific pair-property P. For more details, see the link and A242519.
For this property P and sets {0,1,2,...,n-1} or {1,2,...,n} the problem does not appear to have any solution.
a(40)=a(41)=a(42)=a(43)=a(46)=a(47)=0. - Fausto A. C. Cariboni, May 17 2017

Examples

			The shortest such cycle is of length n=9: {2,4,8,10,5,7,9,3,6}.
The next a(n)>0 occurs for n=14 and has 20 solutions.
The first and the last of these are:
C_1={2,4,8,10,5,7,14,12,15,13,11,9,3,6},
C_2={2,4,12,15,13,11,9,3,5,7,14,10,8,6}.
		

Crossrefs

Programs

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

Extensions

a(29)-a(37) from Fausto A. C. Cariboni, May 17 2017

A242533 Number of cyclic arrangements of S={1,2,...,2n} such that the difference of any two neighbors is coprime to their sum.

Original entry on oeis.org

1, 1, 2, 36, 288, 3888, 200448, 4257792, 139511808, 11813990400, 532754620416
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(2n;S;P) is the count of all neighbor-property cycles for a specific set S of 2n elements and a specific pair-property P. For more details, see the link and A242519.
Conjecture: in this case it seems that NPC(n;S;P)=0 for all odd n, so only the even ones are listed. This is definitely not the case when the property P is replaced by its negation (see A242534).

Examples

			For n=4, the only cycle is {1,2,3,4}.
The two solutions for n=6 are: C_1={1,2,3,4,5,6} and C_2={1,4,3,2,5,6}.
		

Crossrefs

Programs

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

Extensions

a(10)-a(11) from Fausto A. C. Cariboni, May 31 2017, Jun 01 2017

A242534 Number of cyclic arrangements of S={1,2,...,n} such that the difference of any two neighbors is not coprime to their sum.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 0, 0, 0, 72, 288, 3600, 17856, 174528, 2540160, 14768640, 101030400, 1458266112, 11316188160, 140951577600, 2659218508800, 30255151463424, 287496736542720, 5064092578713600, 76356431941939200, 987682437203558400, 19323690313219522560
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(n;S;P) is the count of all neighbor-property cycles for a specific set S of n elements and a specific pair-property P. For more details, see the link and A242519.
Compare this with A242533 where the property is inverted.

Examples

			The first and the last of the 72 cycles for n=10 are:
C_1={1,3,5,10,2,4,8,6,9,7} and C_72={1,7,5,10,8,4,2,6,3,9}.
There are no solutions for cycle lengths from 2 to 9.
		

Crossrefs

Programs

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

Extensions

a(19)-a(27) from Hiroaki Yamanouchi, Aug 30 2014

A244572 a(n) = max(A244570(n), A244571(n)).

Original entry on oeis.org

3, 7, 11, 23, 17, 37, 23, 41, 43, 61, 47, 61, 53, 73, 109, 107, 89, 73, 109, 227, 113, 113, 139, 157, 127, 149, 127, 131, 283, 137, 139, 181, 173, 179, 167, 191, 181, 227, 193, 251, 239, 199, 233, 257, 239, 251, 239, 241, 271, 313, 241, 271, 281, 277, 443, 389
Offset: 2

Views

Author

Vladimir Shevelev, Jun 30 2014

Keywords

Comments

a(n) < (prime(n))^3 yields an infinity of twin primes (it is sufficient, if this inequality holds for an arbitrary infinite subsequence n = n_k). For a proof, see the Shevelev link (Remark 8).
The author apparently claims to have proved the infinitude of twin primes. No alleged proof has been accepted by the mathematical community. - Jens Kruse Andersen, Jul 13 2014
In the statistical part of my link (Section 14), using the Chinese Remainder and Tolev's theorems, I reduced the supposition of the finiteness of twin primes to an arbitrarily long coin-flipping experiment in which only "heads" appear. There I gave only a "demonstration" of the infinity of twin primes. In the analytical part (Sections 15-18) I proved unconditionally till now only Theorem 13. - Vladimir Shevelev, Jul 22 2014

Crossrefs

Programs

  • Mathematica
    a[n_, k_] := For[p = Prime[n], True, p = NextPrime[p], If[PrimeQ[p Prime[n] + k], Return[p]]];
    a[n_] := Max[a[n, -2], a[n, 2]];
    Table[a[n], {n, 2, 60}] (* Jean-François Alcover, Nov 18 2018 *)

Extensions

More terms from Peter J. C. Moses, Jun 30 2014

A369330 Number of permutations of (1, 2, ..., n) in which any two adjacent elements differ by a power of 2.

Original entry on oeis.org

1, 1, 2, 6, 12, 48, 140, 338, 926, 4390, 15990, 52766, 187688, 557768, 1772354, 5865806, 18707354, 102862912, 456146172, 1833942698, 7914142056, 30247599368, 120022505534, 492976337746, 1992746442918, 7203060422116, 27454886930170, 106007544478780, 398728610528654
Offset: 0

Views

Author

Pontus von Brömssen, Jan 20 2024

Keywords

Comments

The number of (directed) Hamiltonian paths in the graph with vertex set {1, 2, ..., n} and edges between vertices that differ by a power of 2.

Crossrefs

Extensions

a(22) from Alois P. Heinz, Jan 20 2024
a(23) from Andrew Howroyd, Jan 20 2024
a(24)-a(28) from Martin Ehrenstein, Mar 02 2024
Previous Showing 11-17 of 17 results.