\documentclass[12pt,reqno]{article}
\usepackage[usenames]{color}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amscd}
\usepackage{graphicx}
\usepackage[active]{srcltx}
\usepackage[shortlabels]{enumitem}

\usepackage[colorlinks=true,
linkcolor=webgreen,
filecolor=webbrown,
citecolor=webgreen]{hyperref}

\definecolor{webgreen}{rgb}{0,.5,0}
\definecolor{webbrown}{rgb}{.6,0,0}

\usepackage{fullpage}
\usepackage{float}

\usepackage{psfig}

\usepackage{graphics}
\usepackage{latexsym}
\usepackage{epsf}
\usepackage{breakurl}

\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{.1in}
\setlength{\evensidemargin}{.1in}
\setlength{\topmargin}{-.1in}
\setlength{\textheight}{8.4in}


\newcommand{\R}{{\mathbb R}}
\newcommand{\Q}{{\mathbb Q}}
\newcommand{\C}{{\mathbb C}}
\newcommand{\N}{{\mathbb N}}

\DeclareMathOperator{\ord}{ord}
\DeclareMathOperator{\lcm}{lcm}
\DeclareMathOperator{\ind}{ind}
\def\modd#1 #2{#1\ \mbox{\rm (mod}\ #2\mbox{\rm )}}


\newcommand{\seqnum}[1]{\href{https://oeis.org/#1}{\rm \underline{#1}}}


\begin{document}

\begin{center}
\epsfxsize=4in
\leavevmode\epsffile{logo129.eps}
\end{center}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{conjecture}[theorem]{Conjecture}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}


\begin{center}
\vskip 1cm{\LARGE\bf
Fermat Numbers Modulo a Prime}
\vskip 1cm
{\Large
Ji\v{r}\'{\i} Kla\v{s}ka\\
Institute of Mathematics\\
Faculty of Mechanical Engineering\\
Brno University of Technology\\
Technick\'{a} 2\\
CZ -- 616 69 Brno\\
Czech Republic \\
\href{mailto:klaska@fme.vutbr.cz}{\tt klaska@fme.vutbr.cz}\\
}
\end{center}

\vskip .2 in


\begin{abstract}
Nearly forty years ago, Aigner published an interesting theorem regarding the periodicity of the sequence
of Fermat numbers reduced by a given prime modulus. In this article we perform a detailed
analysis of Aigner's result and his proof. Above all, however, we show that
Aigner's theorem can be  substantially simplified and also refined.
\end{abstract}




\section{Introduction}
Let $F_n=2^{2^n}+1$ where $n\in \mathbb N\cup \{0\}$. The numbers $F_n$ are called Fermat numbers
after the French mathematician Pierre de Fermat (1601--1665). Many remarkable properties of Fermat
numbers are known. See, for example, the books \cite {3,4}  or consult
The  On-Line Encyclopedia of Integer Sequences \cite[\seqnum{A000215}]{7}.


In 1986, Austrian mathematician Alexander Aigner (1909--1988) published his final paper \cite{1} in which
he opened up a new issue of so-called elite primes. Recall that a prime $p$ is called elite if only
a finite number of Fermat numbers $F_n$ are quadratic residues modulo $p$. See also \cite[\seqnum{A102742}]{7}.

Aigner's paper \cite[p.\ 87]{1} also contains an interesting theorem concerning the periodicity of
the sequence $(F_n \text{ mod } p)_{n=0}^{\infty}$, where $p$ is a prime. Recall now the original
German formulation of Aigner's theorem and his proof arguments.

\begin{theorem} \label{thm:1} {\rm (Aigner, 1986)}
Ist $p-1=2^ru$ mit ungeradem $u$ und $2^st$ mit $0\le s\le r$ und $t\mid u$ der
genaue ``Potenzindex'' des Restes $2 \text{\rm{ mod }} p$, so hat die Vorperiode $r-s$ Glieder und die
L\"ange der Periode wird gleich der Ordnung $h$ des Restes $2$ in der multiplikativen Gruppe $\bmod\: u/t=u'$.
\label{thm1}
\end{theorem}

\begin{proof}
Es existiert eine geeignete Primitivwurzel $g \text{ mod } p$, so {da\ss}  $2\equiv g^{2^st}$ ist. Quadrierung der Potenz $\text{mod } p$
bedeutet Verdopplung des Exponenten $\text{mod } p-1$. Wir sind solange in der Vorperiode, als im Exponenten der Faktor $2^r$
noch nicht erreicht ist. Hernach sind alle Exponenten durch $2^rt$ teilbar. Und soll nach $h$ Schritten die
erste Wiederholung auftreten, so ergibt dies $2^{r+h}t\equiv 2^rt$ nach dem Modul $p-1=2^rtu'$ oder $2^h\equiv 1 (u')$.
\end{proof}

Unfortunately, Aigner's result presented in Theorem~\ref{thm1} has not received the attention that it deserves and
has not appeared in any of the recently published books  \cite{3,4} specifically devoted to Fermat numbers.
The main reason is probably that the paper \cite{1} was published in German, which, along with some vague wording, makes
it difficult to properly understand Theorem~\ref{thm1} and its proof.
In this article, we carry out a detailed analysis of Aigner's result to show that Theorem~\ref{thm1} can be
substantially simplified  and also refined.
The exact formulation of Theorem \ref{thm:1} and its proof in English is presented in Theorem \ref{thm:3} with its simplification 
provided by Theorem \ref{thm:5}.  


Throughout this paper, we adopt the following notation. If $A$ is a finite set, $\# A$ denotes the number of elements of $A$.
Specifically, if $A=\emptyset$, then $\#A=0$.

\section{Basic concepts and auxiliary results}
\label{sec2}

We recall some of the basic definitions and known statements
that we need later in the paper.
\begin{lemma} \label{lem:1}
Let $p$ be a prime. Then there exist $i,j\in \{0,1,\ldots,p\}$ such that
$i<j$ and $F_i\equiv \modd{F_j} {p}$.
\end{lemma}

\begin{proof} The conclusion follows from Dirichlet's well-known pigeonhole principle.
\end{proof}

\begin{remark}
The reader may find some interesting facts on the history of this principle in article \cite{5}.
\end{remark}

\begin{lemma} \label{lem:2}
Let $i\in \mathbb N\cup \{0\}$, $j\in \mathbb N$ and let $i<j$. Further, let
$p$ be a prime. Then \textup{(i)} and \textup{(ii)} hold.
\begin{enumerate}[\rm (i)]
\item If $F_i\equiv \modd{F_j} {p}$, then $F_{i+t}\equiv \modd{F_{j+t}} {p}$ for all $t\in \mathbb N$.
\item If $F_j\not\equiv \modd{F_{j+t}} {p}$ for all $t\in \mathbb N$, then $F_{i}\not\equiv \modd{F_{i+t}} {p}$ for all $t\in \mathbb N$.
\end{enumerate}
\end{lemma}

