\documentclass[12pt,reqno]{article}

\usepackage[usenames]{color}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amscd}

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

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

\usepackage{color}
\usepackage{fullpage}
\usepackage{float}

\usepackage{psfig}
\usepackage{graphics,amsmath,amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{epsf}

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

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


\begin{document}

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

\begin{center}
\vskip 1cm{\LARGE\bf 
Sequences of Generalized Happy Numbers with Small Bases
}
\vskip 1cm
\large
H. G. Grundman \\
Department of Mathematics \\
Bryn Mawr College\\
Bryn Mawr, PA 19010 \\
USA \\
\href{mailto:grundman@brynmawr.edu}{\tt grundman@brynmawr.edu} \\
\ \\
E. A. Teeple   \\
Department of Biostatistics \\
University of Washington \\
Seattle, WA 98195
USA \\
\href{mailto:eteeple@u.washington.edu}{\tt eteeple@u.washington.edu} \\
\end{center}

\vskip .2in

\begin{abstract}
For bases $b \leq 5$ and exponents $e\geq 2$, 
there exist arbitrarily long finite sequences of
$d$-consecutive $e$-power $b$-happy numbers for a
specific $d = d(e,b)$, which is shown to be minimal possible.
\end{abstract}

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



%\usepackage{latexsym,amsthm,amssymb}
%\begin{document}

%\newtheorem{theorem}{Theorem}
%\newtheorem{lemma}[theorem]{Lemma}
%\newtheorem{cor}[theorem]{Corollary}
\def\Z{{\mathbb Z}}
\def\mod{\mbox{\rm mod }}


\section{Introduction}

A positive integer $a$ is a {\it happy number} if taking the sum of
the squares of its digits and repeating the process iteratively 
leads to the number one.  (See \seqnum{A000108} in \cite{sloane2006}.)  
Generalizations of happy numbers, suggested by Richard Guy~\cite{guy},
have been formalized and studied by the present 
authors~\cite{gt4,gt3,gt1,gt2}.

Define $S_{e,b}: {\Z}^+ \rightarrow {\Z}^+$,
for $e \geq 2$, $b \geq 2$, and $0 \leq a_i \leq b-1$, by
$$S_{e,b}\left(\sum_{i=0}^n a_i b^i\right) = \sum_{i=0}^n a_i^e.$$
If $S^m_{e,b}(a) =1$ for some $m \geq 0$, we say that $a$ is
an {\it $e$-power $b$-happy number.}

Guy~\cite{guy} asked for the maximal lengths of strings
of consecutive happy numbers. 
El-Sedy and Siksek~\cite{es} showed that there exist
arbitrarily long finite sequences
of consecutive happy numbers (i.e., $2$-power $10$-happy numbers). 
The present authors proved more general results for sequences
of consecutive $e$-power $b$-happy numbers for $e = 2$ and $3$ ~\cite{gt3} 
and for $e = 5$~\cite{gt4}.  To describe the
relevant results, we need an additional definition.

For $d \in \Z^+$, define a {\em $d$-consecutive sequence} to
be an arithmetic sequence with
constant difference $d$.  In many cases, it is straight-forward to
prove that for fixed values of $e$ and $b$, all 
$e$-power $b$-happy numbers are congruent to some fixed value modulo $d$.
So the most that can be hoped for is a $d$-consecutive sequence of
these numbers.

Specifically, we have that
for any $b$, letting $d = \gcd(2,b-1)$, there exist arbitrarily long
finite $d$-consecutive sequences of $2$-power $b$-happy numbers~\cite{gt3}.
For $2\leq b\leq 13$ and
$d = \gcd(6,b-1)$, there exist arbitrarily long
finite $d$-consecutive sequences of
$3$-power $b$-happy numbers~\cite{gt3}. 
And, for $2 \leq b \leq 10$ and $d = \gcd(30, b-1)$, there
exist arbitrarily long finite sequences
of $d$-consecutive $5$-power $b$-happy numbers~\cite{gt4}.
In each of these cases, $d$ is known to be as small as possible.

In this paper, we consider conditions for the existence of
sequences of $e$-power $b$-happy numbers where, instead of fixing the
exponent, we fix the base.  Restricting to values of $b \leq 5$,
we present new results that hold for all exponents $e$.
In the following section, we present key technical definitions
and the main results of the paper.  In the final section, we
prove these results.


\section{Main Results}

In this section we study the existence of
sequences of consecutive $e$-power $b$-happy numbers with $b\leq 5$.

First note that for each $e \geq 2$, 
every positive integer is
$e$-power $2$-happy.  Hence, trivially, there exist arbitrarily 
long sequences of consecutive $e$-power $2$-happy numbers.  
We now consider bases $3$, $4$, and $5$.

The following lemma and corollary provide that for bases $3$ and $5$, the best
we can achieve is $2$-consecutive sequences and for base $4$ with
odd power, $3$-consecutive sequences.  The proofs are straight-forward. 

\begin{lemma}
\label{base3}
Let $e \geq 2$.  For any $m \in \Z^+$,
$$S_{e,3}^m(x) \equiv x \pmod 2  \mbox{\ \ \ and\ \ \ }
S_{e,5}^m(x) \equiv x \pmod 2.$$
Further, for $e$ odd, $$S_{e,4}^m(x) \equiv x \pmod 3.$$
\end{lemma}


\begin{corollary}
For $e \geq 2$, all $e$-power $3$-happy numbers are congruent to $1$
modulo $2$ 
and all $e$-power $5$-happy numbers are congruent to $1$ modulo $2$.
For odd $e \geq 2$, all $e$-power $4$-happy numbers are congruent to
$1$ modulo $3$.
\end{corollary}

We now recall some needed definitions and two lemmas 
proved previously~\cite{gt3}.
Fix $e\geq 2$ and $b \geq 2$.
Let $U_{e,b}$ denote the union of all cycles (including fixed points)
of the function $S_{e,b}$,
$$U_{e,b} = 
\{a \in \Z^+ | \mbox{ for some } m\in \Z^+,\ S_{e,b}^m(a) = a \}.$$
A finite set $T$ is {\em $(e,b)$-good}
if, for each $u \in U_{e,b}$, there exist
$n, k \in {\Z}^+$ such that for all $t \in T$, $S_{e,b}^k(t+n) = u$.
\begin{lemma}
\label{tlemma}
Fix $e$, $b \geq 2$.  If $T =\{t\} \subseteq \Z^+$, then
$T$ is $(e,b)$-good.
\end{lemma}
Let $I: {\Z}^+ \rightarrow {\Z}^+$ be defined by $I(t) = t + 1$.
\begin{lemma}
\label{Flemma}
Fix $e$, $b \geq 2$.  Let $F:{\Z}^+ \rightarrow {\Z}^+$ be the
composition of a finite sequence of the functions $S_{e,b}$ and $I$.
If $F(T)$ is $(e,b)$-good, then $T$ is $(e,b)$-good.
\end{lemma}

We can now state our main results including giving necessary and
sufficient conditions for the existence of 
arbitrarily long finite sequences of
$e$-power $b$-happy numbers, for $b = 3$, $4$, or $5$.
We prove these results in Section~\ref{proofs} using methods 
generalizing those used in earlier works~\cite{gt4,gt3}.

First we have that, without any restriction on $e$, 
there exist arbitrarily long finite sequences of
$2$-consecutive $e$-power $3$-happy numbers.

\begin{theorem}
\label{clb3}
Let $T$ be a finite set of positive integers. Given any 
$e \geq 2$, $T$ is $(e,3)$-good if and only if the
elements of $T$ are congruent modulo $2$.
\end{theorem}

\begin{corollary}
\label{corb3}
For each $e\geq 2$, there exist arbitrarily long finite sequences of
$2$-consecutive $e$-power $3$-happy numbers.
\end{corollary}

For base $4$, there exist arbitrarily long finite sequences of
$d$-consecutive $e$-power $4$-happy numbers, where $d$ depends
on the parity of $e$.

\begin{theorem}
\label{clb4}
Let $T$ be a finite set of positive integers, and let
$e\geq 2$.  For $e$ even, $T$ is $(e,4)$-good.
For $e$ odd,
$T$ is $(e,4)$-good if and only if the elements of $T$ are
congruent modulo $3$.
\end{theorem}

\begin{corollary}
\label{corb4}
For each even $e\geq 2$, there exist arbitrarily long finite 
sequences of $e$-power $4$-happy numbers.

For each odd $e\geq 2$,
there exist arbitrarily long finite sequences of
$3$-consecutive $e$-power $4$-happy numbers.
\end{corollary}

And finally, for base $5$, we have that, independent of the value of
$e$, there exist arbitrarily long finite sequences of
$2$-consecutive $e$-power $5$-happy numbers.

\begin{theorem}
\label{clb5}
Let $T$ be a finite set of positive integers. Given any
$e \geq 2$, $T$ is $(e,5)$-good if and only if the
elements of $T$ are congruent modulo $2$.
\end{theorem}

\begin{corollary}
\label{corb5}
For each $e\geq 2$, there exist arbitrarily long finite sequences of
$2$-consecutive $e$-power $5$-happy numbers.
\end{corollary}


\section{Proofs of Main Theorems}
\label{proofs}

In this section we prove Theorems~\ref{clb3},~\ref{clb4}, and~\ref{clb5}.

\begin{proof}
[Proof of Theorem~\ref{clb3}.]
If $T$ is $(e,3)$-good, then it follows from Lemma~\ref{base3} that
the elements of $T$ are congruent modulo $2$.

For the converse, let $T$ be a finite set of positive integers
all of which are congruent modulo $2$.
If $T$ is empty, then vacuously it is $(e,3)$-good
and if $T$ has exactly one element, then, by Lemma~\ref{tlemma},
$T$ is $(e,3)$-good.

Fix $N > 1$ and assume that any set of fewer than $N$ elements all
of which are congruent modulo $2$ is
$(e,3)$-good.  Suppose $T$ has exactly $N$ elements and let
$t_1 > t_2 \in T$.

Let $v = \frac{t_1-t_2}{2}$.  
Since $t_1 \equiv t_2\ (\mod 2)$, $v \in \Z$.
Fix $r \in \Z^+$ so that $3^r > 3t_1$ and
let $m = 3^r + v - t_2 > 0$.
Then $$I^m(t_1) = t_1 + 3^r + v - t_2 = 3^r + 3v$$
and
$$I^m(t_2) = t_2 + 3^r + v - t_2 = 3^r + v.$$
Since $3^r > 3v$, it follows that $I^m(t_1)$ and $I^m(t_2)$
have the same non-zero digits in base $3$.  Hence,
$S_{e,3}I^{m}(t_1) = S_{e,3}I^{m}(t_2)$.
Thus the number of elements in $S_{e,3}(I^m(T))$ is less 
than the number of elements in $T$.  Since the elements of 
$S_{e,3}(I^m(T))$ are all congruent modulo $2$, by assumption, 
$S_{e,3}(I^m(T))$ is (e,3)-good.  Hence, by
Lemma~\ref{Flemma}, $T$ is (e,3)-good, as desired.
\end{proof}

Now we turn to the base $4$ case.

\begin{proof}
[Proof of Theorem \ref{clb4}.]
If $e$ is odd and 
$T$ is $(e,4)$-good, then it follows from Lemma~\ref{base3} that
the elements of $T$ are congruent modulo $3$.

For the converse, let $T$ be a finite set of positive integers
and if $e$ is odd, assume that all of the elements of $T$
are congruent modulo $3$.  As in the proof of Theorem~\ref{clb3},
if $T$ is empty or has exactly one element, it is $(e,4)$-good.
Fix $N > 1$.
If $e$ is even, assume that any set of fewer than $N$ elements is
$(e,4)$-good and if $e$ is odd, assume that any set of fewer than $N$
elements all
of which are congruent modulo $3$ is
$(e,4)$-good.  Suppose $T$ has exactly $N$ elements.  
To complete the proof, it suffices to prove
that there exists a function
$F$ as in Lemma~\ref{Flemma} such that for some $t_1 > t_2 \in T$,
$F(t_1) = F(t_2)$.

Suppose that $e$ is even and let $t_1 > t_2 \in T$.
We will show that there exists an $n \in \Z^+$ such that 
$S_{e,4}I^{n}(t_1) \equiv S_{e,4}I^{n}(t_2)\ (\mod 3)$. 
Let $g:\{0,1,2\} \rightarrow \{0,1,2\}$ be defined by
$g(x) \equiv x^e - (x+1)^e \ (\mod 3)$ and notice that since
$e$ is even, $g$ is surjective.
Choose $c \in \{0,1,2\}$ such that 
$g(c) \equiv S_{e,4}(t_1 - t_2 - 1) \ (\mod 3)$.  
(If $t_1 - t_2 - 1 = 0$, choose $c$ so that $g(c) \equiv 0\ (\mod 3)$.)
Fix $s \in \Z^+$ so that $4^{s-1} > t_1$ and
let $n = (c+1)4^s - t_2 - 1$.
Then $$I^{n}(t_2) = (c+1)4^s - 1 = c4^s + \sum_{i=0}^{s-1} 3\cdot 4^i$$
and so $S_{e,4}I^{n}(t_2) \equiv c^e\ (\mod 3)$.
On the other hand, 
$$I^{n}(t_1) = (c+1)4^s + t_1 - t_2 - 1$$ and so
$S_{e,4}I^{n}(t_1) \equiv (c+1)^e + S_{e,4}(t_1 - t_2 - 1)
\equiv  c^e \equiv S_{e,4}I^{n}(t_2)\ (\mod 3)$.
By Lemma~\ref{Flemma}, to prove that $T$ is $(e,4)$-good, it suffices
to prove that $S_{e,4}I^{n}(T)$ is $(e,4)$-good.  Hence we may assume
without loss of generality that $T$ contains $t_1 > t_2 \in T$
with $t_1 \equiv t_2\ (\mod 3)$.

So now letting $e$ be any value (even or odd), let $t_1 > t_2 \in T$
with $t_1 \equiv t_2\ (\mod 3)$.  (By assumption, this is always the case
if $e$ is odd.)
Then, paralleling the proof of~\ref{clb3},
let $v = \frac{t_1-t_2}{3} \in \Z$. 
Fix $r \in \Z^+$ so that $4^r > 4t_1$ and
let $m = 4^r + v - t_2 > 0$.
Then $I^m(t_1) = 4^r + 4v$ and $I^m(t_2) = 4^r + v$.
It follows that $I^m(t_1)$ and $I^m(t_2)$
have the same non-zero digits and so
$S_{e,4}I^{m}(t_1) = S_{e,4}I^{m}(t_2)$.
\end{proof}

Finally, for the base $5$ case, the proof is essentially
the same, so we indicate only the primary steps.

\begin{proof}
[Proof of Theorem \ref{clb5}.]
It is easy to see that if $T$ is $(e,5)$-good, 
then the elements of $T$ are congruent modulo $2$.

Again, using induction, let $T$ have exactly $N$ elements,
all of which are congruent modulo $2$.  Let $t_1 > t_2 \in T$.

First suppose that $u = t_1 - t_2\equiv 2\ (\mod 4)$.
Let $g:\{0,1,2,3\} \rightarrow \{0,1,2,3\}$ be defined by
$g(x) \equiv x^e - (x+1)^e\ (\mod 4)$ 
and note that $g(0) = -1$ and $g(1) = 1$.
Choose $c \in \{0,1,2,3\}$ such that
$g(c) \equiv S_{e,5}(u - 1)\ (\mod 4)$.
Fix $s \in \Z^+$ so that $5^{s-1} > t_1$ and
let $n = (c+1)5^s - t_2 - 1$.
Then $S_{e,5}I^{n}(t_2) \equiv c^e\ (\mod 4)$ and
$S_{e,5}I^{n}(t_1) \equiv (c+1)^e + S_{e,5}(u-1)
\equiv S_{e,5}I^{n}(t_2)\ (\mod 4)$.
Hence we may assume
without loss of generality that $T$ contains $t_1 > t_2 \in T$
with $t_1 \equiv t_2\ (\mod 4)$.

Assuming, then that $t_1 \equiv t_2\ (\mod 4)$, let
$v = \frac{t_1-t_2}{4} \in \Z$.
Fix $r \in \Z^+$ so that $5^r > 5t_1$ and
let $m = 5^r + v - t_2 > 0$.
Then $I^m(t_1) = 5^r + 5v$ and $I^m(t_2) = 5^r + v$, implying that
they have the same non-zero digits.  Hence
$S_{e,5}I^{m}(t_1) = S_{e,5}I^{m}(t_2)$, as desired.
\end{proof}


\begin{thebibliography}{1}

\bibitem{es}
E.~El-Sedy and S.~Siksek,
\newblock On happy numbers,
\newblock {\em Rocky Mountain J. Math.}, {\bf 30} (2000),
565--570.

\bibitem{gt4}
H.~G. Grundman and E.~A. Teeple,
\newblock Iterated sums of fifth powers of digits,
\newblock {\em Rocky Mountain J. Math.}, to appear.

\bibitem{gt3}
H.~G. Grundman and E.~A. Teeple,
\newblock Sequences of consecutive happy numbers,
\newblock {\em Rocky Mountain J. Math.}, to appear.

\bibitem{gt1}
H.~G. Grundman and E.~A. Teeple,
\newblock Generalized happy numbers,
\newblock {\em Fibonacci Quart.}, {\bf 39} (2001), 462--466.

\bibitem{gt2}
H.~G. Grundman and E.~A. Teeple,
\newblock Heights of happy numbers and cubic happy numbers,
\newblock {\em Fibonacci Quart.}, {\bf 41} (2003), 301--306.

\bibitem{guy}
R.~Guy,
\newblock {\em Unsolved Problems in Number Theory},
\newblock Springer-Verlag,  2nd~ed., 1994.

\bibitem{sloane2006}
N.~J.~A. Sloane,
\newblock {\em The On-Line Encyclopedia of Integer Sequences},
\newblock 2006,
\newblock \href{http://www.research.att.com/~njas/sequences/}{\tt http://www.research.att.com/\char'176njas/sequences/}.

\end{thebibliography}


\bigskip
\hrule
\bigskip

\noindent 2000 {\it Mathematics Subject Classification}:
Primary 11A63.

\noindent \emph{Keywords: } happy numbers, consecutive, base.

\bigskip
\hrule
\bigskip

\noindent (Concerned with sequence
\seqnum{A000108}.)

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received June 29 2006;
revised version received  January 8 2007.
Published in {\it Journal of Integer Sequences}, January 8 2007.

\bigskip
\hrule
\bigskip

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


\end{document}

                                                                                


