Semihappy Numbers

H. G. Grundman Department of Mathematics Bryn Mawr College Bryn Mawr, PA 19010 USA

                     hgrundma@brynmawr.edu

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 > 0. Define S_{e} : ℤ^{+} → ℤ^{+} by

S_{e} (∑_{i=0}^{n} a_{i}10^{i}) = ∑_{i=0}^{n} a_{i}^{e_{i}}.

If S_{e}^{k}(a) = 1 for some k ∈ ℤ^{+}, then we say that a is a semihappy number or, more precisely, an e-semihappy number. In this paper, we determine fixed points and cycles of the functions S_{e} 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.

1 Introduction

Let S_{2} : ℤ^{+} → ℤ^{+} denote the function that takes a positive integer to the sum of the squares of its decimal digits. A happy number is a positive integer a such that S_{2}^{m}(a) = 1 for some m ≥ 0. (See sequence \underline{A007770} in Sloane [5].) In [2], happy numbers were generalized as follows: For e ≥ 2, b ≥ 2, and 0 ≤ a_{i} < b, define S_{e,b} : ℤ^{+} → ℤ^{+} by

S_{e,b} (∑_{i=0}^{n} a_{i}b^{i}) = ∑_{i=0}^{n} a_{i}^{e}.

If S_{e,b}^{m}(a) = 1 for some m ≥ 0, then a is an 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} ∈ {1, 2}, for i > 0. Define S_{e} : ℤ^{+} → ℤ^{+} by

S_{e} (∑_{i=0}^{n} a_{i}10^{i}) = ∑_{i=0}^{n} a_{i}^{e_{i}}.

If S_{e}^{k}(a) = 1 for some k ∈ ℤ^{+}, then we say that a is a semihappy number or, more precisely, an e-semihappy number.

Although the functions S_{e} 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_{e} 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.

2 Fixed Points, Cycles, and Heights

Theorem 1 gives the fixed points and cycles of the function S_{e}, for each e. The proof follows standard techniques. We first show that for each a ≥ 100, S_{e}(a) < a and so, for each a ∈ ℤ^{+}, there exists some m ∈ ℤ^{+} such that S_{e}^{m}(a) < 100. The cycles can then be determined by applying powers of S_{e} to each a < 100. Note that the second part of the theorem generalizes the well known result for the function used in defining happy numbers.

Theorem 1. Given e with e_{1} = 1, the function S_{e} has two fixed points, 1 and 89, and one nontrivial cycle, 9 ↦ 81 ↦ 9.

Given e with e_{1} = 2, the function S_{e} has one fixed point, 1, and one nontrivial cycle, 4 ↦ 16 ↦ 37 ↦ 58 ↦ 89 ↦ 145 ↦ 42 ↦ 20 ↦ 4.

Proof. Let a ≥ 100. Then we have a = ∑_{i=0}^{n} a_{i}10^{i}, with n ≥ 2, a_{n} ≠ 0, and 0 ≤ a_{i} ≤ 9 for 0 ≤ i < n. So

a − S_{e}(a) = ∑_{i=0}^{n} a_{i}10^{i} − ∑_{i=0}^{n} a_{i}^{e_{i}}
= ∑ a_{i}(10^{i} − a_{i}^{e_{i}−1})
≥ ∑ a_{i}(10^{i} − a_{i})
≥ a_{n}(10^{n} − a_{n}) + a_{0}(1 − a_{0})
≥ 99 − 72 > 0

So if a ≥ 100, a > S_{e}(a). Since the equality is strict, this implies that for each a ∈ ℤ^{+}, there exists some m ∈ ℤ^{+} such that S_{e}^{m}(a) < 100. A direct calculation for each a < 100 completes the proof.

Generalizing the definition of the height of a happy number, the e-height of an esemihappy number, a, is the number of iterations of S_{e} needed to reach 1:

h_{e}(a) = min{k ∈ ℤ^{+} | S_{e}^{k}(a) = 1}.

