---
abstract: 'The goal of this paper is to study the family of snake polyominoes.  More precisely, we focus our attention on the class of partially directed snakes.  We establish functional equations and length generating functions of two dimensional, three dimensional and then $N$ dimensional partially directed snake polyominoes.  We then turn our attention to partially directed snakes inscribed in a $b\times k$ rectangle and we establish two-variable generating functions, with respect to height $k$ and length $n$ of the snakes.  We include observations on the relationship between snake polyominoes and self-avoiding walks.  We conclude with a discussion on inscribed snakes polyominoes of maximal length which lead us to the formulation of a conjecture encountered in the course of our investigations.' 
address: ' Département de mathématiques et d’informatique, Université du Québec à Trois-Rivières, Trois-Rivières (QC) Canada'
author:
- 'Alain Goupil, Marie-Eve Pellerin, Jérôme de Wouters d’Oplinter'
title: Partially Directed Snake Polyominoes
---

Introduction
============

A two dimensional ($2D$) polyomino is an edge-connected set of cells in a regular lattice up to translation.  In this paper we are solely interested with sets of square cells with sides of unit length in the square lattice.  Since a polyomino can be seen as a simple graph with its square cells as vertices and its edge contacts between adjacent squares as edges, we will use the vocabulary of graph theory when we find it convenient.  Thus the degree of a cell in a polyomino is the number of its edge contacts with its neighbour cells. 

A [*snake polyomino*]{} of length $n$, shortly referred to as a snake, is a polyomino with $n$ cells, no cycle and such that each cell has edge degree at most two.  As a consequence a snake of length at least two has two cells of degree one.  The two cells of degree one, called the tail and the head, can be used to provide snakes with an orientation.  An [*oriented snake*]{} of length $n\geq 2$ is a snake with designated tail and head cells and the orientation goes from tail to head.  When the tail and head cells are not specified in a snake, we say that the snake is [*non-oriented*]{}.  A snake can always be given an orientation and we will call upon this property when needed but snakes are a priori considered non-oriented. 

Oriented snake polyominoes are similar objects to self-avoiding walks (see [@Bm]) but, to our knowledge, no bijective relation between the two sets has been established so far and we found no systematic investigation of snakes in the current literature. 

It is in fact quite straightforward to see that there is an injective map $\phi$ from the set $OS(n)$ of oriented snakes of length $n$ to the set $SAW(n)$ of self-avoiding walks with $n$ vertices by simply transforming cells of snakes into vertices of walks and drawing an edge between two vertices when the two corresponding cells are edge connected (Figure \[inj\]).  This means that the set $OS(n)$ is in bijection with a subset of $SAW(n)$. This correspondence is not invertible because the minimum number of cells needed to form a $U$ shape in a snake is superior by one to the minimum number of vertices in a $U$ shape of a $SAW$. By a $U$ shape, we mean either a snake or a self-avoiding walk that goes in a given direction, say East, then moves in a perpendicular direction, say North, then returns in the direction opposite to the initial one, here West, thus forming a $U$ shape.  Of course the initial direction in a $U$ shape can be any of the four directions. 

\[inj\]

A polyomino $P$ is said to be inscribed in a rectangle $R$ when $P$ is included in $R$ and the cells of $P$ touch each of the four sides of $R$. Enumeration of inscribed polyominoes with area minimal, minimal plus one and minimal plus two were investigated in [@GCN; @GCP].  Inscribed $3D$ polyominoes of minimal volume were investigated in [@GC].  Here the notation $b\times k$ is used for the dimension of the circumscribed rectangle.  This paper is devoted to the enumeration of partially directed snakes but more generally, we are interested in the combinatorial study of different classes of snake polyominoes which are presented in section \[class\]. 

In section \[nonins\] we construct the length generating functions of partially directed snakes.  We start with the two dimensional case, then we show that it is possible to extend the construction to the three dimensional and more generally to the $N$ dimensional cases.  In section \[insc\] we construct, for each value of the width $b$ of the circumscribed rectangle, a two-variable generating function for inscribed partially directed snakes.  The two parameters are the length $n$ of the snake and the height $k$ of the rectangle.  In order to realize this construction, we define subclasses of partially directed snakes and we establish their generating functions.  In particular we define the class of bubble snakes which is related to bargraph polyominoes (see [@BmR]) and we establish their length generating function by way of a combinatorial factorization.  In section \[bij\] we describe a straightforward bijection relating bargraphs to snakes that we have not seen elsewhere in the literature.  In the final section, we present a conjecture concerning inscribed snakes of maximal length. 

