<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\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://www.research.att.com/cgi-bin/access.cgi/as/~njas/sequences/eisA.cgi?Anum=#1}{\underline{#1}}}

\def\Z{{\mathbb Z}}
\newcommand{\e}{{\mathbf e}}
\newcommand{\se}{{\mbox{\scriptsize$\mathbf e$}}}

\begin{document}

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

\begin{center}
\vskip 1cm{\LARGE\bf Semihappy Numbers
}
\vskip 1cm
\large
H. G. Grundman \\
Department of Mathematics \\
Bryn Mawr College \\
Bryn Mawr, PA 19010 \\
USA\\
\href{mailto:hgrundma@brynmawr.edu}{\tt hgrundma@brynmawr.edu}\\
\end{center}

\vskip .2 in

\begin{abstract}
We generalize the concept of happy number as follows.
Let $\e = (e_0,e_1,....)$ be a sequence with $e_0 = 2$
and $e_i = \{1,2\}$ for $i &gt; 0$.
Define $S_{\se}:{\Z}^+ \rightarrow {\Z}^+$ by
\[S_{\se}\left(\sum_{i=0}^n a_i 10^i \right) = \sum_{i=0}^n a_i^{e_i}.\]
If $S_{\se}^k(a) = 1$ for some $k \in {\Z}^+$, then we say that $a$ is
a {\em semihappy number} or, more precisely, an {\em $\e$-semihappy number}.
In this paper, we determine fixed points and cycles of the functions
$S_{\se}$ and discuss heights of semihappy numbers.
We also prove that for each choice of $\e$,
there exist arbitrarily long finite sequences of consecutive
$\e$-semihappy numbers.
\end{abstract}

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{defin}[theorem]{Definition}
\newenvironment{definition}{\begin{defin}\normalfont\quad}{\end{defin}}
\newtheorem{examp}[theorem]{Example}
\newenvironment{example}{\begin{examp}\normalfont\quad}{\end{examp}}
\newtheorem{rema}[theorem]{Remark}
\newenvironment{remark}{\begin{rema}\normalfont\quad}{\end{rema}}

\section{Introduction}

Let $S_2:{\Z}^+ \rightarrow {\Z}^+$ denote the function that takes a
positive integer to the sum of the squares of its decimal digits.
A {\em happy number} is a positive integer $a$
such that $S_2^m(a) = 1$ for some $m \geq 0$.
(See sequence \seqnum{A007770} in Sloane \cite{sloane2010}.)
In~\cite{gt1}, happy
numbers were generalized as follows:
For $e \geq 2$, $b \geq 2$, and $0 \leq a_i &lt; b$, define 
$S_{e,b}: {\Z}^+ \rightarrow {\Z}^+$ 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$, then $a$ is
an {\em $e$-power $b$-happy number.}

Here we generalize the concept of happy numbers in 
a different direction.  Rather than summing the squares of the
digits, we take a sum, squaring only some of the digits, according to
a preset pattern.  More precisely,
let $\e = (e_0,e_1,....)$ be a sequence with $e_0 = 2$
and $e_i \in \{1,2\}$, for $i &gt; 0$.
Define $S_{\se}:{\Z}^+ \rightarrow {\Z}^+$ by
\[S_{\se}\left(\sum_{i=0}^n a_i 10^i \right) = \sum_{i=0}^n a_i^{e_i}.\]
If $S_{\se}^k(a) = 1$ for some $k \in {\Z}^+$, then we say that $a$ is
a {\em semihappy number} or, more precisely, an {\em $\e$-semihappy number}.

Although the functions $S_{\se}$ depend heavily on the value $\e$,
we can still prove a number of results about semihappy numbers in general.

In Section 2, we find all fixed points and cycles for the functions
$S_{\se}$ and the smallest semihappy numbers of 
various heights.  Then in Section 3, we prove that for each choice of
$\e$, there exist arbitrarily long finite sequences of 
${\e}$-semihappy numbers.


\section{Fixed Points, Cycles, and Heights}

