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

A201552 Square array read by diagonals: T(n,k) = number of arrays of n integers in -k..k with sum equal to 0.

Original entry on oeis.org

1, 1, 3, 1, 5, 7, 1, 7, 19, 19, 1, 9, 37, 85, 51, 1, 11, 61, 231, 381, 141, 1, 13, 91, 489, 1451, 1751, 393, 1, 15, 127, 891, 3951, 9331, 8135, 1107, 1, 17, 169, 1469, 8801, 32661, 60691, 38165, 3139, 1, 19, 217, 2255, 17151, 88913, 273127, 398567, 180325, 8953, 1
Offset: 1

Views

Author

R. H. Hardin, Dec 02 2011

Keywords

Comments

Equivalently, the number of compositions of n*(k + 1) into n parts with maximum part size 2*k+1. - Andrew Howroyd, Oct 14 2017

Examples

			Some solutions for n=7, k=3:
..1...-2....1...-1....1...-3....0....0....1....2....3...-3....0....2....1....0
.-1....2...-2....2....2....2...-1....0....2....2...-2...-1...-2...-1....2...-1
.-3...-1....1...-3....2....1....0....1....3....0....2....0...-1....2...-2...-1
..0....3....3....3...-2...-2....3....3...-3...-3....0...-1...-1...-1....0....3
..2...-1...-1...-1...-3....0...-3...-2....1...-1...-1....1....1....0....3...-1
..2...-1...-3....0....2....3....0....1...-2....1....1....1....3...-2...-3...-3
.-1....0....1....0...-2...-1....1...-3...-2...-1...-3....3....0....0...-1....3
Table starts:
.   1,      1,       1,        1,        1,         1,...
.   3,      5,       7,        9,       11,        13,...
.   7,     19,      37,       61,       91,       127,...
.  19,     85,     231,      489,      891,      1469,...
.  51,    381,    1451,     3951,     8801,     17151,...
. 141,   1751,    9331,    32661,    88913,    204763,...
. 393,   8135,   60691,   273127,   908755,   2473325,...
.1107,  38165,  398567,  2306025,  9377467,  30162301,...
.3139, 180325, 2636263, 19610233, 97464799, 370487485,...
		

Crossrefs

Programs

  • Maple
    seq(print(seq(add((-1)^i*binomial(n, i)*binomial((k+1)*n-(2*k+1)*i-1, n-1), i = 0..floor((1/2)*n)), k = 1..10)), n = 1..10); # Peter Bala, Oct 16 2024
  • Mathematica
    comps[r_, m_, k_] := Sum[(-1)^i*Binomial[r - 1 - i*m, k - 1]*Binomial[k, i], {i, 0, Floor[(r - k)/m]}];  T[n_, k_] := comps[n*(k + 1), 2*k + 1, n]; Table[T[n - k + 1, k], {n, 1, 11}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Oct 31 2017, after Andrew Howroyd *)
  • PARI
    comps(r, m, k)=sum(i=0, floor((r-k)/m), (-1)^i*binomial(r-1-i*m, k-1)*binomial(k, i));
    T(n,k) = comps(n*(k+1), 2*k+1, n); \\ Andrew Howroyd, Oct 14 2017

Formula

