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 31-39 of 39 results.

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)

A110491 Expansion of e.g.f.: sqrt(1+2x)/sqrt(1-2x).

Original entry on oeis.org

1, 2, 4, 24, 144, 1440, 14400, 201600, 2822400, 50803200, 914457600, 20118067200, 442597478400, 11507534438400, 299195895398400, 8975876861952000, 269276305858560000, 9155394399191040000, 311283409572495360000
Offset: 0

Views

Author

Paul Barry, Jul 22 2005

Keywords

Comments

Row sums of exponential Riordan array [1, arctanh(2x)]. - Paul Barry, Apr 17 2008
Conjecture: {a(n-1), n>=1} is the T-transform of A093178, where T maps a sequence {b(n), n>=1} to the sequence {c(n)} defined by c(n) = det(M_n), where M_n is the n X n matrix with elements M_n(i,j) = b(2*j) for i>j and M_n(i,j) = b(i+j-1) for i<=j. - Lechoslaw Ratajczak, Aug 04 2021

Crossrefs

Programs

  • Maple
    S:= series(sqrt(1+2*x)/sqrt(1-2*x),x,31):
    seq(coeff(S,x,j)*j!,j=0..30); # Robert Israel, Jun 08 2016
  • Mathematica
    With[{nn=20},CoefficientList[Series[Sqrt[1+2x]/Sqrt[1-2x],{x,0,nn}],x] Range[0,nn]!] (* or *) Join[{1},Table[2n!Binomial[n-1,Floor[(n-1)/2]], {n,20}]] (* Harvey P. Dale, Nov 11 2011 *)
    Table[2^n Binomial[1/2,n] n! Hypergeometric2F1[1/2, -n, 3/2 - n, -1], {n, 0, 20}] (* Benedict W. J. Irwin, Jun 06 2016 *)
  • PARI
    my(x='x+O('x^25)); Vec(serlaplace(sqrt(1+2*x)/sqrt(1-2*x))) \\ Michel Marcus, Aug 05 2021

Formula

E.g.f.: sqrt((1+2x)/(1-2x)); a(n)=2*n!*binomial(n-1, floor((n-1)/2))+0^n.
The sequence 0,1,0,2,0,4,... has e.g.f. arctanh(x). - Paul Barry, Apr 17 2008
D-finite with recurrence a(n) -2*a(n-1) -4*(n-1)*(n-2)*a(n-2)=0. - R. J. Mathar, Sep 20 2012
a(n) ~ 2^(n+1)*n^n/exp(n). - Vaclav Kotesovec, Sep 25 2013
a(n) = 2^n*binomial(1/2,n)*n!*2F1(1/2,-n;3/2-n;-1). - Benedict W. J. Irwin, Jun 06 2016
From Robert Israel, Jun 08 2016: (Start)
a(n) = n! * A063886(n).
E.g.f. satisfies 2*g(x)+(4*x^2-1)*g'(x) = 0, from which Mathar's recurrence follows. (End)
Sum_{n>=0} 1/a(n) = 1 + (StruveL(-1,1/2) + StruveL(0,1/2))*Pi/4, where StruveL is the modified Struve function. - Amiram Eldar, Aug 15 2025

A164584 Expansion of (1 + 6*x - 12*x^2 - 8*x^3)/(1 - 24*x^2 + 16*x^4).

Original entry on oeis.org

1, 6, 12, 136, 272, 3168, 6336, 73856, 147712, 1721856, 3443712, 40142848, 80285696, 935878656, 1871757312, 21818802176, 43637604352, 508677193728, 1017354387456, 11859151814656, 23718303629312, 276480808452096
Offset: 0

Views

Author

Paul Barry, Aug 17 2009

Keywords

Comments

The signed sequence (-1)^C(n+1, 2)*a(n) with g.f. (1 - 6x + 12x^2 - 8x^3) / (1 + 24x^2 + 16x^4) is the Hankel transform of (-1)^C(n+1, 2)*A063886.

Crossrefs

Cf. A063886.

Programs

  • Mathematica
    CoefficientList[Series[(1 + 6 x - 12 x^2 - 8 x^3)/(1 - 24 x^2 + 16 x^4), {x, 0, 20}], x] (* Wesley Ivan Hurt, Mar 30 2017 *)
    LinearRecurrence[{0,24,0,-16},{1,6,12,136},30] (* Harvey P. Dale, Jul 16 2021 *)

