OFFSET
0,2
COMMENTS
Number of paths from (0,0) to (n,n) in an n X n grid using only steps north, northeast and east (i.e., steps (1,0), (1,1), and (0,1)).
Also the number of ways of aligning two sequences (e.g., of nucleotides or amino acids) of length n, with at most 2*n gaps (-) inserted, so that while unnecessary gappings: - -a a- - are forbidden, both b- and -b are allowed. (If only other of the latter is allowed, then the sequence A000984 gives the number of alignments.) There is an easy bijection from grid walks given by Dickau to such set of alignments (e.g., the straight diagonal corresponds to the perfect alignment with no gaps). - Antti Karttunen, Oct 10 2001
Also main diagonal of array A008288 defined by m(i,1) = m(1,j) = 1, m(i,j) = m(i-1,j-1) + m(i-1,j) + m(i,j-1). - Benoit Cloitre, May 03 2002
So, as a special case of Dmitry Zaitsev's Dec 10 2015 comment on A008288, a(n) is the number of points in Z^n that are L1 (Manhattan) distance <= n from any given point. These terms occur in the crystal ball sequences: a(n) here is the n-th term in the sequence for the n-dimensional cubic lattice. See A008288 for a list of crystal ball sequences (rows or columns of A008288). - Shel Kaphan, Dec 26 2022
a(n) is the number of n-matchings of a comb-like graph with 2*n teeth. Example: a(2) = 13 because the graph consisting of a horizontal path ABCD and the teeth Aa, Bb, Cc, Dd has 13 2-matchings: any of the six possible pairs of teeth and {Aa, BC}, {Aa, CD}, {Bb, CD}, {Cc, AB}, {Dd, AB}, {Dd, BC}, {AB, CD}. - Emeric Deutsch, Jul 02 2002
Number of ordered trees with 2*n+1 edges, having root of odd degree, nonroot nodes of outdegree at most 2 and branches of odd length. - Emeric Deutsch, Aug 02 2002
The sum of the first n coefficients of ((1 - x) / (1 - 2*x))^n is a(n-1). - Michael Somos, Sep 28 2003
The Hankel transform (see A001906 for definition) of this sequence is A036442: 1, 4, 32, 512, 16384, ... . - Philippe Deléham, Jul 03 2005
Also number of paths from (0,0) to (n,0) using only steps U = (1,1), H = (1,0) and D =(1,-1), U can have 2 colors and H can have 3 colors. - N-E. Fahssi, Jan 27 2008
Equals row sums of triangle A152250 and INVERT transform of A109980: (1, 2, 8, 36, 172, 852, ...). - Gary W. Adamson, Nov 30 2008
Number of overpartitions in the n X n box (treat a walk of the type in the first comment as an overpartition, by interpreting a NE step as N, E with the part thus created being overlined). - William J. Keith, May 19 2017
Diagonal of rational functions 1/(1 - x - y - x*y), 1/(1 - x - y*z - x*y*z). - Gheorghe Coserea, Jul 03 2018
Dimensions of endomorphism algebras End(R^{(n)}) in the Delannoy category attached to the oligomorphic group of order preserving self-bijections of the real line. - Noah Snyder, Mar 22 2023
a(n) is the number of ways to tile a strip of length n with white squares, black squares, and red dominos, where we must have an equal number of white and black squares. - Greg Dresden and Leo Zhang, Jul 11 2025
REFERENCES
Frits Beukers, Arithmetic properties of Picard-Fuchs equations, Séminaire de Théorie des nombres de Paris, 1982-83, Birkhäuser Boston, Inc.
Miklos Bona, editor, Handbook of Enumerative Combinatorics, CRC Press, 2015, page 593.
L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 81.
L. Moser and W. Zayachkowski, Lattice paths with diagonal steps, Scripta Math., 26 (1961), 223-229.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
R. P. Stanley, Enumerative Combinatorics, Wadsworth, Vol. 2, 1999; see Example 6.3.8 and Problem 6.49.
D. B. West, Combinatorial Mathematics, Cambridge, 2021, p. 28.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 0..1308 (all terms < 10^1000, first 201 terms from T. D. Noe)
Marco Abrate, Stefano Barbero, Umberto Cerruti, and Nadir Murru, Fixed Sequences for a Generalization of the Binomial Interpolated Operator and for some Other Operators, J. Int. Seq. 14 (2011), Art. 11.8.1.
B. Adamczewski, Jason P. Bell, and E. Delaygue, Algebraic independence of G-functions and congruences "à la Lucas", arXiv:1603.04187 [math.NT], 2016.
Max A. Alekseyev, Tewodros Amdeberhan, Jeffrey Shallit, and Ingrid Vukusic, On the p-adic valuations of values of Legendre polynomials, Res. Num. Theory 12 (2026), Art. 52. See also arXiv:2505.08935 [math.NT], 2025. See p. 3.
Jean-Michel Autebert, A.-M. Décaillot, and Sylviane R. Schwer, H.-A. Delannoy et les oeuvres posthumes d'Édouard Lucas, Gazette des Mathématiciens - no 95, Jan 2003 (in French).
Jean-Michel Autebert, Matthieu Latapy, and Sylviane R. Schwer, Le treillis des Chemins de Delannoy, Discrete Math. 258 (2002), 225-234.
Jean-Michel Autebert and Sylviane R. Schwer, On generalized Delannoy paths, SIAM J. Discrete Math. 16(2) (2003), 208-223.
Cyril Banderier and Sylviane Schwer, Why Delannoy numbers?, arXiv:math/0411128 [math.CO], 2004.
Cyril Banderier and Sylviane Schwer, Why Delannoy numbers?, J. Statist. Planning Inference, 135(1) (2005), 40-54.
Paul Barry, On Integer-Sequence-Based Constructions of Generalized Pascal Triangles, J. Int. Seq. 9 (2006), Art. 06.2.4.
Paul Barry, On the Central Coefficients of Riordan Matrices, J. Int. Seq. 16 (2013), Art. 13.5.1.
Paul Barry, On the Inverses of a Family of Pascal-Like Matrices Defined by Riordan Arrays, J. Int. Seq. 16 (2013), Art. 13.5.6.
Paul Barry, Jacobsthal Decompositions of Pascal's Triangle, Ternary Trees, and Alternating Sign Matrices, J. Int. Seq. 19 (2016), #16.3.5.
Paul Barry and Aoife Hennessy, Generalized Narayana Polynomials, Riordan Arrays, and Lattice Paths, J. Int. Seq. 15 (2012), Art. 12.4.8.
Paul Barry, Moment sequences, transformations, and Spidernet graphs, arXiv:2307.00098 [math.CO], 2023.
Thomas Baruchel and C. Elsner, On error sums formed by rational approximations with split denominators, arXiv:1602.06445 [math.NT], 2016.
H. Bateman, Some problems in potential theory, Messenger Math., 52 (1922), 71-78. [Annotated scanned copy]
Raymond A. Beauregard and Vladimir A. Dobrushkin, Powers of a Class of Generating Functions, Math. Mag. 89(5) (2016), 359-363.
Hacène Belbachir and Abdelghani Mehdaoui, Recurrence relation associated with the sums of square binomial coefficients, Quaestiones Mathematicae 44(5) (2021), 615-624.
Hacène Belbachir, Abdelghani Mehdaoui, and László Szalay, Diagonal Sums in the Pascal Pyramid, II: Applications, J. Int. Seq. 22 (2019), Art. 19.3.5.
Renato G. Bettiol and Hannah Friedman, Counting Homogeneous Einstein Metrics, arXiv:2509.09830 [math.DG], 2025. See p. 29.
A. Bostan, S. Boukraa, J.-M. Maillard, and J.-A. Weil, Diagonals of rational functions and selected differential Galois groups, arXiv:1507.03227 [math-ph], 2015.
John S. Caughman, Clifford R. Haithcock, and J. J. P. Veerman, A note on lattice chains and Delannoy numbers, Discrete Math., 308 (2008), 2623-2628.
Jia-Yu Chen and Chen Wang, Congruences concerning generalized central trinomial coefficients, arXiv:2012.04523 [math.NT], 2020.
Johann Cigler, Some nice Hankel determinants, arXiv:1109.1449 [math.CO], 2011.
Johann Cigler and Christian Krattenthaler, Hankel determinants of linear combinations of moments of orthogonal polynomials, arXiv:2003.01676 [math.CO], 2020.
Matthew Coster, Email, Nov 1990.
Fabio Deelan Cunden, Statistical distribution of the Wigner-Smith time-delay matrix for chaotic cavities, arXiv:1412.2172 [cond-mat.mes-hall], 2014.
Emeric Deutsch and B. E. Sagan, Congruences for Catalan and Motzkin numbers and related sequences, J. Num. Theory 117 (2006), 191-215.
Ömür Deveci and Anthony G. Shannon, Some aspects of Neyman triangles and Delannoy arrays, Mathematica Montisnigri, Vol. L (2021), 36-43.
Robert M. Dickau, Delannoy and Motzkin Numbers [Many illustrations].
Robert M. Dickau, The 13 paths in a 4 X 4 grid.
Tomislav Doslic, Seven lattice paths to log-convexity, Acta Appl. Mathem. 110(3) (2010), 1373-1392.
Tomislav Došlic and Darko Veljan, Logarithmic behavior of some combinatorial sequences, Discrete Math. 308(11) (2008), 2182-2212. MR2404544 (2009j:05019) - N. J. A. Sloane, May 01 2012
Dan Drake, Bijections from Weighted Dyck Paths to Schröder Paths, J. Int. Seq. 13 (2010), Art. 10.9.2.
Rui Duarte and António Guedes de Oliveira, Generating functions of lattice paths, Univ. do Porto (Portugal 2023).
Maciej Dziemianczuk, Generalizing Delannoy numbers via counting weighted lattice paths, Integers 13 (2013), Art. A54.
Maciej Dziemianczuk, On Directed Lattice Paths With Additional Vertical Steps, arXiv:1410.5747 [math.CO], 2014.
James East and Nicholas Ham, Lattice paths and submonoids of Z^2, arXiv:1811.05735 [math.CO], 2018.
Steffen Eger, On the Number of Many-to-Many Alignments of N Sequences, arXiv:1511.00622 [math.CO], 2015.
Luca Ferrari and Emanuele Munarini, Enumeration of edges in some lattices of paths, arXiv:1203.6792 [math.CO], 2012.
Luca Ferrari and Emanuele Munarini, Enumeration of edges in some lattices of paths, J. Int. Seq. 17 (2014), Art. 14.1.5.
Seth Finkelstein, Letter to N. J. A. Sloane, Mar 24 1990, with attachments.
Scott Garrabrant and Igor Pak, Counting with irrational tiles, arXiv:1407.8222 [math.CO], 2014.
Joël Gay and Vincent Pilaud, The weak order on Weyl posets, arXiv:1804.06572 [math.CO], 2018.
Taras Goy and Mark Shattuck, Determinant identities for the Catalan, Motzkin and Schröder numbers, Art Disc. Appl. Math. (2023).
Nate Harman, Andrew Snowden, and Noah Snyder, The Delannoy Category, arxiv:2211.15392 [math.RT], 2023.
Tian-Xiao He, One-pth Riordan Arrays in the Construction of Identities, arXiv:2011.00173 [math.CO], 2020.
M. D. Hirschhorn, How many ways can a king cross the board?, Austral. Math. Soc. Gaz., 27 (2000), 104-106.
Nick Hobson, Python program for this sequence.
Po-Yi Huang, Shu-Chung Liu, and Yeong-Nan Yeh, Congruences of Finite Summations of the Coefficients in certain Generating Functions, Elect. J. Comb. 21 (2014), Art. P2.45.
Milan Janjic, Two Enumerative Functions.
Svante Janson, Patterns in random permutations avoiding some sets of multiple patterns, arXiv:1804.06071 [math.PR], 2018.
Shashidhar Kaparthi and H. Raghav Rao, Higher dimensional restricted lattice paths with diagonal steps, Discr. Appl. Math., 31 (1991), 279-289.
D. E. Knuth and N. J. A. Sloane, Correspondence, December 1999.
Daniel Krenn and Jeffrey Shallit, Strongly k-recursive sequences, arXiv:2401.14231 [cs.FL], 2024.
D. F. Lawden, On the Solution of Linear Difference Equations, Math. Gaz. 36 (1952), 193-196.
Tamás Lengyel, On some p-adic properties and supercongruences of Delannoy and Schröder Numbers, Integers 21 (2021), Art. A86.
Huyile Liang, Yanni Pei, and Yi Wang, Analytic combinatorics of coordination numbers of cubic lattices, arXiv:2302.11856 [math.CO], 2023. See p. 4.
Huyile Liang, Jeffrey Remmel, and Sainan Zheng, Stieltjes moment sequences of polynomials, arXiv:1710.05795 [math.CO], 2017, see page 18.
Max A. Little and Ugur Kayas, Polymorphic dynamic programming by algebraic shortcut fusion, arXiv:2107.01752 [cs.DS], 2021.
Lily L. Liu, Positivity of three-term recurrence sequences, Elect. J. Comb. 17 (2010), #R57.
Lee McCulloch-James, The King's Diagonal: Three Parents Instead of Two, Dwight School London (2026). See references.
Romeo Mestrovic, Lucas' theorem: its generalizations, extensions and applications (1878-2014), arXiv preprint arXiv:1409.3820 [math.NT], 2014.
Leo Moser, Note 2487: King paths on a chessboard, Math. Gaz., 39 (1955), 54 (one page only).
Lili Mu and Sai-nan Zheng, On the Total Positivity of Delannoy-Like Triangles, J. Int. Seq. 20 (2017), Art. 17.1.6.
Emanuele Munarini, Combinatorial properties of the antichains of a garland, Integers 9 (2009), 353-374.
Tony D. Noe, On the Divisibility of Generalized Central Trinomial Coefficients, J. Int. Seq. 9 (2006), Art. 06.2.7.
Yassine Otmani and Hacene Belbachir, Some Congruences Involving Fourth Powers of Generalized Central Trinomial Coefficients, arXiv:2512.24148 [math.NT], 2025.
Paul Peart and Wen-Jin Woan, Generating Functions via Hankel and Stieltjes Matrices, J. Int. Seq. 3 (2000), Art. 00.2.1.
Robin Pemantle and Mark C. Wilson, Asymptotics of multivariate sequences, I: smooth points of the singular variety, arXiv:math/0003192 [math.CO], 2000.
Claudio de Jesús Pita Ruiz Velasco, Convolution and Sulanke Numbers, JIS 13 (2010), #10.1.8.
Feng Qi, Xiao-Ting Shi, and Bai-Ni Guo , Some properties of the Schroder numbers, Indian J. Pure Appl. Math 47(4) (2016) 717-732.
José L. Ramírez and Víctor F. Sirvent, A Generalization of the k-Bonacci Sequence from Riordan Arrays, The Electronic Journal of Combinatorics, 22(1) (2015), Art. P1.38
John Riordan, Letter, Jul 06 1978.
John Riordan, Letter to N. J. A. Sloane, Sep 26 1980 with notes on the 1973 Handbook of Integer Sequences. Note that the sequences are identified by their N-numbers, not their A-numbers.
Eric Rowland and Doron Zeilberger, A Case Study in Meta-AUTOMATION: AUTOMATIC Generation of Congruence AUTOMATA For Combinatorial Sequences, arXiv:1311.4776 [math.CO], 2013.
Shiva Samieinia, The number of continuous curves in digital geometry, Res. Reports Math. 3 (2008).
Sylviane Schwer et Jean-Michel Autebert, Henri-Auguste Delannoy, une biographie, Math. & Sci. hum. / Mathematical Social Sciences, 43e année, no. 174 (2006), 25-67.
Seunghyun Seo, The Catalan Threshold Arrangement, J. Int. Seq. 20 (2017), Art. 17.1.1.
Mark Shattuck, On the zeros of some polynomials with combinatorial coefficients, Annales Mathematicae et Informaticae 42 (2013), 93-101.
Zhao Shen, On the 3-adic valuation of a class of Apery-like numbers, arXiv:2112.11135 [math.NT], 2021.
Torsten Sillke, The Delannoy numbers.
Joseph B. Slowinski, The Number of Multiple Alignments, Molecular Phylogenetics and Evolution 10(2) (1998), 264-266.
Joseph B. Slowinski, The Number of Multiple Alignments, Molecular Phylogenetics and Evolution, 10(2) (1998), 264-266.
R. G. Stanton and D. D. Cowan, Note on a "square" functional equation, SIAM Rev. 12 (1970), 277-279.
Robert A. Sulanke, Moments of generalized Motzkin paths, J. Int. Seq. 3 (2000), Art. 00.1.1.
Robert A. Sulanke, Objects Counted by the Central Delannoy Numbers, J. Int. Seq. 5 (2002), Art. 03.1.5.
Robert A. Sulanke et al., Another description of the central Delannoy numbers, Problem 10894, Amer. Math. Monthly, 110(5) (2003), 443-444.
Zhi-Wei Sun, On Delannoy numbers and Schroeder numbers, Journal of Number Theory 131(12) (2011), 2387-2397. doi:10.1016/j.jnt.2011.06.005
Marius Tarnauceanu, The number of fuzzy subgroups of finite cyclic groups and Delannoy numbers, European Journal of Combinatorics 30(1) (2009), 283-287.
Bernhard Von Stengel, New maximal numbers of equilibria in bimatrix games, Disc. Comput. Geom. 21(4) (1999), 557-568. See Eq. (3.7).
Rong-Hua Wang and Michael X. X. Zhong, Congruences for sums of Delannoy numbers and polynomials, arXiv:2505.05728 [math.CO], 2025. See p. 2.
Yi Wang, Sai-Nan Zheng, and Xi Chen, Analytic aspects of Delannoy numbers, Discrete Mathematics 342(8) (2019): 2270-2277.
Eric Weisstein's World of Mathematics, Delannoy Number.
Eric Weisstein's World of Mathematics, Schmidt's Problem.
Wen-Jin Woan, Hankel Matrices and Lattice Paths, J. Int. Seq. 4 (2001), Art. 01.1.2.
Ernest X. W. Xia and Olivia X. M. Yao, A Criterion for the Log-Convexity of Combinatorial Sequences, The Electronic J. Comb. 20 (2013), Art. P3.
Lin Yang, Yu-Yuan Zhang, and Sheng-Liang Yang, The halves of Delannoy matrix and Chung-Feller properties of the m-Schröder paths, Linear Alg. Appl. (2024).
FORMULA
a(n) = P_n(3), where P_n is n-th Legendre polynomial.
G.f.: 1 / sqrt(1 - 6*x + x^2).
Dominant term in asymptotic expansion is binomial(2*n, n)/2^(1/4)*((sqrt(2) + 1)/2)^(2*n + 1)*(1 + c_1/n + c_2/n^2 + ...). - Michael David Hirschhorn
a(n) = Sum_{i=0..n} (A000079(i)*A008459(n, i)) = Sum_{i=0..n} (2^i * C(n, i)^2). - Antti Karttunen, Oct 10 2001
a(n) = Sum_{k=0..n} C(n+k, n-k)*C(2*k, k). - Benoit Cloitre, Feb 13 2003
a(n) = Sum_{k=0..n} C(n, k)^2 * 2^k. - Michael Somos, Oct 08 2003
a(n - 1) = coefficient of x^n in A120588(x)^n if n>=0. - Michael Somos, Apr 11 2012
G.f. of a(n-1) = 1 / (1 - x / (1 - 2*x / (1 - 2*x / (1 - x / (1 - 2*x / (1 - x / ...)))))). - Michael Somos, May 11 2012
INVERT transform is A109980. BINOMIAL transform is A080609. BINOMIAL transform of A006139. PSUM transform is A089165. PSUMSIGN transform is A026933. First backward difference is A110170. - Michael Somos, May 11 2012
E.g.f.: exp(3*x)*BesselI(0, 2*sqrt(2)*x). - Vladeta Jovovic, Mar 21 2004
a(n) = Sum_{k=0..n} C(2*n-k, n)*C(n, k). - Paul Barry, Apr 23 2005
a(n) = Sum_{k>=n} binomial(k, n)^2/2^(k+1). - Vladeta Jovovic, Aug 25 2006
a(n) = a(-1 - n) for all n in Z. - Michael Somos, Sep 23 2006
D-finite with recurrence: a(-1) = a(0) = 1; n*a(n) = 3*(2*n-1)*a(n-1) - (n-1)*a(n-2). Eq (4) in T. D. Noe's article in JIS 9 (2006) #06.2.7.
Define general Delannoy numbers by (i,j > 0): d(i,0) = d(0,j) = 1 =: d(0,0) and d(i,j) = d(i-1,j-1) + d(i-2,j-1) + d(i-1,j). Then a(k) = Sum_{j >= 0} d(k,j)^2 + d(k-1,j)^2 = A026933(n)+A026933(n-1). This is a special case of the following formula for general Delannoy numbers: d(k,j) = Sum_{i >= 0, p=0..n} d(p, i) * d(n-p, j-i) + d(p-1, i) * d(n-p-1, j-i-1). - Peter E John, Oct 19 2006
Coefficient of x^n in (1 + 3*x + 2*x^2)^n. - N-E. Fahssi, Jan 11 2008
G.f.: 1/(1 - x - 2*x/(1 - x - x/(1 - x - x/(1 - x - x/(1 - ... (continued fraction). - Paul Barry, May 28 2009
G.f.: d/dx log(1/(1 - x*A001003(x))). - Vladimir Kruchinin, Apr 19 2011
G.f.: 1/(2*Q(0) + x - 1) where Q(k) = 1 + k*(1-x) - x - x*(k + 1)*(k + 2)/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Mar 14 2013
a(n) = Sum_{k=0..n} C(n,k) * C(n+k,k). - Joerg Arndt, May 11 2013
G.f.: G(0), where G(k) = 1 + x*(6 - x)*(4*k + 1)/(4*k + 2 - 2*x*(6-x)*(2*k + 1)*(4*k + 3)/(x*(6 - x)*(4*k + 3) + 4*(k + 1)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Jun 22 2013
G.f.: 2/G(0), where G(k) = 1 + 1/(1 - x*(6 - x)*(2*k - 1)/(x*(6 - x)*(2*k - 1) + 2*(k + 1)/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Jul 16 2013
G.f.: G(0)/2, where G(k) = 1 + 1/(1 - x*(6 - x)*(2*k + 1)/(x*(6 - x)*(2*k + 1) + 2*(k + 1)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Jul 17 2013
a(n)^2 = Sum_{k=0..n} 2^k * C(2*k, k)^2 * C(n+k, n-k) = A243949(n). - Paul D. Hanna, Aug 17 2014
a(n) = hypergeom([-n, -n], [1], 2). - Peter Luschny, Nov 19 2014
a(n) = Sum_{k=0..n/2} C(n-k,k) * 3^(n-2*k) * 2^k * C(n,k). - Vladimir Kruchinin, Jun 29 2015
a(n) = A049600(n, n-1).
a(n) = Sum_{0 <= j, k <= n} (-1)^(n+j)*C(n,k)*C(n,j)*C(n+k,k)*C(n+k+j,k+j). Cf. A126086 and A274668. - Peter Bala, Jan 15 2020
a(n) ~ c * (3 + 2*sqrt(2))^n / sqrt(n), where c = 1/sqrt(4*Pi*(3*sqrt(2)-4)) = 0.572681... (Banderier and Schwer, 2005). - Amiram Eldar, Jun 07 2020
a(n+1) = 3*a(n) + 2*Sum_{l=1..n} A006318(l)*a(n-l). [Eq. (1.16) in Qi-Shi-Guo (2016)]
a(n) ~ (1 + sqrt(2))^(2*n+1) / (2^(5/4) * sqrt(Pi*n)). - Vaclav Kotesovec, Jan 09 2023
a(n-1) + a(n) = A241023(n) for n >= 1. - Peter Bala, Sep 18 2024
a(n) = Sum_{k=0..n} C(n+k, 2*k) * C(2*k, k). - Greg Dresden and Leo Zhang, Jul 11 2025
EXAMPLE
G.f. = 1 + 3*x + 13*x^2 + 63*x^3 + 321*x^4 + 1683*x^5 + 8989*x^6 + ...
MAPLE
with(combinat, multinomial): seq(add(multinomial(n+k, n-k, k, k), k=0..n), n=0..20); # Zerinvary Lajos, Oct 18 2006
# Alternative:
seq(orthopoly[P](n, 3), n=0..100); # Robert Israel, Nov 03 2015
MATHEMATICA
f[n_] := Sum[ Binomial[n, k] Binomial[n + k, k], {k, 0, n}]; Array[f, 21, 0] (* Robert G. Wilson v, Mar 02 2011 *)
(* Alternative: *)
a[0] = 1; a[1] = 3; a[n_] := a[n] = (3(2 n - 1)a[n - 1] - (n - 1)a[n - 2])/n; Array[a, 21, 0] (* Robert G. Wilson v, Mar 02 2011 *)
(* Alternative: *)
CoefficientList[ Series[1/Sqrt[1 - 6x + x^2], {x, 0, 20}], x] (* Robert G. Wilson v, Mar 02 2011 *)
(* Alternative: *)
Table[LegendreP[n, 3], {n, 0, 22}] (* Jean-François Alcover, Jul 16 2012, from first formula *)
(* Alternative: *)
a[n_] := Hypergeometric2F1[-n, n+1, 1, -1]; Table[a[n], {n, 0, 22}] (* Jean-François Alcover, Feb 26 2013 *)
(* Alternative: *)
a[ n_] := With[ {m = If[n < 0, -1 - n, n]}, SeriesCoefficient[ (1 - 6 x + x^2)^(-1/2), {x, 0, m}]]; (* Michael Somos, Jun 10 2015 *)
PROG
(PARI) {a(n) = if( n<0, n = -1 - n); polcoeff( 1 / sqrt(1 - 6*x + x^2 + x * O(x^n)), n)}; /* Michael Somos, Sep 23 2006 */
(PARI) {a(n) = if( n<0, n = -1 - n); subst( pollegendre(n), x, 3)}; /* Michael Somos, Sep 23 2006 */
(PARI) {a(n) = if( n<0, n = -1 - n); n++; subst( Pol(((1 - x) / (1 - 2*x) + O(x^n))^n), x, 1); } /* Michael Somos, Sep 23 2006 */
(PARI) a(n)=if(n<0, 0, polcoeff((1+3*x+2*x^2)^n, n)) \\ Paul Barry, Aug 22 2007
(PARI) /* same as in A092566 but use */
steps=[[1, 0], [0, 1], [1, 1]]; /* Joerg Arndt, Jun 30 2011 */
(PARI) a(n)=sum(k=0, n, binomial(n, k)*binomial(n+k, k)); \\ Joerg Arndt, May 11 2013
(PARI) my(x='x+O('x^30)); Vec(1/sqrt(1 - 6*x + x^2)) \\ Altug Alkan, Oct 17 2015
(Python) # from Nick Hobson.
def f(a, b):
if a == 0 or b == 0:
return 1
return f(a, b - 1) + f(a - 1, b) + f(a - 1, b - 1)
[f(n, n) for n in range(7)]
(Python)
from gmpy2 import divexact
A001850 = [1, 3]
for n in range(2, 10**3):
# Chai Wah Wu, Sep 01 2014
(Maxima) a(n):=coeff(expand((1+3*x+2*x^2)^n), x, n);
makelist(a(n), n, 0, 12); /* Emanuele Munarini, Mar 02 2011 */
(SageMath)
a = lambda n: hypergeometric([-n, -n], [1], 2)
[simplify(a(n)) for n in range(23)] # Peter Luschny, Nov 19 2014
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
EXTENSIONS
New name and reference Sep 15 1995
Formula and more references from Don Knuth, May 15 1996
STATUS
approved
