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

A143259 a(n) = 1 if n is a nonzero square, -1 if n is twice a nonzero square, 0 otherwise.

Original entry on oeis.org

1, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Michael Somos, Aug 02 2008

Keywords

Comments

Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).

Examples

			G.f. = q - q^2 + q^4 - q^8 + q^9 + q^16 - q^18 + q^25 - q^32 + q^36 + q^49 - q^50 + ...
		

Crossrefs

Programs

  • Magma
    Basis( ModularForms( Gamma1(8), 1/2), 100) [2] ; /* Michael Somos, Jun 10 2014 */
  • Mathematica
    f[n_]:=Which[IntegerQ[Sqrt[n/2]],-1,IntegerQ[Sqrt[n]],1,True,0]; Array[f,110] (* Harvey P. Dale, Jul 07 2011 *)
    a[ n_] := Boole[ IntegerQ[ Sqrt[n]]] - Boole[ IntegerQ[ Sqrt[2 n]]]; (* Michael Somos, Jun 10 2014 *)
    a[ n_] := SeriesCoefficient[ (EllipticTheta[ 3, 0, q] - EllipticTheta[ 3, 0, q^2])/2, {q, 0, n}]; (* Michael Somos, Jun 10 2014 *)
    Table[LiouvilleLambda[n]*Mod[DivisorSigma[1, n], 2], {n, 100}] (* Jon Maiga, Jan 11 2019 *)
  • PARI
    {a(n) = issquare(n) - issquare(2*n)};
    
  • PARI
    {a(n) = if( n<1, 0, n--; polcoeff( prod(k=1, n, (1 - x^k)^([1, 1, 0, -1, -1, -1, 0, 1][k%8 + 1]), 1 + x * O(x^n)), n))};
    

Formula

Expansion of (phi(q) - phi(q^2)) / 2 = q * psi(q^4) * f(-q, -q^7) / f(-q^3, -q^5) in powers of q where phi(), psi() and f() are Ramanujan theta functions.
Expansion of q * f(-q, -q^7)^2 / psi(-q) in powers of q where psi(), f() are Ramanujan theta functions. - Michael Somos, Jan 01 2015
Euler transform of period 8 sequence [ -1, 0, 1, 1, 1, 0, -1, -1, ...].
a(2*n) = -a(n) for all n in Z.
a(n) is multiplicative with a(2^e) = (-1)^e, a(p^e) = (1 + (-1)^e) / 2 if p == 1 (mod 2).
Dirichlet g.f.: zeta(2*s) * (1 - 2^-s); Dirichlet convolution of A010052 and A154955.
G.f. A(x) satisfies: A(x) / A(x^2) = -1 + A111374(x).
G.f. A(x) satisfies: A(x^2) = - (A(x) + A(-x)) / 2.
G.f. A(x) satisfies: 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = w * (u + v)^2 - v * (v + w) * (v + 2*w).
G.f.: (theta_3(q) - theta_3(q^2)) / 2 = Sum_{k>0} x^(k^2) - x^(2k^2).
|a(n)| = A053866(n).
a(n) = A008836(n)*A053866(n). - Jon Maiga, Jan 11 2019
Sum_{k=1..n} a(k) ~ (1 - 1/sqrt(2)) * sqrt(n). - Vaclav Kotesovec, Oct 16 2020

A352687 Triangle read by rows, a Narayana related triangle whose rows are refinements of twice the Catalan numbers (for n >= 2).

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 4, 4, 1, 0, 1, 7, 12, 7, 1, 0, 1, 11, 30, 30, 11, 1, 0, 1, 16, 65, 100, 65, 16, 1, 0, 1, 22, 126, 280, 280, 126, 22, 1, 0, 1, 29, 224, 686, 980, 686, 224, 29, 1, 0, 1, 37, 372, 1512, 2940, 2940, 1512, 372, 37, 1
Offset: 0

Views

Author