Empirical: T(n,k) = Sum_{i=0..floor(k*n/(2*k+1))} (-1)^i*binomial(n,i)* binomial((k+1)*n-(2*k+1)*i-1,n-1).
The above empirical formula is true and can be derived from the formula for the number of compositions with given number of parts and maximum part size. - Andrew Howroyd, Oct 14 2017
Empirical for rows:
T(1,k) = 1
T(2,k) = 2*k + 1
T(3,k) = 3*k^2 + 3*k + 1
T(4,k) = (16/3)*k^3 + 8*k^2 + (14/3)*k + 1
T(5,k) = (115/12)*k^4 + (115/6)*k^3 + (185/12)*k^2 + (35/6)*k + 1
T(6,k) = (88/5)*k^5 + 44*k^4 + 46*k^3 + 25*k^2 + (37/5)*k + 1
T(7,k) = (5887/180)*k^6 + (5887/60)*k^5 + (2275/18)*k^4 + (357/4)*k^3 + (6643/180)*k^2 + (259/30)*k + 1
T(m,k) = (1/Pi)*integral_{x=0..Pi} (sin((k+1/2)x)/sin(x/2))^m dx; for the proof see Dirichlet Kernel link; so f(m,n) = (1/Pi)*integral_{x=0..Pi} (Sum_{k=-n..n} exp(I*k*x))^m dx = sum(integral(exp(I(k_1+...+k_m).x),x=0..Pi)/Pi,{k_1,...,k_m=-n..n}) = sum(delta_0(k1+...+k_m),{k_1,...,k_m=-n..n}) = number of arrays of m integers in -n..n with sum zero. - Yalcin Aktar, Dec 03 2011
T(n, k) = the constant term in the expansion of (x^(-k) + ... + x^(-1) + 1 + x + ... + x^k)^n = the coefficient of x^(k*n) (i.e., the central coefficient) in the expansion of (1 + x + ... + x^(2*k))^n = the coefficient of x^(k*n) in the expansion of ( (1 - x^(2*k+1))/(1 - x) )^n. Expanding the binomials and collecting terms gives the empirical formula above. - Peter Bala, Oct 16 2024

A208597 T(n,k) = number of n-bead necklaces labeled with numbers -k..k not allowing reversal, with sum zero.

Original entry on oeis.org

1, 1, 2, 1, 3, 3, 1, 4, 7, 6, 1, 5, 13, 23, 11, 1, 6, 21, 60, 77, 26, 1, 7, 31, 125, 291, 297, 57, 1, 8, 43, 226, 791, 1564, 1163, 142, 1, 9, 57, 371, 1761, 5457, 8671, 4783, 351, 1, 10, 73, 568, 3431, 14838, 39019, 49852, 20041, 902, 1, 11, 91, 825, 6077, 34153, 129823
Offset: 1

Views

Author

R. H. Hardin, Feb 29 2012

Keywords

Examples

			Table starts
...1....1.....1......1.......1.......1........1........1........1.........1
...2....3.....4......5.......6.......7........8........9.......10........11
...3....7....13.....21......31......43.......57.......73.......91.......111
...6...23....60....125.....226.....371......568......825.....1150......1551
..11...77...291....791....1761....3431.....6077....10021....15631.....23321
..26..297..1564...5457...14838...34153....69784...130401...227314....374825
..57.1163..8671..39019..129823..353333...833253..1764925..3438877...6267735
.142.4783.49852.288317.1172298.3770475.10259448.24627705.53630854.108036775
		

Crossrefs

Rows 3-7 are A002061(n+1), A208598, A208599, A208600, A208601.
Main diagonal is A208590.