Theorem~\ref{cycles} gives the fixed points and cycles of the 
function $S_{\se}$, for each $\e$.  The proof follows
standard techniques.  We first show that for each $a \geq 100$,
$S_{\se}(a) &lt; a$ and so,
for each $a \in \Z^+$, there exists some $m \in \Z^+$ such that
$S_{\se}^m(a) &lt; 100$.  The cycles can then be determined by 
applying powers of $S_{\se}$ to each $a &lt; 100$.  
Note that the second part of the theorem 
generalizes the well known result for the function used in
defining happy numbers.

\begin{theorem}
\label{cycles}
Given $\e$ with $e_1 = 1$, the function $S_{\se}$ has two fixed
points, $1$ and $89$, and one nontrivial cycle, $9\mapsto 81\mapsto 9$.

Given $\e$ with $e_1 = 2$, the function $S_{\se}$ has one fixed point,
$1$, and one nontrivial cycle,
$4\mapsto 16\mapsto 37 \mapsto 58 \mapsto 89 \mapsto 145 \mapsto 42
\mapsto 20 \mapsto 4$.
\end{theorem}


\begin{proof}
Let $a \geq 100$.  Then we have 
$a = \sum_{i=0}^n a_i 10^i$, with $n\geq 2$, $a_n\neq 0$, and 
$0\leq a_i\leq 9$ for $0\leq i &lt; n$.
So
\begin{eqnarray*}
a - S_{\se}(a) &amp; = &amp;
\sum_{i=0}^n a_i 10^i - \sum_{i=0}^n a_i^{e_i}\\
&amp; = &amp; \sum a_i(10^i - a_i^{e_i-1})\\
&amp; \geq &amp; \sum a_i(10^i - a_i)\\
&amp; \geq &amp; a_n(10^n - a_n) + a_0(1-a_0)\\
&amp; \geq &amp; 99 - 72 &gt; 0
\end{eqnarray*}
So if $a \geq 100$, $a &gt; S_{\se}(a)$.
Since the equality is strict, this implies
that for each $a \in \Z^+$, there exists some $m \in \Z^+$ such that
$S_{\se}^m(a) &lt; 100$.  A direct calculation for each $a&lt;100$
completes the proof.
\end{proof}

Generalizing the definition of the height of a happy number, 
the {\em $\e$-height} of an $\e$-semihappy number, $a$, is the number of
iterations of $S_{\se}$ needed to reach 1:
\[h_{\se}(a) = \min \{k\in \Z^+ \ | \ S_{\se}^k(a) = 1\}.\]
For example,
for $\e$ with $e_1 = 1$, $S_{\se}(92) = 13$,
$S_{\se}^2(92) = 10$, and $S_{\se}^3(92) = 1$.
So the $\e$-height of $92$ is $3$.

Using a simple computer search, we determined the least
$\e$-semihappy numbers of given heights for each possible $\e$.
The results are given in Table~\ref{eheights}.

\begin{table}[htb]
\caption{Least $\e$-semihappy numbers of given $\e$-heights}
\label{eheights}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Height &amp; $e_1 = 1$ &amp; $e_1 = 2$ \\ \hline \hline
0 &amp; 1 &amp;1 \\
1 &amp; 10 &amp; 10\\
2 &amp; 13 &amp; 13\\
3 &amp; 43 &amp; 23 \\
4 &amp; 76 &amp; 19 \\
5 &amp; 288 or 398 &amp; 7 \\
\hline
\end{tabular}
\end{center}
\end{table}

The {\em global height} of a semihappy number, $a$, is
\[h(a) = \min_{\se} \{k\in \Z^+ \ | \ S_{\se}^k(a) = 1\}.\]
In Table~\ref{heights}, we list the smallest numbers of each global height 
less than nine, along with the value of $\e$ at which the
minimum is achieved.  (In the table,
trailing dots in the definition of $\e$ indicates that every
value of $\e$ matching what is given up to that point 
works.)  The results 
through height seven are easily verified with a computer
search.  We prove the result for height eight below.