Families of snakes {#class}
==================

Our classification of snake polyominoes follow closely that of self-avoiding walks presented in [@Bm] from which we borrow part of the terminology.  Nevertheless snake polyominoes possess one geometrical property that cannot exist in self-avoiding walks: two cells of a snake separated by at least two cells may touch with their corners.  When there is no such pair of cells in a snake, we say that we have a [*kiss-free*]{} snake. 

A snake polyomino is a [*partially directed*]{} snake ([*PDS*]{}) towards the North when, starting from the tail, each new cell is added in one of the three directions North, East or West with the necessary constraint that East cannot follow immediately West and vice versa.  As a consequence, when a west step follows an east step in a [*PDS*]{}, there are at least two north steps between them.  The same is true when East follows West. 

Throughout this paper, we will adopt the convention of using capital letters $F(s,t,q)$ for generating functions, lower case letters $f(b,k,n)$ for their coefficients and calligraphic capital letters $\mathcal{F}(b,k,n)$ for the corresponding sets of snakes of length $n$ inscribed in a $b\times k$ rectangle: $$\begin{aligned}
F(s,t,q)=\sum_{b,k,n}f(b,k,n)s^bt^kq^n.\end{aligned}$$ The first values of $s(n)$, the total number of non-oriented snakes of length $n$, are presented in table \[tab2\] (see [*OEIS*]{} A182644 (voir [@OEIS]) for $n\leq 24$). 

Non-inscribed partially directed snakes {#nonins}
=======================================

When we want to emphasize on the fact that the rectangular dimensions of a snake are not constrained to specific values, we say that it is [*non-inscribed*]{} but when no confusion is possible, we simply call it a snake.  The parameter of interest for these snakes is the length.  In this section three families of [*PDS*]{} are investigated: two dimensional, three dimensional and $N$ dimensional snakes.  For each family, a functional equation is constructed and solved to obtain a one-variable rational generating function.  Exact formulas in terms of the length of the snakes are presented for the $2$[*D*]{} and the $3$[*D*]{} cases. 

Two dimensions
--------------

The one-variable generating function of $2$[*D*]{} [*PDS*]{}, denoted $PDS_{2D}(q)$, is defined by $$\begin{aligned}
PDS_{2D}(q)=\sum_{n\geq 0} pds_{2D}(n) q^n\end{aligned}$$ where $pds_{2D}(n)$ is the number of [*PDS*]{} of length $n$.

Recall that a [*PDS*]{} is formed using north, east and west steps only.  Moreover two north steps are required to change direction between east and west.  Thus the construction of a functional equation for [*PDS*]{} uses similar ideas to that of partially directed [*SAW*]{} (see [@Bm] or [@St] for generating function), also known as one-sided [*SAW*]{}, that have to be adapted to these additionnal constraints. 

In order to build the functional equation, note that the set of [*PDS*]{} admits a partition into two sets:

-   [*PDS*]{} without two consecutive north steps, $\mathcal S^1_{2D}$;

-   [*PDS*]{} containing two consecutive north steps at least once, $ \mathcal S^2_{2D}$.

Samples of each sets are illustrated in Figure \[NonInsc\_pds1N2N\]. 

Since two consecutive north steps are required to change direction from East to West or from West to East in a [*PDS*]{}, snakes in $\mathcal S^1_{2D}$ cannot have both west and east steps.  In fact these snakes either have north or east steps only or they have north or west steps only.  Lets call [*North-East*]{} snakes the oriented [*PDS*]{} in $\mathcal S^1_{2D}$ with only north or east steps. [* North-West*]{} snakes are defined similarly.  The North-East snakes are counted by Fibonacci numbers, as proved in the next Proposition. 

\[propSNE\] The number of North-East snakes of length $n$, $s_{NE}(n)$, satisfies the relation $$\begin{aligned}
s_{NE}(n)=s_{NE}(n-1)+s_{NE}(n-2) 
\label{sNE}\end{aligned}$$ with $s_{NE}(0)=s_{NE}(1)=1$, which is equal to the $(n+1)^\text{e}$ Fibonacci number.  Consequently the generating function of North-East snakes is $$\begin{aligned}
S_{NE}(q)&=\sum_{n\geq 0}s_{NE}(n)q^n=\frac{1}{1-q-q^2}.  
\label{S_{NE}(z)}\end{aligned}$$

We use the well known interpretation of Fibonacci numbers as the number of tilings of a $b\times 1$ board with monominoes and dominoes (see [@Benjamin2003proofs]).  It is immediate that these tilings are in one-to-one correspondence with North-East snakes when we observe that starting from the left, we place dominoes in vertical positions and the following piece at the upper end of the domino, as illustrated in Figure \[NonInsc\_SNEE\_bijection\].  The monomino-domino tiling of a $n\times 1$ rectangle being counted by the $(n+1)^e$ Fibonacci number, North-East snakes must satisfy equation  from which equation  is obtained by use of standard methods (see [@Wilf1994]). 

![ Bijection from monomino(red)-domino(blue) tilings of a row towards North-East snakes \[NonInsc\_SNEE\_bijection\]](NonInsc_SNEE_bijection.eps)

By symmetry there are as many North-East snakes as North-West snakes.  However the non-oriented snakes consisting of only east steps are the same as the snakes with west steps only.  Also the unique snake of length 2 with one north step belongs to the two sets.  As a result of these observations, we obtain the following generating function of the set $\mathcal S^1_{2D}$: $$\begin{aligned}
S^1_{2D}(q)=\frac{2}{1-q-q^2}-\frac{1}{1-q}-q^2. 
 \label{S_{1N}(z)}\end{aligned}$$ Consider $W\in\mathcal{S}^2_{2D}$. Identifying the last two consecutive north steps when moving from bottom to top, three disjoint parts appear in $W$ respectively illustrated in green, red and blue in Figure \[NonInsc\_S2N\]: [*i*]{}) any [*PDS*]{}, [*ii*]{}) two north steps and [*iii*]{}) either a North-East or a North-West snake.  This combinatorial factorization is the key to obtain the generating function ${S}^2_{2D}(q)$.

![ A [*PDS*]{} in $\mathcal{S}^2_{2D}$ \[NonInsc\_S2N\]](NonInsc_S2N.eps)

The generating function of [*PDS*]{} containing two consecutive north steps at least once is $$\begin{aligned}
S^2_{2D}(q)=\left(PDS_{2D}(q)-1+\frac{q^2}{1-q}\right)q^2\left(\frac{2}{1-q-q^2}-1\right).  
\label{S_{2N}(q)}\end{aligned}$$

The three factors in equation  correspond to each of the three parts of $W$. The left factor represents any [*PDS*]{} where the subtraction of 1 guarantees that the [*PDS*]{} is not empty, i.e. that we add at least one cell in order to build the two last consecutive north steps.  Moreover since two consecutive north steps can be appended to a horizontal row of length at least $2$ in two different ways, the term $\frac{q^2}{1-q}$ is added.  The middle factor $q^2$ in equation  is coding the last two consecutive north steps (red cells in Figure \[NonInsc\_S2N\]).  The right factor is twice the North-East snakes generating function , since there are as many North-East snakes as North-West snakes, with $1$ subtracted since there is only one way to add an empty snake to the red north steps. 

Since $\mathcal{S}^1_{2D}$ and $\mathcal{S}^2_{2D}$ form a partition of the set $\mathcal{PDS}$, the sum of  and  gives a functional equation for 2[*D*]{} [*PDS*]{}: $$\begin{aligned}
PDS_{2D}(q)=\left(PDS_{2D}(q)-1+\frac{q^2}{1-q}\right)q^2\left(\frac{2}{1-q-q^2}-1\right)+\frac{2}{1-q-q^2}-\frac{1}{1-q}-q^2\end{aligned}$$ which is immediately solved to obtain the rational generating function $$\begin{aligned}
\label{PDS2D}
PDS_{2D}(q)&=\frac{q^5+q^3+q^2-2q+1}{(1-q)(1-2q-q^3)}\\
\nonumber
    &=1+q+2q^2+6q^3+14q^4+32q^5+72q^6+160q^7+ 354q^8+\cdots.\end{aligned}$$ A formula giving the number of 2[*D*]{} [*PDS*]{} according to its length $n$ is obtained by converting the rational expression of $PDS_{2D}(q)$ into partial fractions: $$\begin{aligned}
pds_{2D}(n)&=\frac{1}{59}\sum_{\alpha:1-2\alpha-\alpha^3=0 } (13\alpha^{-1}+11-5\alpha)\alpha^{-n}-1\qquad n\geq 2,\\
pds_{2D}(0)&=pds_{2D}(1)=1.\end{aligned}$$

Three dimensions
----------------