For example, for e with e_{1} = 1, S_{e}(92) = 13, S_{e}^{2}(92) = 10, and S_{e}^{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 1.

Table 1: Least e-semihappy numbers of given e-heights

Height e_{1} = 1 e_{1} = 2
0  1  1
1  10  10
2  13  13
3  43  23
4  76  19
5  288 or 398  7

The global height of a semihappy number, a, is

h(a) = min_{e}{k ∈ ℤ^{+} | S_{e}^{k}(a) = 1}.

In Table 2, 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.

Table 2: Least numbers of given global heights

Height least number  e
0  1  (2, ...)
1  10  (2, ...)
2  13  (2, ...)
3  23  (2, 2, ...)
4  19  (2, 2, ...)
5  7  (2, 2, ...)
6  212  (2, 2, 1...)
7  7199  (2, 2, 1, 2...)
8  8 \underbrace{99 … 99}_{86} 799 e = (2, 2, 1, \underbrace{2, 2 …, 2, 2}_{87}, …)

Theorem 2. The least semihappy number of height 8 is

A = 8 \underbrace{99 … 99}_{86} 799.

Proof. Suppose that a ≤ A and has height 8. Since a ≤ A, either a has exactly 89 9’s and at most one digit less than 8, so that S_{e}(a) ≤ 7^{2} + 89 · 9^{2} = 7258, or a has at most 90 digits and fewer than 89 9’s, so that S_{e}(a) ≤ 2 · 8^{2} + 88 · 9^{2} = 7256. Since a has height 8, S_{e}(a) has height 7 and thus S_{e}(a) ≥ 7199. But if 7200 ≤ S_{e}(a) ≤ 7258, then S_{e}^{2}(a) ≤ 7^{2}+2^{2}+5^{2}+9^{2} = 159 < 212, and so S_{e}^{2}(a) is not of height 6, which is a contradiction.

Thus S_{e}(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 …, 2, 2}_{87}, …).

3 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 [1]. (See [3], [4] and [6] 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 [3].

Let I : ℤ^{+} → ℤ^{+} be defined by I(n) = n + 1. For a fixed e, we say that a set D of integers is e-good, if there exist n, k ∈ ℤ^{+} such that for each d ∈ D, S_{e}^{k}(d + n) = 1.

Lemma 3. Fix e and a finite set D. Let F:ℤ^{+} → ℤ^{+} be the composition of a finite sequence of S_{e} and I. If the set F (D) is e-good, then D is e-good.

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_{e}(D) is e-good, then D is e-good.

Suppose that S_{e}(D) is e-good. Then there exist n′ and k′ such that for all s ∈ S_{e}(D), S_{e}^{k′}(s + n′) = 1. Let

n = \underbrace{11 … 11}_{n′} 00 … 00,

where the number of zeros is the number of digits of the largest element of D. Then S_{e}(n) = n′ and for each d ∈ D, S_{e}(d + n) = S_{e}(d) + n′. Let k = k′ + 1. Then for all d ∈ D,

S_{e}^{k}(d + n) = S_{e}^{k′}(S_{e}(d + n)) = S_{e}^{k′}(S_{e}(d) + n′) = 1.

So D is e-good.

Theorem 4. For each e, there exist arbitrarily long sequences of consecutive e-semihappy numbers.

Proof. Given m ∈ ℤ^{+}, set D = {1, 2, …, m}. We prove that D is e-good for any e.

First, suppose e_{1} = 1. By Theorem 1, there exists some k ∈ ℤ^{+} such that for all d ∈ D, S_{e}^{k}(d) ∈ {1, 9, 81, 89}. Let F = S_{e}^{18}I^{91}. Then F (1) = F (9) = 1, F (81) = 9, and F (89) = 81. So

F^{3}S_{e}^{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 1, there exists some k ∈ ℤ^{+} such that for all d ∈ D, S_{e}^{k}(d) ∈ {1, 4, 16, 20, 37, 42, 58, 89, 145}. Let F = S_{e}^{7}I^{22}. Then

F^{5}S_{e}^{k}(D) = F^{5}({1, 4, 16, 20, 37, 42, 58, 89, 145})
= F^{4}({1, 4, 20, 42, 58, 145})
= F^{3}({1, 20, 42, 145})
= F^{2}({1, 20, 145})
= F ({1, 145})
= {1}

In either case, by Lemma 3, D is e-good. Thus there exist n and k ∈ ℤ^{+} such that for each d ∈ D, S_{e}^{k}(d + n) = 1 and, therefore, n + 1, n + 2, …, n + m are all e-semihappy. So for any m ∈ ℤ^{+}, there exists a sequence of m consecutive e-semihappy numbers.

References

[1] E. El-Sedy and S. Siksek, On happy numbers, Rocky Mountain J. Math., 30 (2000), 565–570.

[2] H. G. Grundman and E. A. Teeple, Generalized happy numbers, Fibonacci Quart., 39 (2001), 462–466.

[3] H. G. Grundman and E. A. Teeple, Sequences of consecutive happy numbers, Rocky Mountain J. Math., 37 (2007), 1905–1916.

[4] H. Pan, On consecutive happy numbers, J. Number Theory, 128 (2008), 1646–1654.

[5] N. J. A. Sloane, The On-Line Encyclopedia of Integer Sequences, 2010,

   http://www.research.att.com/~njas/sequences/.

[6] X. Zhou and T. Cai, On e-power b-happy numbers, Rocky Mountain J. Math., 39 (2009), 2073–2081.

2010 Mathematics Subject Classification: Primary 11A63. Keywords: happy numbers, semihappy numbers.

(Concerned with sequence \underline{A007770}.)

Received April 7 2010; revised version received April 12 2010. Published in Journal of Integer Sequences, April 15 2010.

Return to Journal of Integer Sequences home page.