Peter Luschny, Apr 26 2022

Keywords

Comments

This is the second triangle in a sequence of Narayana triangles. The first is A090181, whose n-th row is a refinement of Catalan(n), whereas here the n-th row of T is a refinement of 2*Catalan(n-1). We can show that T(n, k) <= A090181(n, k) for all n, k. The third triangle in this sequence is A353279, where also a recurrence for the general case is given.
Here we give a recurrence for the row polynomials, which correspond to the recurrence of the classical Narayana polynomials combinatorially proved by Sulanke (see link).
The polynomials have only real zeros and form a Sturm sequence. This follows from the recurrence along the lines given in the Chen et al. paper.
Some interesting sequences turn out to be the evaluation of the polynomial sequence at a fixed point (see the cross-references), for example the reversion of the Jacobsthal numbers A001045 essentially is -(-2)^n*P(n, -1/2).
The polynomials can also be represented as the difference between generalized Narayana polynomials, see the formula section.

Examples

			Triangle starts:
[0] 1;
[1] 0, 1;
[2] 0, 1,  1;
[3] 0, 1,  2,   1;
[4] 0, 1,  4,   4,   1;
[5] 0, 1,  7,  12,   7,   1;
[6] 0, 1, 11,  30,  30,  11,   1;
[7] 0, 1, 16,  65, 100,  65,  16,   1;
[8] 0, 1, 22, 126, 280, 280, 126,  22,  1;
[9] 0, 1, 29, 224, 686, 980, 686, 224, 29, 1;
		

Crossrefs

Cf. A090181 and A001263 (Narayana), A353279 (case 3), A000108 (Catalan), A145596, A172392 (central terms), A000124 (subdiagonal, column 2), A115143.
Essentially twice the Catalan numbers: A284016 (also A068875, A002420).
Values of the polynomial sequence: A068875 (row sums): P(1), A154955: P(-1), A238113: P(2)/2, A125695 (also A152681): P(-2), A054872: P(3)/2, P(3)/6 probable A234939, A336729: P(-3)/6, A082298: P(4)/5, A238113: 2^n*P(1/2), A154825 and A091593: 2^n*P(-1/2).