A $3$[*D*]{} polyomino is a face-connected set of unit cubes in the discrete three dimensional space.  A $3$[*D*]{} [*PDS*]{} (towards the $yz$ plane) is a $3$[*D*]{} polyomino that starts at the origin and is formed with steps along the axis $x$, $y$ and $z$ where negative movement along the $y$ and $z$ axis are prohibited.  The possible directions from one cell to a face-connected neighbour cell are denoted by $x^+,\ x^-,\ y^+$ and $z^+$. The $3$[*D*]{} [*PDS*]{} are a natural extension of the $2$[*D*]{} [*PDS*]{} which are snakes that can only have directions both positive and negative along the $x$ axis and positive along the $y$ axis. 

$3$[*D*]{} $\mathcal{ PDS}$ is partitionned into two sets, as shown in Figure \[Parti3dPDS\]:

-   $3$[*D*]{} [*PDS*]{} that do not contain two consecutive steps in the set of directions $\{y^+,z^+\}$, $\mathcal{S}_{3D}^{1}$;

-   $3$[*D*]{} [*PDS*]{} that contain two consecutive steps at least once taken in the set of directions $\{y^+,z^+\}$, $\mathcal{S}_{3D}^{2}$.

Figure \[Setyz\] shows the four types of restricted directions in $\mathcal{S}_{3D}^{1}$.. The set $\mathcal{S}_{3D}^{1}$ is analogous to the set $\mathcal S^1_{2D}$, in which the snakes were not allowed to go from East to West, i.e from $x^+$ to $x^-$. As a consequence of prohibiting two consecutive steps in the set $\{y^+,z^+\}$, snakes belonging to $\mathcal{S}_{3D}^{1}$ cannot contain both directions $x^+$ and $x^-$. So snakes in $\mathcal{S}_{3D}^{1}$ either have $x^+$ or $x^-$ steps but not both, leading to describe $PDS_{x^+}$ and $PDS_{x^-}$ snakes.  Lets denote $\mathcal{PDS}_{x^+}$ the set of snakes in $\mathcal{S}_{3D}^{1}$ with $x^+$ moves.  $\mathcal{PDS}_{x^-}$ is similarly defined. 

The number of $PDS_{x^+}$ of length $n$, denoted $pds_{x^+}(n)$, satisfies the relation $$\begin{aligned}
pds_{x^+}(n)=pds_{x^+}(n-1)+2pds_{x^+}(n-2), \label{pds_{x^+}(n)}\end{aligned}$$ with $pds_{x^+}(0)=pds_{x^+}(1)=1$ and the length generating function of $PDS_{x^+}$ is $$\begin{aligned}
PDS_{x^+}(q)=\sum_{n\geq 0}pds_{x^+}(n)q^n=\frac{1}{(1+q)(1-2q)} \label{PDS_{x^+}(z)}\end{aligned}$$ so that $$\begin{aligned}
pds_{x^+}(n)=\frac{1}{3}\left(2^{n+1}+(-1)^n\right).  \label{pds_{}x^+(n)}\end{aligned}$$

A $PDS_{x^+}$ of length $n$ starts with a step in $\{x^+, y^+,z^+\}$. If the first step is $x^+$, then the second step is $x^+$, $y^+$ or $z^+$. Consequently the snake is completed by any $PDS_{x^+}$ of length $n-1$. If the first step is $y^+$ or $z^+$, then it must be followed by an $x^+$ step and, to complete the snake, any $PDS_{x^+}$ of length $n-2$ can be concatenated.  This yields equation  from which we deduce equation .  The exact formula  is obtained from equation . 

The sets $\mathcal{PDS}_{x^+}$ and $\mathcal{PDS}_{x^-}$ are not disjoint.  The horizontal rows of cells (formed with $x^+$ steps only or with $x^-$ steps only), the unique snake with one $y^+$ and the unique snake with one $z^+$ belong to the two sets.  As a consequence the generating function of $3$[*D*]{} [*PDS*]{} that does not contain two consecutive steps in the set $\{y^+,z^+\}$ is $$\begin{aligned}
S_{3D}^{1}(q)=\frac{2}{(1+q)(1-2q)}-\frac{1}{1-q}-2q^2.  \label{S_{3D}^{1yz}(z)}\end{aligned}$$ A snake $V$ in $\mathcal{S}_{3D}^{2}$ can always be decomposed in three distinct parts shown respectively in red, green and blue in Figure \[3partsS2yz\]: [*i*]{}) any $3$[*D*]{} [*PDS*]{}, [*ii*]{}) the last two consecutive directions taken in the set $\{y^+,z^+\}$ when going from bottom to top in $V$, [*iii*]{}) either a $PDS_{x^+}$ snake or a $PDS_{x^-}$ snake. 

The generating function of the set $\mathcal{S}_{3D}^{2}$ is $$\begin{aligned}
{S}_{3D}^{2}(q)=\left( PDS_{3D}(q)-1+\frac{q^2}{1-q}\right) 4q^2 \left(\frac{2}{(1+q)(1-2q)}-1\right)\label{{S}_{3D}^{2yz}}.\end{aligned}$$

The three parts described earlier yield the three factors of equation , in similarity with the $2$[*D*]{} case.  The left factor characterizes any $3$[*D*]{} [*PDS*]{} where 1 is subtracted and $\frac{q^2}{1-q}$ is added respectively to assure that the $3$[*D*]{} [*PDS*]{} is not empty and because there are two ways to append a given choice of two consecutive steps to a horizontal row.  The middle factor $4q^2$ represents the four possibilities of two consecutive steps taken in $\{y^+,z^+\}$. The right factor is twice the generating function $PDS_{x^+}(q)$ of equation  , since $PDS_{x^+}$ and $PDS_{x^-}$ are symmetric snakes.  Moreover 1 is subtracted to take into account that an empty snake can be appended in only one way to two consecutive steps in $\{y^+,z^+\}$.

The one-variable generating function of $3$[*D*]{} [*PDS*]{}, denoted $PDS_{3D}(q)$, is defined by $PDS_{3D}(q)=\sum_{n\geq 0} pds_{3D}(n) q^n$ where $pds_{3D}(n)$ is the number of $3$[*D*]{} [*PDS*]{} of length $n$. Because the sets $\mathcal{S}_{3D}^{1}$ and $\mathcal{S}_{3D}^{2}$ form a partition of $3$[*D*]{} ${\mathcal{PDS}}$, the sum of equations  and  gives a functional equation for $3$[*D*]{} [*[PDS]{}*]{}: $$\begin{aligned}
PDS_{3D}(q)&=\left( PDS_{3D}(q)-1+\frac{q^2}{1-q}\right) 4q^2 \left(\frac{2}{(1+q)(1-2q)}-1\right)\\ &\quad+\frac{2}{(1+q)(1-2q)}-\frac{1}{1-q}-2q^2.\end{aligned}$$ This equation is directly solved to obtain $$\begin{aligned}
\label{PDS3D}
PDS_{3D}(q)&=\frac{4q^5+2q^4+2q^2-3q+1}{(1-q)(1-3q-4q^3)}\\
\nonumber
             &= 1+q+3q^2+13q^3+45q^4+153q^5+517q^6+1737q^7+5829q^8+\cdots.\end{aligned}$$ Expressing the rational generating series $PDS_{3D}(q)$ into partial fractions, the number of $3$[*D*]{} [*PDS*]{} of length $n$ is given by $$\begin{aligned}