\begin{table}[htb]
\label{heights}
\caption{Least numbers of given global heights}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Height &amp; least number &amp; $\e$ \\ \hline \hline
0 &amp; 1 &amp; $(2,...)$ \\
1 &amp; 10 &amp;  $(2,...)$\\
2 &amp; 13 &amp;  $(2,...)$\\
3 &amp; 23 &amp;  $(2,2,...)$ \\
4 &amp; 19 &amp;  $(2,2,...)$ \\
5 &amp; 7 &amp;  $(2,2,...)$ \\
6 &amp; 212 &amp;  $(2,2,1...)$ \\
7 &amp; 7199 &amp;  $(2,2,1,2...)$ \\
8 &amp; $8\underbrace{99 \ldots 99}_{86}799$ 
&amp; $\e = (2,2,1,\underbrace{2,2\dots,2,2}_{87},\dots)$\\
\hline
\end{tabular}
\end{center}
\end{table}

\begin{theorem}
The least semihappy number of height 8 is
\[A = 8\underbrace{99 \ldots 99}_{86}799.\]
\end{theorem}


\begin{proof}
Suppose that $a \leq A$ and has height 8.  
Since $a \leq A$, either $a$ has exactly 89 9's and at most one digit
less than 8, so that
$S_{\se}(a) \leq 7^2 + 89\cdot 9^2 = 7258,$ or
$a$ has at most 90 digits and fewer than 89 9's, 
so that $S_{\se}(a) \leq 2\cdot 8^2 + 88\cdot 9^2 = 7256$.
Since $a$ has height 8, $S_{\se}(a)$ has height 7 and thus
$S_{\se}(a) \geq 7199$.  But if
$7200\leq S_{\se}(a)\leq 7258$, then $S^2_{\se}(a)\leq 7^2 + 2^2 + 5^2 + 9^2
= 159 &lt; 212$, and so $S^2_{\se}(a)$ is not of height 6, which is 
a contradiction.

Thus $S_{\se}(a) = 7199$ and $\e = (2,2,1,2...)$.  Since at least one
digit is not being squared, a direct calculation shows that 
$a$ must have exactly
88 9's, one 8, and one 7, the 7 being the only digit that is not being
squared.  The smallest possible such number is $A$ with 
$\e = (2,2,1,\underbrace{2,2\dots,2,2}_{87},\dots)$.
\end{proof}

\section{Consecutive Semihappy Numbers}

In this section we prove that for each $\e$, there exist
arbitrarily long finite sequences of
consecutive $\e$-semihappy numbers.  This result was proved
in the special case of happy numbers
by El-Sedy and Siksek~\cite{es}.  (See~\cite{gt3},~\cite{pan} and~\cite{zc}
for alternative proofs
and proofs of similar results for generalized happy numbers.)
Before stating and proving the main theorem, we need some
definitions and lemmas, which parallel closely ones found in~\cite{gt3}.

Let $I:{\Z}^+ \rightarrow {\Z}^+$ be defined by $I(n) = n+1$.
For a fixed $\e$, we say that
a set $D$ of integers is {\em $\e$-good,} 
if there exist $n$, $k\in {\Z}^+$
such that for each $d\in D$, $S^k_{\se}(d+n) = 1$.


\begin{lemma}
\label{Flemma}
Fix $\e$ and a finite set $D$.
Let $F\!:\!{\Z}^+\rightarrow {\Z}^+$ be the composition of a 
finite sequence of $S_{\se}$ and $I$.  If the set $F(D)$ is 
$\e$-good, then $D$ is $\e$-good.
\end{lemma}

\begin{proof}
It follows immediately from the definition
of $\e$-good that 
if $I(D)$ is $\e$-good, then $D$ is $\e$-good.  Using induction on the
length of the sequence of functions, it suffices to show that if
$S_{\se}(D)$ is $\e$-good, then $D$ is $\e$-good.