Programs

  • Maple
    T := (n, k) -> if n = k then 1 elif k = 0 then 0 else
    binomial(n, k)^2*(k*(2*k^2 + (n + 1)*(n - 2*k))) / (n^2*(n - 1)*(n - k + 1)) fi:
    seq(seq(T(n, k), k = 0..n), n = 0..10);
    # Alternative:
    gf := 1 - x + (1 + y)*(1 - x*(y - 1) - sqrt((x*y + x - 1)^2 - 4*x^2*y))/2:
    serx := expand(series(gf, x, 16)): coeffy := n -> coeff(serx, x, n):
    seq(seq(coeff(coeffy(n), y, k), k = 0..n), n = 0..10);
    # Using polynomial recurrence:
    P := proc(n, x) option remember; if n < 3 then [1, x, x + x^2] [n + 1] else
    ((2*n - 3)*(x + 1)*P(n - 1, x) - (n - 3)*(x - 1)^2*P(n - 2, x)) / n fi end:
    Trow := n -> seq(coeff(P(n, x), x, k), k = 0..n): seq(Trow(n), n = 0..10);
    # Represented by generalized Narayana polynomials:
    N := (n, k, x) -> add(((k+1)/(n-k))*binomial(n-k,j-1)*binomial(n-k,j+k)*x^(j+k), j=0..n-2*k): seq(print(ifelse(n=0, 1, expand(N(n,0,x) - N(n,1,x)))), n=0..7);
  • Mathematica
    H[0, ] := 1; H[1, x] := x;
    H[n_, x_] := x*(x + 1)*Hypergeometric2F1[1 - n, 2 - n, 2, x];
    Hrow[n_] := CoefficientList[H[n, x], x]; Table[Hrow[n], {n, 0, 9}] // TableForm
  • Python
    from math import comb as binomial
    def T(n, k):
        if k == n: return 1
        if k == 0: return 0
        return ((binomial(n, k)**2 * (k * (2 * k**2 + (n + 1) * (n - 2 * k))))
               // (n**2 * (n - 1) * (n - k + 1)))
    def Trow(n): return [T(n, k) for k in range(n + 1)]
    for n in range(10): print(Trow(n))
    
  • Python
    # The recursion with cache is (much) faster:
    from functools import cache
    @cache
    def T_row(n):
        if n < 3: return ([1], [0, 1], [0, 1, 1])[n]
        A = T_row(n - 2) + [0, 0]
        B = T_row(n - 1) + [1]
        for k in range(n - 1, 1, -1):
            B[k] = (((B[k] + B[k - 1]) * (2 * n - 3)
                   - (A[k] - 2 * A[k - 1] + A[k - 2]) * (n - 3)) // n)
        return B
    for n in range(10): print(T_row(n))

Formula

Explicit formula (additive form):
T(n, n) = 1, T(n > 0, 0) = 0 and otherwise T(n, k) = binomial(n, k)*binomial(n - 1, k - 1)/(n - k + 1) - 2*binomial(n - 1, k)*binomial(n - 1, k - 2)/(n - 1).
Multiplicative formula with the same boundary conditions:
T(n, k) = binomial(n, k)^2*(k*(2*k^2 + (n + 1)*(n - 2*k)))/(n^2*(n-1)*(n- k + 1)).
Bivariate generating function:
T(n, k) = [x^n] [y^k](1 - x + (1+y)*(1-x*(y-1) - sqrt((x*y+x-1)^2 - 4*x^2*y))/2).
Recursion based on polynomials:
T(n, k) = [x^k] (((2*n - 3)*(x + 1)*P(n - 1, x) - (n - 3)*(x - 1)^2*P(n - 2, x)) / n) with P(0, x) = 1, P(1, x) = x, and P(2, x) = x + x^2.
Recursion based on rows (see the second Python program):
T(n, k) = (((B(k) + B(k-1)) * (2*n - 3) - (A(k) - 2*A(k-1) + A(k-2))*(n-3))/n), where A(k) = T(n-2, k) and B(k) = T(n-1, k), for n >= 3.
Hypergeometric representation:
T(n, k) = [x^k] x*(x + 1)*hypergeom([1 - n, 2 - n], [2], x) for n >= 2.
Row sums:
Sum_{k=0..n} T(n, k) = (2/n)*binomial(2*(n - 1), n - 1) = A068875(n-1) for n >= 2.
A generalization of the Narayana polynomials is given by
N{n, k}(x) = Sum_{j=0..n-2*k}(((k + 1)/(n - k)) * binomial(n - k, j - 1) * binomial(n - k, j + k) * x^(j + k)).
N{n, 0}(x) are the classical Narayana polynomials A001263 and N{n, 1}(x) is a shifted version of A145596 based in (3, 2). Our polynomials are the difference P(n, x) = N{n, 0}(x) - N{n, 1}(x) for n >= 1.
Let RS(T, n) denote the row sum of the n-th row of T, then RS(T, n) - RS(A090181, n) = -4*binomial(2*n - 3, n - 3)/(n + 1) = A115143(n + 1) for n >= 3.

A383011 Square array A(n,k), n >= 1, k >= 1, read by antidiagonals downwards, where A(n,k) = -(1/n) * Sum_{d|n} mu(n/d) * (-k)^d.

Original entry on oeis.org

1, 2, -1, 3, -3, 0, 4, -6, 2, 0, 5, -10, 8, -3, 0, 6, -15, 20, -18, 6, 0, 7, -21, 40, -60, 48, -11, 0, 8, -28, 70, -150, 204, -124, 18, 0, 9, -36, 112, -315, 624, -690, 312, -30, 0, 10, -45, 168, -588, 1554, -2620, 2340, -810, 56, 0, 11, -55, 240, -1008, 3360, -7805, 11160, -8160, 2184, -105, 0
Offset: 1

Views

Author

Seiichi Manyama, Apr 12 2025

Keywords

Examples

			Square array begins:
   1,   2,    3,    4,     5,     6,      7, ...
  -1,  -3,   -6,  -10,   -15,   -21,    -28, ...
   0,   2,    8,   20,    40,    70,    112, ...
   0,  -3,  -18,  -60,  -150,  -315,   -588, ...
   0,   6,   48,  204,   624,  1554,   3360, ...
   0, -11, -124, -690, -2620, -7805, -19656, ...
   0,  18,  312, 2340, 11160, 39990, 117648, ...
		

Crossrefs

Columns k=1..5 give A154955, A038063, A038064, A038065, A038066.
Main diagonal gives A383012.

Programs

  • PARI
    a(n, k) = -sumdiv(n, d, moebius(n/d)*(-k)^d)/n;

Formula

G.f. of column k: Sum_{j>=1} mu(j) * log(1 + k*x^j) / j.
Product_{n>=1} 1/(1 - x^n)^A(n,k) = 1 + k*x.

A380747 Array read by ascending antidiagonals: A(n,k) = [x^n] (1 - x)/(1 - k*x)^2.

Original entry on oeis.org

1, -1, 1, 0, 1, 1, 0, 1, 3, 1, 0, 1, 8, 5, 1, 0, 1, 20, 21, 7, 1, 0, 1, 48, 81, 40, 9, 1, 0, 1, 112, 297, 208, 65, 11, 1, 0, 1, 256, 1053, 1024, 425, 96, 13, 1, 0, 1, 576, 3645, 4864, 2625, 756, 133, 15, 1, 0, 1, 1280, 12393, 22528, 15625, 5616, 1225, 176, 17, 1
Offset: 0

Views

Author

Stefano Spezia, Jan 31 2025

Keywords

Examples

			The array begins as:
   1, 1,   1,    1,     1,     1, ...
  -1, 1,   3,    5,     7,     9, ...
   0, 1,   8,   21,    40,    65, ...
   0, 1,  20,   81,   208,   425, ...
   0, 1,  48,  297,  1024,  2625, ...
   0, 1, 112, 1053,  4864, 15625, ...
   0, 1, 256, 3645, 22528, 90625, ...
   ...
		

Crossrefs

Cf. A000012 (k=1 or n=0), A000567 (n=2), A001792 (k=2), A007778, A060747 (n=1), A081038 (k=3), A081039 (k=4), A081040 (k=5), A081041 (k=6), A081042 (k=7), A081043 (k=8), A081044 (k=9), A081045 (k=10), A103532, A154955, A380748 (antidiagonal sums).

Programs

  • Mathematica
    A[0,0]:=1; A[1,0]:=-1; A[n_,k_]:=((k-1)*n+k)k^(n-1); Table[A[n-k,k],{n,0,10},{k,0,n}]//Flatten (* or *)
    A[n_,k_]:=SeriesCoefficient[(1-x)/(1-k*x)^2,{x,0,n}]; Table[A[n-k,k],{n,0,10},{k,0,n}]//Flatten (* or *)
    A[n_,k_]:=n!SeriesCoefficient[Exp[k*x](1+(k-1)*x),{x,0,n}]; Table[A[n-k,k],{n,0,10},{k,0,n}]//Flatten

Formula

A(n,k) = ((k - 1)*n + k)*k^(n-1) with A(0,0) = 1.
A(n,k) = n! * [x^n] exp(k*x)*(1 + (k - 1)*x).
A(n,0) = A154955(n+1).
A(3,n) = A103532(n-1) for n > 0.
A(n,n) = A007778(n) for n > 0.
Previous Showing 11-14 of 14 results.