pds_{3D}(n)&=\frac{1}{12}\sum_{\alpha:1-3\alpha-4\alpha^3=0} (\alpha^{-1}+1)\alpha^{-n}-1 \qquad n\geq 2,\\
pds_{3D}(0)&=pds_{3D}(1)=1.\end{aligned}$$

N dimensions $\mathbf{PDS}$
---------------------------

There is a natural extension of partially directed snakes in two and three dimensions to the $N$-dimensional lattice $\mathbb{Z}^N$.These $N$-dimensional snakes are denoted $ND$ $PDS$ and their set of possible directions along the coordinate axes is denoted $\{x_1^+,x_1^- ,x_2^+,\ldots , x_N^+\}$. Steps in the negative direction is allowed only along the $x_1$ axis and forbidden along the other axis $x_2,x_3,\ldots , x_n$. We partition again the set $\mathcal{ND\; PDS}$ in two disjoint subsets:

-   $ND$ [*PDS*]{} that do not contain two consecutive steps in the set $\{x_2^+,x_3^+,\ldots , x_N^+\}$: $\mathcal{S}_{ND}^{1}$;

-   $ND$ [*PDS*]{} that contain two consecutive steps in the set $\{x_2^+,x_3^+,\ldots , x_N^+\}$ at least once: $\mathcal{S}_{ND}^{2}$.

If we denote by $\mathcal{PDS}_{x_1^+}$ the set of snakes in $\mathcal{S}_{ND}^{1}$ with $x_1^+$ steps only, then the cardinalty of that set satisfies $$\begin{aligned}
pds_{x_1^+}(n)&=pds_{x_1^+}(n-1)+(N-1)pds_{x_1^+}(n-2)\end{aligned}$$ with $pds_{x_1^+}(0)=pds_{x_1^+}(1)=1$ from which we deduce the length generating function $$\begin{aligned}
PDS_{x_1^+}(q)&=\frac{1}{1-q-(N-1)q^2}\end{aligned}$$ then, using arguments similar to the $2D$ and $3D$ cases, we deduce the exact formula $$\begin{aligned}
pds_{x_1^{+}}(n) = \frac{(2 - 2N)\left(\frac{2 - 2N}{1 - \sqrt{4N - 3}}\right)^{n}}{ (1 - \sqrt{4N-3})\sqrt{4N - 3}} + \frac{(2N - 2) \left(\frac{2 - 2N}{1 + \sqrt{4N - 3}} \right)^n}{(1 + \sqrt{4N - 3})\sqrt{4N - 3}}\end{aligned}$$ and the following rational expressions for the generating functions of the two sets $\mathcal{S}_{ND}^{1}$ and $\mathcal{S}_{ND}^{2}$: $$\begin{aligned}
& S_{ND}^{1}(q) = \frac{2}{q^{2}(1-N) - q + 1} - \frac{1}{1 - q} - (N-1)q^{2},\\
& S_{ND}^{2}(q) = \left(PDS_{ND}(q) - 1 + \frac{q^{2}}{1 - q} \right) (N-1)^{2}q^{2} \left(\frac{2}{q^{2}(1-N) - q + 1} - 1 \right).\end{aligned}$$ Then solving the functional equation $$\begin{aligned}
 PDS_{ND}(q) = S_{ND}^{1}(q) + S_{ND}^{2}(q),\end{aligned}$$ we obtain the following rational expression for the generating function of $N$ dimensional partially directed snakes $$\begin{aligned}
 \label{PDSND}
 PDS_{ND}(q) = \frac{(N-1)^{2}\ q^{5} + (N-1)(N-2)q^{4} - (N-1)(N-3)q^{3} + (N-1)q^{2} - Nq + 1}{(1-q)(1 - Nq - (N-1)^{2}\ q^{3})}.\end{aligned}$$ Equations (\[PDS2D\]) and (\[PDS3D\]) are the special cases $N=2$ and $N=3$ of equation (\[PDSND\]). 

Inscribed partially directed snakes {#SecInscribedPDS}
===================================

\[insc\] Let $pds(b,k,n)$ be the number of partially directed snakes of length $n$ inscribed in a rectangle of size $b\times k$ and define the corresponding generating function $PDS(s,t,q)$ as $$\begin{aligned}
PDS(s,t,q)=\sum_{b,k,n}pds(b,k,n)s^bt^kq^n.\end{aligned}$$

The goal of this section is to present rational expressions for the generating functions $PDS_b(t,q)$ of partially directed snakes of width $b$. In [@Bm] functional equations were first established and then solved to obtain generating functions for bargraph polyominoes.  The method used in the present section is different and consists in starting from a primitive snake for which we know the generating function, stacking on top of each other fundamental pieces of snakes that will produce all possible snakes of a given width $b$ and then modify accordingly the corresponding generating function.  Thus the constructions of the snakes and of the generating functions evolves simultaneously.  The rules for establishing the correspondence are quite straightforward: $i)$ Stacking one family of snakes on top of another corresponds to the product of the corresponding generating functions.  $ii)$ Picking in a bag an arbitrary number of snakes belonging to a family $\mathcal{A}$ and then stacking these snakes on top of the current snake is represented by the multiplication of the current generating function with $\frac{1}{1-A(s)}$ where $A(s)$ is the generating function of the family $\mathcal{A}$.

Let $b$ and $k$ be respectively the horizontal and vertical lengths of the rectangle.  We need four kinds of $PDS$ to construct our generating functions: crossings, bubbles, endings and pillars.  The snakes in the last family are used to connect snakes of the other kinds and are defined in section \[Sec4.1\].  These four kind of snakes are combined in different ways to form four disjoint families of snakes whose union will be the entire set $\mathcal{PDS}(b,k,n)$. In section \[Sec4.2\] generating functions of these snakes are presented. 

