

A171155


For two strings of length n, this is the number of pairwise alignments that do not have an insertion adjacent to a deletion.


6



1, 1, 3, 9, 27, 83, 259, 817, 2599, 8323, 26797, 86659, 281287, 915907, 2990383, 9786369, 32092959, 105435607, 346950321, 1143342603, 3772698725, 12463525229, 41218894577, 136451431723, 452116980643, 1499282161375, 4975631425581, 16524213199923, 54913514061867
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

This is the number of walks from (0,0) to (n,n) where unit horizontal (+1,0), vertical (0,+1), and diagonal (+1,+1) steps are permitted but a horizontal step cannot be followed by a vertical step, nor vice versa.
a(n) is also the number of walks from (0,0) to (n,n) with steps that increment one or two coordinates and having the property that no two consecutive steps are orthogonal.  Lee A. Newberg, Dec 04 2009
a(n) is also the number of standard sequence alignments of two strings of length n, counting only those alignments with the property that, for every pair of consecutive alignment columns, there is at least one sequence that contributes a nongap to both columns. That is, a(n) counts only those standard alignments with a column order that can be unambiguously reconstructed from the knowledge of all pairings, where a pairing is, e.g., that some ith position of the first string is in the same column as some jth position of the second string.  Lee A. Newberg, Dec 11 2009
First differences of A108626: a(n) = A108626(n)  A108626(n1) for n>=1.  Thomas Baruchel, Nov 08 2014
The number of walls of height one in all bargraphs of semiperimeter n>=2. A wall is a maximal sequence of adjacent up steps.  Arnold Knopfmacher, Nov 04 2016
Main diagonal of Table 2 in Covington.  Peter Bala, Jan 27 2018


LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..1000
A. Blecher, C. Brennan and A. Knopfmacher, Walls in bargraphs, preprint.
M. A. Covington, The Number of Distinct Alignments of Two Strings, Journal of Quantitative Linguistics, Vol.11 (2004), Issue3, pp. 173182


FORMULA

a(n) = ((4*n3)*a(n1)(2*n5)*a(n2)+a(n3)(n3)*a(n4))/n.  Alois P. Heinz, Jan 22 2013
G.f.: sqrt((1x)/(13*xx^2x^3)).  Mark van Hoeij, May 10 2013
G.f.: Sum_{n>=0} (2*n)!/n!^2 * x^(2*n) / (12*x)^(3*n+1).  Paul D. Hanna, Sep 21 2013
G.f.: Sum_{n>=0} x^n/(1x)^n * Sum_{k=0..n} C(n,k)^2 * x^k.  Paul D. Hanna, Nov 08 2014


EXAMPLE

For n = 3, the 9 alignments are:
ABC ABC ABC ABC ABC ABC ABC ABC ABC
DEF DEF DEF DEF DEF DEF DEF DEF DEF


MAPLE

a:= proc(n) option remember; `if`(n<4, [1, 1, 3, 9][n+1],
((4*n3)*a(n1) (2*n5)*a(n2) +a(n3) (n3)*a(n4))/n)
end:
seq(a(n), n=0..30); # Alois P. Heinz, Jan 22 2013


MATHEMATICA

CoefficientList[Series[Sqrt[(1  x) / (1  3 x  x^2  x^3)], {x, 0, 40}], x] (* Vincenzo Librandi, Nov 09 2014 *)


PROG

(PARI) x='x+O('x^66); Vec(sqrt((1x)/(13*xx^2x^3))) \\ Joerg Arndt, May 11 2013
(PARI) {a(n)=polcoeff(sum(m=0, n, (2*m)!/m!^2 * x^(2*m) / (1x+x*O(x^n))^(3*m+1)), n)} \\ Paul D. Hanna, Sep 21 2013
(PARI) {a(n)=polcoeff( sum(m=0, n, x^m * sum(k=0, m, binomial(m, k)^2 * x^k) / (1x +x*O(x^n))^m) , n)}
for(n=0, 30, print1(a(n), ", ")) \\ Paul D. Hanna, Nov 08 2014
(PARI) a(n)=sum(k=0, n, sum(i=0, k, binomial(nk, i)^2*binomial(ni, ki)))sum(k=0, n1, sum(i=0, k, binomial(nk1, i)^2*binomial(ni1, ki))) \\ Thomas Baruchel, Nov 09 2014


CROSSREFS

See A171158 for the number of such walks in three dimensions.  Lee A. Newberg, Dec 04 2009
See A171563 for the number of such walks in four dimensions.  Lee A. Newberg, Dec 11 2009
Cf. A108626.
Sequence in context: A099786 A237272 A192909 * A131428 A099787 A176826
Adjacent sequences: A171152 A171153 A171154 * A171156 A171157 A171158


KEYWORD

nonn,walk


AUTHOR

Lee A. Newberg, Dec 04 2009


EXTENSIONS

Extended beyond a(19) by Alois P. Heinz, Jan 22 2013


STATUS

approved