Formula

G.f.: (1 + 6*x - 12*x^2 - 8*x^3)/(1 - 24*x^2 + 16*x^4).
a(n) = 2^n*((((3 + 2*sqrt(2))^((n+1)/2) + (3-2*sqrt(2))^((n+1)/2))/2)(1 - (-1)^n)/2 + (((3 + 2*sqrt(2))^(n/2) + (3 - 2*sqrt(2))^(n/2))/2)(1 + (-1)^n)/2).

A172068 Triangular array T(n,k) is the number of n-step one-dimensional walks that return to the origin exactly k times.

Original entry on oeis.org

1, 2, 2, 2, 4, 4, 6, 6, 4, 12, 12, 8, 20, 20, 16, 8, 40, 40, 32, 16, 70, 70, 60, 40, 16, 140, 140, 120, 80, 32, 252, 252, 224, 168, 96, 32, 504, 504, 448, 336, 192, 64, 924, 924, 840, 672, 448, 224, 64, 1848, 1848, 1680, 1344, 896, 448, 128, 3432, 3432, 3168
Offset: 0

Views

Author

Geoffrey Critzer, Jan 24 2010

Keywords

Comments

In a ballot count of n total votes cast for two candidates, T(n,k) is the number of counts in which exactly k ties occur during the counting process (disregarding the initial tie of 0 to 0) and considering every possible outcome of votes.

Examples

			T(5,2) = 8 because there are eight possible vote count sequences in which five votes are cast and the count becomes tied two times during the counting process: {-1, 0, -1, 0, -1}, {-1, 0, -1, 0, 1}, {-1, 0, 1, 0, -1}, {-1, 0, 1, 0, 1}, {1, 0, -1, 0, -1}, {1, 0, -1, 0, 1}, {1, 0, 1, 0, -1}, {1, 0, 1, 0, 1}
Triangle begins:
   1;
   2;
   2,  2;
   4,  4;
   6,  6,  4;
  12, 12,  8;
  20, 20, 16,  8;
  40, 40, 32, 16;
		

References

  • W. Feller, An Introduction to Probability Theory and its Applications, Vol 1, 3rd ed. New York: Wiley, pp. 67-97, 1968

Crossrefs

The first two columns corresponding to k=0 and k=1 are A063886.