Families of inscribed partially directed snakes {#Sec4.1}
-----------------------------------------------

A [*bubble*]{} is a snake with its tail and head in the same column adjacent to a vertical side of the rectangle and its other cells in the other columns in the rectangle that do not touch the other side of the rectangle so that a bubble is not an inscribed snake.  The set of bubble snakes with head and tail on a given side of the rectangle, say left, that occupies $r$ columns ($r<b$) is denoted $\mathcal{B}_r(k,n)$ and $r$ is called the width of the bubble.  A [*crossing*]{} of width $b$ is an inscribed [*PDS* ]{}whose only two cells adjacent to the left and right sides of the rectangle are the tail and head of the snake.  When the tail touches the left side, the head touches the right side and vice versa.  The set of crossings of length $n$ inscribed in a $b\times k$ rectangle with bottom cell in its left corner is denoted $\mathcal{C}(b,k,n)$. An [*ending*]{} is a partially directed snake whose only cell in the column on one side of the rectangle is the tail.  The set of endings with tail on a given side of the rectangle is denoted $\mathcal{E}(b,k,n)$. Vertical rows of cells on a column adjacent to a side of the rectangle are called [*pillars*]{} with length generating function noted $P(t,q)$. Orientation is not relevant in these four kind of snakes which are therefore non-oriented snakes.  Figure \[famSnake\] shows a sample of snakes from each kind where the blue cells in Figures \[fambubble\] and \[famEnd\] are part of a pillar necessary when they are piled over an existing snake. 

Using a symmetry argument, we can stack on top of each other snakes of each of the families just defined and shown in Figure \[fam\].  In this stacking process, pillars are used as connectors between a snake in one of the three other families and the current snake.  Bubble and crossing snakes may appear an arbitrary number of times in a snake but endings can be used only once at each end of the snake to terminate the stacking process.  This observation allows the use of ordinary product of generating functions to describe sets of inscribed $\mathcal{PDS}$. In fact we will show that all $PDS$ are obtained in this way and that they belong to exactly one of the following four families of inscribed snakes. 

Family $\mathcal{F}_1$ is made of two crossings between which there is an arbitrary number of crossings and bubbles.  Endings can be added at each end of the two mandatory crossings.  Here we use crossings and bubbles up to vertical symmetry and the factor $2$ in equation (\[f1\]) refers to the two choices offered for the lowest crossing in the snake : left or right side of the rectangle for the bottom cell. 

Family $\mathcal{F}_2$ has one mandatory crossing and one mandatory bubble.  The stacking process starts with a crossing and finishes with a bubble.  Between these two snakes, there is an arbitrary number of crossings and bubbles.  Again ending snakes can be added to each extremity of this structure.  Here we use a horizontal and a vertical symmetry to collect all the snakes of this family which explains the factor $4$ in equation (\[f2\]). 

Family $\mathcal{F}_3$ has one crossing snake between two mandatory bubbles.  On one side of the crossing, there is at least one bubble with no crossing.  On the other side of the crossing, there are an arbitrary number of crossings and bubbles terminating with one bubble.  Each extremity of this structure has a possible ending.  We use a horizontal symmetry to collect all snakes of this family which is why the factor $2$ appears in equation (\[f3\]). 

Finally the set $\mathcal{F}_4$ is made of a unique crossing, no bubble, with possible ending snakes on each extremity.  We multiply by two the expression in equation (\[f4\]) because of a vertical symmetry.  We remove the snake $H$ which consists of a single horizontal row from this set for it would otherwise be counted twice. 

Samples from families $\mathcal{F}_1$ to $\mathcal{F}_4$ are shown in Figure \[fam\] and their structure is explicitly described in the following equations where we use the notation $()^*$ to mean that the family of snakes inside the parenthesis can be appended an arbitrary number of times. 

&\_[1]{} := 2( ) C (P (C B))\^[\*]{} P C ( )\[f1\]\
&\_[2]{} := 4( ) C (P (C B))\^[\*]{} P B ( )\[f2\]\
&\_[3]{} := 2( ) B (P B)\^[\*]{} P C (P (C B))\^[\*]{} P B\
&( )\[f3\]\
&\_[4]{} := 2( ) C ( ) - H\[f4\]

These equations are transformed into generating functions in section \[genfunc\].  As explained above, the factors $2$ and $4$ in equations (\[f1\]) to (\[f4\]) are the result of the use of symmetries to obtain all snakes in the corresponding families. 

By construction, families $\mathcal{F}_1$ to $\mathcal{F}_4$ are disjoint and any inscribed $PDS$ belongs to one of these families.  We thus obtain the following proposition

\[proppart\] For all positive integers $b,k$ and $n\geq b+k-1$, we have $$\begin{aligned}
{\mathcal{PDS}}(b,k,n)=\mathcal{F}_1(b,k,n)+\mathcal{F}_2(b,k,n)+\mathcal{F}_3(b,k,n)+\mathcal{F}_4(b,k,n).\end{aligned}$$

The proof is based on the following observations. [* i*]{}) Each inscribed $PDS$ contains at least one crossing. [* ii*]{}) Any inscribed snake can be factored in a unique way as a juxtaposition of crossings, bubbles, endings and pillars. [* iii*]{}) Appending an ending snake at one step terminates the stacking process in one direction.  The head of the ending snake then becomes the head or tail of the entire snake.  Any snake is the juxtaposition of a central part with possible endings appended on each side.  If the central part begins and ends with two different crossings then we have the set $\mathcal{F}_1$. If the central part begins with a crossing and ends with a bubble then we have the set $\mathcal{F}_2$. If the central part begins and ends with a bubble then we have $\mathcal{F}_3$. Finally if the center has exactly one crossing and no bubble then we have $\mathcal{F}_4$. There is no other possibility for the central part.\

