<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>On Counting k-Convex Polyominoes (Short Paper)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Paolo Massazza</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Insubria</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We show that, for any fixed integer  &gt; 2, the problem of computing the number of -convex polyominoes of area  is in P. A polyomino is a geometrical figure consisting of a finite set of connected unit squares (called cells) in the plane Z × Z, considered up to translations. Polyominoes gained popularity after the paper of S. W. Golomb [1]. Nowadays they are widely studied by physicists, mathematicians, computer scientists and also by biologists. The problem of counting the number  of polyominoes with  cells (i.e. of area ) is probably one of the fundamental open problems in combinatorial geometry (see problem 37 in [2]). Due to the dificulty of the problem, simpler classes of polyominoes have been introduced. In particular, the class of convex polyominoes (polyominoes where the intersection with an infinite horizontal or vertical stripe is a finite segment) and some of its subclasses have been investigated [3, 4, 5, 6, 7]. In this paper, we consider the class Conv [8] containing all convex polyominoes  with the property that any two cells of  can be joined by a path in  with at most  changes of direction, where  is a ifxed integer greater than 2. We show that, for any fixed  &gt; 2, the algorithm presented in [9] leads to a set of recurrence equations for computing the number of -convex polyominoes of area  in polynomial time, using (5) space. Let  be a polyomino with an  ×  minimal bounding rectangle. The rows (resp., columns) of  are numbered from bottom to top (resp., from left to right). The area A( ) of  is the number of its cells. A cell of  is identified by a pair of integers (, ), where  (resp., ) is the row (resp., column) index. Two cells  = (, ) and ′ = (′, ′) are adjacent if | − ′| + | − ′| = 1. Given two cells  and  of  , a path in  from  to  is a sequence 1, 2, . . . ,  of cells of  , with 1 =  and  = , such that  and +1 are adjacent for all  with 1 ≤  &lt; . A</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;polyominoes</kwd>
        <kwd>counting problem</kwd>
        <kwd>integer sequence</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Notation and preliminaries</title>
      <p>
        step is a sequence of two adjacent cells (, ), (′, ′). Steps are distinguished according to the
directions N (North), W (West), S (South) and E (East). The number of changes of direction
in a path  ∈ {N, W, S, E}+ is defined as the number of indices  such that   ̸=  +1, with
1 ≤  &lt; | |. A path is monotone if  ∈ {N, W}+ (NW-path) or  ∈ {N, E}+ (NE-path) or
 ∈ {S, E}+ (SE-path) or  ∈ {S, W}+ (SW-path). A polyomino  is horizontally convex (resp.,
vertically convex) if any row (resp. column) of  consists of one segment. The class of convex
polyominoes contains all polyominoes that are both horizontally and vertically convex. It has
been proved [10, Proposition 1] that a polyomino  is convex if and only if any two cells of
 are joined by a monotone path in  . The degree of convexity of  , denoted by deg( ),
