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.

A207974 Triangle related to A152198.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 4, 2, 2, 1, 1, 5, 2, 4, 1, 1, 1, 6, 3, 6, 3, 2, 1, 1, 7, 3, 9, 3, 5, 1, 1, 1, 8, 4, 12, 6, 8, 4, 2, 1, 1, 9, 4, 16, 6, 14, 4, 6, 1, 1, 1, 10, 5, 20, 10, 20, 10, 10, 5, 2, 1
Offset: 0

Views

Author

Philippe Deléham, Feb 22 2012

Keywords

Comments

Row sums are A027383(n).
Diagonal sums are alternately A014739(n) and A001911(n+1).
The matrix inverse starts
1;
-1,1;
1,-2,1;
1,-1,-1,1;
-1,2,0,-2,1;
-1,1,2,-2,-1,1;
1,-2,-1,4,-1,-2,1;
1,-1,-3,3,3,-3,-1,1;
-1,2,2,-6,0,6,-2,-2,1;
-1,1,4,-4,-6,6,4,-4,-1,1;
1,-2,-3,8,2,-12,2,8,-3,-2,1;
apparently related to A158854. - R. J. Mathar, Apr 08 2013
From Gheorghe Coserea, Jun 11 2016: (Start)
T(n,k) is the number of terms of the sequence A057890 in the interval [2^n,2^(n+1)-1] having binary weight k+1.
T(n,k) = A007318(n,k) (mod 2) and the number of odd terms in row n of the triangle is 2^A000120(n).
(End)

Examples

			Triangle begins :