Generating Functions {#Sec4.2}
--------------------

\[genfunc\] Recall that the variables $s,\ t,\ q$ provide respectively the width and height of the rectangle and the length of the snake.  Since the column in which a pillar occur is accounted for in the other families of snakes, the variable $s$ is absent from the generating function $P(t,q)$ of pillars with at least one cell and thus becomes $$P(t,q)=\frac{tq}{1-tq}.$$ In the expansions of generating functions that follow, we will often omit to explicitly declare the formal variables $t$ and $q$ when their presence is obvious, especially for the generating functions $PB(t,q)$ and $B(t,q)$ that will simply be written $PB$ and $B$ respectively. 

#### **Bubbles of given width**

The generating function for the bubbles $\mathcal{B}_2(k,n)$ of width two is $$\begin{aligned}
B_2(t,q)=\frac{t^3q^5}{1-tq}.\end{aligned}$$ The generating function of bubbles on top of pillars (see Figure \[bubblesA\]) is done by multiplication of generating functions.  Thus a bubble of width $r$ with a pillar at its bottom, denoted $PB_r$, is the product $$\begin{aligned}
PB_r=B_r\times P\end{aligned}$$ of the corresponding generating functions.  For instance $PB_2(t,q)=\frac{t^4q^6}{(1-tq)^2}$. Bubbles in $\mathcal{B}_3$ are obtained by juxtaposition of possibly several snakes in $\mathcal{PB}_2$ on top of one bubble in $\mathcal{B}_2$. Then two pillars are added on each end in the tail and head column together with two new cells on a new third column.  These two new cells become the new head and tail of the bubble in $\mathcal{B}_3$. This construction, shown in Figure \[bubblesB\], gives $$\begin{aligned}
B_3(t,q)=\frac{B_2}{(1-PB_2)}\times \frac{q^2}{(1-tq)^2}=
\frac{t^3q^7}{((1-tq)^2-t^4q^6)(1-tq)}.\end{aligned}$$

To construct a $B_4$ snake, we need at least one $B_3$ to which we append an arbitrary number of $B_2$ and $B_3$ on each side.  Assume that the mandatory $B_3$ is the lowest among all the $B_3$ present (see Figure \[bubblesC\_Cor\]).  Then below that $B_3$ is an arbitrary number of $B_2$ and above are an arbitrary number of $B_2$ and $B_3$. Then we append a possible pillar and one cell in a new column on each extremity.  All $B_4$ satisfy this description which is translated into the following expression : $$\begin{aligned}
B_4(t,q)&= \frac{B_3}{(1-PB_2)(1-PB_2-PB_3)} \times \frac{q^2}{(1-tq)^2}.\end{aligned}$$

The precedent description for the set $\mathcal{B}_4$ can be extended to all sets $\mathcal{B}_r$ with $r\geq 3$ so that we have a rational generating function for each bubble in $\mathcal{B}_r$.

\[propbubl\] For all integers $r\geq 3$ we have $$\begin{aligned}
B_r(t,q)&=\frac{B_{r-1}}{(1-\sum_{i=2}^{r-2}PB_i)(1-\sum_{i=2}^{r-1}PB_i)} \times \frac{q^2}{(1-tq)^2}.\end{aligned}$$

#### **Bubbles of arbitrary width**

The task of finding a generating function $B(t,q,w)$ for bubbles of arbitrary width is made possible by the existence of an elegant combinatorial factorization that appear in Figure \[bubni\] reminiscent of a factorization of Dyck paths (see for instance [@Ge]).  This figure informs us that a bubble is either a minimal bubble or a stack of bubbles with pillars on top of an initial bubble terminated on each end by one possible pillar and a mandatory cell on a new column. 

This translates into the following equation where $B$ stands for $B(t,q,w)$. Recall that the variables $t$ and $q$ carry respectively the height and length statistics of the bubble.  We introduce a new statistic called the horizontal half-perimeter which counts half the number of horizontal unitary cell edges on the perimeter of the bubble.  For example the bubble in Figure \[bubblesA\] has horizontal half-perimeter equal to $3$. The half-perimeter statistic is known in the literature (see [@BmR]) and it is carried by the variable $w$ in $B$. $$\begin{aligned}
B=&\frac{w^3t^3q^5}{1-tq} + \frac{wq}{1-tq} \frac{B}{1-PB} \frac{wq}{1-tq}.\end{aligned}$$ This equation is easily solved to give the following expression: $$\begin{aligned}
\label{BNI}
& B=  \frac{1}{2tq(1-tq)} 
\left(1-2tq+w^3t^4q^6-w^2q^2+t^2q^2-\right.\\ \nonumber
&\left.\sqrt{(1+2wq -2tq + w^2q^2 +t^2q^2 -2wq^2t-w^3t^4q^6)(1-2wq-2tq +w^2q^2+t^2q^2+2wq^2t-w^3t^4q^6)}\right).\end{aligned}$$ Setting $t=1$ and $w=1$ reduces equation ([\[BNI\]]{}) to the length generating function $B(q)$: $$\begin{aligned}
 B(q)=  \frac{1}{2q} 
\left(1-q-q^2-q^3-q^4-q^5- \sqrt{(1+q)(1+q+q^2)(1-q+q^2)(1-q-q^2)(1-2q-q^3)}\right)\end{aligned}$$ This generating function, which is algebraic, describes the sequence $A023422$ in the $OEIS$ bank of sequences.  Bubbles snakes belong to the class of non-simple excursions in the lattice paths classification proposed in [@BF].  This combinatorial factorization cannot handle the width parameter $r$. For that reason the generating function of bubbles of given width cannot be obtained with this method.\

#### **Crossings**

The generating function of crossings of width $2$ and $3$ are easy to establish (see Figures \[crossing2\] and \[crossing3\]) and are given by the following expressions $$\begin{aligned}
  C_2(t,q)&=tq^2,\\
    C_3(t,q)&=\frac{tq^3}{1-tq}=\frac{q}{1-tq}C_2(t,q).  \end{aligned}$$

Crossings of width $b=4$ (see Figure \[crossing4\]) are constructed from bottom to top and left to right as follow.  First there is a crossing of width $3$. On top of it an arbitrary number (possibly zero) of bubbles of width two with their pillar are stacked and then a possible final pillar and finally one cell in the fourth column.  This gives $$\begin{aligned}
  C_4(t,q)&=C_3(t,q)\left( \frac{1}{1-PB_2}\right)\frac{q}{1-tq}. 
  \end{aligned}$$ Let’s factor the crossing $C_5$ to describe its generating function and obtain a better understanding of the general case.  Moving from bottom to top, the first factor is a crossing of width $4$ (green part in Figure \[crossing5\]).  On top of that crossing is a stack of an arbitrary number of bubbles with pillars of width $2$ or $3$ (red part in Figure \[crossing5\]).  Finally the end comes with a possible pillar on the fourth column and a last cell in the fifth column (blue part in Figure \[crossing5\]).  This factorization gives the following expression: $$\begin{aligned}
  C_5(t,q)&=C_4(t,q)\left( \frac{1}{1-PB_2-PB_3}\right)\frac{q}{1-tq}.\end{aligned}$$

For crossings of arbitrary width $b$, there is a similar factorization in three parts: $i)$ A crossing of width $b-1$ (green cells in Figure \[cros\]).  $ii)$ A stack of bubbles of width $2$ to $b-2$ (red cells in Figure \[cros\]).  $iii)$ A pillar in column $b-1$ and one cell in column $b$ (blue cells in Figure \[cros\]).  We have proved the following result. 

\[propcros1\]For all $b\geq 3$ we have $$\begin{aligned}
C_b(t,q)&=C_{b-1}(t,q)\left( 
\frac{1} {1-\sum_{i=2}^{b-2}PB_i}\right) \frac{q}{1-tq}
&=   \left(\frac{q}{1-tq}\right)^{b-2}\frac{tq^2}{\prod_{j=2}^{b-2}\left( 1-\sum_{i=2}^{j}PB_i\right)}.\end{aligned}$$