is defined as the least integer  such that any two cells of  can be joined by a monotone
path in  with at most  changes of direction. A convex polyomino is called -convex if its
degree of convexity is at most . Given a convex polyomino  and its minimal bounding
rectangle , we say that  is a stack (resp., Ferrers diagram, parallelogram, rectangle) if it shares
exactly two adjacent (resp., three, two opposite, four) vertices with . A stack  is a left (resp.,
right) stack if the column with the largest area is the last (resp., first) one. Analogously, in a
left (resp., right) Ferrers diagram the largest column is the last (resp., first) one. We denote
by L (resp., R) the set of left (resp., right) stacks. F (resp., F) is the set of left (resp., right)
Ferrers diagrams. Furthermore, we indicate by C (resp., T) the set of parallelograms (resp.,
rectangles). For a class A of polyominoes, A() is the set of polyominoes in A of area . By
low() (resp., high()) we denote the row index of the bottom (resp., top) cell of column .
Similarly, left() denotes the column index of the leftmost cell of row . Lastly, first( )
(resp., last( )) indicates the first (resp., last) column of  . Given two columns  and , we
say that  and  are overlapping (resp., disjoint), denoted by  ⇄ (resp.,  ≍ ), if and only if
low() &lt; low() ≤ high() &lt; high() or low() &lt; low() ≤ high() &lt; high() (resp.,
low() &gt; high() or low() &gt; high()). Moreover, we say that  includes , denoted by  ⊆ ,
if and only if low() ≤ low() and high() ≥ high(). Given a convex polyomino  , let 
be the rightmost column of  such that  ⊆  for 1 ≤  &lt; . Then,  is called descending
(resp., ascending) if there exists a column  such that  &gt; ,  ⇄ and low() &gt; low() (resp.,
low() &lt; low()). The set of descending (resp., ascending) -convex polyominoes is indicated
by DConv (resp., AConv). The set of all descening polyominoes is DConv. If  is neither
descending nor ascending then  ∈ T ∪ F ∪ F ∪ L ∪ R or it belongs to the class LR containing
all convex polyominoes that are the concatenation of two polyominoes,  = 1 · 2, where
1 ∈ L ∪ F, 2 ∈ T ∪ R ∪ F and first(2) ⊊ last(1). Notice that any  ∈ LR contains
a column ¯ such that  ⊆ ¯ for all columns , hence deg( ) ≤ 2. Lastly, a cell (, ) of  is
a NW-corner if (,  − 1) and ( + 1, ) are not cells of  . Analogously, we define NE-corners,
SE-corners and SW-corners. Two corners are called opposite if either one is a NW-corner and
the other is a SE-corner, or one is a NE-corner and the other is a SW-corner. Clearly, one
has Conv = T ∪ F ∪ F ∪ L ∪ R ∪ LR ∪ AConv ∪ DConv and (because of symmetry)
|DConv()| = |AConv()|, |L()| = |R()|, |F()| = |F()|. Since all unions are disjoint,
it follows that
|Conv()| = |T()| + 2 · | F()| + 2 · | L()| + |LR()| + 2 · | DConv()|.
(
        <xref ref-type="bibr" rid="ref1 ref3">1</xref>
        )
Thus, the counting problem for Conv is reduced to computing |DConv()| and to some
other counting problems that are immediately solved in polynomial time. In particular, we can
2 3 3 3 3
Figure 1: The arrows show the first steps of the paths determined by [9, Lemma 8] and associated with
a SW corner. The integer below a column indicates its degree of convexity.
compute |LR()| in polynomial time as shown in [11]. In order to compute |DConv()| we
define a decomposition for descending polyominoes.
      </p>
      <p>Definition 2.1 (standard decomposition). A polyomino  ∈ DConv can be decomposed as
 =  ·  ·  ·  (with  ,  possibly empty) for suitable polyominoes  ∈ L ∪ T ∪ F,  ∈ F,
 ∈ C ∪ T ∪ F, and  ∈ R ∪ T ∪ F such that: first( ) ⊊ last(), low(last()) =
low(first( )), last( ) ⇄first() (or last() ⇄first() if  =  ), low(last()) &gt;
low(first()) and (if  ̸=  ) first() ⊊ last(), low(last()) &lt; low(first()).</p>
      <p>We stress that the standard decomposition of  is unique (e.g. last() is the rightmost
column ¯ of  such that  ⊆ ¯ for  &lt; ¯). The subset of DConv2 containing polyominoes
decomposed as  ·  ·  (resp.,  · ,  ·  ·  · ,  ·  · ) is LCR2 (resp., LC2, LFCR2, LFC2).
Thus, for any  &gt; 2 one has the partition DConv = LFCR ∪ LFC ∪ LCR ∪ LC.</p>
      <p>By [9, Thm. 6], the degree of convexity of  ∈ DConv depends on the number  of changes
of direction in a particular NW-path that starts at a SE-corner  and ends at a NW-corner . This
is a path where the first  − 1 changes of direction always occur on the boundary of  , whereas
the th one possibly occurs on a cell that is not on the boundary. Furthermore, from [9, Thm. 6]
it follows that the degree of convexity of the th column of  is deg(, ) = max{(, )| =
(low() , ),  is a NW-corner of  }, where (, ), is the least integer k such that there exists
a monotone path in  from  to  with k changes of direction.</p>
      <p>Given  =  ·  ·  ·  and a column  in  ·  · , we know from [9, Lemma 8]
