\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}{-.1in} \setlength{\textheight}{8.4in} \newcommand{\seqnum}[1]{\href{https://oeis.org/#1}{\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} \newtheorem{case}{Case}[theorem] \renewcommand\thecase{\arabic{case}} \newtheorem{subcase}{\quad Subcase}[case] \newtheorem{subsubcase}{\quad \quad Subcase}[subcase] \begin{center} \vskip 1cm{\LARGE\bf On Some Sequences Related to \\ \vskip .1in Sums of Powers } \vskip 1cm \large Robert Dawson\\ Dept.~of Mathematics and Computing Science\\ Saint Mary's University\\ Halifax, NS B3L 3C3\\ Canada \\ \href{mailto:rdawson@cs.stmarys.ca}{\tt rdawson@cs.stmarys.ca} \end{center} \vskip .2 in \begin{abstract} Automorphic numbers (in a specified base) have the property that the expansion of $n^2$ ends in that of $n$; Fairbairn characterized these numbers for all bases in 1969. Here we consider some related sequences: those $n$ for which the sum of the first $n$ natural numbers, squares, or cubes ends in $n$. For sums of natural numbers, these are Trigg's ``trimorphic" numbers; for sums of squares, Pickover's ``square pyramorphic'' numbers. We characterize the trimorphic numbers for all bases, and the other two for base 10 and prime powers. We also solve a related problem due to Pickover. \end{abstract} \section{Introduction} In decimal notation, the number 76 appears as the final digit string of its square, 5776. Such numbers are called {\em automorphic}, {\em circular}, or {\em cyclic} (the inconsistent nomenclature was already noted by Kraitchik \cite[pp.~77--78]{K}, in 1942.) The sequence of decimal automorphic numbers appears in the {\it On-line Encyclopedia of Integer Sequences} as sequence \seqnum{A003226}. Such numbers were characterized, in all bases, by Fairbairn \cite{F} in 1969. He showed that if $B$ has $k$ distinct prime factors, then there are $2^k - 2$ $d$-digit automorphic numbers (base $B$), possibly including leading zeros, as well as the trivial $0$ and $1$. In particular, if $B$ is a prime power, there are no nontrivial automorphic numbers. When we wish a string of digits to be interpreted as a number in base $B$, we express the base (as a decimal number) as a subscript. Thus, $10010_2$, $200_3$, and $16_{12}$ all represent 18. On one occasion we use $A$ for the digit after 9. It is clear that a number that ends its own square must end its own cube and all higher powers, too. On the other hand, there are numbers (such as 49) which end their own cubes and not their own squares. This justifies the 1974 introduction by Hunter \cite{H} of the separate term {\em trimorphic} for such numbers (\seqnum{A033819}.) However, these numbers have also been called ``perissomorphic'' \cite{T13}, while ``trimorphic'' has also been used \cite{A,T13,T17} for a number $n$ that ends the decimal representation of the $n$th triangular number. To avoid ambiguity, given any function $F:\mathbb{N}\rightarrow\mathbb{N}$, we say that the number $n$ is {\em $F$-morphic} in base $B$ if the digit string for $F(n)$ terminates in that for $n$. Thus, the decimal automorphic numbers are $n^2$-morphic (base 10). We state the following obvious lemmas for completeness. \begin{lemma}\label{fmorph} A $d$-digit number is $F$-morphic (base B) if and only if $$B^{d} \mid (F(n)-n).$$ \end{lemma} \begin{lemma}\label{digits} If $d>1$, then $B^{d-1} < n < B^d$. \end{lemma} In this paper we consider the sequences of such numbers generated in this way by the following four functions: \begin{itemize} \item the {\em triangular numbers} $T(n) := \sum_{k=0}^n k = n(n+1)/2$\quad (\seqnum{A000217}); \item the {\em pyramidal numbers} $P(n) := \sum_{k=0}^n k^2 = n(n+1)(2n+1)/6$\quad (\seqnum{A000330}); \item the {\em hyperpyramidal numbers} $H(n) := \sum_{i=0}^n i^3 = (T(n))^2$ \quad(\seqnum{A000537}); and \item Pickover's {\em cake numbers} $K(n) := (n^2+n+2)/2 = T(n)+1$\quad (\seqnum{A000124}). \end{itemize} In Section \ref{Tsec} we characterize the $T$-morphic numbers to any base $B$. If $B$ is a prime power, only 0 and 1 are $T$-morphic; otherwise infinitely many numbers have the property. In Section \ref{Psec}, we characterize $P$-morphic numbers for prime power bases and for base 10. In the latter case, we will see that the sequence of $P$-morphic numbers is the union of twelve simpler sequences. In Section \ref{Hsec} we characterize $H$-morphic numbers, again for prime power bases and base 10, and show that the sequence of decimal $H$-morphic numbers is the union of ten simpler sequences. Finally, we settle a conjecture of Pickover by showing that there are no decimal $K$-morphic numbers. \section{$T$-morphic numbers}\label{Tsec} If the digit string (base $B$) representing $T(n)$ ends in the digit string representing $n$, we call $n$ $T$-{\em morphic}. For instance, $T(25) = 3255$, so 25 is $T$-morphic in base 10. The sequence of decimal $T$-morphic numbers is \seqnum{A067270}; a comment in this OEIS entry credits David Wilson with proving that every $T$-morphic number is automorphic. We show below that, conversely, for odd bases all automorphic numbers are $T$-morphic. Trigg \cite{T17} listed all the decimal $T$-morphic numbers with five or fewer digits: 1, 5, 25, 625, 9376, and 90625. He also listed the first five base-6 $T$-morphic numbers, and noted (without proof, but correctly) that there are no $T$-morphic numbers in other bases less than 10. (This follows from Wilson's observation, combined with Fairbairn's proof that there are no automorphic numbers to a prime-power base.) Let $T(n) = n(n+1)/2$ be the $n$th triangular number. To characterize the $T$-morphic numbers, we follow the approach used by Fairbairn \cite{F} for his study of automorphic numbers. \begin{lemma}\label{TLemma} Suppose that $n$ is a $d$-digit $T$-morphic number (base $B$). Then: \renewcommand{\labelenumi}{{\normalfont(\roman{enumi})}} \begin{enumerate} \item $2 B^d \mid{n(n-1)}$; \item if $B$ is odd, $B^d \mid{n(n-1)}$; \item if $p\mid B$, it follows that $p$ divides exactly one of $n$ and $n-1$. \end{enumerate} \end{lemma} \begin{proposition}For a prime or prime power base, the only $T$-morphic numbers are $0$ and $1$.\end{proposition} \begin{proof} For a prime power base $B=p^r$, Lemma \ref{TLemma}(i) implies that $2p^{dr} \mid \; n(n-1).$ As $n$ and $n-1$ have no common factors, $B^d = p^{dr}$ divides either $n$ or $n-1$. But, for $0 \leq n < B^d$, $B^d \mid n$ implies $n=0$, and $B^d \mid n-1$ implies $n=1$. \end{proof} \begin{proposition} If $B$ is odd and has $k$ distinct prime factors, there are $2^k$ $d$-digit $T$-morphic numbers (base $B$) if we permit leading zeros. If we do not permit leading zeros, there are at most $2^k$ one-digit $T$-morphic numbers and, for $d>1$, at most $2^k-2$ $d$-digit $T$-morphic numbers. \end{proposition} \begin{proof} If $B$ is odd, then as shown above, a necessary and sufficient condition for a $d$-digit number $n$ (possibly with one or more leading zeros, which must also appear in $T(n)$) to be $T$-morphic (base $B$) is that $B^d\mid n(n-1)\;$. If this is so, then by Lemma \ref{TLemma}(iii), $n$ determines a unique factorization $B^d = CD$, where $C\mid n$ and $D\mid(n-1)$ are coprime. There are $2^k$ such factorizations. The improper factorization $C=1$, $D=B^d$ gives $B^d\mid n-1$; this has no solutions with $B^{d-1} \leq n < B^d$, except when $d=1$ and $n=1$. For $d>1$ this is still a solution if we permit leading zeros. The other improper factorization, with $C=B^d$ and $D=1$, gives $B^d\mid n$, which has the one-digit solution $n=0$. There are $2^k -2$ proper ordered factorizations; given any such factorization, the Chinese remainder theorem says that the system \begin{align}\label{CD1} C&\mid n\\\ D&\mid n-1\notag \end{align} has a unique solution $n \in [0,B^d)$. If this solution is less than $B^{d-1}$, then $n$ (without leading zeros) is not a $d$-digit number, although $n$ is still $T$-morphic. \end{proof} \begin{example} Let $B=15$. For $d=1$, we have the special solutions $0$ and $1$ from improper factorizations. The proper factorization $C=3$, $D=5$ gives the system of congruences $3\mid n$, $5\mid (n-1)$, with solution $n=6$. $$ 6 = 6_{15};\quad T(6) = 21 = 16_{15}.$$ The proper factorization $C=5$, $D=3$ gives the system of congruences $5\mid n$, $3\mid n-1$, with solution $n=10$ (which we represent in base 15 with the digit `$A$'.) $$ 10 = A_{15}; \quad T(10) = 55 = 3A_{15}.$$ For $d=2$, we consider proper factorizations of $15^2$ into coprime factors. The proper factorization $C=9$, $D=25$ gives the system $9\mid n$, $25\mid n-1$ with solution $n=126$. $$126 = 86_{15};\quad T(126) = 16002 = 2586_{15}.$$ The proper factorization $C=25$, $D=9$ gives the system $25\mid n$, $9\mid n-1$ with solution $n=100$. $$100 = 6A_{15}; \quad T(100) = 5050 = 176A_{15}.$$ ($T(100)$ is, of course, the value apocryphally computed by the youthful Gau{\ss}.) \end{example} In base 10, Lemma \ref{TLemma}(i) yields $2^{d+1} \mid n(n-1)$ and $ 5^d \mid n(n-1)$. By Lemma \ref{TLemma}(iii) we have either \begin{align}\label{SysT1} 2^{d+1}&\mid n\\ 5^{d}&\mid n-1\notag \end{align} or \begin{align}\label{SysT2} 2^{d+1}&\mid n-1\\ 5^{d}&\mid n.\notag \end{align} For any $d$, the systems (\ref{SysT1}) and (\ref{SysT2}) each have a unique solution in the interval $[0,2\cdot10^d)$. We call these $g(d)$ and $g'(d)$ respectively; they are $T$-morphic if and only if they are less than $10^d$. The first few solutions are $$(g(d)) = (16, 176, 1376, {\bf 9376}, 109376, 1109376, {\bf 7109376}, 187109376,\ldots);$$ $$(g'(d)) = ({\bf 5, 25, 625}, 10625, {\bf 90625, 890625}, 12890625, {\bf12890625},\ldots).$$ The $T$-morphic numbers are shown in boldface; we note that, for any given $g$, exactly one of $\{g(d),g'(d)\}$ appears to be $T$-morphic. In fact this is the case: adding the congruences (\ref{SysT1},\ref{SysT2}), we get \begin{align}\label{SysT3} 2^{d+1}&\mid g(d)+g'(d)-1,\\ 5^{d}&\mid g(d)+g'(d)-1,\notag \end{align} whence $g(d)+g'(d) \equiv 1$ (mod $2\cdot10^d$). As $0 < g(d),g'(d) < 2\cdot10^d$, we must have $$g(d) + g'(d) = 2\cdot10^d + 1.$$ By examining the last digits, we rule out the solution $\{10^d,10^d+1\}$. \begin{proposition}\label{decitri} The decimal numbers $0$, $1$, and $5$ are $T$-morphic; and for every $d>1$ there is at most one decimal $T$-morphic number with $d$ digits.\hfill~$\square$ \end{proposition} \begin{remark}\label{ShortRem}If we do not allow leading zeros, there may be no $d$-digit decimal $T$-morphic number. This occurs first when $d=12$: $g(12)=81787109376 < 10^{11}$ while $g'(12)=1918212890625 > 10^{12}$. If, e.g., $g(d)<10^{d-1}$, then $g(d)$ is equal to $g(d-1)$, and is $T$-morphic. In fact, more is true; $g(d)$ is $T$-morphic even when written with a leading zero: $$T(g(12)) = 3344565630081787109376.$$ In fact, as may be seen, $g(11)=g(12)=g(13).$ If $g(d) > 10^d$, then $g(d)$ is $T$-morphic if and only if $g(d) = g(d+1)$. We conclude that every $T$-morphic number with $d$ digits appears as $g(d)$ or $g'(d)$. \end{remark} Proposition \ref{decitri} generalizes straightforwardly to bases with more prime factors. \begin{proposition} If $B$ is even with exactly $k$ distinct prime factors, for every $d>1$ there are at most $2^{k-1}-1$ $T$-morphic numbers (base B) with $d$ digits.\hfill$\square$ \end{proposition} If we consider strings that differ only by leading zeros to be distinct, we have shown that there are infinitely many $T$-morphic numbers. If we do not, we must show that there does not exist some $g(d)$ such that, for all $d'>d$, $g(d')$ is obtained by prefixing $d'-d$ leading zeros to $g(d)$. But if this were so, we would have $g(d)^2 = g(d')^2 \equiv g(k) \equiv g(d)$ (mod $B^k$) for all $k$. Hence $g(d)^2 = g(d)$, so that $g(d)$ must be either 0 or 1. We conclude that even if we do not consider numbers that differ only by a string of leading zeros to be distinct, there must be infinitely many $T$-morphic numbers. However, there appears to be no simple pattern determining which of $g(d)$ and $g'(d)$ is $T$-morphic. The first thousand terms of the sequence \seqnum{A067270} show no obvious sign of periodicity, asymptotic dominance by last digit 5 or 6, or other structure. \section{$P$-morphic numbers}\label{Psec} The $n^{th}$ {\em square pyramidal number} $P(n)$ (\seqnum{A000330}) is defined to be $\sum_{i=0}^n i^2 = n(n+1)(2n+1)/6$. This sequence is so called because $P(n)$ counts the number of spheres in a pyramidal pile on an $n\times n$ square base. Pickover \cite[p.160]{P} and the notes on \seqnum{A093534} call the decimal $P$-morphic numbers {\em square pyramorphic.} We have $$P(n)-n = \frac{n(n+1)(2n+1)}{6} -n = \frac{2n^3+3n^2-5n}{6} = \frac{n(n-1)(2n+5)}{6},$$ and so $n$ is $P$-morphic if and only if \begin{equation}\label{PyrD} 6B^d \mid n(n-1)(2n+5). \end{equation} The following lemma gathers useful and easily-proved facts about the right-hand side of (\ref{PyrD}). \begin{lemma}\label{PyrLem} Of the three numbers $n$, $n-1$, and $2n+5$: \renewcommand{\labelenumi}{{\normalfont(\roman{enumi})}} \begin{enumerate} \item $2n+5$ is always odd, and exactly one of the other two is even; \item exactly one is divisible by $3$; \item only $n$ and $2n+5$ can both be divisible by $5$, and they cannot both be divisible by $25$; \item only $n-1$ and $2n+5$ can both be divisible by $7$, and they cannot both be divisible by $49$; \item no two have a common prime factor greater than $7$. \end{enumerate} \end{lemma} We first consider the numbers which are $P$-morphic to prime power bases. \begin{proposition}\label{2Pow}The only $P$-morphic numbers (base $2^r$) are the trivial cases 0 and 1. \end{proposition} \begin{proof}As observed above, only one of the first two factors of $n(n-1)(2n+5)$ can be even, and $2n+5$ must be odd. So if (\ref{PyrD}) is satisfied, $2\cdot(2^r)^d$ must divide $n$ or $n-1$, both of which are, by Lemma \ref{digits}, less than $(2^r)^d$. This is only possible in the trivial cases where $n = 0$ or $1$. \end{proof} \begin{proposition}\label{3Pow} The only $P$-morphic numbers (base $3^r$) are the trivial cases $0$ and $1$, and the special case $a=2$ when $r=1$. \end{proposition} \begin{proof} For a number $n$ to be $P$-morphic with $d$ digits base $3^r$, it is necessary that one of the following hold: \begin{align}\label{SysP1} 3\cdot3^{rd}&\mid n\\ 3^{rd} &>n; \notag \end{align} \begin{align}\label{SysP2} 3\cdot3^{rd}&\mid n-1\\ 3^{rd} &>n; \notag \end{align} or \begin{align}\label{SysP3} 3\cdot3^{rd}&\mid 2n+5\\ 3^{rd} &>n. \notag \end{align} Neither the system (\ref{SysP1}) nor the system (\ref{SysP2}) have any solution except for the trivial $n=0$ and $n=1$ respectively. The system (\ref{SysP3}) requires that $3^{rd} < 5$, whence $r=d=1$. Thus no number is $P$-morphic base $3^r$ except for 0 and 1 (any $r$) and 2 (base $3$ only.) \end{proof} \begin{proposition}\label{5Pow} The only $d$-digit $P$-morphic numbers (base $5^r$) are the trivial cases $0$ and $1$, and, for $rd>1$, the numbers $c\cdot 5^{rd-1}$ for $c \in \{1,2,3,4\}$, and the numbers $c\cdot 5^{rd-1} + (5^{rd-1}-5)/2$ for $c \in \{0,1,2,3,4\}$. \end{proposition} \begin{proof} $5^{rd}$ cannot (nontrivially) divide any of $n$, $n-1$, or $2n+5$, for the same reasons as above; but if $rd>1$, then, by Lemma \ref{PyrLem}(iii), one of $n$ and $2n+5$ can be divisible by $5^{rd-1}$, the other by 5. (In the case $r=d=1$, $5^1$ cannot be factorized.) In general, we have, for $rd>1$, the following two sets of solutions: \begin{itemize} \item $5^{rd-1}\mid n$, whence $5 \mid 2n+5$; the constraint $n < 5^{rd}$ gives us solutions $p_5(c,rd) := c \cdot 5^{rd-1}, c \in \{1,2,3,4\}$;\\ \item $5^{rd-1} \mid 2n+5$, whence $5 \mid n$; the constraint $n < 5^{rd}$ gives us solutions $p'_5(c,rd) := c \cdot 5^{rd-1} + (5^{rd-1}-5)/2, c \in \{0,1,2,3,4\}$. \end{itemize} By Lemma \ref{PyrLem}(i,ii), 2 and 3 each divide one of $n$, $(n-1)$, and $(2n+5)$; so (\ref{PyrD}) follows. \end{proof} \begin{corollary} \leavevmode \begin{itemize} \item There are, in base $5$, two $P$-morphic numbers with one digit, four with two digits, and eight with $d$ digits for any $d>2$. \item There are, in base $25$, six $P$-morphic numbers with one digit and nine with $d$ digits for any $d>1$. \item For $r>2$ there are, in base $5^r$, eleven $P$-morphic numbers with one digit and nine with $d$ digits for any $d>1$. \end{itemize} \end{corollary} \begin{proof} There are no one-digit base-5 $P$-morphic numbers except for 0 and 1, because $5^{1\cdot 1}$ does not factor. There are only four two-digit base-5 $P$-morphic numbers, because $(5^{2-1}-5)=0$, so that $p_5(c,2) = p'_5(c,2)$ for $c \in \{1,2,3,4\}$, while $p'_5(0,2) = 0$. For $r>2$ the numbers $p_5(c,d)$ and $p'_5(c,d)$ are all distinct for $c \in \{1,2,3,4\}$, but $p'_5(0,d) = p_5(2,d-1)$ (and has $d-1$ digits.) In base 25, one-digit numbers have $rd=2$; again, $p_5(c,2) = p'_5(c,2)$ for $c \in \{1,2,3,4\}$, and there are also the trivial solutions 0 and 1. For $d>2$, $p'_5(0,2d) = (5^{2d-1}-5)/2 > 25^{d-1}$, so that $p'_5(0,2d)$ is a $d$-digit number. There are thus nine distinct $d$-digit solutions. For $k>3$, we always have $rd>2$, so all five $p'_5(c,r)$ and four $p_5(c,r)$ are distinct from each other and from the trivial solutions 0 and 1. For $d>1$ the solutions are exactly the five $p'_5(c,rd)$ and four $p_5(c,rd)$.\end{proof} \begin{example} The sequence of base-$5$ $P$-morphic numbers begins $$(0_5, 1_5, 10_5, 20_5, 30_5, 40_5, 100_5, 120_5, 200_5, 220_5, 300_5, 320_5, 400_5, 420_5,\ldots)$$ \end{example} The situation for powers of 7 is very similar. \begin{proposition}\label{7Pow} The only $P$-morphic numbers (base $7^r$) are the trivial cases $0$ and $1$, and, for $rd>1$, the numbers $c\cdot 7^{rd-1} + 1$ for $c \in \{1, 2, 3, 4, 5, 6\}$, and $c\cdot 7^{rd-1} + (7^{rd-1}-5)/2 + 1$ for $c \in \{0, 1, 2, 3, 4, 5, 6\}$. \end{proposition} \begin{proof} This proceeds like the proof above, noting that, of the three factors, only $n-1$ and $2n+5$ can be simultaneously divisible by 7.\end{proof} \begin{corollary} \leavevmode \begin{itemize} \item There are, in base $7$, two $P$-morphic numbers with one digit, six with two digits, and twelve with $d$ digits for any $d>2$. \item There are, in base $49$, eight $P$-morphic numbers with one digit and, for $d>1$, thirteen with $d$ digits. \item For $r>2$ there are, in base $7^r$, fifteen $P$-morphic numbers with one digit. For any $d>1$ there are thirteen with $d$ digits. $\quad\square$ \end{itemize} \end{corollary} \begin{proposition}\label{pPow} If $p$ is a prime greater than $7$, the only $P$-morphic numbers (base $p^r$) are the trivial cases $0$ and $1$, and the numbers $(p^{rd}-5)/2$. \end{proposition} \begin{proof} No power of a prime $p>7$ can divide two of the three factors of the right-hand side of (\ref{PyrD}) nontrivially; it follows that we must have one of the following: \begin{align}\label{SysP4} p^{rd}&\mid n\\ p^{rd} &>n; \notag \end{align} \begin{align}\label{SysP5} p^{rd}& \mid n-1\\ p^{rd} &>n; \notag \end{align} or \begin{align}\label{SysP6} p^{rd}& \mid 2n+5\\ p^{rd} &>n. \notag \end{align} The first two systems give 0 and 1 respectively. In the third system, for $m \geq 3$ we have $mp^{rd} > 3n > 2n+5$, while $2p^{rd}$ is even. We conclude that $p^{rd} = 2n+5$, whence the conclusion follows. \end{proof} \begin{corollary} For any base which is a power of a prime greater than $7$, there are three one-digit $P$-morphic numbers and one $P$-morphic number of every other length. \hfill$\square$ \end{corollary} \begin{example} The base-11 $P$-morphic numbers are $$(0, 1, 3, 53_{11}, 553_{11}, 5553_{11}, 55553_{11},\ldots, \frac{11^n-5}{2},\ldots).$$ \end{example} The fact that there are four ``special" prime numbers in the theory of $P$-morphic numbers adds significantly to the complication when the base has more than one prime factor. We shall consider the decimal case in detail; the same techniques can be applied to other composite bases. We define the following sequences: \begin{itemize} \item $a(d):= 4\cdot10^{d-1}$; \item $b(d)$ is the unique solution in $[0,2\cdot10^{d})$ of the system $2^{d+1} \mid b(d)$, $5^d \mid b(d)-1$; \item $c(d)$ is the unique solution in $[0,4\cdot10^{d-1})$ of the system $2^{d+1} \mid c(d)$, $5^{d-1} \mid 2c(d)+5$; \item $c'(d)$ is the unique solution in $[0,4\cdot10^{d-1})$ of the system $2^{d+1} \mid c'(d)-1$, $5^{d-1} \mid 2c'(d)+5$; \item $c''(d)$ is the unique solution in $[0,4\cdot10^{d-1})$ of the system $2^{d+1} \mid c''(d)-1$, $5^{d-1} \mid c''$. \end{itemize} \begin{theorem} Every decimal $P$-morphic number belongs to one of the following twelve sequences: \begin{enumerate} \item $(a(d):d\geq 2)$; \item $(2a(d):d \geq 2)$; \item $(b(d): d \geq 1)$; \item $(c(d): d \geq 2)$; \item $(c(d)+a(d): d \geq 2)$; \item $(c(d)+2a(d): d \geq 2, c(d)+2a(d)<10^d)$; \item $(c'(d): d \geq 2)$; \item $(c'(d)+a(d): d \geq 2)$; \item $(c'(d)+2a(d): d \geq 2, c(d)+2a(d)<10^d)$; \item $(c''(d): d \geq 2)$; \item $(c''(d)+a(d): d \geq 2)$; \item $(c''(d)+2a(d): d \geq 2, c(d)+2a(d)<10^d)$. \end{enumerate} \end{theorem} \begin{proof} For $n$ to be $P$-morphic to the base 10, we must have $$6\cdot10^d = 2^{d+1}\cdot3\cdot5^{d} \mid (P(n)-n).$$ By Lemma \ref{PyrLem}(ii), the factor of 3 is always present. By Lemma \ref{PyrLem}(i), $2^{d+1}$ must divide $n$ or $n-1$. We consider these two cases separately. \begin{case}[$2^{d+1} \mid n$] When $d=1$, 5 may divide either $n-1$ or both of $n$ and $2n+5$; neither of these yields a solution in $[0,10)$. For $d>1$, either $5^d \mid n-1$, or $5^{d-1}$ divides one of $\{n, 2n+5\}$, and 5 divides the other. \begin{subcase}[$2^{d+1} \mid n$, $5^{d-1} \mid n$, and $d\geq 2$]\label{SCA} We cannot have $5^d \mid n$ (except in the trivial case $n=0$), as this would require $2\cdot10^d \; \mid n < 10^d\;$. For $d>1$, however, we have $5 \mid (2n+5)$, so that $5^d \mid P(n)$. The system \begin{align}\label{SysA} 2^{d+1}& \mid n\\ 5^{d-1}& \mid n\notag \end{align} has solutions $$a(d) := 4\cdot10^{d-1} \mbox{ and } 2a(d) = 8\cdot10^{d-1},$$ both always less than $10^d$. The first few values of the sequences are $$(a(d):d\geq2) = (-,40,400,4000,\ldots) \mbox { and } (2a(d):d\geq2) = (-,80,800,8000,\ldots)$$ respectively; note that $a(1)=4$ and $2a(1)=8$ are not $P$-morphic. \end{subcase} \begin{subcase}[$2^{d+1} \mid n$, $5^{d-1} \mid n-1$, and $d\geq 2$] In this case, no other factor of $P(n)-n$ can be divisible by 5, so we must have $5^d \mid n-1$. The system \begin{align}\label{SysB} 2^{d+1}& \mid n\\ 5^{d}& \mid n-1\notag \end{align} has a unique solution $b(d) \in [0,2\cdot10^d)$. The first few values in the sequence are $$(b(d):d\geq 1) \in (16,176,1376, {\bf 9376}, 109376, 1109376, {\bf 7109376},187109376,\ldots)\;;$$ values less than $10^d$, shown in bold, are $P$-morphic. \end{subcase} \begin{subcase}[$2^{d+1} \mid n$, $5^{d-1} \mid 2n+5$, and $d\geq 2$] If $d\geq 2$ we have $5 \mid n$, whence $5^d \mid P(n)-n$; and it suffices to solve the system \begin{align}\label{SysC} 2^{d+1}& \mid n\\ 5^{d-1}& \mid 2n+5.\notag \end{align} This system has a unique solution $c(d) \in [0,4\cdot10^{d-1})$ and an arithmetic sequence of solutions $c(d) + ka(d)$. Of these, $c(d)$ always has $d$ or fewer digits; $c(d)+a(d)$ always has exactly $d$ digits; $c(d)+2a(d)$ has $d$ or $d+1$ digits; and the others always have more than $d$ digits. The first few terms in the sequence $(c(d))$ are $$(c(d):d\geq 1) = (0, 0, 160, 2560, 26560, 226560, \mathit{0226560}, 12226560,\ldots).$$ The value $c(6) = c(7) = 226560$ may be considered as $P$-morphic with or without a leading zero (see remark \ref{ShortRem}.) \end{subcase} \end{case} \begin{case}[$2^{d+1} \mid n-1$] \begin{subcase}[$2^{d+1} \mid n-1$ and $5^{d-1} \mid n-1$] In this case, $5$ cannot divide $n$ or $2n+5$, so we must have $5^d \mid n-1$. But then $2\cdot10^d \mid n-1 < 10^d$, giving only the trivial solution $n=1$. \end{subcase} \begin{subcase}[$2^{d+1} \mid n-1$ and $5^{d-1} \mid 2n+5$] The system \begin{align}\label{SysC1} 2^{d+1}& \mid n-1\\ 5^{d-1}& \mid 2n+5\notag \end{align} yields solutions in $[0,4\cdot10^{d+1})$ of the form $$(c'(d):d\geq 1) = (1, 25, 385, 1185, 37185, 317185, 1117185, 25117185,\ldots)$$ along with $c'(d)+a(d)$ and sometimes $c'(d)+2a(d)$. \end{subcase} \begin{subcase}[$2^{d+1} \mid n-1$ and $5^{d-1} \mid n$] The system \begin{align}\label{SysC2} 2^{d+1}& \mid n-1\\ 5^{d-1}& \mid n\notag \end{align} has solutions in $[0,4 \cdot10^{d-1})$ of the form $$(c''(d):d\geq 1) \in (5, 25, 225, 2625, 10625, \mathit{090625}, \mathit{0890625}, 12890625,\ldots),$$ along with $c''(d)+a(d)$ and sometimes $c''(d)+2a(d)$. \end{subcase} \end{case} \end{proof} \begin{remark}\label{Dig} For $d>3$, if a $d$-digit $P$-morphic number $n$ ends in \begin{itemize} \item {\bf 00}: then $n = a(d)$ or $2a(d)$; \item {\bf 76}: then $n = b(k)$ for $k \geq d-1$; \item {\bf 60}: then $n = c(k)$ for $k \geq d$, or $n=c(d)+a(d)$, or $n=c(k)+2a(k)$ for $k \in \{d-1,d\}$; \item {\bf 85}: then $n = c'(k)$ for $k \geq d$, or $n=c'(d)+a(d)$, or $n=c'(k)+2a(k)$ for $k \in \{d-1,d\}$; \item {\bf 25}: then $n = c''(k)$ for $k \geq d$, or $n=c''(d)+a(d)$, or $n=c''(k)+2a(k)$ for $k \in \{d-1,d\}$; \end{itemize} and these are the only two-digit strings that a $P$-morphic number larger than 100 can end in. \end{remark} \begin{remark} It is possible for $b(d)$, $c(d)$, $c'(d)$, or $c''(d)$ to be less than $10^{d-1}$. In such a case, the number is always $P$-morphic; and if, e.g., $$10^{n-1}< b(d)<10^n \mbox{ for } n 10^9 \mbox{ but }P(b(9))=1902532768569804241787019376.$$ If $b(d)$ is $P$-morphic and greater than $10^d$, then $b(d)$ must equal its successor in the same sequence. If $c(d)+2a(d)$ is $P$-morphic and greater than $10^d$, then $c(d)+2a(d)=c(d+1)$; analogous statements hold for $c'(d)+2a(d)$ and for $c''(d)+2a(d)$. We conclude that every $P$-morphic number with $d$ digits appears {\em in its proper place} in one of these sequences. The only other identities between elements of these sequences are \begin{align*} a(1)&=2a(1)=c(1)=c(1)+a(1)=c(1)+2a(1)=c(2)=0; \\ c'(1)&=c'(1)+a(1)=c'(1)+2a(1) = 1; \\ c''(1)&=c''(1)+a(1)=c''(1)+2a(1) = 5; \\ c'(2)&=c''(2) =25. \end{align*} \end{remark} \begin{remark}\label{PList} The sequence of decimal $P$-morphic numbers appears in the OEIS as \seqnum{A093534}. The initial terms are $(0$, $1$, $5$, $25$, $40$, $65$, $80$, $160$, $225$, $385$, $400$, $560$, $625$, $785$, $800$, $960$, $1185$, $2560$, $2625$, $4000$, $5185$, $6285$,$6625$, $8000$, $9185$, $9376,\ldots)$. \end{remark} \begin{corollary} There are three single-digit $P$-morphic decimal numbers and four two-digit $P$-morphic decimal numbers. For any $d>2$, there are at least eight and at most eleven distinct $P$-morphic decimal numbers with $d$ digits. \end{corollary} \begin{proof} For $d=1$ and $d=2$ this is true by inspection. For $d>2$ the sequences $a(d)$, $2a(d)$, $c(d)+a(d)$, $c'(d)+a(d)$, and $c''(d)+a(d)$ always yield distinct $P$-morphic numbers of $d$ digits; and, additionally, at least one of $\{c(d), c(d)+2a(d)\}$, of $\{c'(d), c'(d)+2a(d)\}$, and of $\{c''(d), c''(d)+2a(d)\}$ must have exactly $d$ digits. This minimum is attained (see below): however, at most five of $$\{c(d), c(d)+2a(d), c'(d), c'(d)+2a(d), c''(d), c''(d)+2a(d)\}$$ can be $d$-digit numbers. We note that $$10^{d-1} < c(d), c(d)+2a(d) <10^d \Leftrightarrow 10^{d-1}1$.\end{remark} \begin{proposition}\label{hyperodd} \renewcommand{\labelenumi}{{\normalfont(\roman{enumi})}} \leavevmode \begin{enumerate} \item The only base-$7$ $H$-morphic numbers are $0$, $1$, and $2$. For $r>1$ the only $H$-morphic numbers in base $7^r$ are $0$ and $1$. \item If an odd prime $p$ is congruent to $3$, $5$, or $6$ (mod $7$), the only $H$-morphic numbers in base $p^r$ are $0$ and $1$. \item If an odd prime $p$ is congruent to $1$, $2$, or $4$ (mod $7$) there is at least one and at most two $d$-digit $H$-morphic numbers in base $p^r$. \end{enumerate} \end{proposition} \begin{proof} For $p>2$, at most one of $n$, $n-1$, or $h(n)$ can be divisible by $p^r$. But the system $p^{rd} \mid n$, $0 \leq n < p^{rd}$ has no solution except for $n=0$; and $p^{rd} \mid n-1$, $0\leq n < p^{rd}$ has no solution except for $n=1$. For any other $H$-morphic numbers to exist, we must have $p^{kd} \mid h(n)$. We can use the quadratic formula to solve $h(n) \equiv 0 $ mod $p^d$ if and only if $-7$ is a quadratic residue mod $p$; that is, by the quadratic reciprocity theorem, when $p \equiv 1$, $2$, or $4$ (mod 7). We also have the special case $p=7$ where $h(2)\equiv h'(2) \equiv 0$ (mod 7) but $h(n)$ has no zeros mod 49. Thus, 0, 1, and 2 are the only H-morphic numbers in base 7, and 2 is not H-morphic base $7^r$ for $r>1$. Suppose that $p \equiv 1$, $2$, or $4$ (mod 7). Then $h(n)$ has two zeros, $n$ and $n'$, in $\mathbb{Z}/p\mathbb{Z}$; and for each $d$, Hensel's lemma gives liftings to $\hat{n},\hat{n'} \in \mathbb{Q}_p$. These project to $n(d) := \pi_d(\hat{n})$ and $n'(d) := \pi_d(\hat{n'})$ in $[0,p^{rd})$, such that $p^{rd}$ divides both $h(n(d))$ and $h(n'(d)).$ It follows that $n(d)$ and $n'(d)$ are $H$-morphic, although they do not necessarily have $d$ digits; and that no other $d$-digit numbers are $H$-morphic. By Vieta's formula, $n+n'=-3$ in $\mathbb{Z}/p\mathbb{Z}$. Thus $\hat{n}+\hat{n'} = -3$ in $\mathbb{Q}_p$, and $n(d)+n'(d) = p^{rd}-3$; it follows that at least one of $n(d)$ and $n'(d)$ is greater than $p^{r(d-1)}$, and has $d$ digits. \end{proof} \begin{example} The first odd prime base for which infinitely many $H$-morphic numbers exist is 11. The zeros of $h(n)$, mod 11, are 3 and 5. Hensel's lemma lifts these to $\hat3, \hat5 \in \mathbb{Q}_{11}$, giving base-11 $H$-morphic numbers $$(\pi_d(\hat3)) = (3,13_{11},113_{11},7113_{11},57113_{11}\ldots)$$ and $$(\pi_d(\hat5) = (5,95_{11},995_{11},3995_{11},53995_{11}\ldots).$$ \end{example} As for $T$-morphic and $P$-morphic numbers, the situation is more complicated for bases with more than one prime factor. We again restrict our attention to the decimal case. The following lemma summarizes useful facts about $H(n)-n$, all easily proved. \begin{lemma}\label{HLemma} \renewcommand{\labelenumi}{{\normalfont(\roman{enumi})}} \leavevmode \begin{enumerate} \item No two of $n$, $n-1$ and $h(n)$ can be divisible by 5. \item Only one of $n$ and $n-1$ is even; $h(n)$ is always even. \item We have $4\mid h(n)$ if and only if $4\mid n$ or $4\mid (n-1)$. \item We have $8\mid h(n)$ if and only if $8\mid (n-4)$ or $8\mid (n-1)$. \item It is not possible for $16$ to divide both $n-1$ and $h(n)$. \end{enumerate} \end{lemma} We define the following sequences, where $n_0(d)$, $n_1(d)$ are as defined in (\ref{nvals}): \begin{itemize} \item $p(d)$ is the unique solution in $[0,10^d)$ of the system $2^d\mid p(d) - n_0(d)$, $5^d \mid p(d)$; \item For $d \geq 4$, $q(d)$ is the unique solution in $[0,5\cdot10^{d-1})$ of the system $2^{d-1}\mid q(d)-1$, $5^d\mid q(d)$; \item $q'(d)$ is the unique solution in $[0,5\cdot10^{d-1})$ of the system $2^{d-1}\mid q'(d)-n_1(d)$, $5^d\mid q'(d)$; \item $r(d)$ is the unique solution in $[0,10^d)$ of the system $2^d\mid r(d)$, $5^d\mid r(d)-1$; \item $r'(d)$ is the unique solution in $[0,10^d)$ of the system $2^d\mid r'(d)-n_0(d)$, $5^d\mid r'(d)-1$; \item $s(d) := 5\cdot10^{d-1}+1$; \item $t(d)$ is the unique solution in $[0,5\cdot10^{d-1})$ of the system $2^{d-1}\mid t(d)-n_0(d)$, $5^d\mid t(d)-1$. \end{itemize} \begin{theorem}\label{HyProp} The numbers $1$, $5$, and $25$ are $H$-morphic base $10$. The other base-$10$ $H$-morphic numbers are those in the union of the following ten sequences: \begin{enumerate} \item $(p(d):d\geq 1)$; \item $(q(d):d \geq 4)$; \item $(q(d) + 5\cdot 10^{d-1}: d \geq 4)$; \item $(q'(d):d \geq 4)$; \item $(q'(d) + 5\cdot 10^{d-1}: d \geq 4)$; \item $(r(d): d \geq 2)$; \item $(r'(d): d \geq 2)$; \item $(s(d): d \geq 4)$; \item $(t(d): d\geq 5)$; \item $(t(d) + 5\cdot10^{d-1}: d \geq 5)$. \end{enumerate} \end{theorem} \begin{proof} \begin{case}[$5^d\mid n$] \begin{subcase}[$5^d\mid n$ and $n$ is even]\ By Lemma \ref{HLemma}(ii) we have $2^{d+2}\mid nh(n)$. But by Lemma \ref{digits}, $2^d\nmid n$, and by Lemma \ref{HLemma}(iv), 8 cannot divide both of $\{n,h(n)\}$. It follows that if there is such a solution, $2^d\mid h(n)$ (and, if $d\geq 2$, $4\mid n$.) By Proposition \ref{Hen2}, $n \equiv n_0(d)$ (mod $2^d$). The system \begin{align}\label{SysNE} 2^{d}&\mid n -n_0(d)\\ 5^{d}&\mid n\notag \end{align} has a unique solution $p(d) \in [0,10^d)$; $p(d)$ is always $H$-morphic, but may have fewer than $d$ digits. The first few terms of this sequence are $$(p(d):d\geq 1) = (0,\mathit{00},500,2500,62500,\mathit{062500},4062500,14062500,414062500,\ldots).$$ Italics indicate terms (other than $p(1)=0$) that are less than $10^{d-1}$. These are nonetheless $H$-morphic, and remain so if padded out to $d$ digits (or fewer) with leading zeros. \end{subcase} \begin{subcase}[$5^d\mid n$ and $n$ is odd] By Lemma \ref{HLemma}(ii) we have $2^{d+2}\mid (n-1)h(n)$. For $d=1,2$, Lemma \ref{HLemma}(iii) implies that both $n-1$ and $h(n)$ are divisible by 4; these give the solutions 5 and 25 respectively. For $d=3$ both are divisible by 8, which gives the solution 625. For $d>3$, Lemma \ref{HLemma}(iv,v) imply that one is divisible by $2^{d-1}$ and the other (necessarily) by $8$. \begin{subsubcase}[$5^d\mid n$, $2^{d-1}\mid (n-1)$, and $d\geq 4$] The system \begin{align}\label{SysH1} 2^{d-1}&\mid n-1\\ 5^{d}&\mid n\notag \end{align} has solutions $q(d) \in [0,5\cdot10^{d-1})$ and $q(d)+5\cdot10^{d-1} \in [5\cdot10^{d-1},10^d).$ The first few of these are \begin{eqnarray*} (q(d):d\geq 1) &=& (0,25,-,\mathit{0625},40625,390625, 2890625, 12890625\ldots)\\ (q(d)+5\cdot10^{d-1}: d \geq 1) &=& (5,-, 625,5625,90625, 890625,7890625, 62890625,\ldots). \end{eqnarray*} Dashes represent early terms that are not $H$-morphic and, as above, terms that need a leading zero to have the right number of digits are shown in italic. The terms $q(1)=0$, $q(1)+5=5$, $q(2)=25$, and $q(3)+500=625$ are shown above to be $H$-morphic, even though $8 \nmid h(n)$. On the other hand, $q(2)+50=75$ and $q(3)=125$ are not. \end{subsubcase} \begin{subsubcase}[$5^d\mid n$, $2^{d-1}\mid h(n)$, and $d\geq 4$] Lemma \ref{HLemma}(iv) implies that $8\mid (n-1)$, so $n$ is odd and we have \begin{align}\label{SysH2a} 2^{d-1}&\mid n-n_1(d)\\ 5^{d}&\mid n.\notag \end{align} This has two solutions in $[0,10^d)$, namely $q'(d) \in [0,5\cdot10^{d-1})$, and $q'(d) + 5\cdot10^{d-1} \in [5\cdot10^{d-1},10^d)$. The first few terms of these sequences are \begin{eqnarray*} (q'(d):d\geq 1) &= (-,25,-,\mathit{0625},15625,265625,2265625,47265625,\ldots),\\ (q'(d)+5\cdot10^{d-1}:d\geq 1) &= (5,-,625,5625,65625,765625,7265625,97265625,\ldots). \end{eqnarray*} For $d>4$, $q(d)$ ends in 0625, while $q'(d)$ ends in 5625. We conclude that $q(d) \neq q'(d)$ for $d>4$. \end{subsubcase} \end{subcase} \end{case} \begin{case}[$5^d\mid n-1$] We consider the parity of $n$. \begin{subcase}[$5^d\mid n-1$, $n$ even] In this case $2^{d+2}$ divides $nh(n)$. For $d=1$ there are no solutions. For $d \geq 2$, Lemma \ref{HLemma}(iii) requires both $n$ and $h(n)$ to be divisible by 4, while Lemma \ref{HLemma}(iv) says that one of them is not divisible by 8, so that the other must be divisible by $2^d$. \begin{subsubcase}[$5^d\mid n-1$, $2^d\mid n$, and $d \geq 2$] By Lemma \ref{HLemma}(iii), we have that $4\mid h(n)$. We obtain the system \begin{align}\label{SysH3} 2^{d}&\mid n\\ 5^{d}&\mid n-1.\notag \end{align} This has a unique solution $r(d)$ in $(0,10^d)$ which is always automorphic \cite{F}. The first few terms are $$(r(d):d\geq 1) = (-,76,376,9376,\mathit{09376},109376,7109376,87109376,\ldots).$$ Note that while 6 is a solution to (\ref{SysH3}) for $d=1$, $h(6) = 58$ is not divisible by 4, and 6 is not $H$-morphic. \end{subsubcase} \begin{subsubcase}[$5^d\mid n-1$, $2^d\mid h(n)$, and $d\geq 2$] We obtain the system \begin{align}\label{SysH3a} 2^{d}&\mid n-n_0(d)\\ 5^{d}&\mid n-1.\notag \end{align} This has unique solutions $r'(d)$ in $(0,10^d)$, the first few of which are $$(r'(d):d\geq 1) = (-,76,876,1876,71876,171876,1171876,\mathit{01171876}, \ldots).$$ Again, $r(2)=r'(2)$ but, for $d>2$, $r(d)$ ends in 376 while $r'(d)$ ends in 876; we conclude that for $d\geq3$ the sequences $(r(d))$ and $(r'(d))$ are disjoint. \end{subsubcase} \end{subcase} \begin{subcase}[$5^d\mid n-1$, $n-1$ even] In this case $2^{d+2}$ divides $(n-1)h(n)$. For $d=1$ the only solution is $n=1$. For $d=2$, by Lemma \ref{HLemma}(iii) both $n-1$ and $h(n)$ must be divisible by 4, and again $n=1$ is the only solution. For $d\geq3$, by Lemma \ref{HLemma}(iv) both $n-1$ and $h(n)$ must be divisible by 8. For $d=3$ this gives $n=1$ yet again. For $d>3$, we apply Lemma \ref{HLemma}(v) to show that one of $n-1$ and $h(n)$ is divisible by 8, the other by $2^{d-1}$. \begin{subsubcase}[$5^d\mid n-1$, $2^{d-1}\mid n-1$, and $d\geq4$] We get solutions $s(d) := 5\cdot10^{d-1}+1$: the first few values are $$(s(d):d\geq 1) =(-, -, -, 5001,50001,500001,\ldots,5\cdot10^{d-1},\ldots;.)$$ We note that $6$, $51$ and $501$ are not $H$-morphic. \end{subsubcase} \begin{subsubcase}[$5^d\mid n-1$, $2^{d-1}\mid h(n)$, and $d\geq 4$] We have \begin{align}\label{SysH3b} 2^{d-1}&\mid n-n_1(d)\notag \\ 5^{d}&\mid n-1, \end{align} which has a unique solution $t(d) \in [0,5\cdot 10^{d-1})$ and another solution in $[5\cdot 10^{d-1},10^d)$, both $H$-morphic for $d>4$. (For $d=2,3,4$ we get $t(d)=1$, and $51,501$ are not $H$-morphic.) The first few values are $$(t(d):d\geq 1) = (1,\mathit{01},\mathit{001},\mathit{0001},25001,375001,4375001,34375001,\ldots)$$ $$(t(d)+5\cdot10^{d-1}:d\geq 1) = (-,-,-,5001,75001,875001,9375001,84375001,\ldots)$$ \end{subsubcase} \end{subcase} \end{case} \end{proof} \begin{remark}The initial elements (less than 100,000) of the sequence of decimal $H$-morphic numbers are $(0, 1, 5, 25$, $76$, $376$, $500$, $625$, $876$, $1876$, $2500$, $5001$, $5625$, $9376$, $15625$ ,$25001$, $40625$, $50001$, $62500$, $65625$, $71876$, $75001$, $90625,\ldots).$ This sequence has been added to the OEIS as \seqnum{A301912}. \end{remark} \begin{remark}\label{HDig} For $d>4$, the last four digits of $p(d)$, $q(d)$, $q'(d)$, $r(d)$, $r'(d)$, $s(d)$, and $t(d)$ are $2500$, $0625$, $5625$, $9376$, $1876$, $0001$, and $5001$ respectively. Thus, for $d>4$, the $d$th terms of the ten sequences of Proposition \ref{HyProp} are distinct. We may have equalities within a sequence (e.g, $p(5)=p(6)$); and we may also have equalities between differently-indexed terms of related sequences: e.g., $q(4) = q(3)+5\cdot 10^{d-1}$. \end{remark} \begin{corollary} For $d>4$, there are at most 10 and at least 5 decimal $H$-morphic numbers with $d$ digits. \end{corollary} \begin{proof} The maximum follows from the theorem above; every $d$-digit $H$-morphic number is the $d$-th element of one of the ten subsequences. None of these subsequences ever has a $d$-th element larger than $10^d$, but some may be less than $10^d$, in which case that subsequence has no $d$-digit term. This cannot happen for $s(d)$, $q(d)+5\cdot10^d$, $q'(d)+5\cdot10^d$, or $t(d)+5\cdot10^d$. Furthermore, adding the residues from (\ref{SysH1},\ref{SysH3}), we get \begin{align}\label{SysSQ} 2^{d-1}&\mid q(d)+r(d)-1\\ 5^{d}&\mid q(d)+r(d)-1,\notag \end{align} so that $5\cdot10^{d-1}$ always divides $q(d)+r(d)-1$. As $0 < q(d),r(d)$, at least one of $\{q(d),r(d)\}$ must be greater than $25\cdot10^{d-2}$, and {\em a fortiori} must have $d$ digits. \end{proof} \begin{remark} The maximum is first attained when $d=7$, and all six of $p(7) = 4062500$, $q(7)=2890625$, $q'(7)=2265625$, $r(7)=7109376$, $r'(7)=1171876$, and $t(7)=4375001$ are greater than $10^6$. The minimum is first attained when $d=168$, and $p(168)\approx 0.2896 \times 10^{167}$, $q'(168)\approx 0.0695 \times 10^{167}$, $r(168)\approx 0.1197 \times 10^{167}$, $r'(168)\approx 0.4093 \times 10^{167}$, $t(168)\approx 0.1892 \times 10^{167}$, while $q(168) \approx 4.880 \times 10^{167}$. \end{remark} \begin{remark} Recall that $\hat0 + \hat1 = -3$ in $\mathbb{Q}_2$; and (for $d>1$), $n_0(d)+n_1(d) = -3$ in $\mathbb{Z}/2^d\mathbb{Z}$. Taking a linear combination of the residues from (\ref{SysNE},\ref{SysH1},\ref{SysH2a}), we obtain \begin{align}\label{SysHPQQ} 2^{d-1}&\mid (p(d)+q'(d)+3q(d))\\ 5^{d}&\mid (p(d)+q'(d)+3q(d)).\notag \end{align} Hence, $p(d)+q'(d)+3q(d)$ is positive and divisible by $5\cdot10^{d-1}$, so that at least one of $p(d)$, $q(d)$, and $q'(d)$ is larger than $10^{d-1}$. Thus, if for some $d>3$ there are only five $d$-digit $H$-morphic numbers, they are $$\{q(d),q(d)+5\cdot10^d,q'(d)+5\cdot10^d, s(d),t(d)+5\cdot10^d\}.$$ \end{remark} \begin{remark} Pickover \cite[page 158]{P}, defines {\em cake} numbers to be those of the form $K(n) = (n^2+n+2)/2 = T(n)+1$, the number of pieces into which a pancake may be cut with $n$ cuts. (The sequence appears in OEIS as \seqnum{A000124}, though the name is used for a different sequence.) Pickover conjectures, on the basis of a computer search, that no decimal $K$-morphic numbers exist. Applying the methods of this paper, a $d$-digit number is $K$-morphic (base $B$) if and only if $ 2B^d \mid k(n)$ where $k(n) := n^2 - n + 2$. By coincidence, the discriminant of $k$ (like that of $h$) is $-7$. The polynomial $k(n)$ is identically zero (and its derivative is always nonzero) on $\mathbb{Z}/2\mathbb{Z}$. It follows that, like $h$, $k(n)$ has zeros modulo any power of 2. Moreover, $k(n)$ has a nonliftable zero (this time, 4) in $\mathbb{Z}/7\mathbb{Z}$; has liftable zeros modulo any power of any odd prime that is congruent to 1,2 or 4 (mod 7); and has no zeros modulo any other prime power. Finally, $k(n)$ is even for every $n$, so the extra factor of 2 is automatically provided. We conclude that the sequences of $K$-morphic numbers base $2,4,8,11,16,22,23,\ldots$ are infinite, while $4$ is the unique base-7 $K$-morphic number. However, $k(n)$ has no zeros modulo any power of 5, and hence no decimal numbers are $K$-morphic. \end{remark} \section{Relations between sequences} \begin{proposition} In any base, every $T$-morphic number is automorphic; and the converse also holds in any odd base. \end{proposition} \begin{proof} This follows immediately from Fairbairn's observation \cite{F} that, in base $B$, a $d$-digit number $n$ is automorphic if and only if $B^d\mid n(n-1)$. \end{proof} \begin{proposition} For any base not divisible by $3$, all $T$-morphic numbers are $P$-morphic. \end{proposition} \begin{proof} By Lemma \ref{PyrLem}(ii), we have $3\mid n(n-1)(2n+5)$. If 3 does not divide $B$, then $$2B^d\mid n(n-1) \Rightarrow 6B^d\mid n(n-1)(2n+5),$$ and the result follows. \end{proof} When the base is divisible by 3, the result may fail. For instance, $T(4)=10=14_6$, and $P(4)=30=50_6$; so 4 is $T$-morphic but not $P$-morphic (base 6). Combining these yields a stronger result. \begin{corollary} If $B \equiv 1$ or $5$ (mod $6$), every automorphic number (base B) is $P$-morphic. \end{corollary} There is an analogous result for $H$-morphic numbers. \begin{proposition} \renewcommand{\labelenumi}{{\normalfont(\roman{enumi})}} \leavevmode \begin{enumerate} \item In any odd base, every automorphic number is $H$-morphic; \item In any even base, every automorphic number of two or more digits is $H$-morphic; \item If $4\mid B$, every automorphic number is $H$-morphic. \end{enumerate} \end{proposition} \begin{proof} We always have $4\mid n(n-1)(n^2+3n+4)$; if $B$ is odd, $$B^d\mid n(n-1)(n^2+3n+4) \Rightarrow 4B^d\mid n(n-1)(n^2+3n+4).$$ If $B$ is even, a $d$-digit automorphic number $n$ is congruent to 0 or 1 (mod $2^d$); in particular, for $d\geq 2$, $n \equiv 0$ or $1$ (mod 4). Then $4 \mid n^2+3n+4$, so again $4 B^d \mid n(n-1)(n^2+3n+4)$. A similar argument applies when $4\mid B$. \end{proof} The exception is nonvacuous; in particular, 6 is automorphic but not $H$-morphic (base 10). However, no other base-10 number has this property. Finally, combining the above with remarks \ref{Dig} and \ref{HDig}, we find that $$\seqnum{A093534} \cap \seqnum{A301912} = \seqnum{A067270}.$$ \begin{proposition} A decimal number $n$ is $T$-morphic if and only $n$ is $P$-morphic and $H$-morphic. \end{proposition} We ask whether this is true in other bases. \section{Conclusion} We have generalized the methods of Fairbairn \cite{F} and used them to characterize $T$-morphic mumbers to any base, and decimal and prime-power-base $P$- and $H$-morphic numbers. For a prime power base, the sequences obtained are fairly straightforward; for composite bases, the sequence is typically the union of several subsequences, which may themselves be more or less regular. We have also derived various inclusions between the sequences of automorphic, $T$-morphic, $P$-morphic, and $H$-morphic numbers, mostly base-dependent. \section{Acknowledgments} I would like to thank Prof.~Karl Dilcher, Prof.~Mitja Mastnak, and various editors of the OEIS and JIS for helpful comments, and the anonymous referee for many helpful suggestions. \begin{thebibliography}{99} \bibitem{A} C. Ashbacher, Trimorphic numbers revisited, {\em Topics in Recreational Mathematics} {\bf 1} (2017), 57--58. \bibitem{F} R. A. Fairbairn, More on automorphic numbers, {\em J. Recreational Math.} {\bf 2} (1969--70), 170--174. \bibitem{H} J. A. H. Hunter, Trimorphic numbers, {\em J. Recreational Math.} {\bf 7} (1974--5) 177. \bibitem{Ka} S. Katok, {\em $p$-adic Analysis Compared With Real}, Student Mathematical Library, Vol.~37, American Mathematical Society, 2007. \bibitem{Ko} N. Koblitz, {\em $p$-adic Analysis: a Short Course on Recent Work}, London Mathematical Society Lecture Note Series, Vol.~46, Cambridge University Press, 1980. \bibitem{K} M. Kraitchik, Automorphic numbers, in {\em Mathematical Recreations}, W. W. Norton, 1942. \bibitem{Pe} J. L. Pe, Comment on sequence \seqnum{A067270}, in \url{https://oeis.org}. \bibitem{P} C. Pickover, {\em The Wonder of Numbers}, Oxford University Press, 2001. \bibitem{T13} C. W. Trigg, A matter of morphic nomenclature, {\em J. Recreational Math.} {\bf 13}, (1980--1) 48--49. \bibitem{T17} C. W. Trigg, Trimorphic numbers, {\em J. Recreational Math.} {\bf 17} (1984--5) 282. \end{thebibliography} \bigskip \hrule \bigskip \noindent 2010 {\it Mathematics Subject Classification}: Primary 11A63; Secondary 00A08, 11B83. \noindent \emph{Keywords: } triangular number, trimorphic number, square pyramidal number, automorphic number, Hensel's lemma, cakemorphic number. \bigskip \hrule \bigskip \noindent (Concerned with sequence \seqnum{A000124}, \seqnum{A000217}, \seqnum{A000330}, \seqnum{A000537}, \seqnum{A003226}, \seqnum{A007185}, \seqnum{A016090}, \seqnum{A033819}, \seqnum{A067270}, \seqnum{A093534}, and \seqnum{A301912}.) \bigskip \hrule \bigskip \vspace*{+.1in} \noindent Received April 4 2018; revised versions received July 19 2018; August 1 2018; September 7 2018. Published in {\it Journal of Integer Sequences}, September 8 2018. \bigskip \hrule \bigskip \noindent Return to \htmladdnormallink{Journal of Integer Sequences home page}{http://www.cs.uwaterloo.ca/journals/JIS/}. \vskip .1in \end{document} .