From propositions \[propbubl\] and \[propcros1\] we obtain an expression for crossings in terms of bubbles :

For all integers $b\geq 3$ we have

$$\begin{aligned}
C_{2k+1}(t,q)=\frac{\prod_{i=1..k}B_{2i}} {\prod_{i=2..k}B_{2i-1}}\times \frac{1}{t^2q^2}\\
C_{2k}(t,q)=\frac{\prod_{i=2..k}B_{2i-1}} {\prod_{i=1..k-1}B_{2i}}\times \frac{(1-tq)} {t^2q^3}\end{aligned}$$

#### **Endings**

The most elementary non bubble or non crossing end of a $PDS$ is a pillar.  To fix ideas, let’s number the columns of the rectangle from left to right.  As a warm up, we construct the generating function $E_b^2(t,q)$ of ending snakes in a rectangle of width $b$ with the last cell on the second column (see Figure \[famEnd\]) by stacking its parts upwards. 

We start with a crossing of width two (green cells in Figure \[endA\]).  The second part is a possible pillar (blue cells in Figure \[endA\]).  The third part is a possible stack of bubbles (red cells in Figure \[endA\]) of variable width of value at most $b-2$. But the first cell of the first bubble can be the last cell of the initial crossing which means that we divide the generating function of the first bubble by $tq$. Finally the fourth part is a possible final pillar on top of the last bubble (last blue cell in Figure \[endA\]).  With this factorization we obtain $$\begin{aligned}
 E_b^2(t,q)
  &=tq^2 \times \frac{1}{1-tq}\times \left( 1+ \frac{\sum_{i=2}^{b-2}B_i} {tq(1-\sum_{i=2}^{b-2}PB_i)}
  \times \frac{1}{1-tq}\right). 
  \end{aligned}$$

Now lets turn to the general case $E_b^c(t,q)$ where the ending finishes on column $c$ with $1<c<b$. We are going to factor the snake from left to right and bottom to top.  As in $E_2$, we start with a horizontal row of two cells (green cells in Figure \[endB\]).  The next factor is the move from column two to column three made of a possible pillar (first blue pillar in Figure \[endB\]) followed by one of the two possible patterns: $i)$ A unique cell in the third column $ii)$ At least one bubble on the second column followed by a pillar of height at least two and a cell in the third column.  The first bubble may start with the last cell of the previous factor.  This gives $$\begin{aligned}
  \label{fact1}
 \mbox{First factor:}\; \frac{tq^2}{1-tq} \left( q+\frac{\sum_{i=2}^{b-2}B_i} {(1-\sum_{i=2}^{b-2}PB_i)}\frac{t^2q^3}{tq(1-tq)}
  \right). 
  \end{aligned}$$

The second factor starts at the end of the first factor and ends with the first cell on the fourth column immediately after the last visit on the third column.  It describes the part of the snake from column three to column four, as shown in Figure \[endC\], where the black cells belong to the previous factor.  This gives $$\begin{aligned}
\label{fact2}
 \mbox{Second factor:}\; \frac{1}{1-tq} \left(q+\frac{\sum_{i=2}^{b-3}B_i} {(1-\sum_{i=2}^{b-3}PB_i)}\frac{t^2q^3}{tq(1-tq)}
  \right). 
  \end{aligned}$$

Each factor is constructed similarly, describing the move from one column to the next.  There is a total of $c-1$ factors.  The last factor is slightly different due to the fact that the snake does not move to the next column but starts and terminates on column $c$, as in Figure \[endD\] where the black cells belong to the previous factor.  $$\begin{aligned}
 \label{factc}
 \mbox{Last factor:}\; \left( 1+\frac{\sum_{i=2}^{b-c}B_i} {(1-\sum_{i=2}^{b-c}PB_i)tq(1-tq)} \right)
 \frac{1}{1-tq}. 
  \end{aligned}$$

From equations , and  and the multiplication principle, we deduce the following expression. 

For all integers $b$ and $c$ such that $1<c<b$, the generating function for the ending snakes finishing on column c in a rectangle of width $b$ is the following $$\begin{aligned}
E_b^c(t,q)&=\frac{tq^c}{(1-tq)^{c-1}}\times  \frac{1}{\prod_{j=0}^{c-3} \left(1-\sum_{i=2}^{b-2-j}PB_i\right)}\times 
\left(1+ \frac{\sum_{i=2}^{b-c}PB_i}{t^2q^2\left(1-\sum_{i=2}^{b-c}PB_i\right)} \right).  \end{aligned}$$

Finally the generating function $E_b(t,q)$ of the endings in a rectangle of width $b$ is the sum of the generating functions $E_b^c(t,q)$ for all columns $c$ from $c=2$ to $c=b-1$. The case $c=1$ being a pillar, we have $E_1(t,q)=\frac{1}{1-tq}$ which will be incorporated later in the families $\mathcal{F}_i$.

The generating function $E_b(t,q)$ for the ending snakes in a $b\times k$ rectangle is the following: $$\begin{aligned}
E_b(t,q)&=\sum_{c=2}^{b-1} E_b^c(t,q)\\
&= \sum_{c=2}^{b-1} \frac{tq^c}{(1-tq)^{c-1}}\times  \frac{1}{\prod_{j=0}^{c-3} \left(1-\sum_{i=2}^{b-2-j}PB_i\right)}\times 
\left(1+ \frac{\sum_{i=2}^{b-c}PB_i}{t^2q^2\left(1-\sum_{i=2}^{b-c}PB_i\right)} \right).\end{aligned}$$

#### **Generating functions for inscribed [*PDS*]{}**

We are now in a position to present three-variable generating functions $F_i(s,t,q)$ for the families of inscribed $PDS$ with the structure given by equations  to .  We obtain $$\begin{aligned}
\allowdisplaybreaks
F_1(s,t,q)&=2\sum_{b\geq 2} s^b \left[ [1+P(t,q)(1+E_b(t,q))]^2\times \frac{ P(t,q)C_b(t,q)^2}{\left[1-P(t,q)(C_b(t,q)+\sum_{i=2}^{b-1}B_i(t,q))\right]}
\right]\\
F_2(s,t,q)&=4 \sum_{b\geq 2} s^b \left[ [1+P(t,q)(1+E_b(t,q))]^2\times 
\frac{ P(t,q)C_b(t,q)\sum_{i=2}^{b-1}B_i(t,q)}{\left[1-P(t,q)(C_b(t,q)+\sum_{i=2}^{b-1}B_i(t,q))\right]}
\right]\\
F_3(s,t,q)&=2\sum_{b\geq 2} s^b \left[ [1+P(t,q)(1+E_b(t,q))]^2\times 
\frac{ P(t,q)\sum_{i=2}^{b-1}B_i(t,q)}{\left[1-P(t,q)\sum_{i=2}^{b-1}B_i(t,q)\right]}\times \right.\\
 &\hspace{6.5cm}\left.\frac{ P(t,q)C_b(t,q)\sum_{i=2}^{b-1}B_i(t,q)}{\left[1-P(t,q)(C_b(t,q)+\sum_{i=2}^{b-1}B_i(t,q))\right]}
\right]\notag\\
F_4(s,t,q)&=\sum_{b\geq 2} 2s^b \left[ [1+P(t,q)(1+E_b(t,q))]^2\times C_b(t,q)
\right] -tq^b\end{aligned}$$