that deg(, ) = min(deg(, ′) + 2, deg(, ′′) + 1), where ′ = left(high()) and
′′ = left(low()). see Fig. 1 for an example. In the sequel, we consider each column  of 
as the concatenation of vertical segments associated with diferent degrees of convexity. These
segments are identified by considering the degrees of convexity of the leftmost columns that
are reached by W-paths starting from cells of .</p>
      <p>Definition 2.2 ( -segment). A cell (, ) of  ∈ DConv belongs to a  -segment if and only if
either  &gt; 0 ∧  &lt; low(first( )) and the cell (, left()) belongs to a column of degree of
convexity  , or  = 0 ∧  ≥ low(first( )).</p>
      <p>From [9, Lemma 8], if deg(, ) =  then column  may contain only  -segments with
 − 2 ≤  ≤  . Notice that (, ) belongs to a  -segment if and only if (,  − 1) belongs
to a  -segment or (,  − 1) is not in  and deg(, ) =  . Fig. 1 shows how the columns
of a polyomino in DConv consist of at most three  -segments (depicted as vertical segments
comprising cells of the same color).</p>
    </sec>
    <sec id="sec-3">
      <title>3. Counting</title>
      <p>
        We focus on computing |DConv()| since the remaining values in (
        <xref ref-type="bibr" rid="ref1 ref3">1</xref>
        ) are easily computed
in polynomial time (see, for instance, [11]). Given , , , , ,  ∈ N, with ,  &gt; 0 and
 +  ≤ , let (, , , , , ) be the number of polyominoes  in LFC() ∪ LC() such that
A(last( )) = , deg(, last( )) = , low(last( ) − 1) − low(last( )) = , and where
last( ) contains a -segment of area , a ( − 1)-segment of area  and a ( − 2)-segment of
area − − , see Fig. 2. Obviously, one has |LFC()|+|LC()| = ∑︀,,,, (, , , , , ),
and the problem boils down to compute (, , , , , ) eficiently.
      </p>
      <p>
        Consider the standard decomposition of a polyomino  counted by (, , , , , ),  =
 ·  ·  or  =  · . If the second to last column of  belongs to  then (, , , , , )
depends on ( − , ′, ′, ′, ′, ′) for suitable ′, ′, ′, ′, ′. Otherwise, the second to last
column of  is in  or in , and (, , , , , ) is computed using the values (′, ′, ′, ′)
and  (′, ′, ′), where (′, ′, ′, ′) (resp.,  (′, ′, ′)) is the number of  ∈ L(′) ∪
F(′) ∪ T(′) (resp.  ∈ F(′)) such that A(first( )) = ′, A(last( )) = ′ and
low(first( ))− low(last( )) = ′. Here we consider only the case when column last( )−
1 is in  (we refer to the full paper for the remaining cases). This is the most complex case
as it leads to four diferent equations, depending on the conditions  &gt;  (
        <xref ref-type="bibr" rid="ref1 ref3">1</xref>
        ),  =  ∧  = 0
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        ),  =  ∧  &gt; 0 ∧  &gt; 0 (
        <xref ref-type="bibr" rid="ref4">3</xref>
        ) and  =  ∧  &gt; 0 ∧  = 0 (
        <xref ref-type="bibr" rid="ref5">4</xref>
        ). In case (
        <xref ref-type="bibr" rid="ref1 ref3">1</xref>
        ), column last( ) − 1
always has degree of convexity , since the relation  &gt;  implies the existence of a column
of degree of convexity  to the left of last( ), and the sequence of degrees of convexity of
columns in  is not decreasing by [9, Thm. 9]. Furthermore, one necessarily has  +  &lt; 
because last( ) contains a ( − 2)-segment, see Fig. 3. So, it follows that (, , , , , ) =
∑︀′− =−− 2 ∑︀′−=0 ( − , ′, ,  − , , ′). In case (
        <xref ref-type="bibr" rid="ref4">3</xref>
        ) (see Fig. 4) the recurrence equation is