\begin{proof} We prove (i). Let $t\in \mathbb N$. First, observe that
$$F_i\equiv \modd{F_j} {p} \Longleftrightarrow 2^{2^i}\equiv \modd{2^{2^j}} {p}.$$
Next, by raising  both sides of $2^{2^i}\equiv \modd{2^{2^j}} {p}$ to $2^t$-th power
we obtain $2^{2^{i+t}}\equiv \modd{2^{2^{j+t}}} {p}$.
Hence, $F_{i+t}\equiv \modd{F_{j+t}} {p}$.

We prove (ii). Suppose that $F_{i}\equiv \modd{F_{i+s}} {p}$ for an $s\in \mathbb N$. Since $i<j$,
there exists a $l\in \mathbb N$ such that $j=i+l$. Using
part (i) of Lemma 2.3, we now get
$$F_j=F_{i+l}\equiv F_{i+l+s}=\modd{F_{j+s}} {p},$$
which is a contradiction.
\end{proof}

It is clear, that Lemma \ref{lem:2} has a crucial importance for further considerations. Indeed, it guarantees that
the sequence $(F_n \text{ mod } p)_{n=0}^{\infty}$
becomes periodic at some point. In the usual terminology
(see, for example, \cite{7}) we say that $(F_n \text{ mod } p)_{n=0}^{\infty}$ is
an eventually (or ultimately) periodic sequence.  Let us now recall some basic definitions.

\begin{definition}\label{def:1} Let $p$ be a prime.
\begin{enumerate}[\rm (i)]
\item Let $H(p)=\{h\in \mathbb N\cup \{0\}:F_h\not\equiv \modd{F_{h+i}} {p} \text{ for all } i\in \mathbb N\}$
and let $h(p)=\# H(p)$. Then we call $h(p)$  {\it the length of the pre-period} of the sequence $(F_n \text{ mod } p)_{n=0}^{\infty}$.
Specifically, if $h(p)=0$, then we say  that $(F_n \text{ mod } p)_{n=0}^{\infty}$ does not have a pre-period.
\item Let $i\in \mathbb N\cup \{0\}$, $j\in \mathbb N$ and let $i<j$. If $F_i\equiv \modd{F_j} {p}$,
we call the number $j-i$ {\it the length of the period} of  $(F_n \text{ mod } p)_{n=0}^{\infty}$.
\item Let $h(p)$ be the length of the pre-period of $(F_n \text{ mod } p)_{n=0}^{\infty}$.
Then we call the number $k(p)=\min\{t\in\mathbb N: F_{h(p)}\equiv \modd{F_{h(p)+t}} {p}\}$ {\it the length of the primitive period}
of the sequence $(F_n \text{ mod } p)_{n=0}^{\infty}$.
\end{enumerate}
\end{definition}


An important relationship between the length of a period
and the length of the primitive period $k(p)$ is provided by Lemma \ref{lem:3}.
\begin{lemma} \label{lem:3} Let $i\in \mathbb N\cup\{0\}$, $j\in \mathbb N$ and let  $i<j$. Further, let $p$ be a
prime.  Then  $F_i\equiv \modd{F_j} {p}$ if and only if $i\geq h(p)$ and $i\equiv \modd{j} {k(p)}$.
\end{lemma}

\begin{proof} Let $F_i\equiv \modd{F_j} {p}$. Then, by Definition \ref{def:1},  $i\geq h(p)$
and $k(p)\leq j-i$. It is obvious that $j-i$ can be written uniquely in the form of $j-i=\alpha\cdot k(p)+\beta$ where $\alpha\in \mathbb N$,
$\beta\in \mathbb N\cup\{0\}$ and $0\leq  \beta<k(p)$. Hence,
\begin{gather}\label{eq:1}
F_i\equiv \modd{F_j} {p}  \Longleftrightarrow   F_i\equiv \modd{F_{i+\alpha\cdot k(p)+\beta}} {p}.
\end{gather}
On the other hand, we have  $F_i\equiv \modd{F_{i+k(p)}} {p}$ and, by induction, we find that
$F_i\equiv \modd{F_{i+s\cdot k(p)}} {p}$ for each $s\in \mathbb N$. In particular, if $s=\alpha$, then
\begin{gather}\label{eq:2}
F_i\equiv \modd{F_{i+\alpha\cdot k(p)}} {p}.
\end{gather}
Combining  \eqref{eq:1} and \eqref{eq:2}, we now get
\begin{gather}\label{eq:3}
F_{i+\alpha\cdot k(p)}  \equiv \modd{F_{i+\alpha\cdot k(p)+\beta}} {p}.
\end{gather}
Suppose  that $\beta \ne 0$. Then, by \eqref{eq:3},
$(F_n \text{ mod } p)_{n=0}^{\infty}$ is periodic with the length of  period equal to $\beta$.
Since $\beta<k(p)$, we have a contradiction. Consequently, $\beta=0$ and  $j-i=\alpha\cdot k(p)$.
Hence,  $k(p)\mid j-i$,  and $i\equiv \modd{j} {k(p)}$ follows.

Let $i\geq h(p)$ and let $i\equiv \modd{j} {k(p)}$. Then $k(p)\mid j-i$ and thus, there exists an $\alpha\in \mathbb N$ such that
$j-i=\alpha\cdot k(p)$. This, together with $F_i\equiv \modd{F_{i+\alpha\cdot k(p)}} {p}$, yields
$F_i\equiv \modd{F_j} {p}$, as required.
\end{proof}

It is also useful to recall the following definitions.
\begin{definition} \label{def:2}
Let $a,m\in \mathbb N$ and let $\gcd(a,m)=1$.
\begin{enumerate}[\rm (i)]
\item The least $t\in \mathbb N$ such that $a^t\equiv \modd{1} {m}$ is called the {\it multiplicative
order} of $a$ modulo $m$ and  is denoted by $\ord_m(a)$.
\item If $\ord_m(a)=\phi(m)$, then $a$ is called a {\it primitive root} of $m$. Here, $\phi$ means the Euler function.
\item Let $g$ be a primitive root of $m$. The unique $t\in \mathbb N$ satisfying $1\le t\le \phi(m)$ and
$g^t\equiv \modd{a} {m}$  is called {\it index} (or {\it discrete logarithm}) of $a$ to the base $g$
modulo $m$ and  denoted by $\ind_g(a)$.
\end{enumerate}
\end{definition}


For the theory of indices and primitive roots, see, for example, \cite[pp.\ 147--168]{2} or \cite[pp.\ 347--385]{6}.
\begin{lemma}  \label{lem:4}  Let $a,m,s,t\in \mathbb N$ and let $\gcd(a,m)=1$. Then \textup{(i)--(iv)} hold.
\begin{enumerate}[\rm (i)]
\item $a^s\equiv \modd{1} {m}$  if and only if  $\ord_m(a)\mid s$.
In particular, if $m=p$ is a prime, then $\ord_p(a)\mid p-1$.
\item $a^s\equiv \modd{a^t} {m}$ if and only if $s\equiv \modd{t} {\ord_m(a)}$.
\item We have $$\ord_m(a^s)=\frac{\ord_m(a)}{\gcd(s,\ord_m(a))}.$$
\item Let $g$ be a primitive root of a prime $p$ and let $a\in\{1,\ldots,p-1\}$. Then we have
$$\gcd(p-1,\ind_g(a))=\frac{p-1}{\ord_p(a)}.$$
\end{enumerate}
\end{lemma}