These four last expressions are not rational but, together with Proposition \[proppart\], they allow the production of a two-variable rational expression for each value of the width $b$.

A Bijection {#bij}
===========

Bargraphs are a class of polyominoes that has received the interest of combinatorists who provided their generating functions according to different parameters (see [@BmR]).  Bargraphs are defined as column-convex polyominoes with their lower edge lying on the horizontal axis.  They are uniquely characterized by the height of their columns.  Looking at bargraphs and bubble snakes simultaneously, we are compelled to guess that bubbles are contours of bargraphs.  Indeed there exists a bijection between these two sets of objects that we describe in the present section. 

In order to uniformize our presentation, we apply on bargraphs a counterclockwise rotation of 90 degrees.  So from now on, we adapt our notation to the rotated bargraphs.  A bargraph has width $h$ when its longest horizontal row has length $h$ (see figure \[Bargraph\]).  Given a bargraph, the corresponding bubble will be the set of cells on the perimeter of the bargraph with side or corner contact with the restriction that the bubble has no cell on the right side of the bargraph.  We can thus see a bubble as the envelop of a bargraph.  But before envelopping a bargraph, we need to stretch its wells. 

A $well$ of height $k$ is a part of a bargraph formed by two rows of length $h_0$ and $h_2$ such that all the $k$ rows between them are of the same length $h_1$ with $h_0> h_1 < h_2$. For example the bargraph in figure \[Bargraph\] has a well of height $k=2$. Bargraphs having wells of height $k< 3$ cannot be directly enveloped in a bubble.  So we increase by two the height of each well in a bargraph to guarantee that all wells have height at least $3$ and then we envelop the bargraph with a unique bubble as explained above. 

There is a bijection $f: bargraph(h-1) \rightarrow bubble(h)$ from the set of bargraphs of width $h-1$ to the set of bubbles of width $h$.

Let us consider a bubble.  The bargraph sent to this bubble is the interior of the latter from which we remove two rows in each well.  So $f$ is surjective.  Given a bargraph the corresponding bubble is the envelop of the bargraph after the addition of two rows in each well (see figures \[Sbargraph\] and \[Bubble\]).  The two-step construction of $f$ garantees that distinct bargraphs are sent by $f$ to distinct bubbles so that $f$ is injective and thus bijective. 

Inscribed snakes of maximal length {#conj}
==================================

In the course of our investigations of snake polyominoes, we have been interested in inscribed snakes of maximal length.  To this end, partially directed snakes and kiss-free snakes have been studied.  We define a [*kiss-free snake*]{} as a snake polyomino such that there exists no $2\times 2$ rectangle with two cells of the snake in one of its diagonals and two empty cells in its other diagonal (see Figure \[Maximal\_kissfree\]). 

It is straightforward to obtain the value of the maximal length of $PDS$ inscribed in a rectangle of size $b\times k$ which is $ \left\lfloor \frac{(b+1)(k+1)}{2}\right\rfloor-1$, as illustrated on figure \[Maximal\_PDS1\].  In an earlier version of this text, we conjectured that this length is also the maximal length for any inscribed kiss-free snake, as shown on figure \[Maximal\_kissfree\].  This fact which is the content of the following conjecture has recently been generalized to tree polyominoes and proved by a different group of authors (see [@BGL]). 

The maximal length of kiss-free snakes inscribed in a $b\times k$ rectangle is $$\begin{aligned}
\label{maxl}
 \left\lfloor \frac{(b+1)(k+1)}{2}\right\rfloor-1.\end{aligned}$$

In other words, when we relax the condition of being $PDS$, there is no gain when the goal is to fill a rectangle with the longest snake as long as the snake remains kiss-free.  For arbitrary snakes this conjecture is not true: figure \[Max\_uniqB\] shows a snake with length exceeding expression .  We could not conjecture an exact expression for the maximal length of inscribed arbitrary snakes in terms of $b$ and $k$. A. Goupil’s work was supported by FODAR.  M.-E. Pellerin is grateful to NSERC for a graduate scholarship.  The three authors thank H. Lessard for the conception and implementation of computer programs that generate inscribed snakes. 

[99]{}

C. Banderier and P. Flajolet, [*Basic analytic combinatorics of Directed Lattice paths*]{}, Theoret.  Comp.  Sci.,  281(1-2), 37-80, 2002.  Selected paper in honour of Maurice Nivat. 

A. Blondin Massé, A. Goupil and M. Lapointe,[*Tree and snake polyominoes of maximal area*]{}, to be submitted. 

M. Bousquet-Mélou, [*Families of prudent self-avoiding walks*]{}, J. of Comb.  Theory, Series A, 117, 313-344, 2010. 

M. Bousquet-Mélou and A. Rechnitzer, [*The site perimeter of bargraphs*]{}, Adv.  in Applied Math.,  vol.  31, no 1, 86-112, 2003. 

A. T. Benjamin and J. J. Quinn, [*Proofs that Really Count: The Art of Combinatorial Proof*]{}, Dolciani Mathematical Expositions, Mathematical Association of America, 2003. 

I. M. Gessel, [*An introduction to lattice path enumeration*]{}, tutorial monograph, 2007. 

A. Goupil and H. Cloutier, [*Enumeration of 3D polyominoes inscribed in a rectangular prism*]{}, DMTCS proc.  FPSAC 2011, 2012. 

A. Goupil, H. Cloutier and F. Nouboud, [*Enumeration of polyominoes inscribed in a rectangle*]{}, Discrete Appl.  math.,  vol 158(18), 2014-2023, 2010. 

A. Goupil, H. Cloutier and M.E. Pellerin, [*Generating functions for inscribed polyominoes*]{}, Discrete Appl.  math.,  vol 161(1-2), 151-166, 2013. 

J. Myers, <https://oeis.org/A182644>, 2010. 

R. P. Stanley, [*Enumerative Combinatorics, vol.  1*]{}, Cambridge Stud.  Adv.  Math.,  vol 49, Cambridge University Press, Cambridge, 1997. 

H. S. Wilf, [*generatingfunctionology*]{}, internet edition, Academic Press Inc, 1994.