Programs

  • GAP
    T:= function(n,k)
        if Mod(n,2)=0 then return 2^k*Binomial(n-k, Int(n/2)-k);
        else return 2^(k+1)*Binomial(n-k-1, Int((n-1)/2)-k);
        fi; end;
    Flat(List([0..20], n-> List([0..Int(n/2)], k-> T(n,k) ))); # G. C. Greubel, Dec 05 2019
  • Magma
    function T(n,k)
      if (n mod 2) eq 0 then return 2^k*Binomial(n-k, Floor(n/2)-k);
      else return 2^(k+1)*Binomial(n-k-1, Floor((n-1)/2)-k);
      end if; return T; end function;
    [T(n,k): k in [0..Floor(n/2)], n in [0..20]]; // G. C. Greubel, Dec 05 2019
    
  • Maple
    T:= (n, k)-> `if`(irem(n, 2, 'r')=0, binomial(n-k, r-k)*2^k, 2*T(n-1,k)):
    seq(seq(T(n,k), k=0..iquo(n,2)), n=0..20); # Alois P. Heinz, May 07 2013
  • Mathematica
    Table[Table[ Length[Select[Map[Accumulate, Strings[{-1, 1}, n]], Count[ #, 0] == k &]], {k, 0, Floor[n/2]}], {n, 0, 20}] // Grid
  • PARI
    T(n,k) = if(Mod(n,2)==0, 2^k*binomial(n-k, (n/2)-k), 2^(k+1)*binomial(n-k-1, ((n-1)/2)-k) ); \\ G. C. Greubel, Dec 05 2019
    
  • Sage
    def T(n, k):
        if (mod(n,2)==0): return 2^k*binomial(n-k, (n/2)-k)
        else: return 2^(k+1)*binomial(n-k-1, ((n-1)/2)-k)
    [[T(n, k) for k in (0..floor(n/2))] for n in (0..20)] # G. C. Greubel, Dec 05 2019
    

Formula

T(2n,k) = binomial(2n-k, n-k)*2^k; T(2n+1,k) = 2*T(2n,k). - David Callan, May 01 2013

A180967 Number of n-game win/loss series that contain at least one dead game.

Original entry on oeis.org

0, 0, 4, 4, 20, 24, 88, 116, 372, 520, 1544, 2248, 6344, 9520, 25904, 39796, 105332, 164904, 427048, 679064, 1727640, 2783440, 6977744, 11368904, 28146120, 46307664, 113416528, 188202256, 456637712, 763506784
Offset: 1

Views

Author

Dmitry Kamenetsky, Jan 28 2011

Keywords

Comments

A series of n games are played between two teams. The outcome of each game is either a win or a loss (there are no draws). A team wins the whole series if it wins k=floor(n/2)+1 games or more. If a team reaches k wins then the games that follow (if there are any) are dead games, because their outcome cannot affect the outcome of the series.
Number of n-game series whose outcome is decided in the last game is A063886(n).

Examples

			We can represent an n-game series as a binary string of length n, where '0' means a loss for the first team and '1' means a win for the first team. For n=3 there are 2^3=8 possible game series. Out of these there are 4 that contain at least one dead game (the last one): 000, 001, 110, 111. Hence a(3)=4.
		

Crossrefs

See A181618 for win/loss/draw series.

Programs

  • Mathematica
    f[n_] := 2^n - 2*If[ OddQ@ n, Binomial[n - 1, (n - 1)/2], 2 Binomial[n - 1, n/2]]; Array[f, 30] (* Robert G. Wilson v *)

Formula

The last game is "alive" if and only if the result of the first n-1 games
is either (if n is odd) (n-1)/2 wins for both teams, or (if n is even) n/2 wins for one and n/2-1 for the other. Hence a(n)=2^n - 2C(n-1,(n-1)/2) for odd n and a(n)=2^n - 4C(n-1,n/2) for even n. - Robert Israel, Jan 28 2011
-n*a(n) +n*a(n-1) +2*(3*n-5)*a(n-2) +4*(-n+1)*a(n-3) +8*(-n+4)*a(n-4)=0. - R. J. Mathar, May 19 2014

A237520 Irregular triangular array read by rows: T(n,k) is the number of n-step walks (steps +1,-1) on the x-axis beginning at the origin that are on the origin for the last time on step 2k, n>=0, 0<=k<=floor(n/2).

Original entry on oeis.org

1, 2, 2, 2, 4, 4, 6, 4, 6, 12, 8, 12, 20, 12, 12, 20, 40, 24, 24, 40, 70, 40, 36, 40, 70, 140, 80, 72, 80, 140, 252, 140, 120, 120, 140, 252, 504, 280, 240, 240, 280, 504, 924, 504, 420, 400, 420, 504, 924, 1848, 1008, 840, 800, 840, 1008, 1848, 3432, 1848, 1512, 1400, 1400, 1512, 1848
Offset: 0

Views

Author

Geoffrey Critzer, Feb 08 2014

Keywords

Comments

Column k=0 is A063886.
Row sums give A000079.

Examples

			1;
2;
2,   2;
4,   4;
6,   4,   6;
12,  8,   12;
20,  12,  12,  20;
40,  24,  24,  40;
70,  40,  36,  40,  70;
140, 80,  72,  80,  140;
252, 140, 120, 120, 140, 252;
T(4,1) = 4 because we have: (-1,+1,-1,-1), (-1,+1,+1,+1), (+1,-1,-1,-1), (+1,-1,+1,+1). These walks have 4 steps and are on the origin for the last time on step 2*1=2.
		

Crossrefs

Cf. A067804.

Programs

  • Maple
    T:= (n, k)-> 2^irem(n, 2)*binomial(2*k, k)*
        binomial(2*iquo(n, 2)-2*k, iquo(n, 2)-k):
    seq(seq(T(n, k), k=0..iquo(n, 2)), n=0..14);  # Alois P. Heinz, May 10 2014
  • Mathematica
    nn=20;d=(1-(1-4x^2)^(1/2))/(2x^2);Map[Select[#,#>0&]&,Transpose[Table[ CoefficientList[Series[Binomial[2n,n]x^(2n)(1-2x^2d)/(1-2x),{x,0,nn}],x],{n,0,nn/2}]]]//Grid
    (* or *)
    f[list_]:=If[Max[Flatten[Position[list,0]]]== -Infinity,0,Max[Flatten[ Position[list,0]]]]; Table[Distribution[Map[f,Map[Accumulate, Strings[{-1,1},n]]]],{n,0,10}]//Grid

Formula

G.f. for column k: binomial(2k,k) x^k*A(x) where A(x) is the o.g.f. for A063886.

A304915 Expansion of ((1 + 16*x)/(1 - 16*x))^(1/16).

Original entry on oeis.org

1, 2, 2, 172, 342, 26556, 67220, 4875160, 14125030, 973837420, 3087573628, 204536051176, 692771715836, 44412235657176, 158358513025896, 9874709152875568, 36706645561910150, 2234840966950941260, 8601116786415880940, 512801585354912006600, 2032977466125710169236
Offset: 0

Views

Author

Seiichi Manyama, May 21 2018

Keywords

Comments

Let ((1 + k*x)/(1 - k*x))^(1/k) = a(0) + a(1)*x + a(2)*x^2 + ...
Then n*a(n) = 2*a(n-1) + k^2*(n-2)*a(n-2) for n > 1.

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[((1+16x)/(1-16x))^(1/16),{x,0,30}],x] (* Harvey P. Dale, Jul 21 2021 *)
  • PARI
    N=66; x='x+O('x^N); Vec(((1+16*x)/(1-16*x))^(1/16))

Formula

n*a(n) = 2*a(n-1) + 16^2*(n-2)*a(n-2) for n > 1.
a(n) ~ 2^(4*n + 1/16) / (Gamma(1/16) * n^(15/16)) * (1 - (-1)^n * sqrt(2 - sqrt(2 + sqrt(2))) * 2^(7/8) * Gamma(1/16)^2 / (64*Pi*n^(1/8))). - Vaclav Kotesovec, May 21 2018

A335974 Number of tieless quidditch games with n scoring events.

Original entry on oeis.org

2, 4, 4, 8, 12, 24, 40, 80, 140, 280, 504, 1008, 1848, 3696, 6864, 13726, 25740, 51450, 97240, 194210, 369512, 737124, 1410864, 2810178, 5408312, 10752868, 20801200, 41273500, 80233200, 158851800, 310235040, 612835830, 1202160780, 2369260560, 4667212440
Offset: 1

Views

Author

Cameron Ford, Jul 03 2020

Keywords

Comments

Quidditch is a sport invented by author J. K. Rowling for her fantasy book series Harry Potter.
In quidditch, the match ends when the snitch is caught. The team which caught it is awarded 150 points. All other scoring events are worth 10 points, and occur when the quaffle is thrown through one of the hoops.
A game is, therefore, a list of +10s and -10s, with a final entry of either +150 or -150. Negative points are for the away team, positive points are for the home team.
A tieless game is one in which the teams never have the same score (except at the beginning, when no team has scored yet).
For n <= 15 and all odd n: a(n) = 2*A063886(n)
For even n greater than 15: a(n) = 2*(A063886(n) + A009766((n-2+14)/2,(n-2-14)/2))

Examples

			a(3) = 4 because to avoid a tie after two scoring events, the same team must score the first two goals, i.e., the game starts (+10,+10) or (-10,-10). Then there are two options for who catches the snitch. So the tieless games with three scoring events are (-10,-10,-150), (-10,-10,+150), (+10,+10,-150) and (+10,+10,+150).
		

References

  • J. K. Rowling, Harry Potter and the Philosopher's Stone, Chapter 10, Bloomsbury, 1997.

Crossrefs

Inspired by A137684 and Robin Smyrl.
Tieless games: A137684 (American football), A135490 (basketball), A135489 (basketball 1896-1967), A334288 (rugby union), this sequence (quidditch).
Cf. A063886.

Programs

  • Python
    def number_of_tieless_quidditch_games(n):
        """
        Takes an integer n, and returns a list containing the number of tieless
        quidditch games with 1, 2, 3 .... n scoring events.
        Note, the last scoring event is always catching the snitch, which gives
        +150 if the home team caught it, or -150 if the away team caught it.
        All scoring events prior to the snitch being caught are worth +10 or -10.
        """
        dictionary_of_scores = {0:1}
        # The keys of this dictionary represent possible scores.
        # The values represent the number of ways this score can be reached with
        # the game being tieless.
        list_to_return = []
        for i in range(n):
            # We have a dictionary of tieless games with i ten point scoring events.
            # Check still tieless after snitch catch
            number_of_tieless_games = 0
            for score, number_of_ways in dictionary_of_scores.items():
                if score != 150: # away team can catch snitch without a tie
                    number_of_tieless_games += number_of_ways
                if score != -150: # home team can catch snitch without a tie
                    number_of_tieless_games += number_of_ways
            list_to_return.append(number_of_tieless_games)
            # Update dictionary to have one more ten point scoring event
            old_dictionary = dictionary_of_scores
            dictionary_of_scores = {}
            for scoring_event in (-10, 10):
                for score, number_of_ways in old_dictionary.items():
                    new_score = score + scoring_event
                    if score + scoring_event != 0:
                        dictionary_of_scores[new_score] =\
                        dictionary_of_scores.get(new_score,0) + number_of_ways
        return list_to_return

Formula

A063886(n-1) gives the number of n-1 step walks on a line starting from the origin but not returning to it. This is equivalent to the number of quidditch games with n scoring events which are tieless after the first n-1 scores (all of which are +10 or -10). Therefore, as the last score can be +150 or -150, there are 2*A063886(n-1) quidditch games with n scoring events which are tieless after n-1 scores.
To be tied after n scores, one team must be 150 points ahead after n-1 scores and then the other team must catch the snitch. If n-1 is less than 15, this cannot happen. Additionally, if n is odd, then after n-1 scores the difference between the scores is an even multiple of 10, so cannot be 150.
Now, for even n greater than 15, we must subtract from 2*A063886(n-1) the number of games which are tieless after n-1 scores but tied after n scores. For this to be the case, supposing the away team catches the snitch, we must have the game starting with +10, ending with -150 and with a block of n-2 +10s and -10s in the middle such that the net score after n-1 scores is +150 and the cumulative number of -10s in the n-2 block is never more than the cumulative number of +10s.
Catalan's triangles, Catalan(m,k) gives the number of sequences of m +10s and k -10s such that the cumulative number of -10s is never greater than the cumulative number of +10s. We require m+k = n-2 and m = k+14. Solving this gives m = (n+12)/2 and k = (n-16)/2. Doubling, to count the games where the home team catches the snitch, we have the number of games which are tieless after n-1 scoring events but tied after the snitch catch is 2*Catalan((n+12)/2,(n-16)/2) hence giving the formula below.
Therefore, the total number of tieless quidditch games with n scoring events is:
2*A063886(n-1) if n is odd or n < 16.
2*A063886(n-1) - 2*A009766((n+12)/2,(n-16)/2) otherwise

A179461 Decimal expansion of sqrt(51)/7.

Original entry on oeis.org

1, 0, 2, 0, 2, 0, 4, 0, 6, 1, 2, 2, 0, 4, 0, 7, 1, 4, 2, 5, 7, 1, 3, 4, 2, 8, 3, 0, 1, 9, 5, 3, 2, 3, 6, 1, 1, 2, 5, 2, 3, 1, 0, 1, 6, 5, 7, 0, 0, 3, 9, 0, 5, 4, 7, 6, 0, 1, 2, 0, 4, 4, 1, 1, 8, 2, 3, 6, 8, 8, 6, 2, 9, 4, 9, 1, 4, 3, 1, 6, 9, 8, 0, 3, 6, 9, 9, 8, 3, 1, 6, 2, 1, 8, 9, 7, 4, 3, 4, 5, 4, 6, 2, 0, 6
Offset: 1

Views

Author

Mark Dols, Jul 14 2010

Keywords

Comments

sqrt(3/2)= sqrt(12/8)= 1.224744... sqrt(51/49)= sqrt(102/98)= 1.0202040612... sqrt (501/499)=sqrt (1002/998)= 1.002002004...

Crossrefs

Programs

Extensions

Keyword:frac replaced by keyword:cons - R. J. Mathar, Jul 20 2010
More terms from Robert G. Wilson v, Aug 23 2010
Previous Showing 31-39 of 39 results.