For a proof of part (i) of Lemma \ref{lem:4}, see, for example, \cite[p.\ 148]{2} or  \cite[p.\ 348]{6}.
A proof of part (ii) can be found in \cite[p.\ 148]{2} or  \cite[p.\ 349]{6}.
For a proof of part (iii),
see \cite[p.\ 149]{2} or \cite[p.\ 351]{6}. Finally, a proof of (iv) can be found in  \cite[p.\ 115]{8}.






\section{Aigner's theorem revised}


In this section, we use the following special case of the 
Chinese remainder theorem.
\begin{theorem} \label{thm:2} Let $m_1$ and $m_2$ be relatively prime positive integers. Then, for all integers
$a$ and $b$, the system of congruences
$$x\equiv \modd{a} {m_1},\  x\equiv \modd{b} {m_2} $$
has a solution, and this solution is uniquely determined modulo $m_1m_2$.
\end{theorem}

For a proof of the Chinese remainder theorem see, for example \cite[p.\ 79]{2}, or consult \cite[p.\ 162]{6}.
\begin{lemma} \label{lem:5} Let $\alpha,\beta\in \mathbb N$ and let $\gcd(\alpha,\beta)=1$. Then, for every $\gamma \in \mathbb N$,
there exists a $c\in  \mathbb N$ satisfying the conditions
\begin{gather}\label{eq:21}\gcd(c,\gamma)=1,\ c\equiv \modd{\beta} {\alpha}.\end{gather}
\end{lemma}

\begin{proof} Let $\gamma$  be a positive integer and let
\begin{gather}\label{eq:22} d=\max\{\delta\in \mathbb N: \delta\mid \gamma, \ \gcd(\delta,\alpha)=1\}.
\end{gather}

The basic idea of the proof is as follows. We show that \eqref{eq:21} is met by
every solution $c\in \mathbb N$ of the system of congruences
\begin{gather}\label{eq:23} c\equiv \modd{1} {d},\ c\equiv \modd{\beta} {\alpha}.
\end{gather}

First, observe that \eqref{eq:24} immediately follows from \eqref{eq:22}.
\begin{gather}\label{eq:24} \text{If $p$ is a prime satisfying $p\mid \frac{\gamma}{d}$, then $p\mid \alpha$}.
\end{gather}
Next, it is obvious that implication \eqref{eq:25} applies.
\begin{gather}\label{eq:25}
\text{If $c\in \mathbb N$, $p$ is a prime satisfying $p\mid d$ and  $c\equiv \modd{1} {d}$, then $p\nmid c$}.
\end{gather}

Assume now that $c\in \mathbb N$, $p$ is a prime satisfying $p\mid (\gamma/d)$ and that $c\equiv \modd{\beta} {\alpha}$.
Then, by  \eqref{eq:24}, $p\mid \alpha$.  Therefore there exists a $q\in \mathbb N$ such that $\alpha=pq$.
Hence, $c\equiv \modd{\beta} {pq}$, which implies  $c\equiv \modd{\beta} {p}$.
Using the hypothesis $\gcd(\alpha,\beta)=1$ we  obtain
$\gcd(pq,\beta)=1$, and $\beta\not\equiv \modd{0} {p}$ follows. This together with
$c\equiv \modd{\beta} {\alpha}$ yields $c\not\equiv \modd{0} {p}$.
Hence, \eqref{eq:26}.
\begin{gather}\label{eq:26}
\text{If  $c\in \mathbb N$, $p$ is a prime satisfying $p\mid \frac{\gamma}{d}$, and  $c\equiv \modd{\beta} {\alpha}$, then $p\nmid c$}.
\end{gather}

Combining \eqref{eq:25} with \eqref{eq:26} we see that, if $c\in \mathbb N$, $p$ is a prime satisfying
$p\mid \gamma=d\cdot (\gamma/d)$, $c\equiv \modd{1} {d}$ and $c\equiv \modd{\beta} {\alpha}$, then  $p\nmid c$.
Consequently, every solution $c\in \mathbb N$  of the system of congruences \eqref{eq:23} satisfies \eqref{eq:21}.

Since, by \eqref{eq:22}, $\gcd(d,\alpha)=1$, the system of
congruences \eqref{eq:23} is solvable by Theorem \ref{thm:2}. Moreover, if $c$ satisfies \eqref{eq:23}, then $c$ is uniquely determined
modulo $\alpha d$. The proof is complete.
\end{proof}


\begin{proposition} \label{prop:1} Let $p$ be a prime and let $a\in\{1,\ldots,p-1\}$. Then there exists a primitive root $g$ of $p$ satisfying
\begin{gather}\label{eq:27}\ind_g(a)=\frac{p-1}{\ord_p(a)}.
\end{gather}
\end{proposition}

\begin{proof} Let $h$ be a primitive root of $p$. Then there exists a unique $s\in \mathbb N$, $1\leq s\leq \phi(p)=p-1$ such
that $a\equiv \modd{h^s} {p}$, that is, $s=\ind_h(a)$. Next, let $t$ be 
positive integer satisfying
$a^t\equiv \modd{1} {p}$. From the assumptions made, it follows that
\begin{gather}\label{eq:28}
a^t\equiv \modd{1} {p}\Longleftrightarrow h^{st}\equiv \modd{1} {p}\Longleftrightarrow p-1\mid st.
\end{gather}
Let us now put $d:=\gcd(p-1,s)$. Then we have
\begin{gather}\label{eq:29}
p-1\mid st \Longleftrightarrow \frac{p-1}{d}\mid \frac{ts}{d} \Longleftrightarrow  \frac{p-1}{d}\mid t.
\end{gather}
Combining  \eqref{eq:28} with  \eqref{eq:29}, we  obtain
$$
a^t\equiv \modd{1} {p}\Longleftrightarrow \frac{p-1}{d}\mid t,
$$
which means that $$\ord_p(a)=\frac{p-1}{d}.$$

We now use Lemma \ref{lem:5}. Let  us put $\alpha:=(p-1)/d$ and $\beta:=s/d$. Since $\gcd(\alpha,\beta)=1$,
for each $\gamma\in \mathbb N$  there exists a $c\in \mathbb N$ satisfying \eqref{eq:21}.
In particular for $\gamma=p-1$, there exists a $c\in \mathbb N$ such that
\begin{gather}\label{eq:210}
\gcd(c,p-1)=1,\ c\equiv \frac sd\; \left(\textup{mod}\ \frac{p-1}{d}\right)
\end{gather}
and this $c$ is uniquely determined modulo $\alpha d=p-1$.


From the second relation of \eqref{eq:210} we receive $cd\equiv \modd{s} {p-1}$.
Since $h$ is a primitive root of $p$, we have $\ord_p(h)=p-1$,  thus,
$cd\equiv \modd{s} {\ord_p(h)}$.
Next, applying part (ii) of Lemma \ref{lem:4},  we get
\begin{gather}\label{eq:211}
cd\equiv \modd{s} {\ord_p(h)}\Longleftrightarrow h^{cd}\equiv \modd{h^s} {p}\Longleftrightarrow  h^{cd}\equiv \modd{a} {p}.
\end{gather}



Let us now prove that $g:=h^c$ is a primitive root of $p$. Using part (iii) of Lemma \ref{lem:4}
and applying the first part of \eqref{eq:210}, we obtain \eqref{eq:212}.
\begin{gather}\label{eq:212}
\ord_p(g)=\ord_p(h^c)=\frac{\ord_p(h)}{\gcd(c,\ord_p(h))}=\frac{p-1}{\gcd(c,p-1)}=p-1.
\end{gather}

Finally,  from $g\equiv \modd{h^c} {p}$ it follows  $g^d\equiv \modd{h^{cd}} {p}$ and, by \eqref{eq:211},
we have  $h^{cd}\equiv \modd{a} {p}$. Hence,  $g^{d}\equiv \modd{a} {p}$.
This together with  $d=(p-1)/\ord_p(a)$ yields $\ind_g(a)=(p-1)/\ord_p(a)$, as required.
\end{proof}


\begin{remark}
A primitive root $g$ of a prime $p$ satisfying \eqref{eq:27} may not be determined uniquely.
For example, if $a=2$ and $p=31$, then  $\ord_{31}(2)=5$. By direct calculation, we can find
that there exist exactly two primitive roots of $31$ satisfying
\eqref{eq:27}---namely, $\ind_{12}(2)=\ind_{21}(2)=30/5=6$.
\end{remark}


\begin{proposition} \label{prop:2}
Let $p$ be a prime and let $a\in\{1,\ldots,p-1\}$.
Further, let $g$ be a primitive root of $p$.
Then we have
\begin{gather}\label{eq:213}\ind_g(a)\mid p-1 \text{ if and only if } \ind_g(a)=\frac{p-1}{\ord_p(a)}.
\end{gather}
\end{proposition}

\begin{proof} Let $\ind_g(a)\mid p-1$.  Then there is a $c\in \mathbb N$ such that $p-1=c\cdot \ind_g(a)$.
Hence,
\begin{gather}\label{eq:214}
\gcd(p-1,\ind_g(a))=\ind_g(a)\cdot \gcd(c, 1)=\ind_g(a).
\end{gather}
On the other hand, by part (iv) of Lemma \ref{lem:4}, we have
$$\gcd(p-1,\ind_g(a))=\frac{p-1}{\ord_p(a)}.$$
This, together with  \eqref{eq:214}, yields $\ind_g(a)=(p-1)/\ord_p(a)$.

Since the converse implication is evident, the desired result follows.
\end{proof}

\begin{corollary} \label{cor:1}
Let $p$ be an odd prime and let $p-1=2^r u$ where $r,u\in \mathbb N$ and $2\nmid u$.
Then there exist a uniquely determined $s\in \mathbb N\cup \{0\}$ and $t\in \mathbb N$
such that
\begin{gather}\label{eq:215}
0\leq s\leq r, \ t\mid u  \text{ and } 2^st=\ind_g(2) \text{ for some primitive root }  g \text { of } p.
\end{gather}
\end{corollary}

\begin{proof}
First, by part (i) of Lemma \ref{lem:4}, we have $\ord_p(2)\mid p-1=2^ru$. This means that $\ord_p(2)=2^qv$ for a $q\in \mathbb N\cup\{0\}$,
$0\leq q\leq r$ and $v\in \mathbb N$ satisfying $v\mid u$, $2\nmid v$.
Let us now put $s:=r-q$ and $t:=u/v$. Then  $s\in \mathbb N\cup \{0\}$, $0\leq s\leq r$, $t\in \mathbb N$, and $t\mid u$.
Next, by Proposition \ref{prop:1}, there exists at least one primitive root  $g$ of $p$ such that
$$
\ind_g(2)=\frac{p-1}{\ord_p(2)}=\frac{2^ru}{2^qv}=2^{s}t.
$$
From this and from \eqref{eq:213} it now follows that $s$ and $t$ are the only numbers
satisfying \eqref{eq:215}.
\end{proof}



We are  now  ready to properly understand Aigner's Theorem \ref{thm:1}, presented in the introduction.
Theorem \ref{thm:1} can be formulated more exactly as follows.

\begin{theorem} \label{thm:3} Let $p$ be an odd prime and let $p-1=2^r u$ where $r,u\in \mathbb N$ and $2\nmid u$.
Then  \textup{(i)--(iii)} hold.
\begin{enumerate}[\rm (i)]
\item There exist uniquely determined $s\in \mathbb N\cup \{0\}$ and $t\in \mathbb N$ such that
$0\leq s\leq r$,  $t\mid u$ and $2^st=\ind_g(2)$ for some primitive root $g$ of $p$.
\item  $h(p)=r-s$.
\item $k(p)=\ord_{u'}(2)$, where $u'=u/t$.
\end{enumerate}
\end{theorem}

\begin{proof} Since the proof of (i) has already been given in Corollary \ref{cor:1},
it  is sufficient to prove (ii) and (iii).

We prove (ii).
Let $g$ be a primitive root of $p$ and let
$\ind_g(2)=2^st$ where $s\in \mathbb N\cup\{0\}$, $0\leq s\leq r$,  $t\in \mathbb N$, and $t\mid u$.
Then by part (i) of Theorem \ref{thm:3}, $s$ and $t$ are uniquely determined and we have
\begin{gather}\label{eq:216}
2\equiv  \modd{g^{2^{s}t}} {p}.
\end{gather}
By raising  both sides of \eqref{eq:216} to $2^j$, with $j\in \mathbb N\cup\{0\}$, we obtain
\begin{gather}\label{eq:217}
2^{2^j}\equiv  \modd{g^{2^{s+j}t}} {p}.
\end{gather}


Let $w\in \mathbb N\cup\{0\}$ and let $0\leq w<r-s$. Suppose that
$F_w\equiv  \modd{F_{r-s}} {p}$. Then we have
\begin{gather}\label{eq:218}
2^{2^w}\equiv  \modd{2^{2^{r-s}}} {p}.
\end{gather}
We now use \eqref{eq:217}. Taking $j=w$,   we obtain $2^{2^w}\equiv  \modd{g^{2^{s+w} t}} {p}$
and, taking $j=r-s$, we get  $2^{2^{r-s}}\equiv  \modd{g^{2^{r} t}} {p}$.
The last two congruences together with \eqref{eq:218} lead to
\begin{gather}\label{eq:219}
g^{2^{s+w} t}\equiv  \modd{g^{2^{r} t}} {p}.
\end{gather}
Because $g$ is a primitive root of $p$, we have $\ord_p(g)=p-1$. Applying part (ii) of Lemma \ref{lem:4}, we now see
that \eqref{eq:219} is equivalent to
\begin{gather}\label{eq:220}
 2^{w+s} t\equiv  \modd{2^{r} t} {p-1}.
\end{gather}
Furthermore, $t\mid u$ implies that there exists a $u'\in \mathbb N$ such that
$u=tu'$. This means that $p-1=2^rtu'$. Since $w<r-s$, there exists an $l\in \mathbb N$ such that
$w+l=r-s$. Substituting $r=s+w+l$ and $p-1=2^{s+w+l}tu'$ into \eqref{eq:220}, we obtain
\begin{gather}\label{eq:221}
2^{w+s} t\equiv  \modd{2^{s+w+l} t} {2^{s+w+l} tu'}.
\end{gather}
From \eqref{eq:221} now it follows that $2^{l}\equiv  \modd{1} {2^{l} u'}$, which yields
$2^l\mid 2^{l}-1$,  a contradiction.
Consequently, $F_w\not\equiv  \modd{F_{r-s}} {p}$ for every $w\in\{0,\ldots,r-s-1\}$.
Therefore,
\begin{gather}\label{eq:222}
h(p)\ge \#\{0,\ldots,r-s-1\}=r-s.
\end{gather}

Now we show that there exists an $l\in \mathbb N$ such that
\begin{gather}\label{eq:223}
F_{r-s}\equiv  \modd{F_{r-s+l}} {p}, \text{ or equivalently, } 2^{2^{r-s}}\equiv  \modd{2^{2^{r-s+l}}} {p}.
\end{gather}
Again, applying \eqref{eq:217}, for $j=r-s$ we obtain $2^{2^{r-s}}\equiv  \modd{g^{2^{r} t}} {p}$
and, for $j=r-s+l$,  we get  $2^{2^{r-s+l}}\equiv  \modd{g^{2^{r+l} t}} {p}$.
Combining the last two congruences with \eqref{eq:223} we get $g^{2^{r} t}\equiv  \modd{g^{2^{r+l} t}} {p}$,
which is, by part (ii) of Lemma \ref{lem:4},  equivalent to $2^rt\equiv  \modd{2^{r+l} t} {p-1}$.
Because $p-1=2^rtu'$,  it is clear that $2^{l}\equiv  \modd{1} {u'}$ and,
by part (i) of Lemma \ref{lem:4}, we conclude that $2^{l}\equiv  \modd{1} {u'}$ holds
for every  $l=c\cdot \ord_{u'}(2)$ where $c\in \mathbb N$.
From \eqref{eq:223} now it follows that $h(p)\leq r-s$, which together with  \eqref{eq:222} proves (ii).

We prove (iii). First, taking $l=\ord_{u'}(2)$ in \eqref{eq:223}, we obtain
$$F_{r-s}\equiv  \modd{F_{r-s+\ord_{u'}(2)}} {p},$$
which means that $\ord_{u'}(2)$
is the length of a period of $(F_n \text{ mod } p)_{n=0}^{\infty}$.
Applying Lemma \ref{lem:3}, we now get $k(p)\mid \ord_{u'}(2)$, and thus
there exists a $c\in \mathbb N$ such that $k(p)=\ord_{u'}(2)/c$.
Suppose that $c\ne 1$. Then we have $F_{r-s}\equiv  \modd{F_{r-s+\ord_{u'}(2)/c}} {p}$, or equivalently,
\begin{gather}\label{eq:224}
2^{2^{r-s}}\equiv  \modd{2^{2^{r-s+\ord_{u'}(2)/c}}} {p}.
\end{gather}
Again, using  \eqref{eq:217}, we find that \eqref{eq:224} is equivalent to
$g^{2^{r} t}\equiv  \modd{g^{2^{r+\ord_{u'}(2)/c} t}} {p}$ and, by part (ii) of Lemma \ref{lem:4}, we get
\begin{gather}\label{eq:225}
2^{r} t\equiv  \modd{2^{r+\ord_{u'}(2)/c} t} {p-1}.
\end{gather}
As $p-1=2^rtu'$, \eqref{eq:225} implies $2^{\ord_{u'}(2)/c}\equiv  \modd{1} {u'}$.
Hence, by part (i) of Lemma  \ref{lem:4}, we obtain $\ord_{u'}(2)\mid \ord_{u'}(2)/c$,
which is a contradiction with $c\ne 1$. This proves (iii).
\end{proof}

\begin{example}
Let $p=41$. Then $p-1=2^3\cdot 5$. Hence, $r=3$ and $u=5$. Next, we have $\ord_{41}(2)=20=2^2\cdot 5$, and
thus $(p-1)/\ord_p(2)=2$. By Proposition \ref{prop:1} we now obtain $\ind_g(2)=2$ for some primitive root $g$ of $41$ and,
by  direct calculation, we can find that  $\ind_g(2)=2$ if and only if $g\in \{17,24\}$.
Since $\ind_g(2)=2$, we have $s=1$, $t=1$,  and $u'=u/t=5$.
By part (ii) of Theorem \ref{thm:3}, we now get $h(41)=r-s=2$ and, from part (iii) of Theorem \ref{thm:3},
we obtain  $k(41)=\ord_5(2)=4$. Finally, direct calculation verifies that
$$(F_n\bmod 41)_{n=0}^{\infty}=(3,5,17,11,19,38,17,11,19,38,\ldots ).$$
\end{example}

The following Lemma \ref{lem:6} is well-known.
\begin{lemma} \label{lem:6}
Let $n\in \mathbb N\cup \{0\}$ and let $p$ be an odd prime. Then the Fermat number $F_n$ is divisible
by $p$ if and only if $\ord_p(2)=2^{n+1}$.
\end{lemma}

A proof of Lemma \ref{lem:6} can be found, for example, in \cite[p.\ 37]{4}.
\vskip 2mm
Let $F=\{3,5,17,257,641,65537,114689,\ldots \}$ be the set of all primes $p$
such that $p$ is a divisor of some Fermat number $F_n$, where $n\in \mathbb N\cup \{0\}$.
Since every Fermat number $F_n$ is divisible by at least one prime $p$ and every two Fermat
numbers are coprime by Goldbach theorem \cite[p.\ 33]{4}, $F$ is the infinite set.

\begin{proposition} \label{prop:3}
Let $p$ be a prime, $p\ne 2$. Then $p\in F$ if and only if $k(p)=1$.
\end{proposition}

\begin{proof}
Let $p-1=2^ru$ where $r,u\in \mathbb N$ and let $2\nmid u$.


First, assume that $p\in F$.  Then, by Lemma \ref{lem:6},
$\ord_p(2)=2^q$ for some $q\in \mathbb N$ and, by part (i) of Lemma \ref{lem:4}, we get $q\leq r$. Hence,
\begin{gather}\label{eq:226}
\frac{p-1}{\ord_p(2)}=2^{r-q}u.
\end{gather}
On the other hand, by Corollary \ref{cor:1}, there exist  uniquely determined $s\in \mathbb N\cup \{0\}$
and $t\in \mathbb N$ such that $0\leq s\leq r$, $t\mid u$ and
$2^st=\ind_g(2)$ for some primitive root $g$ of $p$.
Applying  \eqref{eq:27}, we now obtain
$$\frac{p-1}{\ord_p(2)}=\ind_g(2)=2^st.$$
This, along with \eqref{eq:226}, yields $2^{r-q}u=2^st$.
Since $2\nmid u$ and $2\nmid t$, we have $u=t$. Hence, $u/t=1$ and,
by part (iii) of Theorem~\ref{thm:3}, we get $k(p)=1$.

Conversely, let us assume that $k(p)=1$. Then, by part (iii) of Theorem~\ref{thm:3},
we have $\ord_{u'}(2)=1$, which implies $u'=1$.
As $u'=u/t$, we have $u=t$ and, by Corollary \ref{cor:1}, $\ind_g(2)=2^su$
for some $s\in \mathbb N\cup\{0\}$ where $0\leq s\leq r$.
Next, applying \eqref{eq:27}, we obtain
\begin{gather}\label{eq:227}
\ord_p(2)=\frac{p-1}{\ind_g(2)}=\frac{2^ru}{2^su}=2^{r-s}.
\end{gather}
Suppose now that $r-s=0$. Then, by \eqref{eq:227}, $\ord_p(2)=1$ which yields $2\equiv \modd{1} {p}$, a contradiction. Hence,
$r-s\in \mathbb N$ and, $r-s-1\in \mathbb N\cup \{0\}$.
Applying Lemma \ref{lem:6} to \eqref{eq:227} we now get $p\mid F_{r-s-1}$, which means that $p\in F$.
\end{proof}



\begin{example}
Let $p=641$. Then $p-1=2^7\cdot 5$. Hence, $r=7$ and, $u=5$. Since  $\ord_{641}(2)=2^6$,
by Lemma \ref{lem:6} we have  $641\mid F_5$. As $(p-1)/\ord_p(2)=10$, by  \eqref{eq:27}, we  obtain $\ind_g(2)=10$
for some primitive root $g$ of $641$ and  direct calculation verifies that $\ind_g(2)=10$ if and only if
$g\in \{96, 108, 299, 304, 337, 342, 533, 545\}$. Hence, $s=1$, $t=5$ and $u'=u/t=1$.
Applying  part (ii) and (iii) of Theorem \ref{thm:3}, we now get $h(641)=r-s=6$ and  $k(641)=\ord_1(2)=1$.
Finally,  we can verify that
$$(F_n\bmod 641)_{n=0}^{\infty}=(3,5,17,257,155,0,2,2,2,2,2,\ldots ).$$
\end{example}


\section{A simpler formulation of Aigner's theorem}

In this section we find a simpler formulation of Aigner's result presented as Theorem \ref{thm:1}.
We show that the numbers $h(p)$ and $k(p)$ can be determined without resorting to the theory of
primitive roots and indices. Our considerations are based only on the concept of a multiplicative
order and its  properties.
\begin{theorem} \label{thm:5}
Let $p$ be a prime, $p\ne 2$ and let $\ord_p(2)=2^vw$ where $v\in\mathbb N\cup\{0\}$, $w\in \mathbb N$ and, $2\nmid w$.
Then we have
\begin{enumerate}[\rm (i)]
\item $h(p)=v$.
\item $k(p)=\ord_w(2)$.
\end{enumerate}
\end{theorem}

\begin{proof} We prove (i). First we show that
\begin{gather}\label{eq:41}
F_v\equiv \modd{F_{v+\ord_w(2)}} {p}.
\end{gather}
Since $\ord_p(2)=2^vw$,  from part (i) of Definition \ref{def:2}, we get
\begin{gather}\label{eq:42}
2^{\ord_w(2)}\equiv 1\; \left(\textup{mod}\ \frac{\ord_p(2)}{2^v}\right).
\end{gather}
By multiplying \eqref{eq:42} by $2^v$, we receive
$2^{v+\ord_w(2)}\equiv \modd{2^v} {\ord_p(2)}$,
which is, by part (ii) of Lemma \ref{lem:4}, equivalent to
$2^{2^{v+\ord_w(2)}}\equiv \modd{2^{2^v}} {p}$.
Hence, \eqref{eq:41} follows.

Next, applying Lemma \ref{lem:3} to \eqref{eq:41}, we obtain
$v\equiv \modd{v+\ord_w(2)} {k(p)}$, which yields
$h(p)\leq v$ and $k(p)\mid \ord_w(2)$.
Specifically, by taking $v=0$ in  $h(p)\leq v$, we get $h(p)=0$.
Let $v\ne 0$ and let $t\in \{0, \ldots, v-1\}$. Suppose now that $F_t\equiv \modd{F_v} {p}$.
Then $2^{2^t}\equiv \modd{2^{2^{v}}} {p}$ and, using part
(ii) of Lemma \ref{lem:4}, we obtain  $2^t\equiv \modd{2^{v}} {\ord_p(2)}$.
Since $\ord_p(2)=2^vw$ we have $2^vw\mid 2^t(2^{v-t}-1)$, which is a contradiction with $v>t$.
Hence, $F_t\not\equiv \modd{F_v} {p}$ for every $t\in \{0,\ldots,v-1\}$.
This means that $h(p)\geq\#\{0,\ldots,v-1\}=v$, which along with $h(p)\leq v$, proves (i).

We prove (ii). By \eqref{eq:41}, $\ord_w(2)$ is the length of the period of $(F_n \text{ mod } p)_{n=0}^{\infty}$
and, by Lemma \ref{lem:3}, we have $k(p)\mid \ord_w(2)$.
Therefore, there exists an $s\in \mathbb N$ such that $k(p)=\ord_w(2)/s$.
Suppose that $s\ne 1$. From
$F_v\equiv \modd{F_{v+k(p)}} {p}$ now it follows that
$2^{2^{v}}\equiv \modd{2^{2^{v+\ord_w(2)/s}}} {p}$
and, by part (ii) of Lemma \ref{lem:4}, we obtain $$2^v\equiv \modd{2^{v+\ord_w(2)/s}} {\ord_p(2)}.$$
This, together with $\ord_p(2)=2^vw$, yields  $2^{\ord_w(2)/s}\equiv \modd{1} {w}$.
Applying part (i) of Lemma \ref{lem:4}, we now get
$\ord_w(2)\mid \ord_w(2)/s$, which is a contradiction. Hence, we have $s=1$ and
the desired result follows.
\end{proof}

\section{Some new results concerning the numbers $h(p)$}

In  this section, we take a closer look at  the properties of
the numbers $h(p)$ and show that part (i) of Theorem \ref{thm:5} can be refined substantially.
We start by recalling some known properties of the quadratic character of $2$.
\begin{theorem}\label{thm:6} Let $p$ be a prime, $p\ne 2$. Then we have
\begin{gather} \label{eq:51} \left( \frac {2} {p} \right)\equiv 2^{\frac{p-1}{2}}\;  (\textup{mod}\, p)\end{gather}
and,
\begin{gather} \label{eq:52} \left( \frac {2} {p} \right)=(-1)^{\frac{p^2-1}{8}}=
\begin{cases} \ \ 1, \ \text{if}\ \ p\equiv 1,7\;  (\textup{mod}\, 8);\\
-1, \ \text{if}\ \ p\equiv 3,5\;  (\textup{mod}\, 8).\end{cases}
\end{gather}
\end{theorem}

A proof of  \eqref{eq:51} can be found, for example, in the books \cite[p.\ 176]{2} or \cite[p.\ 418]{6} and,
for a  proof of \eqref{eq:52}, see \cite[p.\ 180]{2} or \cite[p.\ 422]{6}.
\begin{theorem}\label{thm:7}
For every prime $p$, \textup{(i)--(iii)} hold.
\begin{enumerate}[\rm (i)]
\item If $p\equiv \modd{7} {8}$, then $2\nmid \ord_p(2)$. Consequently, $h(p)=0$.
\item If $p\equiv \modd{3} {8}$, then $2\parallel \ord_p(2)$. Consequently, $h(p)=1$.
\item If $p\equiv \modd{5} {8}$, then $4\parallel  \ord_p(2)$.  Consequently, $h(p)=2$.
\end{enumerate}
\end{theorem}
\begin{proof} We prove (i). If $p\equiv \modd{7} {8}$, then $p=8\alpha+7$ for an $\alpha\in \mathbb N\cup \{0\}$.
Hence, $2^{(p-1)/2}=2^{4\alpha+3}$. On the other hand, by Theorem \ref{thm:6}, $2^{(p-1)/2}\equiv \modd{1} {p}$.
This means that $2^{4\alpha+3}\equiv \modd{1} {p}$. By part (i) of Lemma \ref{lem:4}, we
now obtain $\ord_p(2)\mid 4\alpha+3$. Hence, $2\nmid \ord_p(2)$. Finally, applying part (i) of Theorem \ref{thm:5},
we get $h(p)=0$.

We prove (ii). If $p\equiv \modd{3} {8}$, then $p=8\alpha+3$ for an $\alpha\in \mathbb N\cup \{0\}$.
Hence, $2^{(p-1)/2}=2^{4\alpha+1}$. On the other hand, by Theorem \ref{thm:6}, $2^{(p-1)/2}\equiv \modd{-1} {p}$.
This means that $2^{4\alpha+1}\equiv \modd{-1} {p}$. Let $\ord_p(2)=u$. Suppose now that $2\nmid u$. Then, by
part (i) of Lemma \ref{lem:4},  $u\mid p-1=2(4\alpha +1)$. This means that
$u\mid 4\alpha +1$. Therefore, there exists a $t\in \mathbb N$ such that $4\alpha+1=tu$.
Hence, $2^{4\alpha+1}=(2^u)^t\equiv 1^t\equiv  \modd{1} {p}$, which is a contradiction.
Thus, we have $2\mid u$, which, along with $u\mid 2(4\alpha+1)$, yields $2\parallel \ord_p(2)$.
Applying part (i) of Theorem \ref{thm:5}, we now obtain $h(p)=1$.

We prove (iii). If $p\equiv \modd{5} {8}$, then $p=8\alpha+5$ for an $\alpha\in \mathbb N\cup \{0\}$.
Hence, $2^{(p-1)/2}=2^{4\alpha+2}$. On the other hand, by Theorem \ref{thm:6}, we have $2^{(p-1)/2}\equiv \modd{-1} {p}$.
This means that $2^{4\alpha+2}\equiv \modd{-1} {p}$. Let $\ord_p(2)=u$. Suppose now that $4\nmid u$. Then, by
part (i) of Lemma \ref{lem:4},  $u\mid p-1=4(2\alpha +1)$ and
$u\mid 2\alpha +1$ follows. Therefore, there exists a $t\in \mathbb N$ such that $2\alpha+1=tu$.
Hence,  $2^{4\alpha+2}=(2^u)^{2t}\equiv 1^{2t}\equiv  \modd{1} {p}$, which is a contradiction.
Thus, $4\mid u$, which, along  with $u\mid 4(2\alpha+1)$, yields $4\parallel \ord_p(2)$.
Applying part (i) of Theorem \ref{thm:5}, we now obtain $h(p)=2$.
\end{proof}


The case of primes $p\equiv \modd{1} {8}$ solves Theorem \ref{thm:8}.


\begin{theorem}\label{thm:8} For every $v\in \mathbb N\cup \{0\}$, there exists at least one
prime $p\equiv \modd{1} {8}$ such that $h(p)=v$.
\end{theorem}
\begin{proof}
Let us divide the proof into two parts. First, we show that the conclusion of Theorem \ref{thm:8} is true
for every $v\in \{0,1,2\}$. Direct calculation  verifies that
(i)--(iii) hold.

\begin{itemize}
\item[(i)] If $p=73$, then $p\equiv \modd{1} {8}$ and $h(73)=0$.
\item[(ii)]  If $p=281$, then $p\equiv \modd{1} {8}$ and $h(281)=1$.
\item[(iii)]  If $p=41$, then $p\equiv \modd{1} {8}$ and $h(41)=2$.
\end{itemize}

The values of the primes $p\equiv \modd{1} {8}$ shown in (i)--(iii) are
the least values  for which the equality $h(p)=v$ occurs.
Secondly, we prove that Theorem \ref{thm:8} also applies for every
$v\in \mathbb N\cup\{0\}$, $v\geq 3$.
Let  $p$ be
a prime such that $p\mid F_{v-1}$ where $v\geq 3$.
Then, by Lemma \ref{lem:6}, $\ord_p(2)=2^v$. This, along with part (i) of
Theorem \ref{thm:5}, yields $h(p)=v$.
Now it is clear from Theorem \ref{thm:7} that $p=2$ or $p\equiv \modd{1} {8}$.
Since $h(2)=0$, we have $p\equiv \modd{1} {8}$, as required.
\end{proof}

We conclude our study of Fermat numbers by presenting the tables of $h(p)$ and $k(p)$
for all primes $p<1000$. The tables are shown in the Appendix.

\section{Acknowledgment}

The author thanks the  anonymous referee for carefully reading  the manuscript.

\appendix 

\section{Appendix:  Tables of the values of $h(p)$ and $k(p)$ for $p<1000$}

\begin{table}[H]
\centering
\resizebox{3.6in}{!}{%
\begin{tabular}{|c|c|c||c|c|c||c|c|c|}
$p$ & $h(p)$ & $k(p)$ & $p$ & $h(p)$ & $k(p)$ & $p$ & $h(p)$ & $k(p)$ \\
\hline
2  &  0  &    1  &    3  &  1  &    1  &    5  &  2  &    1  \\
  7  &  0  &    2  &   11  &  1  &    4  &   13  &  2  &    2  \\
 17  &  3  &    1  &   19  &  1  &    6  &   23  &  0  &   10  \\
 29  &  2  &    3  &   31  &  0  &    4  &   37  &  2  &    6  \\
 41  &  2  &    4  &   43  &  1  &    3  &   47  &  0  &   11  \\
 53  &  2  &   12  &   59  &  1  &   28  &   61  &  2  &    4  \\
 67  &  1  &   10  &   71  &  0  &   12  &   73  &  0  &    6  \\
 79  &  0  &   12  &   83  &  1  &   20  &   89  &  0  &   10  \\
 97  &  4  &    2  &  101  &  2  &   20  &  103  &  0  &    8  \\
107  &  1  &   52  &  109  &  2  &    6  &  113  &  2  &    3  \\
127  &  0  &    3  &  131  &  1  &   12  &  137  &  2  &    8  \\
139  &  1  &   22  &  149  &  2  &   36  &  151  &  0  &    4  \\
157  &  2  &   12  &  163  &  1  &   54  &  167  &  0  &   82  \\
\end{tabular}%
}
\end{table}

\begin{table}[H]
\centering
\resizebox{3.6in}{!}{%
\begin{tabular}{|c|c|c||c|c|c||c|c|c|}
$p$ & $h(p)$ & $k(p)$ & $p$ & $h(p)$ & $k(p)$ & $p$ & $h(p)$ & $k(p)$ \\
\hline
173  &  2  &   14  &  179  &  1  &   11  &  181  &  2  &   12  \\
191  &  0  &   36  &  193  &  5  &    2  &  197  &  2  &   21  \\
199  &  0  &   30  &  211  &  1  &   12  &  223  &  0  &   36  \\
227  &  1  &   28  &  229  &  2  &   18  &  233  &  0  &   28  \\
239  &  0  &   24  &  241  &  3  &    2  &  251  &  1  &   20  \\
257  &  4  &    1  &  263  &  0  &  130  &  269  &  2  &   66  \\
271  &  0  &   36  &  277  &  2  &   11  &  281  &  1  &   12  \\
283  &  1  &   23  &  293  &  2  &    9  &  307  &  1  &    8  \\
311  &  0  &   20  &  313  &  2  &   12  &  317  &  2  &   39  \\
331  &  1  &    4  &  337  &  0  &    6  &  347  &  1  &  172  \\
349  &  2  &   28  &  353  &  3  &   10  &  359  &  0  &  178  \\
367  &  0  &   60  &  373  &  2  &   10  &  379  &  1  &   18  \\
383  &  0  &   95  &  389  &  2  &   48  &  397  &  2  &   10  \\
401  &  3  &   20  &  409  &  2  &    8  &  419  &  1  &   90  \\
421  &  2  &   12  &  431  &  0  &   14  &  433  &  3  &    6  \\
439  &  0  &    9  &  443  &  1  &   24  &  449  &  5  &    3  \\
457  &  2  &   18  &  461  &  2  &   44  &  463  &  0  &   30  \\
467  &  1  &   29  &  479  &  0  &  119  &  487  &  0  &  162  \\
491  &  1  &   84  &  499  &  1  &   82  &  503  &  0  &   50  \\
509  &  2  &    7  &  521  &  2  &   12  &  523  &  1  &   84  \\
541  &  2  &   36  &  547  &  1  &   12  &  557  &  2  &  138  \\
563  &  1  &   70  &  569  &  2  &   35  &  571  &  1  &   18  \\
577  &  4  &    6  &  587  &  1  &  292  &  593  &  2  &   36  \\
599  &  0  &  132  &  601  &  0  &   20  &  607  &  0  &  100  \\
613  &  2  &   24  &  617  &  1  &   30  &  619  &  1  &  102  \\
631  &  0  &   12  &  641  &  6  &    1  &  643  &  1  &  106  \\
647  &  0  &   72  &  653  &  2  &  162  &  659  &  1  &   69  \\
661  &  2  &   20  &  673  &  4  &    2  &  677  &  2  &  156  \\
683  &  1  &   10  &  691  &  1  &   44  &  701  &  2  &   60  \\
709  &  2  &   58  &  719  &  0  &  179  &  727  &  0  &  110  \\
733  &  2  &   60  &  739  &  1  &   20  &  743  &  0  &  156  \\
751  &  0  &  100  &  757  &  2  &   18  &  761  &  2  &   36  \\
769  &  7  &    2  &  773  &  2  &   96  &  787  &  1  &  130  \\
797  &  2  &   99  &  809  &  2  &  100  &  811  &  1  &   36  \\
821  &  2  &   20  &  823  &  0  &   68  &  827  &  1  &  174  \\
829  &  2  &   66  &  839  &  0  &  418  &  853  &  2  &   70  \\
857  &  2  &  106  &  859  &  1  &   60  &  863  &  0  &   43  \\
877  &  2  &   18  &  881  &  0  &   20  &  883  &  1  &   42  \\
887  &  0  &  442  &  907  &  1  &   30  &  911  &  0  &   12  \\
919  &  0  &   24  &  929  &  4  &   28  &  937  &  0  &   12  \\
941  &  2  &   92  &  947  &  1  &   70  &  953  &  2  &    8  \\
967  &  0  &   66  &  971  &  1  &   48  &  977  &  3  &   60  \\
983  &  0  &  490  &  991  &  0  &   60  &  997  &  2  &   82  \\
\end{tabular}
}
\end{table}

\begin{thebibliography}{8}
\bibitem{1}
A. Aigner, \"Uber Primzahlen, nach denen (fast) alle Fermatschen Zahlen quadratische Nichtreste sind, \emph{Monatsh. Math.} \textbf{101} (1986), 85--93.
\bibitem{2}
D. M. Burton, \emph{Elementary Number Theory}, 7th edition, 
McGraw-Hill, 2011.
\bibitem{3}
E. Deza, \emph{Mersenne Numbers and Fermat Numbers, Selected Chapters of Number Theory: Special Numbers}, World Scientific, 2021.
\bibitem{4}
M. K\v{r}\'{i}\v{z}ek, F. Luca, and L. Somer, \emph{$17$ Lectures on Fermat Numbers, From Number Theory to Geometry}, Canadian Mathematical Society, Springer, 2001.
\bibitem{5}
B. Rittaud and A. Heeffer, The pigeonhole principle, two centuries before Dirichlet,
\emph{Math. Intell.} \textbf{36} (2014), 27--29.
\bibitem{6}
K. H. Rosen, \emph{Elementary Number Theory and Its Applications}, Sixth Edition, Addison-Wesley, 2011.
\bibitem{7}
N. J. A. Sloane et al., The On-Line Encyclopedia of Integer Sequences, available at \url{https://oeis.org}, 2024.
\bibitem{8}
I. M. Vinogradov, \emph{Elements of  Number Theory},  Dover Publications, 1954.
\end{thebibliography}

\bigskip
\hrule
\bigskip

\noindent 2020 {\it Mathematics Subject Classification:}
Primary 11B50; Secondary 11B83, 11A41.

\noindent \emph{Keywords:}
Fermat number, modular periodicity, pre-period, primitive period.

\bigskip
\hrule
\bigskip

\noindent (Concerned with sequences
\seqnum{A000215} and
\seqnum{A102742}.)

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received June 18 2024;
revised version  received  April 29 2025.
Published in {\it Journal of Integer Sequences}, December 15 2025.

\bigskip
\hrule
\bigskip

\noindent
Return to \href{https://cs.uwaterloo.ca/journals/JIS/}{Journal of Integer Sequences home page}.
\vskip .1in


\end{document}

                                                                                