(, , , , , ) = ∑︀′− =−− 2+1 ∑︀′′−=+−−− 1 ∑︀′=0 ( − , ′,  − 1, , ′, ′) + ∑︀′− =−− 2 ( −
, ′, , 0, , 0). In fact, the second to last column of a polyomino  counted by (, , , , , )
may have degree of convexity  − 1 or , but not  − 2. Indeed, if one had deg(, last( )− 1) =
 − 2 then the sequence of degrees of convexity in  would be decreasing, since last( ) contains
a ( − 1)-segment and this implies the existence of a column  to the left of last( ) such
that deg(, ) =  − 1. Furthermore,  =  ∧  &gt; 0 implies that last( ) contains a ( −
2)segment. As a consequence the ( − 1)-segments in last( ) − 1 and in last( ) have the same
area. So, if deg(, last( ) − 1) =  − 1 we sum the values ( − , ′,  − 1, , ′, ′) on all
′, ′, ′ such that:
      </p>
      <p>• the area ′ of column last( ) − 1 is at least  −  + 1 (since ′ must contain a ( −
3)segment) and at most  −  − 2 (since A() ≥ 2);
• the area ′ of the ( − 2)-segment in last( ) − 1 is at least  −  −  (the area of the
( − 2)-segment in last( )) and at most ′ −  +  − 1 (because column last( ) − 1
must contain a ( − 3)-segment);
• ′ is at least 0 and at most  (the lower ′ cells of last( ) − 1 has degree  − 1 since
left(low(last( ) − 1) + ) = last( ) − 1 for 0 ≤  &lt; ′).</p>
      <p>
        Otherwise, if deg(, last( ) − 1) =  we sum the values ( − , ′, , 0, , 0) on all ′ no
smaller than  −  and no greater than  −  − 2. From the existence of a ( − 1)-segment in
last( ) and deg(, last( )− 1) = , it follows low(last( ) − 2)− low(last( ) − 1) = 0.
Hence, last( ) − 1 cannot contain a -segment. The recurrence equations for cases (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) and
(
        <xref ref-type="bibr" rid="ref5">4</xref>
        ), as well as for the cases associated with the set LCR ∪ LFCR, are obtained by a similar
reasoning.
      </p>
      <p>Based on these equations, we have developed a C++ program to compute |Conv()| for
 &gt; 2 and  &gt; 0. This program has space complexity (5) (coming from the size of the table
containing the values (, , , , , )) and produced Table 1 in few minutes (on a Macbook
Pro). We point out that this integer sequence does not appear in OEIS.</p>
      <p>0, 1, 2, 6, 19, 59, 172, 470, 1206, 2934, 6812, 15192, 32709, 68282, 138678, 274822, 532719, 1012144