Programs

  • Mathematica
    comps[r_, m_, k_] := Sum[(-1)^i*Binomial[r-1-i*m, k-1]*Binomial[k, i], {i, 0, Floor[(r-k)/m]}]; a[n_, k_] := DivisorSum[n, EulerPhi[n/#] comps[#*(k + 1), 2k+1, #]&]/n; Table[a[n-k+1, k], {n, 1, 11}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Oct 07 2017, after Andrew Howroyd's PARI code *)
  • PARI
    comps(r,m,k)=sum(i=0,floor((r-k)/m),(-1)^i*binomial(r-1-i*m, k-1)*binomial(k, i));
    a(n,k)=sumdiv(n,d,eulerphi(n/d)*comps(d*(k+1), 2*k+1, d))/n;
    for(n=1,8,for(k=1,10,print1(a(n,k),", ")); print()); \\ Andrew Howroyd, May 16 2017
    
  • Python
    from sympy import binomial, divisors, totient, floor
    def comps(r, m, k): return sum([(-1)**i*binomial(r - 1 - i*m, k - 1)*binomial(k, i) for i in range(floor((r - k)/m) + 1)])
    def a(n, k): return sum([totient(n//d)*comps(d*(k + 1), 2*k + 1, d) for d in divisors(n)])//n
    for n in range(1, 12): print([a(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, Nov 07 2017, after PARI code
    
  • R
    require(numbers)
    comps <- function(r, m, k) {
      S <- numeric()
      for (i in 0:floor((r-k)/m)) S <- c(S, (-1)^i*choose(r-1-i*m, k-1)*choose(k, i))
      return(sum(S))
    }
    a <- function(n, k) {
      S <- numeric()
      for (d in divisors(n)) S <- c(S, eulersPhi(n/d)*comps(d*(k+1), 2*k+1, d))
      return(sum(S)/n)
    }
    for (n in 1:11) {
      for (k in 1:n) {
        print(a(k,n-k+1))
      }
    } # Indranil Ghosh, Nov 07 2017, after PARI code

Formula

T(n,k) = Sum_{d|n} phi(n/d) * A201552(d, k). - Andrew Howroyd, Oct 14 2017
Empirical for row n:
n=1: a(k) = 1.
n=2: a(k) = k + 1.
n=3: a(k) = k^2 + k + 1.
n=4: a(k) = (4/3)*k^3 + 2*k^2 + (5/3)*k + 1.
n=5: a(k) = (23/12)*k^4 + (23/6)*k^3 + (37/12)*k^2 + (7/6)*k + 1.
n=6: a(k) = (44/15)*k^5 + (22/3)*k^4 + (23/3)*k^3 + (14/3)*k^2 + (12/5)*k + 1.
n=7: a(k) = (841/180)*k^6 + (841/60)*k^5 + (325/18)*k^4 + (51/4)*k^3 + (949/180)*k^2 + (37/30)*k + 1.

A318793 Constant term in the expansion of (Sum_{k=0..n} k*(x^k + x^(-k)))^n.

Original entry on oeis.org

1, 0, 10, 84, 12060, 922680, 203474180, 45546045720, 16977056982648, 7385901628225968, 4359210462435545640, 3063111491275816418020, 2669859570203387710219500, 2738752987417403052110951664, 3328615281192062743163487239944
Offset: 0

Views

Author

Seiichi Manyama, Dec 15 2018

Keywords

Examples

			(2/x^2 + 1/x + 0 + x + 2*x^2)^2 = 4/x^4 + 4/x^3 + 1/x^2 + 4/x + 10 + 4*x + x^2 + 4*x^3 + 4*x^4. So a(2) = 10.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := If[n==0, 1, Coefficient[Expand[Sum[k*(x^k + x^(-k)), {k, 0, n}]^n], x, 0]]; Array[a, 15, 0] (* Amiram Eldar, Dec 15 2018 *)
  • PARI
    {a(n) = polcoeff((sum(k=0, n, k*(x^k+x^(-k))))^n, 0, x)}

Formula

a(n) ~ exp(1) * n^(2*n - 3/2) / sqrt(Pi). - Vaclav Kotesovec, Dec 15 2018

A329076 Constant term in the expansion of ((Sum_{k=-n..n} x^k) * (Sum_{k=-n..n} y^k) - (Sum_{k=-n+1..n-1} x^k) * (Sum_{k=-n+1..n-1} y^k))^n.

Original entry on oeis.org

1, 0, 16, 72, 7008, 162000, 17555520, 1093527120, 140846184640, 16016249944800, 2550757928818680, 419682645514181280, 82389928294166805312, 17418502084657134228768, 4123280170924828458697152, 1054943518137131171386437600, 293933660095874311773617934720, 87968971083026619734709639853632
Offset: 0

Views

Author

Seiichi Manyama, Nov 04 2019

Keywords

Comments

Also number of n-step closed paths (from origin to origin) in 2-dimensional lattice, using steps (t_1,t_2) (|t_1| + |t_2| = 2*n).

Crossrefs

Main diagonal of A329074.

Programs

  • PARI
    {a(n) = polcoef(polcoef((sum(k=-n, n, x^k)*sum(k=-n, n, y^k)-sum(k=-n+1, n-1, x^k)*sum(k=-n+1, n-1, y^k))^n, 0), 0)}
    
  • PARI
    {a(n) = polcoef(polcoef((sum(k=0, 2*n, (x^k+1/x^k)*(y^(2*n-k)+1/y^(2*n-k)))-x^(2*n)-1/x^(2*n)-y^(2*n)-1/y^(2*n))^n, 0), 0)}
    
  • PARI
    f(n) = (x^(n+1)-1/x^n)/(x-1);
    a(n) = sum(k=0, n, (-1)^(n-k)*binomial(n, k)*polcoef(f(n)^k*f(n-1)^(n-k), 0)^2)

Formula

Conjecture: a(n) ~ 3 * 2^(3*n - 2) * n^(n-3) / Pi. - Vaclav Kotesovec, Nov 05 2019

A160492 a(n) = number of solutions to an equation x_1 + ... + x_j =0 with 1<=j<=n satisfying -n<=x_i<=n (1<=i<=j).

Original entry on oeis.org

1, 6, 45, 560, 9795, 223524, 6284089, 210208560, 8156750283, 360297117070, 17853149451841, 980844453593160, 59179098916735213, 3890176308574524934, 276750779199166606705, 21185250061147839785120, 1736385140876356212244563, 151719500906542020597450498
Offset: 1

Views

Author

Srikanth K S, May 15 2009

Keywords

Comments

The number of variables in the equation can be from 1 to n and each variable can have a value of -n to n. See A286928 for the case of exactly n variables. - Andrew Howroyd, May 16 2017

Examples

			From _Andrew Howroyd_, May 16 2017 (Start)
Case n=3:
1 variable: {0} is only solution.
2 variables: {-3,3}, {-2,2}, {-1,1}, {0,0}, {1,-1}, {2,-2}, {3,-3}.
3 variables: {-3 0 3}x6, {-3 1 2}x6, {-2 -1 3}x6, {-2 0 2}x6,
             {-2 1 1}x3, {-1 -1 2}x3, {-1 0 1}x6, {0 0 0}x1
In the above, {-3 0 3}x6 means that the values can be expanded to 6 solutions by considering different orderings.
In total there are 1 + 7 + 37 = 45 solutions so a(3)=45.
(End)
		

Crossrefs

Cf. A286928.

Programs

  • Mathematica
    zerocompositionswithzero[p_] := Module[{united = {}, i, zerosums = {}, count = 0}, For[i = 1, i <= p, i = i + 1, united = Union[united, Tuples[Table[x, {x, -p, p}], i]] ]; For[i = 1, i <= Length[united], i = i + 1, If[Sum[united[[i, j]], {j, 1, Length[united[[i]]]}] == 0, zerosums = Append[zerosums, united[[i]]]; count = count + 1;]; ]; Return[{count, zerosums}]; ];
  • PARI
    \\ nr compositions of r with max value m into exactly k parts.
    compositions(r,m,k)=sum(i=0,floor((r-k)/m),(-1)^i*binomial(r-1-i*m, k-1)*binomial(k, i));
    a(n)=sum(v=1,n,compositions(v*(n+1),2*n+1,v));  \\ Andrew Howroyd, May 16 2017
    
  • Python
    from sympy import binomial
    def C(r, m, k): return sum([(-1)**i*binomial(r - 1 - i*m, k - 1)*binomial(k, i) for i in range(int((r - k)/m) + 1)])
    def a(n): return sum([C(v*(n + 1), 2*n + 1, v) for v in range(1, n + 1)]) # Indranil Ghosh, May 16 2017, after the PARI program by Andrew Howroyd

Formula

a(n) = Sum_{k=1..n} Sum_{i=0..floor(k/2)} (-1)^i*binomial(k*(n+1)-i*(2*n+1)-1, k-1)*binomial(k, i). - Andrew Howroyd, May 16 2017

Extensions

Name clarified and a(6)-a(18) from Andrew Howroyd, May 16 2017

A322514 a(n) = [x^(n^2)] (Sum_{k=0..2*n} (k+1)*x^k)^n.

Original entry on oeis.org

1, 2, 35, 1624, 169653, 30961656, 8792309747, 3592089777760, 1998565555891049, 1454040182726241040, 1340732073013968993771, 1528443066775450331625912, 2111332024387378632991315275, 3475577885419591506890414078832
Offset: 0

Views

Author

Seiichi Manyama, Dec 13 2018

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Coefficient[Expand[Sum[(k+1)*x^k ,{k, 0, 2n}]^n, x], x, n^2]; Array[f, 15, 0] (* Amiram Eldar, Dec 13 2018 *)
  • PARI
    {a(n) = polcoeff((sum(k=0, 2*n, (k+1)*x^k))^n, n^2, x)}
Showing 1-6 of 6 results.