n\k  [0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
[0]  1;
[1]  1,  1;
[2]  1,  2,  1;
[3]  1,  3,  1,  1;
[4]  1,  4,  2,  2,  1;
[5]  1,  5,  2,  4,  1,  1;
[6]  1,  6,  3,  6,  3,  2,  1;
[7]  1,  7,  3,  9,  3,  5,  1,  1;
[8]  1,  8,  4,  12, 6,  8,  4,  2,  1;
[9]  1,  9,  4,  16, 6,  14, 4,  6,  1,  1;
[10] ...
		

Crossrefs

Cf. Diagonals : A000012, A000034, A052938, A097362
Related to thickness: A000120, A027383, A057890, A274036.

Programs

  • Maple
    A207974 := proc(n,k)
        if k = 0 then
            1;
        elif k < 0 or k > n then
            0 ;
        else
            procname(n-1,k-1)-(-1)^k*procname(n-1,k) ;
        end if;
    end proc: # R. J. Mathar, Apr 08 2013
  • PARI
    seq(N) = {
      my(t = vector(N+1, n, vector(n, k, k==1 || k == n)));
      for(n = 2, N+1, for (k = 2, n-1,
          t[n][k] = t[n-1][k-1] + (-1)^(k%2)*t[n-1][k]));
      return(t);
    };
    concat(seq(10))  \\ Gheorghe Coserea, Jun 09 2016
    
  • PARI
    P(n) = ((2+x+(n%2)*x^2) * (1+x^2)^(n\2) - 2)/x;
    concat(vector(11, n, Vecrev(P(n-1)))) \\ Gheorghe Coserea, Mar 14 2017

Formula

T(n,k) = T(n-1,k-1) - (-1)^k*T(n-1,k), k>0 ; T(n,0) = 1.
T(2n,2k) = T(2n+1,2k) = binomial(n,k) = A007318(n,k).
T(2n+1,2k+1) = A110813(n,k).
T(2n+2,2k+1) = 2*A135278(n,k).
T(n,2k) + T(n,2k+1) = A152201(n,k).
T(n,2k) = A152198(n,k).
T(n+1,2k+1) = A152201(n,k).
T(n,k) = T(n-2,k-2) + T(n-2,k).
T(2n,n) = A128014(n+1).
T(n,k) = card {p, 2^n <= A057890(p) <= 2^(n+1)-1 and A000120(A057890(p)) = k+1}. - Gheorghe Coserea, Jun 09 2016
P_n(x) = Sum_{k=0..n} T(n,k)*x^k = ((2+x+(n mod 2)*x^2)*(1+x^2)^(n\2) - 2)/x. - Gheorghe Coserea, Mar 14 2017

A307768 Number of n-step random walks on a line starting from the origin and returning to it at least once.

Original entry on oeis.org

0, 0, 2, 4, 10, 20, 44, 88, 186, 372, 772, 1544, 3172, 6344, 12952, 25904, 52666, 105332, 213524, 427048, 863820, 1727640, 3488872, 6977744, 14073060, 28146120, 56708264, 113416528, 228318856, 456637712, 918624304, 1837248608, 3693886906, 7387773812, 14846262964, 29692525928
Offset: 0

Views

Author

Robert FERREOL, Apr 27 2019

Keywords

Comments

a(n)/2^n tends to 1 as n goes to infinity; this means that on the line any random walk returns sooner or later to its starting point with a probability 1.
a(n) is also the number of heads-or-tails games of length n during which at some point there are as many heads as tails.

Examples

			The a(3)=4 three-step walks returning to 0 are [0, -1, 0, -1], [0, -1, 0, 1], [0, 1, 0, -1], [0, 1, 0, 1].
The a(4)=10 three-step walks returning to 0 are [0, -1, -2, -1, 0], [0, -1, 0, -1, -2], [0, -1, 0, -1, 0], [0, -1, 0, 1, 0], [0, -1, 0, 1, 2], [0, 1, 0, -1, -2], [0, 1, 0, -1, 0], [0, 1, 0, 1, 0], [0, 1, 0, 1, 2], [0, 1, 2, 1, 0].
		

Crossrefs

Programs

  • Maple
    b:=n->piecewise(n mod 2 = 0,binomial(n,n/2),2*binomial(n-1,(n-1)/2)):
    seq(2^n-b(n),n=0..20);
    # second program:
    A307768 := series(exp(2*x) - int((1/x + 2)*BesselI(1,2*x),x) - BesselI(1,2*x), x = 0, 36): seq(n!*coeff(A307768, x, n), n = 0 .. 35); # Mélika Tebni, Jun 19 2024
  • Mathematica
    a[n_] := If[n == 0, 0, 2^n - 2*Binomial[n-1, Floor[(n-1)/2]]];
    Array[a, 36, 0] (* Jean-François Alcover, May 05 2019 *)

Formula

a(n) = 2^n - A063886(n).
a(n+1) = 2*A045621(n) = 2*(2^n - binomial(n,floor(n/2))).
a(2n) = 2^(2n) - binomial(2n,n); a(2n+1) = 2*a(2n).
G.f.: (1-sqrt(1-4*x^2))/(1-2*x). - Alois P. Heinz, May 05 2019
n*(a(n)-2*a(n-1)) - 4*(n-3)*(a(n-2)-2*a(n-3)) = 0. - Robert Israel, May 06 2019
a(2n+2) - 2*a(2n+1) = A284016(n) = 2*Catalan(n). - Robert FERREOL, Aug 26 2019
From Mélika Tebni, Jun 19 2024: (Start)
E.g.f.: exp(2*x) - Integral_{x=-oo..oo} (1/x + 2)*BesselI(1, 2*x) dx - BesselI(1, 2*x).
a(n) = 2*(A027306(n) - A128014(n)). (End)

A337499 a(n) is the number of ballot sequences of length n tied or won by at most 2 votes.

Original entry on oeis.org

1, 2, 4, 6, 14, 20, 50, 70, 182, 252, 672, 924, 2508, 3432, 9438, 12870, 35750, 48620, 136136, 184756, 520676, 705432, 1998724, 2704156, 7696444, 10400600, 29716000, 40116600, 115000920, 155117520, 445962870
Offset: 0

Views

Author

Nachum Dershowitz, Aug 29 2020

Keywords

Comments

Also the number of n-step walks on a path graph ending within 2 steps of the origin. Also the number of monotonic paths of length n ending within 2 steps of the diagonal.

Crossrefs

Bisections give A000984 (odd part, starting from second element), A051924 (even part).

Programs

  • Maple
    f:= gfun:-rectoproc({(4 + 4*n)*a(n) + (-12 - 4*n)*a(1 + n) + (-22 - 5*n)*a(2 + n) + (n + 4)*a(n + 3) + (6 + n)*a(n + 4), a(0) = 1, a(1) = 2, a(2) = 4, a(3) = 6},a(n),remember):
    map(f, [$0..100]); # Robert Israel, Oct 08 2020

Formula

a(n) = A128014(n+1) + ((n+1) mod 2)*2*A001791(ceiling(n/2)).
D-finite with recurrence +(n+2)*a(n) +n*a(n-1) +(-5*n-2)*a(n-2) +4*(-n+1)*a(n-3) +4*(n-3)*a(n-4)=0. - Conjectured by R. J. Mathar, Sep 27 2020, verified by Robert Israel, Oct 08 2020
G.f.: ((4*x + 2)*sqrt(-4*x^2 + 1) + 4*x^2 + 4*x + 2)/(sqrt(-4*x^2 + 1)*(1 + sqrt(-4*x^2 + 1))^2). - Robert Israel, Oct 08 2020
a(n) ~ 2^(n - 1/2) * (5 + (-1)^n) / sqrt(Pi*n). - Vaclav Kotesovec, Mar 08 2023

A385641 Partial sums of A097893.

Original entry on oeis.org

1, 3, 8, 20, 51, 133, 356, 972, 2695, 7557, 21372, 60840, 174097, 500295, 1442720, 4172752, 12099411, 35161001, 102375400, 298586652, 872177273, 2551118623, 7471195500, 21904500500, 64286141881, 188844619563, 555216323396, 1633658183432, 4810340397375, 14173698242137
Offset: 0

Views

Author

Mélika Tebni, Aug 03 2025

Keywords

Comments

Second partial sums of the central trinomial coefficients (A002426).
Third partial sums of A025178 (sequence starting 1, 0, 2, 4, 12, 32, 90 .... with offset 0).
For p prime of the form 4*k + 3 (A002145), a(p) + 1 == 0 (mod p).
For p Pythagorean prime (A002144), a(p) - 3 == 0 (mod p).
Sequences with g.f. (1-x)^k / sqrt(1-2*x-3*x^2): this sequence (k=-2), A097893 (k=-1), A002426 (k=0), A025178 (k=1), A024997 (k=2), A026083 (k=3). - Mélika Tebni, Aug 25 2025

Crossrefs

Programs

  • Maple
    a := series(exp(x)*(BesselI(0, 2*x) + 2*int(BesselI(0, 2*x), x) + int(int(BesselI(0, 2*x), x), x)), x = 0, 30): seq(n!*coeff(a, x, n), n = 0 .. 29);
  • PARI
    a(n) = sum(k=0, n, sum(i=0, k, sum(j=0, i, binomial(i, i-j)*binomial(j, i-j)))); \\ Michel Marcus, Aug 06 2025
  • Python
    from math import comb as C
    def a(n):
        return sum(C(n+1, k+1)*C(2*(k//2), k//2) for k in range(n + 1))
    print([a(n) for n in range(30)])
    

Formula

G.f.: (1 / sqrt((1 + x)*(1 - 3*x))) / (1 - x)^2.
E.g.f.: exp(x)*(BesselI(0, 2*x) + 2*g(x) + Integral_{x=-oo..oo} g(x) dx) where g(x) = Integral_{x=-oo..oo} BesselI(0, 2*x) dx.
D-finite with recurrence n*a(n) = (4*n-1)*a(n-1) - (2*n+1)*a(n-2) - (4*n-5)*a(n-3) + 3*(n-1)*a(n-4).
a(0) = 1, a(1) = 3 and a(n) = a(n-2) - 1 + 2*A383527(n) for n >= 2.
a(n) = Sum_{k=0..n} binomial(n+1, k+1)*A128014(k).
a(n) = Sum_{k=0..n} (2*A247287(k) + k+1).
a(n) ~ 3^(n + 5/2) / (8*sqrt(Pi*n)). - Vaclav Kotesovec, Aug 03 2025
Sum_{k=0..n} A295112(n-k)*a(k) + binomial(n+3, 3) = 0. - Mélika Tebni, Sep 03 2025
Previous Showing 11-14 of 14 results.