1888226, 3464168, 6258249, 11146013, 19590450, 34011064, 58371083, 99103808, 166563604,
277281796, 457451501, 748274488, 1214117566, 1954879052, 3124637754, 4959621329,
7819943680, 12251575214, 19077932142, 29534613958, 45466767846, 69616951878, 106043316448</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S. W.</given-names>
            <surname>Golomb</surname>
          </string-name>
          ,
          <article-title>Checker boards and polyominoes</article-title>
          ,
          <source>Amer. Math. Monthly</source>
          <volume>61</volume>
          (
          <year>1954</year>
          )
          <fpage>675</fpage>
          -
          <lpage>682</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>E. D.</given-names>
            <surname>Demaine</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. S. B.</given-names>
            <surname>Mitchell</surname>
          </string-name>
          ,
          <string-name>
            <surname>J. O'Rourke,</surname>
          </string-name>
          <article-title>The open problems project, last update 2020</article-title>
          . URL: http://cs.smith.edu/~jorourke/TOPP.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <article-title>Table 1 The number of 3-convex polyominoes of area  for 0 ≤  ≤ 40.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Bousquet-Mélou</surname>
          </string-name>
          ,
          <article-title>Convex polyominoes and heaps of segments</article-title>
          ,
          <source>Journal of Physics A: Mathematical and General</source>
          <volume>25</volume>
          (
          <year>1992</year>
          )
          <fpage>1925</fpage>
          -
          <lpage>1934</lpage>
          . URL: https://doi.org/10.1088/
          <fpage>0305</fpage>
          -4470/ 25/7/031. doi:
          <volume>10</volume>
          .1088/
          <fpage>0305</fpage>
          -4470/25/7/031.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>E.</given-names>
            <surname>Barcucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Pinzani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Sprugnoli</surname>
          </string-name>
          ,
          <article-title>Directed column-convex polyominoes by recurrence relations</article-title>
          , in: M.
          <string-name>
            <surname>C. Gaudel</surname>
            ,
            <given-names>J. P.</given-names>
          </string-name>
          Jouannaud (Eds.),
          <source>TAPSOFT'93: Theory and Practice of Software Development</source>
          , Springer Berlin Heidelberg, Berlin, Heidelberg,
          <year>1993</year>
          , pp.
          <fpage>282</fpage>
          -
          <lpage>298</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Bousquet-Mélou</surname>
          </string-name>
          ,
          <article-title>A method for the enumeration of various classes of column-convex polygons</article-title>
          ., Discrete Math.
          <volume>154</volume>
          (
          <year>1996</year>
          )
          <fpage>1</fpage>
          -
          <lpage>25</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>A.</given-names>
            <surname>Del Lungo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Nivat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Pinzani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rinaldi</surname>
          </string-name>
          ,
          <article-title>A bijection for the total area of parallelogram polyominoes, Discret</article-title>
          . Appl. Math.
          <volume>144</volume>
          (
          <year>2004</year>
          )
          <fpage>291</fpage>
          -
          <lpage>302</lpage>
          . URL: https://doi.org/10.1016/j.dam.
          <year>2003</year>
          .
          <volume>11</volume>
          .007. doi:
          <volume>10</volume>
          .1016/j.dam.
          <year>2003</year>
          .
          <volume>11</volume>
          .007.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>G.</given-names>
            <surname>Castiglione</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Restivo</surname>
          </string-name>
          ,
          <article-title>Ordering and convex polyominoes</article-title>
          ,
          <source>in: MCU</source>
          <year>2004</year>
          , volume
          <volume>3354</volume>
          of Lecture Notes in Comput. Sci., Springer,
          <year>2005</year>
          , pp.
          <fpage>128</fpage>
          -
          <lpage>139</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Micheli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Rossin</surname>
          </string-name>
          ,
          <article-title>Counting k-convex polyominoes</article-title>
          ,
          <source>Electron. J. Comb</source>
          .
          <volume>20</volume>
          (
          <year>2013</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>S.</given-names>
            <surname>Brocchi</surname>
          </string-name>
          , G. Castiglione,
          <string-name>
            <given-names>P.</given-names>
            <surname>Massazza</surname>
          </string-name>
          ,
          <article-title>On the exhaustive generation of k-convex polyominoes</article-title>
          ,
          <source>Theor. Comput. Sci</source>
          .
          <volume>664</volume>
          (
          <year>2017</year>
          )
          <fpage>54</fpage>
          -
          <lpage>66</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>G.</given-names>
            <surname>Castiglione</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Restivo</surname>
          </string-name>
          , Reconstruction of l-convex polyominoes,
          <source>Electronic Notes in Discrete Mathematics</source>
          <volume>12</volume>
          (
          <year>2003</year>
          )
          <fpage>290</fpage>
          -
          <lpage>301</lpage>
          . URL: http://www.sciencedirect.com/science/article/ pii/S1571065304004949. doi:https://doi.org/10.1016/S1571-
          <volume>0653</volume>
          (
          <issue>04</issue>
          )
          <fpage>00494</fpage>
          -
          <lpage>9</lpage>
          , 9th International Workshop on Combinatorial Image Analysis.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>V.</given-names>
            <surname>Dorigatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Massazza</surname>
          </string-name>
          ,
          <article-title>On counting l-convex polyominoes</article-title>
          ,
          <source>in: 22nd Italian Conference on Theoretical Computer Science</source>
          ,
          <year>2021</year>
          , volume
          <volume>3072</volume>
          <source>of CEUR Proceedings</source>
          ,
          <year>2021</year>
          , pp.
          <fpage>193</fpage>
          -
          <lpage>198</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>