Suppose that $S_{\se}(D)$ is
$\e$-good.  Then there exist $n^\prime$
and $k^\prime$ such that for all $s \in S_{\se}(D)$,
$S_{\se}^{k^\prime}(s + n^\prime) = 1$.
Let \[n = \underbrace{11\ldots11}_{n^\prime}00\ldots00,\]
where the number of zeros is the number of
digits of the largest element of $D$.  Then $S_{\se}(n) = n^\prime$ and
for each $d \in D$, $S_{\se}(d+n) = S_{\se}(d) + n^\prime$.
Let $k = k^\prime + 1$.
Then for all $d\in D$,
\[S_{\se}^{k}(d+n) = S_{\se}^{k^\prime}(S_{\se}(d+n)) =
S_{\se}^{k^\prime}(S_{\se}(d) + n^\prime) = 1. \]
So $D$ is $\e$-good. 
\end{proof}

\begin{theorem}
\label{main}
For each $\e$, there exist
arbitrarily long sequences of
consecutive $\e$-semihappy numbers.
\end{theorem}

\begin{proof}
Given $m\in \Z^+$, set $D = \{1, 2,\dots, m\}$.
We prove that $D$ is $\e$-good for any $\e$.

First, suppose $e_1 = 1$.  By Theorem~\ref{cycles}, there exists some
$k\in \Z^+$ such that for all $d\in D$,
$S_{\se}^k(d) \in \{1,9,81,89\}$.  Let $F = S_{\se}^{18}I^{91}$.
Then $F(1) = F(9) = 1$, $F(81) = 9$, and $F(89) = 81$.  So
\[
F^3S_{\se}^k(D) = F^3(\{1,9,81,89\}) = F^2(\{1,9,81\}) = F(\{1,9\}) = \{1\}.
\]

Now, suppose $e_1 = 2$.  Again, by Theorem~\ref{cycles}, there exists some
$k\in \Z^+$ such that for all $d\in D$,
$S_{\se}^k(d) \in \{1,4,16,20,37,42,58,89,145\}$.  
Let $F = S_{\se}^{7}I^{22}$.  Then
\begin{eqnarray*}
F^{5}S_{\se}^k(D)
&amp; = &amp;
F^5(\{1,4,16,20,37,42,58,89,145\})\\
&amp; = &amp;
F^4(\{1,4,20,42,58,145\})\\
&amp; = &amp;
F^3(\{1,20,42,145\})\\
&amp; = &amp;
F^2(\{1,20,145\})\\
&amp; = &amp;
F(\{1,145\})\\
&amp; = &amp;
\{1\}
\end{eqnarray*}

In either case, by Lemma~\ref{Flemma}, $D$ is $\e$-good.  Thus
there exist $n$ and $k\in {\Z}^+$ 
such that for each $d\in D$, $S^k_{\se}(d+n) = 1$ and,
therefore, $n+1, n+2, \dots, n+m$ are all $\e$-semihappy. 
So for any $m\in \Z^+$, there exists a sequence of $m$ 
consecutive $\e$-semihappy numbers.
\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{gt1}
H.~G. Grundman and E.~A. Teeple,
\newblock Generalized happy numbers,
\newblock {\em Fibonacci Quart.}, {\bf 39} (2001), 462--466.

\bibitem{gt3}
H.~G. Grundman and E.~A. Teeple,
\newblock Sequences of consecutive happy numbers,
\newblock {\em Rocky Mountain J. Math.},
\newblock {\bf 37} (2007), 1905--1916.

\bibitem{pan}
H.~Pan, 
\newblock On consecutive happy numbers, 
\newblock {\em J. Number Theory}, 
\newblock {\bf 128} (2008), 1646--1654.


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

\bibitem{zc}
X.~Zhou and T.~Cai,
\newblock On $e$-power $b$-happy numbers,
\newblock {\em Rocky Mountain J. Math.},
\newblock {\bf 39} (2009), 2073--2081.

\end{thebibliography}





\bigskip
\hrule
\bigskip

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

\noindent \emph{Keywords: } 
happy numbers, semihappy numbers.

\bigskip
\hrule
\bigskip

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

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received  April 7 2010;
revised version received  April 12 2010.
Published in {\it Journal of Integer Sequences}, April 15 2010.

\bigskip
\hrule
\bigskip

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


\end{document}

                                                                                


</pre></body></html>