A note on congruence properties of the generalized bi-periodic Horadam sequence

Abstract: In this paper, we consider a generalization of Horadam sequence {w_n} which is defined by the recurrence w_n = aw_n-1 + cw_n-2; if n is even, w_n = bw_n-1 + cw_n-2; if n is odd with arbitrary initial conditions w_0, w_1 and nonzero real numbers a, b, and c. We investigate some congruence properties of the generalized Horadam sequence {w_n}.

\section{Introduction}

The generalized bi-periodic Horadam sequence $\left\{ w_{n}\right\} $ is
defined by the recurrence relatio
\begin{equation*}
w_{n}=\left\{
\begin{array}{ll}
aw_{n-1}+cw_{n-2}, & \mbox{ if }n\mbox{ is even} \\
bw_{n-1}+cw_{n-2}, & \mbox{ if }n\mbox{ is odd
\end{array
\right. ,\text{ }n\geq 2
\end{equation*
with arbitrary initial conditions $w_{0},w_{1}$ and nonzero real numbers
a,b $ and $c$. It is emerged as a generalization of the best known sequences
in the literature, such as the Horadam sequence, the Fibonacci\&Lucas
sequence, the $k$-Fibonacci\&$k$-Lucas sequence, the Pell\&Pell-Lucas
sequence, the Jacobsthal\& Jacobsthal-Lucas sequence, etc. Similar to the
notation of the classical Horadam sequence \cite{Horadam}, we write $\left\{
w_{n}\right\} := $ $\{w_{n}\left( w_{0},w_{1};a,b,c\right) \}.$ In
particular, using this notation, we define $\{u_{n}\}=\{w_{n}\left(
0,1;a,b,c\right) \}$ and $\{v_{n}\}=\{w_{n}\left( 2,b;a,b,c\right) \}$ as
the \textit{generalized bi-periodic Fibonacci sequence} and the \textit
generalized bi-periodic Lucas sequence, }respectively\textit{.} For the
basic properties of the generalized bi-periodic Horadam sequence and some
special cases of this sequence, see \cite{Edson, Yayenie, Sahin, Panario,
Bilgici, Tan1, Tan3, Tan5, Tan-Leung}.

On the other hand, it is important to investigate the congruence properties
of different integer sequences. Several methods can be applied to produce
identities for the Fibonacci and Lucas sequences. For example, Carlitz and
Ferns \cite{Carlitz} used polynomial identities in conjunction with the
Binet formula to generate new identities for these sequences. The method of
Carlitz and Ferns was used by several authors to obtain analogous results
for the generalized Fibonacci and Lucas sequences, see \cite{Zhang0, Kilic}.
On the other hand, Keskin and Siar \cite{Siar} obtained some number
theoretic properties of the generalized Fibonacci and Lucas numbers by using
matrix method. Morover, Hsu and Maosen \cite{Hsu} and Zhang \cite{Zhang1}
applied an operator method to establish some of these properties. Recently,
Yang and Zhang \cite{Zhang} have studied some congruence relations for the
bi-periodic Fibonacci and Lucas sequences by using operator method. But some
of the results that are obtained by the operator method are incorrect. In
this study, by using the method of Carlitz and Ferns \cite{Carlitz}, we give
more general identities involving the generalized bi-periodic Horadam
sequences and derive some congruence properties of the generalized
bi-periodic Horadam numbers. In particular, our results include the
corrected version of some of the results in \cite{Zhang}.

The outline of this paper as follows: In Section $2$, we give some basic
properties of the generalized bi-periodic Horadam sequence. In Section $3$,
we give some binomial identities and congruence relations for the
generalized bi-periodic Horadam sequence by using the method of Carlitz and
Ferns \cite{Carlitz}.

\section{Some preliminary results for the sequence $\{w_{n}\}$}

In this section, we give some basic properties of the bi-periodic Horadam
sequences.

The Binet formula of the sequence $\{u_{n}\}$ i
\begin{equation}
u_{n}=\frac{a^{\xi \left( n+1\right) }}{\left( ab\right) ^{\left\lfloor
\frac{n}{2}\right\rfloor }}\left( \frac{\alpha ^{n}-\beta ^{n}}{\alpha
-\beta }\right)  \label{3}
\end{equation
which can be obtained by \cite[Theorem 8]{Yayenie}. Here $\alpha $ and
\beta $ are the roots of the polynomial $x^{2}-abx-abc,$ that is, $\alpha
\frac{ab+\sqrt{a^{2}b^{2}+4abc}}{2}$ and $\beta =\frac{ab-\sqrt
a^{2}b^{2}+4abc}}{2}$, and $\xi \left( n\right) =n-2\left\lfloor \frac{n}{2
\right\rfloor $ is the parity function, i.e., $\xi \left( n\right) =0$ when
n$ is even and $\xi \left( n\right) =1$ when $n$ is odd. Let assume $\Delta
:=a^{2}b^{2}+4abc\neq 0.$ Also we have $\alpha +\beta =ab,$ $\alpha -\beta
\sqrt{a^{2}b^{2}+4abc}$ and $\alpha \beta =-abc.$

\begin{lemma}
\label{l1}For any integer $n>0,$ we hav
\begin{equation*}
w_{n}=u_{n}w_{1}+c\left( \frac{b}{a}\right) ^{\xi \left( n\right)
}u_{n-1}w_{0}.
\end{equation*}
\end{lemma}

By\ using Lemma \ref{l1} and the Binet formula of $\left\{ u_{n}\right\} $
in (\ref{3}), we can easily obtain the Binet formula of the sequence
\{w_{n}\}.$ We note that the extended Binet formula for the general case of
this sequence was given in \cite[Theorem 9]{Panario}. But here we express
the Binet formula of the sequence $\{w_{n}\}$ in a different manner, that
is, our $\alpha $ and $\beta $ are different from the roots which are used
in \cite{Panario}.

\begin{theorem}
\label{t1}(Binet Formula) For $n>0,$ we hav
\begin{equation*}
w_{n}=\frac{a^{\xi \left( n+1\right) }}{\left( ab\right) ^{\left\lfloor
\frac{n}{2}\right\rfloor }}\left( A\alpha ^{n}-B\beta ^{n}\right) ,
\end{equation*
where $A:=\frac{w_{1}-\frac{\beta }{a}w_{0}}{\alpha -\beta }$and $B:=\frac
w_{1}-\frac{\alpha }{a}w_{0}}{\alpha -\beta }.$
\end{theorem}

\begin{proof}
By\ using Lemma \ref{l1} and (\ref{3}), we get the desired result.
\end{proof}

By taking initial conditions $w_{0}=2,w_{1}=b$ in Theorem \ref{t1}, we
obtain the Binet formula for the sequence $\{v_{n}\}$ as follows
\begin{equation}
v_{n}=\frac{a^{-\xi \left( n\right) }}{\left( ab\right) ^{\left\lfloor \frac
n}{2}\right\rfloor }}\left( \alpha ^{n}+\beta ^{n}\right) .  \label{4}
\end{equation
Also by\ using Lemma \ref{l1}, we have $v_{n}=bu_{n}+2c\left( \frac{b}{a
\right) ^{\xi \left( n\right) }u_{n-1}.$ Thus we get a relation between the
generalized bi-periodic Fibonacci and the generalized bi-periodic Lucas
numbers as
\begin{equation}
v_{n}=\left( \frac{b}{a}\right) ^{\xi \left( n\right) }\left(
u_{n+1}+cu_{n-1}\right) .  \label{5}
\end{equation
It should be noted that the generalized Lucas sequence $\left\{
t_{n}\right\} $ in \cite{Zhang} is a special case of the generalized
bi-periodic Horadam sequence. That is, $\{t_{n}\}=\{w_{n}\left(
2a,ab;a,b,1\right) \}.$

The generating function of the sequence $\left\{ w_{n}\right\} $ i
\begin{equation}
G\left( x\right) =\frac{w_{0}+w_{1}x+\left( aw_{1}-\left( ab+c\right)
w_{0}\right) x^{2}+c\left( bw_{0}-w_{1}\right) x^{3}}{1-\left( ab+2c\right)
x^{2}+c^{2}x^{4}},  \label{6}
\end{equation
which can be obtained from \cite[Theorem 6]{Panario}.

Also we need the following identity which can be found in \cite{Tan-Leung}
\begin{equation}
u_{mn+r}=\frac{a^{1-\xi \left( mn+r\right) }}{\left( ab\right)
^{\left\lfloor \frac{mn+r}{2}\right\rfloor }}\sum_{i=0}^{n}\dbinom{n}{i
c^{n-i}u_{m}^{i}u_{m-1}^{n-i}u_{i+r}\delta \lbrack m,n,r,i]  \label{7}
\end{equation
where $\delta \lbrack m,n,r,i]:=\left( ab\right) ^{\left\lfloor \frac{i+r}{2
\right\rfloor +n\left\lfloor \frac{m}{2}\right\rfloor }a^{-\xi \left(
m+1\right) i-1+\xi \left( i+r\right) }b^{\xi \left( m\right) \left(
n-i\right) }.$

\section{Main results}

To extend the results in \cite[Theorem 4.7, Theorem 4.9, Theorem 4.11,
Theorem 4.13]{Zhang}, we give the following theorem. Also we assume that
a,b $ and $c$ are positive integers.

\begin{theorem}
\label{t2}For any nonnegative integers $n,r$ and $m$ with $m>1$, we hav
\begin{equation*}
w_{mn+r}=\frac{a^{1-\xi \left( mn+r\right) }}{\left( ab\right)
^{\left\lfloor \frac{mn+r}{2}\right\rfloor }}\sum_{i=0}^{n}\dbinom{n}{i
c^{n-i}u_{m}^{i}u_{m-1}^{n-i}w_{i+r}\delta \lbrack m,n,r,i]
\end{equation*
where $\delta \lbrack m,n,r,i]:=\left( ab\right) ^{\left\lfloor \frac{i+r}{2
\right\rfloor +n\left\lfloor \frac{m}{2}\right\rfloor }a^{-\xi \left(
m+1\right) i-1+\xi \left( i+r\right) }b^{\xi \left( m\right) \left(
n-i\right) }.$
\end{theorem}

\begin{proof}
Similar to the relation $\gamma ^{n}=\gamma F_{n}+F_{n-1}$ for the classical
Fibonacci numbers, where $\gamma $ is one of the root of the equation
x^{2}-x-1=0,$ we have
\begin{equation*}
\alpha ^{m}=a^{-1}a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}\alpha
u_{m}+ca^{\frac{m-\xi (m)}{2}}b^{\frac{m+\xi (m)}{2}}u_{m-1}
\end{equation*
an
\begin{equation*}
\beta ^{m}=a^{-1}a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}\beta
u_{m}+ca^{\frac{m-\xi (m)}{2}}b^{\frac{m+\xi (m)}{2}}u_{m-1}.
\end{equation*
By using the binomial theorem, we hav
\begin{equation*}
\alpha ^{mn}=\sum_{i=0}^{n}\dbinom{n}{i}a^{-i}a^{i\frac{m+\xi (m)}{2}+\left(
n-i\right) \frac{m-\xi (m)}{2}}b^{i\frac{m-\xi (m)}{2}+\left( n-i\right)
\frac{m+\xi (m)}{2}}c^{n-i}u_{m}^{i}u_{m-1}^{n-i}\alpha ^{i},
\end{equation*
\begin{equation*}
\beta ^{mn}=\sum_{i=0}^{n}\dbinom{n}{i}a^{-i}a^{i\frac{m+\xi (m)}{2}+\left(
n-i\right) \frac{m-\xi (m)}{2}}b^{i\frac{m-\xi (m)}{2}+\left( n-i\right)
\frac{m+\xi (m)}{2}}c^{n-i}u_{m}^{i}u_{m-1}^{n-i}\beta ^{i}.
\end{equation*}

Multiplying both sides of the above equalities by $A\alpha ^{r}$ and $B\beta
^{r},$ respectively, and using the Binet formula of $\left\{ w_{n}\right\} ,$
we ge
\begin{eqnarray*}
&&\left( A\alpha ^{mn+r}-B\beta ^{mn+r}\right) \\
&=&a^{-\xi \left( mn+r+1\right) }\left( ab\right) ^{\left\lfloor \frac{mn+r}
2}\right\rfloor }w_{mn+r} \\
&=&\sum_{i=0}^{n}\dbinom{n}{i}\left( ab\right) ^{\left\lfloor \frac{i+r}{2
\right\rfloor +n\left\lfloor \frac{m}{2}\right\rfloor }a^{-\xi \left(
m+1\right) i-1+\xi \left( i+r\right) }b^{\xi \left( m\right) \left(
n-i\right) }c^{n-i}u_{m}^{i}u_{m-1}^{n-i}w_{i+r}.
\end{eqnarray*}

which gives the desired result. It can be expressed a
\begin{equation*}
w_{mn+r}=\sum_{i=0}^{n}\dbinom{n}{i}\left( \frac{b}{a}\right) ^{\frac{\xi
\left( mn+r\right) -2i\xi (m)+i-\xi \left( i+r\right) +n\xi (m)}{2
}c^{n-i}u_{m}^{i}u_{m-1}^{n-i}w_{i+r}.
\end{equation*}

We note that it can also be obtained by using Lemma \ref{l1} and the
identity (\ref{7}) as
\begin{eqnarray*}
&&w_{mn+r} \\
&=&w_{1}\frac{a^{1-\xi \left( mn+r\right) }}{\left( ab\right) ^{\left\lfloor
\frac{mn+r}{2}\right\rfloor }}\sum_{i=0}^{n}\dbinom{n}{i
c^{n-i}u_{m}^{i}u_{m-1}^{n-i}u_{i+r}\delta \lbrack m,n,r,i] \\
&&+w_{0}c\left( \frac{b}{a}\right) ^{\xi \left( mn+r\right) }\frac{a^{1-\xi
\left( mn+r-1\right) }}{\left( ab\right) ^{\left\lfloor \frac{mn+r-1}{2
\right\rfloor }}\sum_{i=0}^{n}\dbinom{n}{i
c^{n-i}u_{m}^{i}u_{m-1}^{n-i}u_{i+r-1}\delta \lbrack m,n,r-1,i]\text{ \ \ \
\ }
\end{eqnarray*
\begin{eqnarray*}
&=&\frac{a^{1-\xi \left( mn+r\right) }}{\left( ab\right) ^{\left\lfloor
\frac{mn+r}{2}\right\rfloor }}\sum_{i=0}^{n}\dbinom{n}{i
c^{n-i}u_{m}^{i}u_{m-1}^{n-i}\delta \lbrack m,n,r,i]\left(
w_{1}u_{i+r}+cw_{0}\left( \frac{b}{a}\right) ^{\xi \left( i+r\right)
}u_{i+r-1}\right) \\
&=&\frac{a^{1-\xi \left( mn+r\right) }}{\left( ab\right) ^{\left\lfloor
\frac{mn+r}{2}\right\rfloor }}\sum_{i=0}^{n}\dbinom{n}{i
c^{n-i}u_{m}^{i}u_{m-1}^{n-i}w_{i+r}\delta \lbrack m,n,r,i].
\end{eqnarray*}
\end{proof}

By considering the identity $\xi (mn+r)=\xi (mn)+\xi (r)-2\xi (mn)\xi (r),$
we have the following corollary.

\begin{remark}
When $m$ and $r$ are all even and $c=1$ in Theorem \ref{t2}, we obtain the
identit
\begin{equation*}
w_{2mn+2r}=\dsum\limits_{i=0}^{n}\binom{n}{i}\left( \frac{b}{a}\right) ^
\frac{i-\xi \left( i\right) }{2}}u_{2m}^{i}u_{2m-1}^{n-i}w_{i+2r}.
\end{equation*
Thus, the result in \cite[Theorem 4.7]{Zhang} can be corrected by
multiplying the right side of the equation by $\left( \frac{b}{a}\right) ^
\frac{i-\xi \left( i\right) }{2}}.$ The other results in \cite[Theorem 4.9,
Theorem 4.11, Theorem 4.13]{Zhang} can be corrected similarly.
\end{remark}

\begin{corollary}
\label{c1}For $m,n,r>0,$ we hav
\begin{equation*}
w_{mn+r}-\left( \frac{b}{a}\right) ^{\xi (m)\left( \frac{n+\xi (n)}{2
\right) -\xi \left( mn\right) \xi \left( r\right) }c^{n}u_{m-1}^{n}w_{r
\text{ }\equiv 0\left( \func{mod}u_{m}\right) .
\end{equation*}
\end{corollary}

Now we give a generalization of the Ruggles identity \cite{Ruggles} which
also generalizes the identities in \cite[Theorem 2.2 (3-4)]{Zhang} and \cite
Theorem 1]{Yayenie}. Then we give a related binomial identity for the
generalized bi-periodic Horadam sequence\textit{.}

For $n\geq 0$ and $k\geq 1,$ the Ruggles identity \cite{Ruggles} is given b
\begin{equation*}
F_{n+2k}=L_{k}F_{n+k}+\left( -1\right) ^{k+1}F_{n},
\end{equation*
where $\{F_{n}\}$ and $\{L_{n}\}$ are the Fibonacci and Lucas numbers,
respectively. Horadam \cite{Horadam} generalized this result to a general
second order recurrence relatio
\begin{equation*}
W_{n+2k}=V_{k}W_{n+k}+\left( -1\right) ^{k+1}q^{k}W_{n},
\end{equation*
where $W_{k}=pW_{k-1}+qW_{k-2}$ with arbitrary initial conditions $W_{0}$
and $W_{1}.$ The sequence $\left\{ V_{k}\right\} $ satisfies the same
recurrence relation as the sequence $\left\{ W_{k}\right\} ,$ but it begins
with $V_{0}=2,V_{1}=p.$

A generalization of Ruggles identity can be given in the following lemma.

\begin{lemma}
\label{l2}For integers $n\geq 0$ and $k\geq 1,$ we hav
\begin{equation*}
w_{n+2k}=\left( \frac{a}{b}\right) ^{\xi (n+1)\xi (k)}v_{k}w_{n+k}-\left(
-c\right) ^{k}w_{n}
\end{equation*
where $\left\{ w_{n}\right\} $ is the \textit{generalized bi-periodic
Horadam sequence} and $\{v_{n}\}$ is the \textit{generalized bi-periodic
Lucas sequence}.
\end{lemma}

\begin{proof}
It can be obtained simply by the Binet formula of $\left\{ w_{n}\right\} .$
\end{proof}

\begin{theorem}
\label{t3}For nonnegative integers $n,r$ and $m$ with $m>1$, we hav
\begin{equation*}
w_{2mn+r}=\dsum\limits_{i=0}^{n}\binom{n}{i}\left( -1\right) ^{\left(
m+1\right) \left( n-i\right) }\left( \frac{a}{b}\right) ^{\xi (m)\left(
\frac{i+\xi \left( i\right) }{2}\right) -\xi (im)\xi (r)}c^{m\left(
n-i\right) }v_{m}^{i}w_{im+r}.
\end{equation*}
\end{theorem}

\begin{proof}
From the Binet formula of $\left\{ v_{k}\right\} $ and $\alpha \beta =-abc,$
it is clear to see that
\begin{equation*}
\alpha ^{2m}=a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}v_{m}\alpha
^{m}-\left( -abc\right) ^{m}.
\end{equation*
By using the binomial theorem, we hav
\begin{equation*}
\alpha ^{2mn}=\sum_{i=0}^{n}\dbinom{n}{i}a^{i\frac{m+\xi (m)}{2}}b^{i\frac
m-\xi (m)}{2}}\left( -1\right) ^{\left( m+1\right) \left( n-i\right) }\left(
abc\right) ^{m\left( n-i\right) }v_{m}^{i}\alpha ^{im}.
\end{equation*
Similarly, we hav
\begin{equation*}
\beta ^{2mn}=\sum_{i=0}^{n}\dbinom{n}{i}a^{i\frac{m+\xi (m)}{2}}b^{i\frac
m-\xi (m)}{2}}\left( -1\right) ^{\left( m+1\right) \left( n-i\right) }\left(
abc\right) ^{m\left( n-i\right) }v_{m}^{i}\beta ^{im}.
\end{equation*}

Multiplying both sides of the above equalities by $A\alpha ^{r}$ and $B\beta
^{r},$ respectively, and using the Binet formula of $\left\{ w_{n}\right\} ,$
we ge
\begin{eqnarray*}
&&\left( A\alpha ^{2mn+r}-B\beta ^{2mn+r}\right) \\
&=&a^{-\xi \left( 2mn+r+1\right) }\left( ab\right) ^{\left\lfloor \frac{2mn+
}{2}\right\rfloor }w_{2mn+r} \\
&=&\sum_{i=0}^{n}\dbinom{n}{i}a^{i\frac{m+\xi (m)}{2}}b^{i\frac{m-\xi (m)}{2
}\left( -1\right) ^{\left( m+1\right) \left( n-i\right) }\left( abc\right)
^{m\left( n-i\right) }v_{m}^{i}\left( A\alpha ^{im+r}-B\beta ^{im+r}\right) .
\end{eqnarray*
Thus, again by using the identity $\xi (mn+r)=\xi (mn)+\xi (r)-2\xi (mn)\xi
(r),$ we hav
\begin{eqnarray*}
w_{2mn+r} &=&\sum_{i=0}^{n}\dbinom{n}{i}\left( -1\right) ^{\left( m+1\right)
\left( n-i\right) }c^{m\left( n-i\right) }v_{m}^{i}w_{im+r} \\
&&\times a^{i\frac{m+\xi (m)}{2}}b^{i\frac{m-\xi (m)}{2}}\left( ab\right)
^{m\left( n-i\right) -\left\lfloor \frac{2mn+r}{2}\right\rfloor
+\left\lfloor \frac{im+r}{2}\right\rfloor }a^{\xi \left( 2mn+r+1\right)
}a^{-\xi \left( im+r+1\right) }
\end{eqnarray*
which gives the desired result.
\end{proof}

\begin{remark}
Since $\left( \frac{a}{b}\right) ^{\xi (r+1)\xi (m)i+\left( -1\right)
^{r+1}\xi (m)\left( \frac{i-\xi \left( i\right) }{2}\right) }=\left( \frac{
}{b}\right) ^{\xi (m)\left( \frac{i+\xi \left( i\right) }{2}\right) -\xi
(im)\xi (r)},$ the results in \cite[Theorem 4.3, Theorem 4.5]{Zhang} can be
corrected by multiplying the right side of the equations by $\left( \frac{a}
b}\right) ^{\left( -1\right) ^{r+1}\left( \frac{i-\xi \left( i\right) }{2
\right) }.$
\end{remark}

\begin{corollary}
\label{c2}For $m,n,r>0,$ we hav
\begin{equation*}
w_{2mn+r}-\left( -1\right) ^{\left( m+1\right) n}c^{mn}w_{r}\equiv 0\left(
\func{mod}v_{m}\right) .
\end{equation*}
\end{corollary}

Note that for $m=2$ and $m=3$, Corollary \ref{c2} gives the results in \cite
Corollary 4.2, Corollary 4.4, Corollary 4.6]{Zhang}. Also for the case of
generalized Fibonacci and Lucas sequences, it gives the results in \cite
3.3. Corollary]{Siar}.

\begin{lemma}
\label{l3}For $m,r>0$, we hav
\begin{eqnarray*}
&&-\left( -abc\right) ^{m+r}+a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{2
}v_{r}\left( -abc\right) ^{m}z^{r}+z^{2\left( m+r\right) } \\
&=&z^{m+2r}a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}v_{m}
\end{eqnarray*
where $z$ is either $\alpha $ or $\beta .$
\end{lemma}

\begin{proof}
From the Binet formula of $\left\{ v_{n}\right\} $ and $\alpha \beta =-abc,$
it is clear to see that $z^{2r}=a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{2
}v_{r}z^{r}-\left( -abc\right) ^{r}.$ Thus we hav
\begin{eqnarray*}
&&-\left( -abc\right) ^{m+r}+a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{2
}v_{r}\left( -abc\right) ^{m}z^{r}+z^{2\left( m+r\right) } \\
&=&\left( -abc\right) ^{m}\left( a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{
}}v_{r}z^{r}-\left( -abc\right) ^{r}\right) +z^{2\left( m+r\right) } \\
&=&\left( -abc\right) ^{m}z^{2r}+z^{2\left( m+r\right) } \\
&=&z^{m+2r}\left( \left( -abc\right) ^{m}z^{-m}+z^{m}\right) \\
&=&z^{m+2r}\left( \beta ^{m}+\alpha ^{m}\right) \\
&=&z^{m+2r}a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}v_{m}.
\end{eqnarray*}
\end{proof}

\begin{theorem}
\label{t4}For $n,m,r>0$, we hav
\begin{eqnarray*}
&&-\left( -c\right) ^{m+r}w_{n}+\left( -c\right) ^{m}\left( \frac{a}{b
\right) ^{\xi (r)\xi (n+1)}v_{r}w_{r+n}+w_{2\left( m+r\right) +n} \\
&=&\left( \frac{a}{b}\right) ^{\xi (m)\xi (n+1)}v_{m}w_{m+2r+n}.
\end{eqnarray*}
\end{theorem}

\begin{proof}
From Lemma \ref{l3}, we hav
\begin{eqnarray}
&&-\left( -abc\right) ^{m+r}+a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{2
}v_{r}\left( -abc\right) ^{m}\alpha ^{r}+\alpha ^{2\left( m+r\right) }
\notag \\
&=&\alpha ^{m+2r}a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}v_{m}.
\label{*}
\end{eqnarray
Similarly, we hav
\begin{eqnarray}
&&-\left( -abc\right) ^{m+r}+a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{2
}v_{r}\left( -abc\right) ^{m}\beta ^{r}+\beta ^{2\left( m+r\right) }  \notag
\\
&=&\beta ^{m+2r}a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}v_{m}.
\label{**}
\end{eqnarray
By multiplying both sides of the equations (\ref{*}) and (\ref{**}) by
A\alpha ^{n}$ and $B\beta ^{n},$ respectively, we ge
\begin{eqnarray*}
&&-\left( A\alpha ^{n}-B\beta ^{n}\right) \left( -abc\right) ^{m+r} \\
&&+a^{\frac{r+\xi (r)}{2}}b^{\frac{r-\xi (r)}{2}}v_{r}\left( -abc\right)
^{m}\left( A\alpha ^{r+n}-B\beta ^{r+n}\right) \\
&&+\left( A\alpha ^{2\left( m+r\right) +n}-B\beta ^{2\left( m+r\right)
+n}\right) \\
&=&a^{\frac{m+\xi (m)}{2}}b^{\frac{m-\xi (m)}{2}}v_{m}\left( A\alpha
^{m+2r+n}-B\beta ^{m+2r+n}\right) .
\end{eqnarray*
Then by using the Binet formula of $\left\{ w_{n}\right\} $, we have
\begin{eqnarray*}
&&-\left( ab\right) ^{m+r}\left( -c\right) ^{m+r}a^{\frac{n+\xi (n)}{2}}b^
\frac{n-\xi (n)}{2}}w_{n} \\
&&+\left( -c\right) ^{m}\left( ab\right) ^{m+r}a^{\frac{n+\xi (r+n)+\xi (r)}
2}}b^{\frac{n-\xi (r+n)-\xi (r)}{2}}v_{r}w_{r+n} \\
&&+\left( ab\right) ^{m+r}a^{\frac{n+\xi (n)}{2}}b^{\frac{n-\xi (n)}{2
}w_{2\left( m+r\right) +n} \\
&=&\left( ab\right) ^{m+r}a^{\frac{n+\xi (m+n)+\xi (m)}{2}}b^{\frac{n-\xi
(m+n)-\xi (m)}{2}}v_{m}w_{m+2r+n}.
\end{eqnarray*
By considering the identity $\xi (mn+r)=\xi (mn)+\xi (r)-2\xi (mn)\xi (r),$
we get the desired result.
\end{proof}

If we take $r=1,m=2,c=1$ in Theorem \ref{t4}, we ge
\begin{equation*}
\left( ab+2\right) w_{n+4}=w_{n}+a^{\xi (n+1)}b^{\xi (n)}w_{n+1}+w_{n+6}
\end{equation*
which reduces to the identit
\begin{equation*}
\left( ab+1\right) w_{n+4}=w_{n}+a^{\xi (n+1)}b^{\xi (n)}w_{n+1}+a^{\xi
(n+1)}b^{\xi (n)}w_{n+5}
\end{equation*
in \cite[Theorem 4.15, Theorem 4.17]{Zhang}.

\begin{theorem}
\label{t5}The symbol $\dbinom{n}{i,j}$is defined by $\dbinom{n}{i,j}:=\frac
n!}{i!j!\left( n-i-j\right) !}.$ For $n,m,r,d>0,$ we hav
\begin{eqnarray}
w_{\left( m+2r\right) n+d} &=&v_{m}^{-n}\sum_{i+j+s=n}\dbinom{n}{i,j}\left(
-1\right) ^{s}\left( -c\right) ^{mj+\left( m+r\right) s}v_{r}^{j}w_{2\left(
m+r\right) i+rj+d}  \notag \\
&&\times \left( \frac{a}{b}\right) ^{\xi (r)\frac{j+\xi \left( j\right) }{2
-\xi (m)\frac{n+\xi \left( n\right) }{2}-\xi \left( rj\right) \xi \left(
d\right) +\xi \left( mn\right) \xi \left( d\right) }  \label{s2}
\end{eqnarray
an
\begin{eqnarray}
w_{2\left( m+r\right) n+d} &=&\sum_{i+j+s=n}\dbinom{n}{i,j}\left( -1\right)
^{j}\left( -c\right) ^{s\left( m+r\right) +mj}v_{m}^{i}v_{r}^{j}w_{\left(
m+2r\right) i+rj+d}  \notag \\
&&\times \left( \frac{a}{b}\right) ^{\xi (m)\frac{i+\xi \left( i\right) }{2
+\xi (r)\frac{j+\xi \left( j\right) }{2}-\xi \left( mi\right) \xi \left(
rj\right) -\xi \left( mi+rj\right) \xi \left( d\right) }.  \label{s3}
\end{eqnarray}
\end{theorem}

\begin{proof}
By using Lemma \ref{l3} and the multinomial theorem, we obtain the following
identities
\begin{eqnarray*}
&&a^{n\frac{m+\xi (m)}{2}}b^{n\frac{m-\xi (m)}{2}}v_{m}^{n}z^{\left(
m+2r\right) n} \\
&=&\sum_{i+j+s=n}\dbinom{n}{i,j}\left( -1\right) ^{s}\left( -abc\right)
^{s\left( m+r\right) +mj}a^{j\frac{r+\xi (r)}{2}}b^{j\frac{r-\xi (r)}{2
}v_{r}^{j}z^{2\left( m+r\right) i+rj}\text{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ }
\end{eqnarray*
an
\begin{eqnarray*}
&&z^{2\left( m+r\right) n} \\
&=&\sum_{i+j+s=n}\dbinom{n}{i,j}\left( -1\right) ^{j}\left( -abc\right)
^{s\left( m+r\right) +mj}a^{\frac{im+i\xi (m)+jr+j\xi (r)}{2}}b^{\frac
im-i\xi (m)+jr-j\xi (r)}{2}}v_{m}^{i}v_{r}^{j}z^{\left( m+2r\right) i+rj}.
\end{eqnarray*
By multiplying both sides in the preceding equalities by $z^{d}$ and using
the Binet formula of $\left\{ w_{n}\right\} ,$ we have (\ref{s2}) and (\re
{s3}), respectively.
\end{proof}

We note that for the computational simplicity, the equation (\ref{s3}) is
more practical than the equation (\ref{s2}).

From (\ref{s3}), by using the decompositio
\begin{equation*}
\sum_{i+j+s=n}=\sum_{i+j+s=n,i=0}+\sum_{i+j+s=n,i\neq 0}
\end{equation*
and Theorem \ref{t3}, we get the following corollary.

\begin{corollary}
\label{c3}For $n,m,r,d>0$, we hav
\begin{equation*}
w_{2\left( m+r\right) n+d}-\left( -1\right) ^{n\left( m+1\right)
}c^{mn}w_{2rn+d}\equiv 0\left( \func{mod}v_{m}\right) .
\end{equation*}
\end{corollary}

\section{Acknowledgement}

The first author is grateful to Dr. Mohamed Salim for the arrangement of her
visit to United Arab Emirates University (UAEU) in February 2019. It is
supported by UAEU UPAR Grant G00002599 (Fund No. 31S314).


An incomplete variant of Wilson's congruence

Abstract: This article examines the nontrivial solutions of the congruence \[ (p-1)\cdots(p-r) \equiv -1 \pmod p. \] We discuss heuristics for the proportion of primes $p$ that have exactly $N$ solutions to this congruence. We supply numerical evidence in favour of these conjectures, and discuss the algorithms used in our calculations.

\section{Heuristics and conjectures}
Wilson's Theorem \cite[Theorems 80 and 81]{HW} states that
 \[ (p-1)! \equiv -1 \pmod p \]
if and only if $p$ is a prime. Now truncate the factorial after $r$ terms. For which primes $p$ is there an $r$ for which
\begin{equation}\label{wit}
 (p-1)\cdots(p-r) \equiv -1 \pmod p ?
\end{equation}
Certainly $r=1$ is trivial; $r=p-1$ follows from Wilson's Theorem, whence $r=p-2$ follows trivially. Henceforth we consider only $2 \leq r \leq p - 3$.

Initially we proceeded as follows. The congruence \eqref{wit} has no solutions if and only if none of the $p - 4$ integers $(p-1)\cdots(p-r) + 1$, for $2\leq r \leq p-3$, are divisible by $p$. The probability that a prime $p$ divides a `random' integer $N$ is $1/p$. Given $m$ random integers chosen independently, the probability that $p$ does not divide any of them is then $(1 - 1/p)^m$. Thus, under heroic randomness and independence assumptions, we expect the proportion of $p$ for which \eqref{wit} has no solutions to be roughly
 \[ (1-1/p)^{p-4}\rightarrow e^{-1} \approx 0.36788 \]
when $p$ is large.

Turning to numerical experiment, we find that 429 of the 1229 primes less than $10^4$ have no solutions to \eqref{wit}. The proportion is 0.349, reasonably close to our initial guess.

It turns out that this guess is almost certainly wrong. The remainder of this paper may serve as yet another cautionary tale about the dangers of heuristic probabilistic reasoning in number theory.

First, our independence assumption is not justified. Denoting by $T_r$ the partial product $T_r = (p - 1) \cdots (p - r)$, we have:
\begin{Lem}\label{Lemma1}
For any $2 \leq r \leq p - 3$,
 \[ T_r T_{p-r-1} \equiv (-1)^{r+1} \pmod p. \]
\end{Lem}
\begin{proof}
Observe that $T_r \equiv (-1)^r r! \pmod p$, and apply Wilson's Theorem.
\end{proof}
Thus the cases $r$ and $s = p - r - 1$ are not independent. For odd $r$, we see that \eqref{wit} holds for $r$ if and only if it holds for $s$. For even $r$, we see that \eqref{wit} holds for either $r$ or $s$, but not both; and it holds for one of them if and only if $T_r \equiv \pm 1 \pmod p$.

Taking these observations into account, we should posit $p/4 + O(1)$ independent events with probability $1 - 1/p$ corresponding to the odd $r < p/2$, and $p/4 + O(1)$ independent events with probability $1 - 2/p$ corresponding to the even $r < p/2$. Our revised estimate for the proportion of primes for which \eqref{wit} has no solutions is thus
 \[ (1 - 1/p)^{p/4} (1 - 2/p)^{p/4} \rightarrow e^{-3/4} \approx 0.47237. \]
This `improved' heuristic is an even worse match for the observed data!

In fact we are on the right track. We have simply forgotten the following arithmetic gem.
\begin{Lem}\label{Lemma2}
Let $p \equiv 3 \pmod 4$. Then
\begin{equation*}
\left(\frac{p-1}2\right)! \equiv (-1)^{\nu_p} \pmod p,
\end{equation*}
where $\nu_p$ is the number of quadratic non-residues $1 < x < p/2$.
\end{Lem}
\begin{proof}
See \cite[Theorem 114]{HW}.
\end{proof}
When $\nu_p$ is even, the congruence \eqref{wit} automatically has the solution $r = (p-1)/2$. To incorporate this into our model, we must address the question as to how often $\nu_p$ is even. Numerical evidence (see Section \ref{sec:computations}) suggests the following conjecture:
\begin{con}\label{con1}
For $p \equiv 3 \pmod 4$, the proportion of $p$ for which $\left(\frac{p-1}2\right)! \equiv 1 \pmod p$ approaches $\frac{1}{2}$ as $p \to \infty$.
\end{con}
We are not aware of this conjecture having appeared before in print, but it has been raised on the Mathoverflow discussion forum \cite{MO}. The problem has been recast by Mordell \cite{Mordell1961} in terms of the class number $h(-p)$ of $\QQ(\sqrt{-p})$. Namely, for $p > 3$ we have
 \[ \nu_p = \begin{cases} 0 \pmod 2 & \text{if $h(-p) \equiv 3 \pmod 4$}, \\ 1 \pmod 2 & \text{if $h(-p) \equiv 1 \pmod 4$}. \end{cases} \]
We do not know if this interpretation sheds any light on Conjecture \ref{con1}.

We now revise our model a second time, taking into account Lemma \ref{Lemma2} and Conjecture \ref{con1}. Of those primes satisfying $p \equiv 1 \pmod 4$, asymptotically half the primes, our estimate for the proportion of primes for which \eqref{wit} has no solution is still $e^{-3/4}$. For those primes $p \equiv 3 \pmod 4$ with $\nu_p$ odd, the estimate is again $e^{-3/4}$. According to Conjecture \ref{con1} this accounts for another quarter of the primes. However, for the remaining primes, where $\nu_p$ is even, our estimate is zero. This leads to our main conjecture.
\begin{con}\label{Conmain}
The proportion of primes for which \eqref{wit} has no nontrivial solutions is
 \[ \frac{3}{4} e^{-3/4} \approx 0.3542749. \]
\end{con}

Using the same model, we may develop a more refined conjecture that estimates the proportion of primes $p$ for which there are exactly $N$ values of $r$ satisfying \eqref{wit}.
\begin{con}\label{ConN}
Let $N \geq 0$. The proportion of primes $p$ for which \eqref{wit} has exactly $N$ nontrivial solutions is
 \[
\frac{e^{-3/4}}{2^{N+1}}
 \left( \frac{3}{2} \sum_{k=0}^{\lfloor N/2 \rfloor} \frac{1}{k! (N-2k)!} + \sum_{k=0}^{\lfloor (N-1)/2 \rfloor} \frac{1}{k! (N-1-2k)!}\right).
 \]
\end{con}
This formula is derived as follows. For $k \geq 0$, denote by $P_k$ the probability that \eqref{wit} has exactly $k$ odd solutions in the range $3 \leq r < (p-1)/2$. By the discussion following Lemma \ref{Lemma1}, and the usual properties of the binomial distribution, for large $p$ our model suggests that
 \[ P_k = \binom{p/4 + O(1)}{k} \left(\frac1p\right)^k \left(1 - \frac1p\right)^{p/4 - k + O(1)} \rightarrow \frac{e^{-1/4}}{4^k k!}. \]
Similarly, for $\ell \geq 0$ denote by $Q_\ell$ the probability that $T_r \equiv \pm 1 \pmod p$ has exactly $\ell$ even solutions in the range $2 \leq r < (p-1)/2$. Then
 \[ Q_\ell = \binom{p/4 + O(1)}{\ell} \left(\frac2p\right)^\ell \left(1 - \frac2p\right)^{p/4 - \ell + O(1)} \rightarrow \frac{e^{-1/2}}{2^\ell \ell!}. \]
Assuming that the behaviour for odd and even $r$ is independent, the probability of observing exactly $N$ solutions for $2 \leq r \leq p - 3$, $r \neq (p-1)/2$, should be
 \[ \sum_{2k + \ell = N} P_k Q_\ell = \sum_{k=0}^{\lfloor N/2\rfloor} \frac{e^{-1/4}}{4^k k!} \cdot \frac{e^{-1/2}}{2^{N-2k} (N-2k)!} = \frac{e^{-3/4}}{2^N} \sum_{k=0}^{\lfloor N/2\rfloor} \frac1{k!(N-2k)!}. \]
Finally, for $p \equiv 1 \pmod 4$, and for $p \equiv 3 \pmod 4$ with $\nu_p$ odd, the probability that \eqref{wit} has exactly $N$ solutions is given by the above formula (the exceptional value $r = (p-1)/2$ makes a negligible contribution asymptotically). For $p \equiv 3 \pmod 4$ with $\nu_p$ even, we must replace $N$ by $N-1$ to account for the automatic solution $r = (p-1)/2$. Our final estimated probability is thus
 \[ \frac34 \left(\frac{e^{-3/4}}{2^N} \sum_{k=0}^{\lfloor N/2\rfloor} \frac1{k!(N-2k)!} \right) + \frac 14 \left(\frac{e^{-3/4}}{2^{N-1}} \sum_{k=0}^{\lfloor (N-1)/2\rfloor} \frac1{k!(N-1-2k)!}\right). \]

\section{Algorithms and computations}
\label{sec:computations}

We first consider the motivating problem, counting the number of nontrivial solutions to \eqref{wit}. For this the na\"ive algorithm appears to be the best available. For each prime $p$ up to some bound, we compute $T_2, T_3, \ldots$, by successive multiplication modulo $p$, and count how many times we see $-1$.

We wrote a simple C implementation of this algorithm, paying some attention to efficient modular arithmetic. We ran it for all primes up to $10^8$. The running time was 22 hours on a 16-core 2.6 GHz Intel Xeon server. Table \ref{tab1} summarises the results. The last column shows the probabilities for each $N$ proposed in Conjecture \ref{ConN}; they are a superb fit for the observed proportions in the previous column.

It is difficult to push the search bound higher. The running time for each prime is essentially linear in $p$, so the cost of handling all $p < x$ grows essentially quadratically in $x$. For example, to increase the search bound to $10^9$ would take about three months on the same hardware. We do not know of any asymptotically faster algorithms for this problem.
\begin{table}[h]
\centering
\caption{Statistics of nontrivial solutions to \eqref{wit} for $p < 10^8$}
\begin{tabular}{rrrr}
\toprule
 $N$  & \# Primes with $N$ solutions   & Proportion & Conjecture \ref{ConN} \\
\midrule
0           &   2041117      &  0.3542711  &   0.3542749   \\
1           &   1701240      &  0.2952796  &   0.2952291   \\
2           &   1104376      &  0.1916835  &   0.1918989   \\
3           &    553921      &  0.0961426  &   0.0959495   \\
4           &    232308      &  0.0403211  &   0.0402865   \\
5           &     87019      &  0.0151037  &   0.0151612   \\
6           &     29037      &  0.0050399  &   0.0050358   \\
7           &      8887      &  0.0015425  &   0.0015638   \\
8           &      2631      &  0.0004567  &   0.0004423   \\
9           &       692      &  0.0001201  &   0.0001190   \\
10          &       165      &  0.0000286  &   0.0000298   \\
11          &        42      &  0.0000073  &   0.0000071   \\
12          &        17      &  0.0000030  &   0.0000016   \\
13          &         3      &  0.0000005  &   0.0000004   \\
\midrule
Total       &   5761455      &  1.0000000  &   1.0000000   \\
\bottomrule
\end{tabular}
\label{tab1}
\end{table}

Next we consider the problem of computing $((p-1)/2)! \pmod p$ for $p \equiv 3 \pmod 4$, in order to test Conjecture \ref{con1}. For this there is a greater variety of algorithms available. The na\"ive approach leads to an $O(p)$ algorithm as above (with a comparable implied constant). An algorithm with complexity $p^{1/2+o(1)}$ can be deduced from \cite{BGS}. We opted to implement an algorithm with average complexity only $(\log p)^{4 + o(1)}$ per prime, using the ``accumulating remainder tree'' technique introduced in \cite{CGH}.

We give a brief sketch of this algorithm. Suppose that we wish to compute $r_p = ((p-1)/2)! \bmod p$ for all primes $p \equiv 3 \pmod 4$ in some interval $2M < p < 2N$, where $M$ and $N$ are positive integers. Consider the binary tree, with nodes indexed by pairs $(a, b)$, where $b > a > 0$ are integers, defined as follows. The root node is $(M, N)$. The children of a given node $(a, b)$ are $(a, c)$ and $(c, b)$, where $c = \lfloor (a + b)/2\rfloor$. For each node let
 \[ I_{a,b} = \{k \in \ZZ : \text{$k$ odd, } 2a < k < 2b\}. \]
Thus at level $d$, the intervals $I_{a,b}$ partition $I_{M,N}$ into $2^d$ subintervals of roughly equal size. We stop at level $\ell = \lceil \log_2(N - M)\rceil$; at this level each $I_{a,b}$ has cardinality either zero or one.

The algorithm now proceeds as follows. First, for each node let
 \[ P_{a,b} = \prod_{\substack{p \in I_{a,b} \\ p \equiv 3 \bmod 4 \\ \text{$p$ prime}}} p, \qquad  V_{a,b} = \prod_{k \in I_{a,b}} \frac{k+1}2. \]
Compute $V_{a,b}$ and $P_{a,b}$ for each node, working from the bottom of the tree to the top, using the identities $V_{a,b} = V_{a,c} V_{c,b}$ and $P_{a,b} = P_{a,c} P_{c,b}$. Second, for each node let
 \[ X_{a,b} = a! \bmod {P_{a,b}}. \]
Compute $X_{M,N} = M! \bmod P_{M,N}$ using the method of Sch\"onhage (see for example \cite[Prop.~2.3]{CGH}). Then compute $X_{a,b}$ for each node, now working from the top of the tree downwards, using the formulae $X_{a,c} = X_{a,b} \bmod P_{a,c}$ and $X_{c,b} = X_{a,b} V_{a,c} \bmod P_{c,b}$ to descend from each node to its children. Finally, for each $p \equiv 3 \pmod 4$ in the interval $2M < p < 2N$, there is a unique node $(a, b)$ at level $\ell$ such that $p \in I_{a,b}$; for this node we have $I_{a,b} = \{p\}$, $P_{a,b} = p$ and $X_{a,b} = ((p-1)/2)! \pmod p$. For more details, including a complexity analysis, see \cite{CGH}. We mention here only that the complexity bound depends essentially on asymptotically fast algorithms for multiplication and division of large integers.

Using a straightforward implementation of the above algorithm in the Sage computer algebra system \cite{sage}, we computed $r_p$ for all $p < 10^{10}$. To keep memory usage under control, we split the work into intervals $(M, N)$ of size $1.5 \times 10^8$. The total CPU time expended was 4.4 days. The results, shown in Table \ref{tab2}, are in excellent agreement with Conjecture \ref{con1}.
\begin{table}[h]
\centering
\caption{Statistics of $r_p$ for $p < 10^{10}$, $p \equiv 3 \pmod 4$}
\begin{tabular}{lrrr}
\toprule
 $X$  & $\# \{p < X\}$ & $\# \{ p < X: r_p = 1 \}$ & proportion \\
\midrule
$10^1$     &             2  &              1   &  0.5000000000 \\
$10^2$     &            13  &              6   &  0.4615384615 \\
$10^3$     &            87  &             43   &  0.4942528736 \\
$10^4$     &           619  &            310   &  0.5008077544 \\
$10^5$     &        4\,808  &         2\,418   &  0.5029118136 \\
$10^6$     &       39\,322  &        19\,704   &  0.5010935354 \\
$10^7$     &      332\,398  &       166\,270   &  0.5002135994 \\
$10^8$     &   2\,880\,950  &    1\,440\,268   &  0.4999281487 \\
$10^9$     &  25\,424\,042  &   12\,713\,329   &  0.5000514474 \\
$10^{10}$  & 227\,529\,235  &  113\,772\,462   &  0.5000344769 \\
\bottomrule
\end{tabular}
\label{tab2}
\end{table}

\section*{Acknowledgements}

We are indebted to Professor Roger Heath-Brown for suggesting part of the argument leading to Conjectures \ref{Conmain} and \ref{ConN}.

\bibliographystyle{plain}


Matchings and Hamilton Cycles with Constraints on Sets of Edges

Abstract: The aim of this paper is to extend and generalise some work of Katona on the existence of perfect matchings or Hamilton cycles in graphs subject to certain constraints. The most general form of these constraints is that we are given a family of sets of edges of our graph and are not allowed to use all the edges of any member of this family. We consider two natural ways of expressing constraints of this kind using graphs and using set systems.For the first version we ask for conditions on regular bipartite graphs $G$ and $H$ for there to exist a perfect matching in $G$, no two edges of which form a $4$-cycle with two edges of $H$.In the second, we ask for conditions under which a Hamilton cycle in the complete graph (or equivalently a cyclic permutation) exists, with the property that it has no collection of intervals of prescribed lengths whose union is an element of a given family of sets. For instance we prove that the smallest family of $4$-sets with the property that every cyclic permutation of an $n$-set contains two adjacent pairs of points has size between $(1/9+o(1))n^2$ and $(1/2-o(1))n^2$. We also give bounds on the general version of this problem and on other natural special cases.We finish by raising numerous open problems and directions for further study.

\section{Introduction}

Many results in graph theory concern establishing conditions on a graph $G$ which guarantee that $G$ must contain some particular spanning structure. A classical example of this is Dirac's theorem \cite{Dirac}:

\begin{theorem}[Dirac]\label{dirac:thm}
Every graph on $n$ vertices with minimum degree at least $n/2$ has a Hamilton cycle.
\end{theorem}

Demetrovics, Katona, and Sali \cite{DKS} proved an extension of this in which there is a second graph $H$ on the same vertex set as $G$, and we are required to find a Hamilton cycle in $G$ which satisfies the condition that no two edges of it form an ``alternating cycle'' with two edges of $H$. More precisely they proved:

\begin{theorem}[Demetrovics, Katona, and Sali]\label{dks:thm}
Let $G$ and $H$ be graphs with $V(G)=V(H)$ and $E(G)\cap E(H)=\emptyset$.
Let $|V(G)|=n$, $r$ be the minimum degree of $G$, and $s$ be the maximum degree of $H$. Provided that
\[
2r-8s^2-s-1>n
\]
there is a Hamilton cycle in $G$ such that if $(a,b)$ and $(c,d)$ are both edges
of the cycle, then $(b,c),(d,a)$  are not both edges of $H$.
\end{theorem}

We mention briefly that this theorem was proved with an application involving pairing up sets in mind. In this application, the graph $G$ has as vertices the $r$-element subsets of $[m]$ with disjoint subsets being adjacent. By a suitable choice of $H$ it was shown that the $r$-element subsets of $[m]$ can be paired up into disjoint pairs with distinct pairs being significantly different in some natural quantitative sense. See \cite{DKS} and \cite{K} for more details.

Some further results on finding Hamilton cycles in graphs under constraints of this kind were proved and some questions were raised in \cite{K}. The aim of this paper is to answer, completely or partially, some of these questions, and to give some further results, questions and conjectures which may lead towards a more general theory of problems of this kind.

In Section 2 we consider the following question and related problems.

\begin{q}\label{regularmatch:q}
Let $A,B$ be fixed $n$-sets and let $G,H$ be bipartite graphs on $A\cup B$ with bipartition $(A,B)$. Further, suppose that $G$ is $r$-regular, $H$ is $s$-regular and $G$ and $H$ have disjoint edge sets. For which $n,r,s$ are we guaranteed that there exists a perfect matching in $G$ in which no two edges of the matching form a 4-cycle with two edges of $H$.
\end{q}

Answers to this can be thought of as bipartite analogues of Theorem \ref{dks:thm}. The replacement of the Hamilton cycle in a graph of Theorem \ref{dks:thm} with a perfect matching in a bipartite graph is natural particularly given the pairing up sets applications from \cite{DKS} and \cite{K}. We give conditions on $r$ and $s$ for a perfect matching of this form to exist. In the case that $G$ and $H$ are bipartite complements (in the sense that they are edge disjoint and their union is $K_{n,n}$) we are able to bound the smallest $s$ for which a suitable perfect matching is guaranteed to exist between $c_1n^{1/2}$ and $c_2n^{3/4}$.

Section 3 concerns generalisations of the following question from \cite{K}.

\begin{q}\label{F:q}
What is the smallest family $\mathcal{F}\subseteq[n]^{(4)}$ with the property that every Hamilton cycle in $K_n$ contains a pair of edges whose union is an element of $\mathcal{F}$.
\end{q}

In the general question $\mathcal{F}$ is a family of $r$-sets and we require that our Hamilton cycle does not have a set of intervals of given lengths whose union is an element of $\mathcal{F}$.

To describe this generalisation more precisely, let $\mathcal{F}\subseteq[n]^{(r)}$, and ${\bf x}=(x_1,\dots,x_k)$ with $x_i$ positive integers and $\sum x_i=r$. We say that a Hamilton cycle in $G$ is ${\bf x}$-acceptable for $\mathcal{F}$ if we do not have intervals of vertices of lengths $x_1,\dots,x_k$ in the cycle whose union is an element of $\mathcal{F}$. We are interested in how small $|\mathcal{F}|$ can be if there is no ${\bf x}$-acceptable Hamilton cycle for $\mathcal{F}$.

Although this question is implicitly present in \cite{K}, no general results or conjectures are made there. We give upper and lower bounds for the smallest such $|\mathcal{F}|$, each of the form $c n^{r-k}$, and conjecture that our general upper bound is asymptotically tight. We prove results on a number of special cases including improved bounds when ${\bf x}=(2,2)$, an asymptotic determination of the extremal function when ${\bf x}=(2,\underbrace{1,\dots,1}_{r-2})$, and an answer to a question from \cite{K} on the ${\bf x}=(3,1)$ case.

In the final section we suggest a number of further questions and directions for study.

We note that a more general context for expressing this kind of problem is the notion of finding structures under constraints which forbid certain sets of edges all being used. We are given a graph $G$ and a family of sets of edges.
Under what conditions on $G$ and this family  can we guarantee the existence of some structure (typically a Hamilton cycle or a perfect matching) the edge set of which does not contain any member of the forbidden family. For example, the conditions of Theorem \ref{dks:thm} can be phrased as: for every pair of edges $(a,b),(c,d)\in E(G)$ for which $(b,c),(d,a)\in E(H)$ we cannot use both $(a,b)$ and $(c,d)$ in our Hamilton cycle. Both the constraints coming from a graph looked at in Section 2 and the constraints coming from a set system considered in Section 3 are also of this form. It may be interesting to consider different ways of expressing constraints of this kind in addition to the two considered here.

Finally we remark that although the case that $G$ is a complete graph considered as \ref{F:q} looks rather special, we feel this may be a potentially good first step towards understanding the general behaviour. Another justification for this special case is that it naturally generalises some classical graph theoretic results. Dirac's theorem for instance can be stated (somewhat perversely) as: ``If $F\subseteq V^{(2)}$ is a set of forbidden edges then provided that no vertex is incident with more than $n/2$ elements of $F$ the graph $K_n$ contains a Hamilton cycle which does not contain any element of $F$.'' In our problem we replace the condition that certain edges are not allowed to be used with the condition that none of a certain family of \emph{sets} of edges is allowed to be all used .

\section{Matchings with Constraints given by a graph}

Throughout this section, by bipartite graph we mean a graph on vertex set $V=A\cup B$ with bipartition $(A,B)$ and $|A|=|B|=n$. In other words when we speak of several bipartite graphs they always have a single fixed bipartition. If $G$ and $H$ are bipartite graphs we say that a perfect matching $M$ in $G$ is \emph{acceptable} for $H$ if no two edges of $M$ form a 4-cycle with two edges of $H$. The general question is:

\begin{q}\label{match:q}
Under what conditions on the degrees of $G$ and $H$ can we guarantee the existence of a perfect matching in $G$ which is acceptable for $H$?
\end{q}

It is natural to consider the case that $G$ and $H$ are regular graphs. It will be convenient to assume further that the edge sets of $G$ and $H$ are disjoint. This brings us to Question \ref{regularmatch:q} from the introduction.

We have the following positive result which applies when $r$ is reasonably large.

\begin{theorem}\label{match-deg:thm}
Let $G$ be an $r$-regular bipartite graph and $H$ be an $s$-regular bipartite graph with $E(G)\cap E(H)=\emptyset$. Provided that $r>\frac{n}{2}+s^2$ there exists a perfect matching in $G$ which is acceptable for $H$.
\end{theorem}

\begin{proof}
Since $G$ is regular it certainly contains at least one perfect matching. Suppose, for a contradiction, that $G$ does not contain a perfect matching which is acceptable for $H$. Remove edges from $H$ one by one until one of the perfect matchings in $G$ becomes acceptable. Let $H'$ be the subgraph we are left with, and $e$ be the last edge removed. Let $M$ be any perfect matching in $G$ which is acceptable for $H'$. Label the vertices so that $A=\{a_1,\dots,a_n\}$, $B=\{b_1,\dots,b_n\}$ with $M=\{(a_i,b_i): 1\leq i\leq n\}$ and $e=(a_n,b_{n-1})$.

Adding $e$ to $H'$ makes $M$ unacceptable but this can only be because of the $4$-cycle $a_n,b_n,a_{n-1},b_{n-1}$. Hence, the matching $M\setminus (a_n,b_n)$ of $n-1$ edges is acceptable for $H'\cup e$. Let $Y=\Gamma_H(a_n)\subseteq B$ and $X=\Gamma_H(b_n)\subseteq A$. Let $X'=\{b_i: a_i\in X\}$, $Y'=\{a_i:b_i\in Y\}$. Finally, let $X''=\Gamma_H(X')\subseteq A$ and $Y''=\Gamma_H(Y')\subseteq B$. Since $H$ is $s$-regular $|X''|, |Y''|\leq s^2$. Since $deg_G(a_n)-|Y''|\geq r-s^2>n/2$ and similarly $deg_G(b_n)-|X''|\geq r-s^2>n/2$ we can find $t$ so that $(a_n,b_t),(a_t,b_n)\in E(G)$, $a_t\not\in X''$, $b_t\not\in Y''$.

We claim that $M'=M\setminus \{(a_n,b_n),(a_t,b_t)\}\cup\{(a_t,b_n),(a_n,b_t)\}$ is acceptable for $H'\cup e$. This will contradict the definition of $H'$ and $e$.

Suppose that we have a bad $4$-cycle containing two edges of $M'$ and two edges of $H'\cup e$. Since $M\setminus (a_n,b_n)$ is acceptable for $H'\cup e$ our bad cycle must contain at least one edge of $(a_t,b_n),(a_n,b_t)$. Further, since $a_n,b_n\not\in E(H)$ (as $E(G)\cap E(H)=\emptyset$) it must contain exactly one of the edges. Suppose that our bad cycle is $a_n,b_t,a_s,b_s$ with $(a_n,b_s),(a_s,b_t)\in E(H)$. This means that $b_s\in Y$, $a_s\in Y'$ and $b_t\in Y''$, contradicting our choice of $t$. Similarly, by the definition of $X,X'$ and $X''$, we cannot have that our bad cycle is $b_n,a_t,b_s,a_s$. It follows that $M'$ is acceptable for $H'\cup e$ and this contradiction completes the proof.
\end{proof}

A special case of this result gives a condition for an acceptable matching when $E(H)=E(K_{n,n})\setminus E(G)$. To express this we introduce some notation. Suppose that $G$ is a bipartite graph. We write $\overline{G}$ for the bipartite graph with edge set $\{ab: a\in A, b\in B, ab\not\in E(G)\}$. Let $b(n)$ be the minimum number $s$ such that there exists an $s$-regular bipartite graph $H$ for which there is no perfect matching in $\overline{H}$ which is acceptable for $H$.

\begin{cor}\label{match-comp-lb:cor}
For all $n$ we have that
\[
b(n)>\frac{1}{2}\left(\sqrt{2n+1}-1\right)=(\sqrt{2}+o(1))n^{1/2}.
\]
\end{cor}

\begin{proof}
If $H$ is an $s$-regular graph then $G=\overline{H}$ is an $n-s$ regular graph. Theorem \ref{match-deg:thm} shows that
we have a perfect matching in $G$ which is acceptable for $H$ if $n-s>\frac{n}{2}+s^2$. That is if $s<\frac{1}{2}\left(\sqrt{2n+1}-1\right)$.
\end{proof}

A construction gives an upper bound for $b(n)$.

\begin{theorem}\label{match-comp-ub:thm}
For infinitely many $n$ we have that
\[
b(n)<(2+o(1))n^{3/4}.
\]
\end{theorem}

The construction we give works for all $n$ of the form $m\lfloor m^{1/3}\rfloor$ where $m=\frac{q^4-1}{q-1}$ with $q$ a prime power. It appears to be surprisingly difficult to deduce anything valid for all values of $n$ from this. The fact that we do not even know whether the function $b(n)$ is non-decreasing in $n$ contributes to this difficulty.

An ingredient of this construction is a bipartite graph with good expansion properties as described in the following result of Alon \cite{Alon}.

\begin{theorem}[Alon \cite{Alon}]\label{alon:thm}
For any integer $d\geq 1$ and $n=\frac{q^{d+1}-1}{q-1}$ with $q$ a prime power, there is an $r$-regular bipartite graph with $r=\frac{q^d-1}{q-1}=(1+o(1))n^{1-1/d}$ such that for all $0<x<n$ and any $X\subseteq A$ with $|X|=x$ we have $|\Gamma(X)|\geq n-\frac{n^{1+1/d}}{x}$.
\end{theorem}

\begin{proof}[Proof of Theorem \ref{match-comp-ub:thm}]
Let $m=\frac{q^4-1}{q-1}$ and $n=m\lfloor m^{1/3}\rfloor$. We need to construct a regular bipartite graph $H$ of degree $(2+o(1))n^{3/4}$ with the property that no perfect matching in $G=\overline{H}$ is acceptable for $H$.

We first partition the vertices in $A$ into $k=\lfloor m^{1/3}\rfloor$ parts $A_1,A_2,\dots,A_k$ each of size $m$. Similarly we partition the vertices in $B$ into $k=\lfloor m^{1/3}\rfloor$ parts $B_1,B_2,\dots,B_k$ each of size $m$.

Let $B(m)$ be a bipartite graph with $m$ vertices in each part which satisfies the conditions of the $d=3$ case of Theorem \ref{alon:thm}. This graph is regular of degree $(1+o(1))m^{2/3}$.

We form $H$ by putting a copy of $K_{m,m}$ between each pair $A_i,B_i$ for $1\leq i\leq k$ and a copy of $B(m)$ between each pair $A_i,B_j$ with $i\not=j$. The graph $H$ is clearly regular of degree $m+(k-1)(1+o(1))m^{2/3}=(2+o(1))n^{3/4}$.

Suppose that $M$ is any perfect matching in $G$. Let $Y=\{b\in B: (a,b)\in M \text{ for some } a\in A_1\}$ and $X=\{a\in B: (a,b)\in M \text{ for some } b\in B_1\}$. Since $|X|=|Y|=m$ and $X\cap A_1=Y\cap B_1=\emptyset$ there is some $s$ with $|X\cap A_s|\geq m/(k-1)>m^{2/3}$ and some $t$ with $|Y\cap B_t|\geq m/(k-1)>m^{2/3}$. Now, if $s=t$ we have a $4$-cycle consisting of an edge of $M$ between $A_1$ and $B_t$, an edge of $M$ between $A_s$ and $B_1$, and two edges from copies of $K_{m,m}$. If $s\not=t$ then the construction of $B(m)$ implies that there is some edge of $H$ between $X\cap A_s$ and $Y\cap B_t$. If not then $X\cap A_s$ has less than $m-|Y\cap B_t|\leq m-m^{2/3}$ neighbours in $B_s$ contradicting the defintion of $B(m)$. It follows that we have a $4$-cycle consisting of this edge, an edge of $M$ between $A_1$ and $B_t$, an edge of $M$ between $A_s$ and $B_1$, and an edge from the copy of $K_{m,m}$ between $A_1$ and $B_1$.

We conclude that $H$ does have the property that no perfect matching in $G$ is acceptable for $H$.
\end{proof}

In fact, if we only require an $H$ with small maximum degree with the property that no perfect matching in $\overline{H}$ is acceptable for $H$ a slightly simpler construction works. Assuming $n$ is of the form $\frac{q^4-1}{q-1}$ start with a copy of $B(n)$ as defined in the proof above. Take subsets $X\subseteq A$, $Y\subseteq B$ with $|X|=|Y|=n^{2/3}+1$ and add all edges between $X$ and $Y$ to form a graph $H$. Since there is an edge of $B(n)$ between any two subsets of size $n^{2/3}+1$, there is an edge of $B(n)$ between the vertices matched to $X$ and the vertices matched to $Y$ for any perfect matching in $\overline{H}$. It follows that no perfect matching in $\overline{H}$ is acceptable for $H$. The graph $H$ has maximum degree at most $2n^{2/3}+1$ although it is not regular.

Turning now to the more general question in which $G$ and $H$ are not required to be complementary Theorem \ref{match-deg:thm} is rather weak since the condition only holds when the degree of $G$ is quite large. For smaller degrees of $G$ we have a negative result obtained by taking copies of the graph constructed in the proof of Theorem \ref{match-comp-ub:thm}.

\begin{cor}
For any $r$ there exists, for infinitely many $n$, an $r$-regular graph $G$ and a $(2+o(1))r^{3/4}$-regular graph $H$ with disjoint edge sets and with the property that no perfect matching in $G$ is acceptable for $H$.
\end{cor}

\begin{proof}
Take vertex disjoint copies of the graphs constructed in the proof of Theorem \ref{match-comp-ub:thm}.
\end{proof}

Positive results in this small degree of $G$ case seem to be harder to prove. Indeed, we can not answer even the following apparently simple question:

\begin{q}\label{match-small:q}
Is there an integer $k$ such that for all sufficiently large $n$, if $G$ is a $k$-regular bipartite graph and $H$ is a 1-regular bipartite graph, we are guaranteed to have a perfect matching in $G$ which is acceptable for $H$?
\end{q}

We remark briefly that the conclusion does not hold if $k=2$ since such a 2-regular $G$ may have only 2 perfect matchings and it is easy to choose a 1-regular $H$ so that neither of them is acceptable (provided that $n\geq7$). However, it may be that even $k=3$ is sufficient for a positive answer.

\section{Constraints given by a set system}

\subsection{Hamilton cycles}

We turn now to constraints described in a different form.

If $\mathcal{F}\subseteq[n]^{(4)}$ and $G$ is a graph with vertex set $[n]$ we say that a Hamilton cycle in $G$ is a $(2,2)$-acceptable Hamilton cycle with respect to $\mathcal{F}$ if we do not have two disjoint edges of the cycle whose union is an element of $\mathcal{F}$. We will mainly be interested in the case when $G=K_n$. This leads us to Question \ref{F:q} from the introduction which can now be rephrased as:

\begin{q}\label{F22:q}
What is the smallest family $\mathcal{F}\subseteq[n]^{(4)}$ with the property that $K_n$ does not contain a $(2,2)$-acceptable Hamilton cycle with respect to $\mathcal{F}$?
\end{q}

A Hamilton cycle in $K_n$ can be thought of as a cyclic ordering of the vertices and we shall represent our Hamilton cycles by such a string of vertices. For a more general question, suppose that $G$ is a graph with vertex set $[n]$, $\mathcal{F}\subseteq[n]^{(r)}$, and ${\bf x}=(x_1,\dots,x_k)$ with $x_i$ positive integers and $\sum x_i=r$. We say that a Hamilton cycle $c_1,c_2,c_3,\dots,c_n$ in $G$ is ${\bf x}$-acceptable for $\mathcal{F}$ if we do not have $t_1,\dots,t_k$ with
\[
\bigcup_{i=1}^k\{c_{t_i+1},c_{t_i+2},\dots,c_{t_i+x_i}\}\in\mathcal{F}.
\]
(Here and elsewhere we interpret suffices modulo $n$.)

We generalise Question \ref{F22:q} in the obvious way.

\begin{q}\label{Fx:q}
Given ${\bf x}$ as above what is the smallest family $\mathcal{F}\subseteq[n]^{(r)}$ with the property that $K_n$ does not contain an ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$?
\end{q}

We will denote the size of this smallest family $\mathcal{F}$ by $m({\bf x},n)$.

This question of determining $m({\bf x},n)$ was essentially raised (with slightly different notation) in \cite{K} where a number of constructions relating to particular cases of it are given. Our aim is to improve the bounds in some of these and other special cases, and also to consider what general results may hold. We will generally be interested in asymptotic results in which $n$ tends to infinity with ${\bf x}$ (and hence $r$) being fixed.

A simple averaging argument gives a lower bound on $m({\bf x},n)$ for any ${\bf x}$.

\begin{theorem}\label{mxn-lb:thm}
Given ${\bf x}$ as above we have that
\[
m({\bf x},n)\geq\left(\frac{1}{c({\bf x})x_1!x_2!\dots x_k!}+o(1)\right)n^{r-k},
\]
where $c({\bf x})$ is the number of unordered partitions of an $r$-set into $k$ sets of sizes $x_1,x_2,\dots,x_k$ (and in particular does not depend on $n$).
\end{theorem}

Let $S$ be the set of all Hamilton cycles in $K_n$ (cyclic orderings of the vertices). Clearly $|S|=(n-1)!$. Given a set $F\in[n]^{(r)}$ we denote by $H(F)$ the set of all elements of $S$ which are not acceptable with respect to the single set $F$ (that is all cyclic orderings in which $F$ is a union of disjoint intervals of the appropriate size). Of course $H(F)$ also depends on ${\bf x}$ but it will always be clear from the context what ${\bf x}$ is and so this notation should cause no confusion.

\begin{proof}
If $\mathcal{F}$ is such that $K_n$ has no ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$ then $\bigcup_{F\in\mathcal{F}}H(F)=S$ and so $\sum_{F\in\mathcal{F}}|H(F)|\geq(n-1)!$. Now $|H(F)|$ does not depend on $F$ and $|H(F)|\leq c({\bf x})x_1!x_2!\dots x_k!(n-r+k-1)!$ (for certain ${\bf x}$ this will be an equality but in some cases it will be possible to have a Hamilton cycle for which $F$ can be represented as the union of suitable intervals in more than one way). It follows that
\[
c({\bf x})x_1!x_2!\dots x_k!(n-r+k-1)!|\mathcal{F}|\geq(n-1)!
\]
and so
\[
|\mathcal{F}|\geq\frac{(n-1)!}{c({\bf x})x_1!\dots x_k!(n-r+k-1)!}=\left(\frac{1}{c({\bf x})x_1!x_2!\dots x_k!}+o(1)\right)n^{r-k}
\]
as required.
\end{proof}

In fact this lower bound gives the correct order of magnitude for $m({\bf x},n)$ as the following theorem shows.

\begin{theorem}\label{mxn-ub:thm}
Given ${\bf x}$ as above and $n\geq r$ we have that
\[
m({\bf x},n)\leq\binom{n-k}{r-k}=\left(\frac{1}{(r-k)!}+o(1)\right)n^{r-k}.
\]
\end{theorem}

\begin{proof}
Let $\mathcal{F}=\{X\in[n]^{(r)}: \{1,2,\dots,k\}\subseteq X\}$.

We will show that in any permutation of $[n]$ it is possible to find $k$ disjoint intervals of lengths $x_1,x_2,\dots,x_k$ such that
the union of these intervals contains $[k]$. This clearly shows that there is no ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$.

We will prove this claim by induction on $n$. If $n=1$ then the claim obviously holds. It is also clearly true if $n=r$. Suppose that $n>1$, $r<n$ and $c_1,\dots,c_n$ is our permutation. If $c_1\not\in[k]$ then applying the induction hypothesis to the permutation $c_2,\dots,c_n$ gives the result. If $c_1\in[k]$ then we will take our first interval to be $c_1,\dots,c_{x_1}$ and consider the permutation $c_{x_1+1},\dots,c_n$. Applying the induction hypothesis to this permutation with vector of interval lengths $(x_2,\dots,x_k)$ gives the result. (It may be that we have fewer than $k-1$ elements of $[k]$ contained in this permutation but this can only weaken the condition we need to satisfy.)
\end{proof}

If some of the $x_i$ are equal to 1 then the bound of Theorem \ref{mxn-ub:thm} is not sharp. In this situation we have the following stronger result.

\begin{theorem}\label{mxn-ub2:thm}
If ${\bf x}=(x_1,\dots,x_k)$ with $x_1\geq\dots\geq x_t>x_{t+1}=\dots=x_k=1$ then
\[
m({\bf x},n)\leq(1+o(1))\frac{\binom{n-t}{r-k}}{\binom{r-t}{r-k}}=\left(\frac{(k-t)!}{(r-t)!}+o(1)\right)n^{r-k}.
\]
\end{theorem}

\begin{proof}
Let $\mathcal{M}$ be the smallest family of $(r-t)$-subsets of $[n]\setminus[t]$ with the property that every $(r-k)$-subset of $[n]\setminus[t]$ is contained in at least one set in $\mathcal{M}$. By R\"odl's proof of the Erd\H os-Hanani conjecture \cite{Rodl} we have that $|\mathcal{M}|=(1+o(1))\frac{\binom{n-t}{r-k}}{\binom{r-t}{r-k}}=\left(\frac{(k-t)!}{(r-t)!}+o(1)\right)n^{r-k}$. Now let $\mathcal{F}=\{X\in[n]^{(r)}: [t]\subseteq X, X\setminus[t]\in \mathcal{M}\}$. We will show that there is no ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$. From which the required upper bound on $m({\bf x},n)$ follows.

As in the proof of Theorem \ref{mxn-ub:thm}, in any permutation of $[n]$ it is possible to find $t$ disjoint intervals $X_1,\dots,X_t$ of lengths $x_1,\dots,x_t$ such that the union of these intervals contains $[t]$. Now $\left(X_1\cup\dots\cup X_t\right)\setminus[t]$ is an $(r-k)$-subset of $[n]\setminus[t]$ and so there is some $(r-t)$-set $M\in\mathcal{M}$ which contains it. It follows that the intervals $X_1,\dots,X_t$ together with $k-t$ singleton intervals form a set in $\mathcal{F}$. It follows that no Hamilton cycle is ${\bf x}$-acceptable with respect to $\mathcal{F}$.
\end{proof}

We tentatively conjecture that the upper bounds of Theorems \ref{mxn-ub:thm} and \ref{mxn-ub2:thm} are asymptotically sharp under the appropriate conditions on ${\bf x}$.

\begin{conj}\label{mxn:conj}
If $x_i\not=1$ for all $i$ then
\[
m({\bf x},n)=\left(\frac{1}{(r-k)!}+o(1)\right)n^{r-k}.
\]
If ${\bf x}=(x_1,\dots,x_k)$ with $x_1\geq\dots\geq x_t>x_{t+1}=\dots=x_k=1$ then
\[
m({\bf x},n)=\left(\frac{(k-t)!}{(r-t)!}+o(1)\right)n^{r-k}.
\]
\end{conj}

As we shall see later the exact upper bound of Theorem \ref{mxn-ub:thm} is not always correct even when $x_i\not=1$ for all $i$. This
slight improvement suggest that even if the conjecture is correct, the extremal families may have quite a complicated structure.

The next result improves the bound given by the averaging argument of Theorem \ref{mxn-lb:thm} (except in the trivial case when $x_i=1$ for all $i$).

\begin{theorem}\label{mxn-lb2:thm}
Given ${\bf x}$ as above with the $x_i$ not all equal to 1 we have that
\[
m({\bf x},n)\geq\frac{4kr+1}{4kr}\left(\frac{1}{c({\bf x})x_1!x_2!\dots x_k!}+o(1)\right)n^{r-k}.
\]
\end{theorem}

The proof is by showing that the assumptions made in the proof of Theorem \ref{mxn-lb:thm} cannot hold with equality. The main aim of this result is to demonstrate that Theorem \ref{mxn-lb:thm} is not sharp and we have not made a particular effort to obtain the strongest bound this method will give. We will however go through the details more carefully in one special case later.

If $C$ is a Hamilton cycle (cyclic ordering) then let $d(C)$ be the number of $F\in\mathcal{F}$ for which $F$ consists of $k$ disjoint intervals of lengths $x_1,\dots,x_k$ in $S$ (in other words the number of $F\in\mathcal{F}$ for which $C\in H(F)$). Strictly $d(C)$ depends on $\mathcal{F}$ and ${\bf x}$ as well as $C$ but it will always be clear from the context what these are.

\begin{proof}
We will assume that $x_1=t$ is the maximum of the $x_i$.

Let $\mathcal{F}$ be such that there is no ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$. We may assume also that $|\mathcal{F}|\leq\binom{n-k}{r-k}$ since we know that this is an upper bound for $m({\bf x},n)$.

We have that $\sum_{F\in\mathcal{F}}|H(F)|=\sum_{C\in S}d(C)$. The property that there is no ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$ is equivalent to having $d(C)\geq1$ for all $C\in S$. Previously we used this bound on $d(C)$ to deduce a bound on $\mathcal{F}$. Here we will show that it is not possible for all the $d(C)$ to be this small and so obtain a stronger bound on their sum. Let
\[
U'=\{C\in S : d(C)=1\}.
\]
For a cycle in $U'$ there is a unique $F\in\mathcal{F}$ for which $C\in H(F)$. Let $U$ be the set of all cycles in $U'$ for which the end points of any two of the $k$ intervals in $C$ whose union is this $F$ are at distance at least $r$ around $C$. We have that each $F\in \mathcal{F}$ gives rise to at most $c(n-r+k-2)!$ cycles in $U'\setminus U$ where $c$ is some constant depending only on ${\bf x}$. It follows that $|U'\setminus U|\leq |\mathcal{F}|c(n-r+k-2)!=o((n-1)!)$. Hence, if we can show that $|U|\leq\alpha(n-1)!$ then we will have $|U'|\leq(\alpha+o(1))(n-1)!$. Our aim is to prove such a bound by showing that each cycle in $U$ gives rise to a cycle not in $U'$.

Suppose that $C\in U$. Without loss of generality we may assume that $C=1,2,\dots,n$ and that $C\in H(F)$ where $F=\bigcup_{i=1}^k\{a_i+1,\dots,a_i+x_i\}$ with $a_1=1$. Consider the cycle $C'=1,2,\dots,t-1,t+1,t,t+2,\dots,n$ (that is $C$ with $t$ and $t+1$ exchanged). This is not in $H(F)$ since $F$ meets $C'$ in $k+1$ intervals (we are using here that $C\not\in U'$). Because there is no ${\bf x}$-acceptable Hamilton cycle we must have $C'\in H(F')$ for some $F'\in\mathcal{F}$. Now since $C\not\in H(F')$ we must have that either $t-1,t+1\in F'$, $t\not\in F'$ (Case 1) or $t,t+2\in F'$, $t+1\not\in F'$ (Case 2).

If we are in Case 1 then one of the $k$ intervals in $C'$ which is contained in $F'$ must be the length $t-i+1$ interval $i,i+1,\dots,t-1,t+1$. By our choice of $x_1$ to be the largest $x_i$ we have that $i\geq1$ and so the interval must be of this form. Let $C''$ be the cycle
\[
1,2,\dots,i-1,t,i,i+1,\dots,t-1,t+1,t+2,\dots, n.
\]
Now it is clear that $C''\in H(F)$ and also $C''\in H(F')$ and so $d(C'')\geq2$.

If we are in Case 2 then suppose that one of the $k$ intervals in $C'$ which is contained in $F'$ is the length $i-t$ interval $t,t+2,t+3,\dots,i$. Let $C''$ be the cycle
\[
1,2,\dots,t-1,t,t+2,t+3,\dots,i,t+1,i+1,\dots,n.
\]
Now it is clear that $C''\in H(F')$. We also know, since the intervals of $C$ whose union is $F$ are at distance at least $r$ round the cycle, that none of $t+1,\dots,i$ are elements of $F$ (this is where we use the fact that we are working in $U$ and not just $U'$). It follows that $C''\in H(F)$ and so $d(C'')\geq2$.

Notice finally that in each case $C''$ was constructed from $C$ by moving one vertex by $x_i$ places in the cycle for some $i$. It follows that each cycle in $C''\in S\setminus U'$ can arise in this way from at most $4kr$ different cycles in $U$ (if $F,G\in\mathcal{F}$ with $C''\in H(F)\cap H(G)$ then the moved vertex must be in $F\cup G$ and there are at most $2k$ choices for where to move it). Hence
\[
|U|\leq 4kr|S\setminus U|
\]
and so
\[
|U|\leq\frac{4kr}{4kr+1}|S|
\]
Now since $U'\setminus U=o((n-1)!)$ we have that $U'\leq\left(\frac{4kr}{4kr+1}+o(1)\right)(n-1)!$. Using the same approach as in Theorem \ref{mxn-lb:thm}
\[
c({\bf x})x_1!x_2!\dots x_k!(n-r+k-1)!|\mathcal{F}|\geq(n-1)!+\left(\frac{1}{4kr+1}+o(1)\right)(n-1)!
\]
That is
\[
|F|\geq\left(\frac{4kr+1}{4kr}\frac{1}{c({\bf x})x_1!x_2!\dots x_k!}+o(1)\right)n^{r-k}
\]
\end{proof}

We now address some natural special cases of our problem of determining $m({\bf x},n)$. One, mentioned in \cite{K}, is the case
${\bf x}=(2,2)$ which we referred to earlier. Theorems \ref{mxn-ub:thm} and \ref{mxn-lb:thm} show that
\[
\left(\frac{1}{12}+o(1)\right)n^2\leq m((2,2),n)\leq\left(\frac{1}{2}+o(1)\right)n^2.
\]
Going through a similar argument to Theorem \ref{mxn-lb2:thm} with more care and refining the construction of Theorem \ref{mxn-ub:thm} we are able to improve the constant in the lower bound and the $o(n^2)$ term in the upper bound as follows

\begin{theorem}\label{22:thm}
For some constant $c>0$ we have
\[
\left(\frac{1}{9}+o(1)\right)n^2\leq m((2,2),n)\leq\frac{1}{2}n^2-\frac{1}{2}n^{3/2}
\]
\end{theorem}

\begin{proof}
For the upper bound let $H$ be a graph with $V(H)=\{3,4,\dots,n\}$ which is $C_4$-free, triangle-free, and contains no Hamilton path. We will show that the there are no $(2,2)$-acceptable Hamilton cycles with respect to the family
\[
\mathcal{F}=\{X\in[n]^{(4)}:1,2\in X, X\setminus\{1,2\}\not\in E(H)\}.
\]
The simplest case of the K\H ov\'ari-S\'os-Tur\'an Theorem \cite{KST} shows that there is a $C_4$-free bipartite graph with at most $1/2n^{3/2}+n$ edges. A suitable $H$ may be constructed from such a graph by deleting at most $n$ edges. It follows that we may take $|E(H)|=1/2n^{3/2}$ which will establish the upper bound.

To prove that $\mathcal{F}$ is as required we show that any Hamilton cycle has two disjoint edges whose union is an element of $\mathcal{F}$. Suppose that our Hamilton cycle is $C=c_1,\dots,c_n$ with $c_i=1$, $c_j=2$ and (without loss of generality) $1<i<j<n$. We consider three cases:
\begin{enumerate}
\item[Case 1:] If $j-i>2$ then consider the pairs $(c_{i-1},c_{j-1})(c_{i-1},c_{j+1}),(c_{i+1},c_{j-1}),(c_{i+1},c_{j+1})$. Since $H$ is $C_4$-free at least one of these pairs is not an edge of $H$. It follows that at least one of these pairs together with 1,2 forms a 4-set in $\mathcal{F}$ and so $C$ is not $(2,2)$-acceptable with respect to $\mathcal{F}$.
\item[Case 2:] If $j-i=2$ the consider the pairs $(c_{i-1},c_{i+1}),(c_{i-1},c_{i+3}),(c_{i+1},c_{i+3})$. Since $H$ is triangle-free at least one of these pairs is not an edge of $H$. It follows that at least one of these pairs together with 1,2 forms a 4-set in $\mathcal{F}$ and so $C$ is not $(2,2)$-acceptable with respect to $\mathcal{F}$.
\item[Case 3:] If $j-i=1$ then consider the pairs $(c_{j+1},c_{j+2}),(c_{j+2},c_{j+3}),\dots,(c_{i-2},c_{i-1})$. Since $H$ does not have a Hamilton path at least one of these pairs is not an edge of $H$. It follows that at least one of these pairs together with 1,2 forms a 4-set in $\mathcal{F}$ and so $C$ is not $(2,2)$-acceptable with respect to $\mathcal{F}$.
\end{enumerate}

For the lower bound let $\mathcal{F}$ be such that there is no $(2,2)$-acceptable Hamilton cycle with respect to $\mathcal{F}$ and assume that $|\mathcal{F}|\leq\binom{n-2}{2}$. As before we have that $\sum_{F\in\mathcal{F}}|H(F)|=\sum_{C\in S}d(C)$. Let
\[
U'=\{C\in S : d(C)=1\}.
\]
For a cycle $C\in U'$ there is a unique $F\in\mathcal{F}$ for which $C\in H(F)$. Let $U$ be the set of all cycles in $U'$ for which the end points of the 2 edges whose union is this $F$ are at distance at least 3 around $C$. As in the proof of Theorem \ref{mxn-lb2:thm} $|U'\setminus U|=o((n-1)!)$. We also define
\begin{align*}
D&=\{C\in S : d(C)=2\}\\
T&=\{C\in S : d(C)\geq3\}.
\end{align*}

If $i$ and $j$ are consecutive elements of a cyclic ordering $C$ we will denote by $\pi_{i,j}(C)$ the cyclic ordering formed by swapping $i$ and $j$.We will refer to cycles $B$ and $C$ with $C=\pi_{i,j}(B)$ as being neighbouring.

Suppose that the cycle $C$ has $d(C)=1$ and let $F=\{a,b,x,y\}\in\mathcal{F}$ with $a$ and $b$ consecutive in $C$ and $x$ and $y$ consecutive in $C$. Suppose that $a,b,c,d$ are consecutive in $C$ and consider the cycle $C'=\pi_{b,c}(C)$. There is a set $F'\in\mathcal{F}$ with $C'\in H(F')$ and we must have either $a,c\in F'$ (Case 1) or $b,d\in F'$ (Case 2). Since $C\not\in H(F')$ we cannot have that $F'=\{a,b,c,d\}$ and so exactly one of these cases occurs.

If we are in Case 1 then the cycle $C''=\pi_{a,b}(C)$ is in both $H(F)$ and $H(F')$ and so $d(C'')\geq2$.

If we are in Case 2 then the cycle $C''=\pi_{d,c}(C)$ is in both $H(F)$ and $H(F')$ and so $d(C'')\geq2$ (note that here we need the condition which distinguishes $U$ from $U'$ to ensure that $C''\in H(F)$).

Repeating the same argument starting from $C'=\pi_{z,a}(C)$ where $z$ is the predecessor of $a$ in $C$ we obtain that $C$ has either
at least 2 neighbouring cycles in $D\cup T$ or at least 1 neighbouring cycle in $T$.

Repeating the same argument starting with the pair $x,y$ we obtain that $C$ has one of the following:
\begin{itemize}
\item at least 2 neighbouring cycles in $T$,
\item at least 3 neighbouring cycle in $D\cup T$ of which at least 1 is in $T$,
\item at least 4 neighbouring cycles in $D\cup T$.
\end{itemize}
Writing $e(U,T)$ for the number of pairs of neighbouring cycles with one in $U$ and one in $T$ and similarly for $e(U,D)$ we obtain that
\[
4|U|\leq 2e(U,T)+e(U,D).
\]
It is easy to see that a cycle in $D\cup T$ can neighbour at most 8 cycles in $U$ and so $e(U,T)\leq 8|T|$, $e(U,D)\leq8|D|$. From this we get that
\[
|U|\leq 4|T|+2|D|.
\]
Now
\[
12(n-3)!|\mathcal{F}|=\sum_{F\in\mathcal{F}}|H(F)|=\sum_{C\in S}d(C)\geq|S|+|D|+2|T|\geq|S|+\frac{1}{2}|U|.
\]
Also
\[
12(n-3)!|\mathcal{F}|\geq|S|+(|S|-|U'|)=2|S|-|U|+o((n-1)!).
\]
Taking whichever of these bounds is stronger depending on $|U|$ we conclude that
\[
12(n-3)!|\mathcal{F}|\geq\frac{4}{3}|S|+o((n-1)!)
\]
and so
\[
|\mathcal{F}|\geq\left(\frac{1}{9}+o(1)\right)n^2.
\]
\end{proof}

Another natural case is ${\bf x}=(2,1,..,1)$ . Here we have a lower bound which agrees asymptotically with the upper bound from Theorem \ref{mxn-ub2:thm}.

\begin{theorem}\label{211:thm}
Let ${\bf x}=(2,\underbrace{1,\dots,1}_{r-2})$ with $r$ fixed. We have
\[
m({\bf x},n)=\left(\frac{1}{r-1}+o(1)\right)n.
\]
\end{theorem}

It is worth noting that in this case $m({\bf x},n)$ can be expressed more directly in graph theoretic terms; it is the smallest number of copies of $K_r$ whose removal makes $K_n$ non-Hamiltonian. We will use this formulation in the proof below. We will also the use the well known Bondy-Chv\'atal Theorem \cite{BC} which characterises Hamiltonian graphs.

\begin{theorem}[Bondy-Chv\'atal]
Let $G$ be a graph on $n$ vertices and $x,y$ be two non-adjacent vertices in $G$ with $\deg(x)+\deg(y)\geq n$. Then $G$ is Hamiltonian if and only if the graph formed by adding the edge $xy$ to $G$ is Hamiltonian.
\end{theorem}

\begin{proof}[Proof of Theorem \ref{211:thm}]
The upper bound follows from Theorem \ref{mxn-ub2:thm}. In fact it is also rather easy to describe the construction directly. Let $P$ be a family of $(r-1)$-subsets of $\{2,\dots,n\}$ with $|P|=\lceil\frac{n-1}{r-1}\rceil$ whose union is $\{2,\dots,n\}$ (if $r-1$ divides $n-1$ we simply take a partition if not then we keep the overlap as small as possible). Now let $\mathcal{F}=\{\{1\}\cup X: X\in P\}$. If $C=c_1,\dots,c_n$ is a Hamilton cycle with $c_1=1$ then $c_2\in X$ for some $X\in P$ and then $\{1\}\cup X$ contains two consecutive elements of $C$. This means that $\mathcal{F}$ has no ${\bf x}$-acceptable Hamilton cycle and so $m({\bf x},n)\leq\lceil\frac{n-1}{r-1}\rceil$.

For the corresponding lower bound we use the fact that $m({\bf x},n)$ is equal to the smallest number $t$ for which we can delete $t$ copies of $K_r$ from $K_n$ and be left with a non-Hamiltonian graph. Suppose that the graph we are left with after deleting these copies of $K_r$ is $G$ and let $\deg_G(i)=d_i$. We will say that a pair $x,y\in[n]$ with $xy\not\in E(G)$ is \emph{bad} if $d_x+d_y<n$. By the Bondy-Chv\'atal Theorem $G$ must remain non-Hamiltonian even after we add to it all pairs which are not bad. So we must, by Dirac's theorem, have a vertex $x$ which is incident with at least $n/2$ bad edges.

Let $f=n-1-d_x$ be the number of edges in $K_n$ incident with $x$ which are deleted (that is those that are contained in some deleted $K_r$). Each $K_r$ removed from $K_n$ contributes at most $r-1$ to $f$ and so
\[
t\geq\frac{f}{r-1}.
\]
For the pair $x,y$ to be bad we must have $d_y\leq f$ and so at least $n-1-f$ edges incident with $y$ must be deleted. In total we have $n/2$
vertices $y$ for which this holds and each edge deleted is incident with at most 2 of them. It follows that at least $\frac{n(n-1-f)}{4}$ edges must be deleted. Since each $K_r$ contributes $\binom{r}{2}$ to the total number of deleted edges, we have that
\[
t\geq\frac{n(n-1-f)}{2r(r-1)}.
\]
The first bound is increasing with $f$, the second bound is decreasing with $f$. They are equal when $f=\frac{n(n-1)}{n+2r}$ at which point their common value is $\frac{n(n-1)}{(n+2r)(r-1)}$. It follows that
\[
t\geq\frac{n(n-1)}{(n+2r)(r-1)}=(1-o(1))\frac{n}{r-1}.
\]
\end{proof}

A further instance of the general problem which we mention briefly is the case ${\bf x}=(r-1,1)$. The upper bound we get here from Theorem \ref{mxn-ub2:thm} is
\[
m((r-1,1),n)\leq\left(\frac{1}{(r-1)!}+o(1)\right)n^{r-2}.
\]
In particular $m((3,1),n)\leq(\frac{1}{6}+o(1))n^2$. This answers in the negative a question of Katona (Problem 5 from \cite{K}) which essentially asked ``Is it true that if $|\mathcal{F}|\leq(\frac{1}{4}+o(1))n^2$ then $K_n$ contains a Hamilton cycle which is both $(3,1)$-acceptable and $(2,2)$-acceptable for $\mathcal{F}$?''

\subsection{Other graphs}

It is possible to raise similar questions in which the structure we are interested in is something other than a Hamilton cycle.
Probably the most natural sort of structure is a spanning subgraph of some simple form. One simple variant is to consider Hamilton paths.

\begin{q}\label{F22-path:q}
What is the smallest family $\mathcal{F}\subseteq[n]^{(4)}$ with the property that $K_n$ does not contain a $(2,2)$-acceptable Hamilton path with respect to $\mathcal{F}$?
\end{q}
Where, naturally, a Hamilton path is $(2,2)$-acceptable if we do not have two disjoint edges of the path whose union is an element of $\mathcal{F}$.

We denote the size of this smallest family $\mathcal{F}$ by $p((2,2),n)$. The main reason for raising this question is that there are indications (see below) that the extremal families for this variant may have a simpler structure. This suggests that it may be good test case for developing approaches to this type of problem.

\begin{theorem}\label{22hpath:thm}
\[
\frac{1}{6}(n-3)(n-2)\leq p((2,2),n)\leq\binom{n-2}{2}
\]
\end{theorem}

\begin{proof}
For the upper bound note that if $\mathcal{F}=\{X\in[n]^{(4)}:1,2\in X\}$ there is no $(2,2)$-acceptable Hamilton path with respect to $\mathcal{F}$.

For the lower bound consider, as in the proof of Theorem \ref{mxn-lb:thm}, the set $S$ of all Hamilton cycles in $K_n$ and denote by $H(F)$ the set of all elements of $S$ which are not acceptable with respect to the single set $F$. If $\mathcal{F}$ is such that $K_n$ has no ${\bf x}$-acceptable Hamilton path with respect to $\mathcal{F}$ then every element of $S$ is contained in at least $2$ of the $H(F)$ with $F\in\mathcal{F}$ (if a Hamilton cycle was contained in a unique $H(F)$ then deleting one of the edges whose union is $F$ would give an acceptable Hamilton path). It follows that
$\sum_{F\in\mathcal{F}}|H(F)|\geq2(n-1)!$ and since $|H(F)|=12(n-3)!$ the bound follows.
\end{proof}

The upper bound construction is the same as that given for the Hamilton cycle case in Theorem \ref{mxn-ub:thm}. However, in contrast
to the Hamilton cycle problem this construction is minimal in that we cannnot remove any $4$-set from it without making some Hamilton path $(2,2)$-acceptable. It is possible that this upper bound is exactly sharp and if this is the case then the simple structure of the extremal family may make the problem easier that the Hamilton cycle case.

\section{Further Questions}

Several questions and conjectures have been mentioned in earlier sections. In this section we summarise these and collect a few other possible questions and directions for further study, concentrating mainly on the situation where our constraints are given by a set system.

For matchings under constraints given by a graph the most obvious question is to bound $b(n)$ more tightly. We have no feeling for where the true order of magnitude should lie between $n^{1/2}$ and $n^{3/4}$. In addition it would be nice to know more about the general behaviour of $b$; for instance is it a non-decreasing function. The $k=3$ case of Question \ref{match-small:q} is also an appealing problem which we repeat here.

\begin{q}\label{match-3:q}
Is it true that for all sufficiently large $n$, if $G$ is a $3$-regular bipartite graph and $H$ is a 1-regular bipartite graph, we are guaranteed to have a perfect matching in $G$ which is acceptable for $H$?
\end{q}

For Hamilton cycles under constraints given by a set system the main open problem is Conjecture \ref{mxn:conj} on the asymptotic behaviour of $m({\bf x},n)$. As well as this asymptotic behaviour we could ask for exact values of $m({\bf x},n)$. This is probably a much harder problem even for our main example ${\bf x}=(2,2)$ (at least if Conjecture \ref{mxn:conj} is correct). However, as we indicated earlier, there may be variants of the problem for which this is a more approachable question. For instance:

\begin{q}
Is it true that if $\mathcal{F}\subseteq[n]^{(4)}$ with $|\mathcal{F}|<\binom{n-2}{2}$ then $K_n$ does not contain a $(2,2)$-acceptable Hamilton path with respect to $\mathcal{F}$?
\end{q}

It may be worth seeking out other variants along these lines for which the conjectured extremal family has a simple structure.

Another direction also raised in \cite{K} is to consider degree versions. Given $0\leq t<r$ and $F\subseteq[n]^{(r)}$ we let $d_t(\mathcal{F})$ be the maximum $t$-degree of $\mathcal{F}$; that is the maximum over all $t$-subsets $D\in[n]^{(t)}$ of the number of elements of $\mathcal{F}$ which contain $D$. We now define $m_t({\bf x},n)$ to be the smallest $t$-degree $d_t(\mathcal{F})$ where $\mathcal{F}\subseteq[n]^{(r)}$ is a family with the property that $K_n$ does not contain an ${\bf x}$-acceptable Hamilton cycle with respect to $\mathcal{F}$. This is a generalisation of our earlier question since $d_0(\mathcal{F})=|\mathcal{F}|$ and so $m({\bf x},n)=m_0({\bf x},n)$.

For the family $\mathcal{F}=\{\{1,x,x+1,y\}: 2\leq x\leq n-1, y\not=1,x,x+1\}\cup\{\{1,2,y,n\}: y\not=1,2,n\}$ there are no $(2,2)$-acceptable Hamilton cycles in $K_n$. Also no pair is contained in more that $3n-13$ of the $4$-sets in $\mathcal{F}$. It follows that $m_2((2,2),n)\leq 3n-13$. It seems plausible that $m_2((2,2),n)$ is linear in $n$ but we could not prove this. For $m_1({\bf x},n)$ it is trivial that $\frac{m_0({\bf x},n)}{n}\leq m_1({\bf x},n)\leq m_0({\bf x},n)$ so the order of magnitude of $m_1({\bf x},n)$ is between $n^{r-k-1}$ and $n^{r-k}$.

In all our constructions $\mathcal{F}$ is very asymmetric. This leads us to the following question:

\begin{q}
What is the smallest vertex-transitive $\mathcal{F}$ with the property that $K_n$ does not contain a $(2,2)$-acceptable Hamilton cycle with respect to $\mathcal{F}$? In particular is there such a family with $|\mathcal{F}|=cn^2$ for some $c$?
\end{q}

We suspect that the answer to the second of these questions is no. The connection between Hamilton cycles and symmetry is tantalising (consider for instance Lov\'asz's famous question of whether all but finitely many connected vertex-transitive graphs are Hamiltonian \cite{Lov}) and questions like the one above may give some insight into it. There is also a connection between this problem and the degree variants mentioned above since a vertex-transitive $\mathcal{F}$ would have $d_1(\mathcal{F})=\frac{|\mathcal{F}|}{n}$ and so if the above question has a positive answer then $m_1((2,2),n)$ is linear in $n$.

Recalling Katona's question on the minimum size of an $\mathcal{F}$ with no Hamilton cycle which is both $(2,2)$-acceptable and $(3,1)$-acceptable it would be possible to pose the more general problem involving more than one ${\bf x}$. Specifically, if ${\bf x}=(x_1,\dots,x_k)$, ${\bf y}=(y_1,\dots,y_l)$ with $x_i$ positive integers and $\sum x_i=\sum y_i=r$ then what is the smallest $\mathcal{F}$ for which $K_n$ has no Hamilton cycle which is both ${\bf x}$-acceptable and ${\bf y}$-acceptable. The size of such an $\mathcal{F}$ is necessarily smaller than both $m({\bf x},n)$ and $m({\bf y},n)$. It would be interesting to know whether behaviour analogous to principality of the graph Tur\'an density exists. That is, whether the size of the minimal $\mathcal{F}$ is essentially equal to whichever of of $m({\bf x},n)$ and $m({\bf y},n)$ is smallest or whether it can be significantly smaller than both of them.

Finally, could these results on the existence of ${\bf x}$-acceptable Hamilton cycle in $K_n$ be extended to ${\bf x}$-acceptable Hamilton cycles in an arbitrary $r$-regular graph $G$?

\section{Acknowledgement}
Part of this work was carried out during the author's visit to Budapest in March 2011. I am grateful to Gyula Katona for
several useful and interesting conversations. I also thank the London Mathematical Society and the Alfr\'ed R\'enyi Institute for providing funding for this visit.


Accuracy analysis of the box-counting algorithm

Abstract: Accuracy of the box-counting algorithm for numerical computation of the fractal exponents is investigated. To this end several sample mathematical fractal sets are analyzed. It is shown that the standard deviation obtained for the fit of the fractal scaling in the log-log plot strongly underestimates the actual error. The real computational error was found to have power scaling with respect to the number of data points in the sample ($n_{tot}$). For fractals embedded in two-dimensional space the error is larger than for those embedded in one-dimensional space. For fractal functions the error is even larger. Obtained formula can give more realistic estimates for the computed generalized fractal exponents' accuracy.

\section{Introduction}

 In last decades computations of fractal dimensions (exponents)
have become very popular in various areas of physics, as well
as in interdisciplinary research. Fractal structures have been
found in wide spectrum of problems, ranging from high energy physics
\cite{Bialas1988} to cosmology \cite{Chmaj1991} and from
medicine \cite{AZG-Skrzat} to econophysics \cite{AZG2002}.
In spite of its popularity accuracy of obtained results is usually
either not discussed or overestimated.
Moreover, it has been found that in quite a few papers
wrong numerical results and conclusions have been published
\cite{AZG-Skrzat,AZGpreprint,AZG2001,McCauley2002}.

 The aim of this paper is to calculate fractal exponents for several well known
mathematical fractals with the box-counting algorithm
to estimate real accuracy of these computations.
The dependence of accuracy with respect to the size of the available data
set ($n_{tot}$) is also discussed and its simple scaling properties are found.

 It should be stressed that accuracy of fractal exponent computations
in principle depends on many factors. For example, the accuracy can be
degraded by presence of noise in the data. Also, one can get different results
using different box-counting algorithms (see {\it e.g.} \cite{Theiler1990})
or using different digital representations of the investigated physical object
(picture). Furthermore, one should be very careful translating Hurst exponents
into fractal exponents as, in general, there is no simple reation of both \cite{Jaffard1997}.

 In Sec.~2 we calculate the box-counting fractal exponents for six different
fractal sets for various numbers of data points ($n_{tot}$). The generalized fractal exponent
is defined in the standard way \cite{AZG2001}
\begin{equation}
\label{dqdef}
  d(q) = \frac{1}{1-q} \, \lim_{N\to\infty}
  \frac{\sum_i \log p_i^q(N)}{\log N}
 \ ,
\end{equation}
where $N$ denotes the total number of boxes and $p_i(N)$ is the measure of the subset
in the $i$-th box for the given division $N$. Where the box size $\varepsilon = 1/N$.
To find accuracy estimates the obtained results are compared with precise mathematical values
of the exponents determined analytically. Furthermore, we calculate standard errors
for the linear fits in the log-log plots used to calculate the exponents.
Finally, the inverse power fits were found to give fair approximation of accuracy dependence
on the size of the data set ($n_{tot}$).
The final Section contains summary and conclusions.

\section{Accuracy estimates}

To start with we calculate fractal exponents for fractal sets embedded in one-dimensional
space, namely the classical Cantor set (CS) \cite{Mandelbrot} and the (multifractal)
asymmetric Cantor set (ACS) \cite{Tel1987}.
The calculations have been repeated for different sizes of the sets, ranging from
less than $10^2$ up to $10^5$ data points.
The final results are given in Fig.~1. Crosses indicate the real accuracy of the box-countong
algorithm computations, \textit{i.e.} the absolute value of the difference between
the calculated exponent and exact analytical result. Circles give standard errors
obtained for the linear fits in the corresponding log-log plots. In addition, the inverse power
fit for accuracy as the function of the number of available data points ($n_{tot}$)
is given by the dashed line. The parameter $\alpha$ denotes the exponent of the
inverse power fit
\begin{equation}
\label{alphadef}
  \text{real error} \ \sim \ \frac{1}{n_{tot}^\alpha}
 \ .
\end{equation}
 At first glimp it is clear that the standard error, that is often treated
as the accuracy of the algorithm, considerably (up to the order of magnitude)
underestimates the real error. In the case of Cantor set (A) we have
$\alpha_{CS} \approx 0.50$.
Similar result was obtained for the case of asymmetric Cantor set,
$\alpha_{ACS} \approx 0.48$. Hence, in these cases one can expect the error
of the size $\sim 1/\sqrt{n_{tot}}$.

\begin{figure}
\begin{center}
 \includegraphics[width=8.0cm,angle=0]{Fig1.eps}
 \caption{Real accuracy of the fractal exponent $d(0)$ (crosses)
 and the standard errors obtained for the linear fit in the log-log plots
 used to determine fractal exponents (circles). The dashed line is the inverse power fit.
 The upper plot (A) is for the Cantor set and the lower plot (B) is for the ACS.}
\end{center}
\label{fig:fig1}
\end{figure}

\begin{figure}
\begin{center}
 \includegraphics[width=8.0cm,angle=0]{Fig2.eps}
 \caption{Real accuracy of the fractal exponent $d(0)$ (crosses)
 and the standard errors obtained for the linear fit in the log-log plots
 used to determine fractal exponents (circles). The dashed line is the inverse power fit.
 The upper plot (A) is for the Sierpi\'nski triangle and the lower plot (B)
 is for the Koch curve.}
\end{center}
\label{fig:fig2}
\end{figure}

\begin{figure}
\begin{center}
 \includegraphics[width=8.0cm,angle=0]{Fig3.eps}
 \caption{Real accuracy of the fractal exponent $d(0)$ (crosses)
 and the standard errors obtained for the linear fit in the log-log plots
 used to determine fractal exponents (circles). The dashed line is the inverse power fit.
 The upper plot (A) is for the Weierstrass-Mandelbrot curve with parameter $D=1.5$ and
 the lower plot (B) is for the curve with $D=1.8$.}
\end{center}
\label{fig:fig3}
\end{figure}

 As the second step we analyze fractal sets embedded in two-dimensional space:
the Sierpi\'nski triangle and the Koch curve. The results are given in Fig.~2,
with the same notation as for the Fig.~1.
In this case we have $\alpha_{ST}\approx 0.31$ and $\alpha_{KC}\approx 0.18$.
Hence, the error scales approximately as $\sim 1/n_{tot}^{1/4}$.
This results is intuitively clear, as to have the same accuracy as for the
one-dimensional case the squared number of data points has to be used.
In these examples the actual error is also much bigger than the estimated
standard error.

 For fractals embedded in two-dimensional space special attention should
be paid to fractals that are of the function type, \textit{i.e.} there exists
a reference frame in which for a given value of one coordinate there is
at most one point of the fractal set. Hence, in one direction number of points
in a given box is limited and this may cause slower convergence of the box-counting
scheme (scaling can be observed in one direction only) resulting in bigger errors,
slower convergence.
Because this type of fractals has wide applicability, \textit{e.g.}
in the time series analysis, we will consider this case separately.
A good example of such fractal sets with precisely known fractal dimensions are
the Weierstrass-Mandelbrot (WM) functions \cite{BerryLewis}
\begin{equation}
\label{WMdef}
 W(t) = \sum_{n=-\infty}^{n=+\infty} \ \frac{1}{\gamma^{(2-D)n}} \
 \left[ 1 - \cos (\gamma^n t) \right]
 \ .
\end{equation}

 We investigate two WM fractal functions with dimensions $d=1.5$ (A) and $d=1.8$ (B).
The results are shown in Fig.~3.  Again one can find a fair inverse power fit
for the error with the exponents $\alpha_{WM}$ equal to $0.14$ and $0.12$
($\sim 1/8$), respectively.
Hence, to have similar accuracy as for ordinary fractals embedded in two-dimensional
space one has to use squared number of data points ($n_{tot}$).
This is intuitively clear, as in this case the fractal scaling can be observed
in only one (instead of two) dimensions.
In effect, to have reasonable accuracy for the fractal exponent, a very large number
of data points has to be taken into account ($>10^5$) even though we deal with perfect
mathematical fractals without any external noise.

\section{Summary and conclusions}

 It has been shown that for the box-counting algorithm there is a fair inverse power
scaling of the actual error of the computed fractal exponents of the type (\ref{alphadef}).
The standard error calculated for the fit in the log-log plot strongly underestimates
the actual error leading to the overestimated accuracy.
Furthermore, to obtain a given level of accuracy number of data points ($n_{tot}$)
used for fractals embedded in two-dimensional space should be the squared number of
data points sufficient for fractals embedded in one-dimensional space.
The corresponding exponents $\alpha$ are roughly equal to $1/4$ and $1/2$, respectively.

 Similar phenomenon occurs for fractal functions embedded in two-dimensional space,
where the exponent $\alpha$ was found around $1/8$. Hence, up to an overall factor,
to have the same accuracy as for the Cantor set and $10^2$ data points one has to use
of order $10^8$ data points for the fractal WM function.

 The formula (\ref{alphadef}) and plots in Figs.~1--3 can be used to estimate
accuracy of such computationion in much higher accuracy than the estimated
standard errors for the linear fits.
The estimated accuracy of the box-counting algorithm for various sizes of the
data sets ($n_{tot}$) is also presented in Table~1.
It should be stressed that for fractals with additional external noise
one can expect even worse results --- the errors will be greater.

\begin{table}
\begin{center}
 \caption{\label{tab:table1} Absolute errors. }
     \begin{tabular}{|lccc|}%
      \hline %
      \hline %
         $n_{tot}$ & $1000$ & $10~000$ & $100~000$\\
      \hline%
      \hline%
         1-D fractals   & $\pm$0.020 & $\pm$0.006 & $\pm$0.002 \\
         2-D fractals   & $\pm$0.060 & $\pm$0.030 & $\pm$0.020 \\
         2-D W-M curve  & $\pm$0.200 & $\pm$0.150 & $\pm$0.100 \\
     \hline %
     \hline %
\end{tabular}
\end{center}
\end{table}

Adaptation and Self-Organizing Systems (nlin.AO); Computational Physics (physics.comp-ph); Data Analysis, Statistics and Probability (physics.data-an)