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.

A293857 a(n) is the number of permutations {c_1..c_n} of {1..n} for which c_1 - c_2 + ... + (-1)^(n-1)*c_n are squares.

Original entry on oeis.org

1, 1, 1, 4, 12, 36, 144, 1440, 9216, 66240, 504000, 7344000, 73612800, 830995200, 9373190400, 181875456000, 2474319052800, 38246274662400, 572552876851200, 13783143886848000, 237527801118720000, 4658378696294400000, 86818505051013120000, 2488457229932298240000
Offset: 0

Views

Author

Vladimir Shevelev, Oct 17 2017

Keywords

Comments

For a permutation C = {c_1..c_n} of {1..n}, set s(C) = c_1 - c_2 + ... + (-1)^(n-1)*c_n. Then max s(C) is square that is (ceil(n/2))^2 or A008794(n+1).
a(n)/n! is slowly and non-monotonically decreasing: 1, 1/2, 2/3, 1/2, 3/10, 1/5, 2/7, 8/35, 23/126, 5/36, 85/462, 71/462, ... .
Positions for which a(n) divisible by all primes <= n: 1, 4, 10, ... .
The smallest primes <= n not dividing a(n) or 0 if there is no such primes: 0, 2, 3, 0, 5, 5, 7, 5, 7, 0, 7, 7, ... .
Let k = floor(n / 2). Then a(n) = divisible by k! * (n-k)!. - David A. Corneth, Oct 18 2017. (For a proof, cf. comment in A293984. - Vladimir Shevelev, Nov 06 2017)

Examples

			Let n=3. For a permutation C={c_1,c_2,c_3}, set s = s(C) = c_1 - c_2 + c_3. We have the permutations:
1,2,3; s=2
1,3,2; s=0
2,1,3; s=4
2,3,1; s=0
3,1,2; s=4
3,2,1; s=2
Here there are 4 permutations for which {s} are squares. So a(3)=4.
		

Crossrefs

Programs

  • Maple
    b:= proc(p, m, s) option remember; (n-> `if`(n=0, `if`(issqr(s), 1, 0),
          `if`(p>0, b(p-1, m, s+n), 0)+`if`(m>0, b(p, m-1, s-n), 0)))(p+m)
        end:
    a:= n-> (t-> b(n-t, t, 0)*t!*(n-t)!)(iquo(n, 2)):
    seq(a(n), n=0..28);  # Alois P. Heinz, Sep 17 2020
  • Mathematica
    a293857=Table[Total[(Floor[n/2]!*(n-Floor[n/2])!)(Reverse[Map[SeriesCoefficient[QBinomial[n,Floor[(n+1)/2],q],{q,0,#}]&,Map[2#(Floor[(n+1)/2] - #)&,Range[0,Floor[(n+1)/4]]]]]
    )],{n,25}] (* Peter J. C. Moses, Nov 01 2017 *)

Formula

From author's comment in A008794 it follows that a(n) >= A010551(n).

Extensions

a(5)-a(12) from Peter J. C. Moses, Oct 17 2017
a(13)-a(23) from David A. Corneth, Oct 17 2017
a(0)=1 prepended by Alois P. Heinz, Sep 17 2020

A293984 a(n) = A293857(n)/A010551(n).

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 4, 10, 16, 23, 35, 85, 142, 229, 369, 895, 1522, 2614, 4348, 10467, 18038, 32160, 54488, 130148, 226594, 414130, 710880, 1685496, 2958666, 5503780, 9544629, 22476690, 39724867, 74884360, 130949625, 306457174, 544777361, 1037587152, 1827129712
Offset: 0

Views

Author

Vladimir Shevelev, Oct 21 2017

Keywords

Comments

Or row sums of the compressed triangle in A293783.
Conjecture: all terms are positive integers.
From David A. Corneth (with participation of Vladimir Shevelev), Oct 24 2017: (Start)
Conjecture is true. Proof.
1) Let C={c_1..c_n} be a permutation of {1..n}, d(C) be alternating sum c_1 - c_2 + ... +(-1)^(n-1)*c_n. Then max_{C in S_n}d(C) = A008794(n+1). Indeed, if n = 2*m, then evidently the maximum is reached on a C={2*m,1,2*m-1,2,...,m+1,m}; if n=2*m - 1, then the maximum is reached on a C={2*m-1,1,2*m-2,2,...,m-1,m}. In both cases max_{C in S_n}d(C) = m^2 = A008794(n+1). The number of distinct reaches of the maximum is, evidently, floor(n/2)!*floor((n+1)/2)! which is also Avi Peretz's representation (2001) of A010551(n). So, A293857(n) >= A010551(n) and a(n)>=1.
2) Consider two cases: a) there are no C in S_n for which d(C) = k^2 < A008794(n+1). Then A293857(n) = A010551(n) and a(n) = 1; b) there is C for which d(C) = k^2 < A008794(n+1). Then, as in 1) to reach k^2 in case n=2*m consider all (n/2)! permutations of {c_1,c_3,...,c_n} and all (n/2)! permutations of {c_2, c_4, ... , c_(n+1)}, or in case n = 2*m-1, all ((n+1)/2)! permutations of {c_1,c_3,...,c_(2*m-1)} and ((n-1)/2)! permutations of {c_2,c_4,...,c_(2*m-2)}. So we again have A010551(n) distinct reaches. If the same k^2 could be reached by another permutation C_1 (other than above permutations of C), then we again obtain A010551 distinct reaches, etc. So, A293857(n) is always divisible by A010551(n). (End)

Crossrefs

Programs

  • Maple
    b:= proc(p, m, s) option remember; (n-> `if`(n=0, `if`(issqr(s), 1, 0),
          `if`(p>0, b(p-1, m, s+n), 0)+`if`(m>0, b(p, m-1, s-n), 0)))(p+m)
        end:
    a:= n-> (t-> b(n-t, t, 0))(iquo(n, 2)):
    seq(a(n), n=0..40);  # Alois P. Heinz, Sep 17 2020
  • Mathematica
    a293984=Table[
    possibleSums=Range[1/2-(-1)^n/2-Floor[n/2]^2,Floor[(n+1)/2]^2];
    filteredSums=Select[possibleSums,IntegerQ[Sqrt[#]]&];
    positions=Map[Flatten[{#,Position[possibleSums,#,1]-1}]&,filteredSums];
    Total[Map[SeriesCoefficient[QBinomial[n,Floor[(n+1)/2],q],{q,0,#[[2]]/2}]&,positions]],{n,20}] (* Peter J. C. Moses, Nov 05 2017 *)

Extensions

a(13)-a(30) from David A. Corneth, Oct 21 2017; a(31)-a(38) from Peter J. C. Moses, Nov 02 2017
a(0)=1 prepended by Alois P. Heinz, Sep 17 2020
Showing 1-2 of 2 results.