## Picture-Perfect Numbers and Other Digit-Reversal Diversions

By

Joseph L. Pe

iDEN System Engineering Tools and Statistics

Motorola

21440 West Lake Cook Road

Deer Park, IL 60010

Email: ajp070@email.mot.com

ABSTRACT. This paper discusses three of the author’s digit-reversal recreations. First, picture-perfect numbers are numbers n such that the reverse of n equals the sum of the reverses of the proper divisors of n. Second, the palinpoints of an arithmetical function f are arguments at which f commutes with the reverse function. Third, the fixated points of f are arguments n such that n and reverse(n) appear in f(n). This paper also mentions several conjectures and open problems, and includes source code to start the reader on his own computer explorations.

1.      Preliminaries

In this discussion, number refers to natural number. Functions are called arithmetical if their domains are sets of integers. For simplicity, an arithmetical function in this paper will also be integer-valued and have the set of natural numbers as its domain.

2.      Perfect number recreations

In [P], I introduced generalized perfect numbers. If f is an arithmetical function, then the set of f-perfect numbers is the collection of numbers n such that f(n) equals the sum of  f(d), where d ranges over all proper divisors of n; symbolically, While this generalization adds a new perspective to the question of the existence of odd perfect numbers (odd numbers appear late in some perfect number sequences), it can also provide amusing and curious relations for f that transforms its argument’s digits in some way.

For example, let f(n) = n<>n, the concatenation of n with itself (e.g., f(123) = 123123). Then 6 is an f-perfect number (indeed, it is the only such number less than 106), and also 6 is the first perfect number. This observation yields the pretty pair of equations

6   =  1   +   2  +   3

66 =  11 +  22 +  33.

In the next section, the perfect numbers resulting from f(n) = reverse(n) (e.g., f(123) = 321) will be examined.

3. The elusive picture-perfect numbers

There is something very special about the number 10311.

Recall that a number is perfect if it equals the sum of its proper divisors (that is, its divisors excluding itself). 10311 is not perfect: its proper divisors are 1, 3, 7, 21, 491, 1473, 3437, which sum to 5433. (Since 5433 < 10311, 10311 is said to be "deficient".) Hence, the equation

10311 = 1 + 3 + 7 + 21 + 491 + 1473 + 3437

is not valid. However, reading this invalid equation backwards gives

7343 + 3741 + 194 + 12 + 7 + 3 + 1 = 11301

which, amazingly, is valid!

A number n is called picture-perfect or mirror-perfect if the reverse of n equals the sum of the reverses of the proper divisors of n. (Ignore leading 0s.) In short, n is an f-perfect number, where f(n) = reverse(n). If n is placed on one side of an equality sign and the (unevaluated) sum of the proper divisors of n are placed on the other side, then the resulting equation read backwards is valid. This explains the use of the term “picture-perfect”, since a picture of an object is a mirror image (i.e., an orientation reversal) of that object.

The first picture-perfect number is 6, but since 6 and its proper divisors are single digit, it is trivially picture-perfect. The first non-trivial picture-perfect number is 10311.

If P is a picture-perfect number, then call the expression P =b D, where D is the (unevaluated) sum of the proper divisors of P, the mirror equation of P. The symbol =b indicates that the mirror equation should be read backwards to be valid. For example, the mirror equation of 10311 is

10311 =b 1 + 3 + 7 + 21 + 491 + 1473 + 3437.

Here is Mathematica code to generate picture-perfect numbers not exceeding 108:

```f[n_]:= FromDigits[Reverse[IntegerDigits[n]]];```
`Do[If[f[n]==Apply[Plus,Map[f,Drop[Divisors[n],-1]]],Print[n]],{n,2,10^8}]`

Some versions of Mathematica will not allow the Do loop iterators to be larger than 1010, but this code using a While loop does not suffer from this drawback:

f[n_] := FromDigits[Reverse[IntegerDigits[n]]];

n = 2; (*Place initial value of n here*)

While[n<10^12, `If[f[n]==Apply[Plus,Map[f,` Drop[Divisors[n], -1]]], Print[n]]; n++]

When my computer search had turned up no new picture-perfect numbers less than 107, I was about to conjecture that 10311 was the only non-trivial such number. However, after several hours of Mathematica running on my machine, I was rewarded with the third picture perfect number: 21661371, which has mirror equation

21661371 =b 1 + 3 + 9 + 27 + 443 + 1329 + 1811 + 3987 + 5433 + 11961 +

16299 + 48897 + 802273 + 2406819 + 7220457.

The discovery of this large picture-perfect number raised hopes that the set of such numbers is infinite, and that a fourth number would be found before long. Two puzzle enthusiasts, Daniel Dockery and Mark Ganson, soon joined me in the search. Our team has a discussion forum at [Su], and membership is open to the interested public. Ganson provides free a Windows search utility he has written ([Su]).

We focused our efforts on the interval from 109 to 1010. Three weeks later, Dockery [D] found the fourth picture-perfect number. It is the ten-digit 1460501511, with mirror equation

1460501511 =b 1 + 3 + 7 + 21 + 101 + 303 + 707 + 2121 + 688591 +

2065773 + 4820137 + 14460411 + 69547691 + 208643073 + 486833837.

After this, our progress was slow, even though Ganson’s C++ search program ran at least twice faster than Mathematica. Then Jens Kruse Andersen ([An]) joined the team by announcing his discovery of a new picture-perfect number: 7980062073 with mirror equation

7980062073 =b 1 + 3 + 19 + 57 + 140001089 + 420003267 + 260020691.

Devising an efficient algorithm that caches divisor information, Andersen quickly tested all numbers up to 1010, and concluded that there are no more picture-perfect numbers in this range other than the five already mentioned above.

Currently, our team is exhaustively searching the interval from 1010 to 1012 using Andersen’s program; see [Su] for progress updates and program download.

The sequence

6, 10311, 21661371, 1460501511, 7980062073 …

is sequence A069942 in [S]. “Small” picture-perfect numbers are extremely rare pearls in the infinite ocean of numbers—there are only five picture-perfect numbers below 1010. Unexpectedly, this sparseness is somewhat relieved in the realm of large numbers, as the next section will show.

4. Andersen’s Theorem

# The even perfect numbers can be generated by Euclid’s expression 2n-1 (2n-1),

where n is a prime making (2n-1) a prime. Is there an expression yielding (not necessarily all) picture-perfect numbers?

As this paper was nearing its final draft, Andersen discovered the remarkable result that if the decimal number p = 140z10n89 is prime, then the product 57p is picture-perfect, and conversely, where z is any number (possibly none) of 0s and n is any number (possibly none) of 9s. In particular, if n has no 9s, then 57p has the form 798z62073; if n has at least one 9, then 57p has the form 798z626m373 where m has one 9 less than n. The proof of Andersen’s beautiful theorem appears towards the end of this section.

Call a prime p of the form 140z10n89 an Andersen prime, and its corresponding picture-perfect number 57p an Andersen number. Examples of Andersen prime/ number pairs are:

Andersen prime                                  Corresponding Andersen number

140001089                                          7980062073

1401099989                                        79862699373

14000109989                                      798006269373

140000109999989                              7980006269999373

The finite sequences z, n, and m (as defined above) appear in boldface. Ganson [Ga] has used Andersen’s theorem to identify 204 (mostly huge) Andersen numbers, the largest with 177 digits! This is the gargantuan 798z626m373 where z has 77 0s and m has 91 9s.

The sequence of picture-perfect numbers is an intriguing example of a sequence that appears at first to be extremely sparse—even finite—but yields several terms in the scale of the very large. An open problem is whether picture-perfect numbers such as 10311 can generate other picture-perfect numbers in the same way that Andersen’s 7980062073 does.

The proof of Andersen’s theorem now follows. The proof is due to Andersen, except for the proof of Andersen’s lemma, which I have provided.

Andersen’s lemma: if p (not necessarily prime) is of the abovementioned form 140z10n89, then reverse(57p) = 170 + reverse(p) + reverse(3p) + reverse(19p).

Assuming the validity of the lemma, suppose that p is prime. Then the proper divisors of 57p = 3 x 19 x p are

1, 3, 19, 57, p, 3p, 19p.

Adding the reverses of these proper divisors,

reverse(1) + reverse(3) + reverse(19) + reverse(57) + reverse(p) + reverse(3p) + reverse(19p)

= 170 + reverse(p) + reverse(3p) + reverse(19p)

= reverse(57p), by the lemma.

Hence, 57p is picture-perfect.

Conversely, if p is not prime, then 57 p will have more divisors, and the sum of the reversed divisors becomes larger than 170 + reverse(p) + reverse(3p) + reverse(19p) = reverse(57p). Hence, 57p is not picture-perfect. This completes the proof of Andersen’s theorem.

To establish Andersen’s lemma, consider two cases.

Case (1) n has at least one 9, hence, p = 140z10n89. In what follows, the finite sequences z, n, and m (as defined above) appear in boldface. To simplify notation, z, n, m appear as 00, 999, and 99, respectively. There is no loss of generality here: the boldfaced finite sequences can be replaced by arbitrary sequences in the appropriate manner without affecting the correctness of the proof. For example, everywhere in the proof, 00 (i.e., z) and 999 (i.e., n) can be replaced by, say, 0000 and 9999, respectively, in which case, 99 (i.e., m) must then be replaced by 999.

Thus, with p = 140001099989, simple multiplication shows that

57p = 7980062699373       reverse(57p) = 3739962600897

19p = 2660020899791       reverse(19p) = 1979980200662

3p = 420003299967           reverse(3p) = 769992300024

p = 140001099989             reverse(p) = 989990100041

(The reader should do the multiplications by hand to better understand the numerical patterns at work here. Of course, the proof can be written even more formally—and more opaquely—by stating that 57p = 798z626m373, 19p = 266z208m791, 3p = 420z32n67, and so on.)

Adding reverse(19p), reverse(3p), reverse(p), and 170 gives reverse(57p), as

required:

1979980200662

+            769992300024

989990100041

170

3739962600897

Case (2) n has no 9s, hence p = 140z1089. The proof here is handled similarly as in case (1). I only mention the final summation of reverse(19p), reverse(3p), reverse(p), and 170 to reverse(57p), using the same notation as case (1):

1960200662

+            762300024

980100041

170

3702600897

5.      Observations and Conjectures

Andersen conjectures that there are infinitely many Andersen primes, hence

infinitely many corresponding Andersen numbers.

Even before the third number 21661371 had been found, Ganson had conjectured that all picture-perfect numbers are divisible by 3. Equivalently, the digital sum of each picture-perfect number is divisible by 3. Of course, the discoveries of 21661371, 1460501511, and the many Andersen numbers, all multiples of 3, have further strengthened Ganson’s conjecture. Andersen asserts the weak result that every picture-perfect number has a prime factor less than 100 ([Su]).

Since the ancient Greeks first posed it, the conjecture that every perfect number is even has remained unanswered. Of course, in the “mirror”, things appear reversed. Ganson and I conjecture that every non-trivial picture-perfect number is odd. (6, the only trivial picture-perfect number, is even.) We also believe that 6 is the only number that is both perfect and picture-perfect.

Ganson investigated picture-perfect numbers in bases other than 10. In base 6, he found only four such numbers not exceeding 106: 28 = 446, 145 = 4016, 901 = 41016, and 1081 = 50016. For example, 145 = 4016 has mirror equation

4016 =b 456 + 56 + 16,

where the sum on the right-hand side of the equation is a base-6 sum.

Ganson observed that the digital sum of each of these numbers is divisible by 5 and conjectures that this is true for all base-6 picture-perfect numbers. (Compare this to his base-10 conjecture.)

More intriguingly, Ganson found 41 base-5 picture-perfect numbers less than 106.

Continuing the computation, Dockery found 38 more such numbers less than

2.1 x 107. All but one of these 79 base-5 numbers are divisible by 3. The single exception is 5. However, Ganson notes that for any prime p, p has only one proper divisor (i.e., 1) and has a base-p representation as 10; therefore p is trivially base-p picture-perfect. 5 is trivially base-5 picture-perfect. Thus, Ganson conjectures that every non-trivial base-5 picture-perfect number is divisible by 3.

Observe that a perfect number p is (trivially) picture-perfect in any base b larger than p. This is because p and its proper divisors have one-digit base-b representations. For example, 6 and 28 are picture-perfect in base 29.

Here is the Mathematica code Ganson used to investigate the situation for other bases:

f[n_] := FromDigits[Reverse[IntegerDigits[n, base]], base];
baseDivisors[n_, base_] := IntegerDigits[Drop[Divisors[n], -1], base];
Do[startFrom = 2;Do[If[f[n] == Apply[Plus, Map[f, Drop[Divisors[n], -1]]],
Print["base = ", base, ", n = ", n, ") ", IntegerDigits[n, base],
" divisors: ", Drop[Divisors[n], -1], " base divisors: ",
baseDivisors[n, base]]], {n, startFrom, 10000}], {base, 2, 10}]

6. Picture-Amicable pairs

Let D(n) denote the sum of f(d), where d ranges over all proper divisors of n. For an arithmetical function f, a pair of numbers a, b is called f-amicable if f(b) = D(a) and f(a) = D(b) (cf. [P]). A pair a, b is called picture-amicable (or mirror-amicable) if a, b is an f-amicable pair for f(n) = reverse(n).

I had the pleasure of discovering the picture-amicable pair 2320000, 34049. The mirror equations of a picture-amicable pair can be defined similarly as for picture-perfect numbers. This pair has mirror equations

2320000 =b 1 + 79 + 431

34049 =b 1 + 2 + 4 + 5 + 8 + 10 + 16 + 20 + 25 + 29 + 32 + 40 + 50 + 58 + 64 + 80 + 100 + 116 + 125 + 128 + 145 + 160 + 200 + 232 + 250 + 290 + 320 + 40 + 464 + 500 + 580 + 625 + 640 + 725 + 800 + 928 + 1000 + 1160 + 1250 + 1450 + 1600 + 1856 + 2000 + 2320 + 2500 + 2900 + 3200 + 3625 + 3712 + 4000 + 4640 + 5000 + 5800 + 7250 + 8000 + 9280 + 10000 + 11600 + 14500 + 16000 + 18125 + 18560 + 20000 + 23200 + 29000 + 36250 + 40000 + 46400 + 58000 + 72500 + 80000 + 92800 + 116000 + 145000 + 232000 + 290000 + 464000 + 580000 + 1160000.

The sum of the proper divisors of 34049 appear on the right side of the first equation, and the sum of the proper divisors of 2320000 appear on the right side of the second equation.

I used the following Mathematica code to generate picture-amicable pairs {n, b}:

```f[x_] := FromDigits[Reverse[IntegerDigits[x]]];```
`d[x_] := Apply[ Plus, Map[ f, Drop[Divisors[ x], -1] ] ];`
`Do[a = d[n];` `b = f[a];` ```c = d[b]; u = Last[IntegerDigits[a]];```
```If[u != 0 && n != b && c == f[n], Print[{n, b}]], {n, 2, 10^8}] ```

# My computer search has reached as far as n = 2 x 107. Using this code, I found another picture-amicable pair: 10223000, 1790947. Exercise: find the mirror equations of this pair.

Readers may enjoy finding other picture-amicable pairs or even picture-sociable chains. Since the reverse function is not injective, my program does not perform an exhaustive search (not all possible values of b are tested). Perhaps a resourceful reader will write an exhaustive search program. This might appear to be an impossible task since infinitely many b have to be inspected for a particular n. However, some variation of Cantor’s “zigzag argument” for the countability of the rational numbers can probably be used to circumvent this difficulty.

7. Palinpoints of arithmetical functions

# Let f(n) = n2. The picturesque equations

3112 = 76721

1132 = 12767

(where 113 and 12767 in the second equation are reverses of 311 and 76721, respectively, in the first equation) can be compactly expressed by the single equation

f(reverse(311)) = reverse(f(311)).

To generalize, let f be an arithmetical function. The         palinpoints of f are arguments at which f commutes with the reverse function, that is,

f(reverse(n)) = reverse(f(n)).

As usual, ignore leading 0s.

Hence, 311 is a palinpoint of f(n) = n2. (Martin Gardner in [Ga], p. 97 mentions that 132 = 169 and 312 = 961, but the notion of palinpoint for arbitrary arithmetical functions in this paper appears to be new.)

As examples, let φ(n) and σ(n) denote Euler’s totient function and the sum-of-divisors function, respectively. The sequence of palinpoints of φ(n) begins

1, 2, 3, 4, 5, 6, 7, 8, 9, 535, 767, 2110, 6188, 6991, 8299, 8816, 9928...

(A069282 in [S].) For example,

φ(9928) = 4608

φ(8299) = 8064.

The sequence of palinpoints of σ(n) begins

1, 2, 3, 4, 5, 7, 14, 41, 124, 194, 333, 421, 491, 1324, 4231…

(A069514 in [S]).

Now, let p(n) denote the n-th prime number. The first seven palinpoints of f are 1, 2, 3, 4, 5, 12, 21 (A069469 in [S]). The first four of these are trivial palinpoints since p(1), …, p(4) are one-digit numbers. In the non-trivial n = 21, for example, p(21) = 73 and p(12) = 37. However, p has no palinpoints between 21 and 106 (which is as far as I have searched). The reader may find it a challenging recreation to search for larger palinpoints of p, or prove that no others exist.

Here is Mathematica code to find palinpoints of p below 108:

`rev[n_] := FromDigits[Reverse[IntegerDigits[n]]];`
`f[n_] := Prime[n];`
```Select[Range[10^8], f[rev[#]] == rev[f[#]] &]```

Returning to f(n) = n2, the palinpoints of f not exceeding 1000 are

1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 30, 31, 100, 101, 102, 103, 110, 111, 112, 113, 120, 121, 122, 130, 200, 201, 202, 210, 211, 212, 220, 221, 300, 301, 310, 311, 1000

I attempted to submit this sequence to the Online Encyclopedia of Integer Sequences ([S])—or OEIS for short—and was surprised to find that it was already there, albeit in a different guise. In the OEIS this was characterized as the sequence of numbers n such that

(sum of digits of n)2 = sum of digits of n2

(A061909 in [S]). I conjectured that the palinpoint sequence and the OEIS sequence are identical.

Robert Israel [I] of the Department of Mathematics, University of British Columbia, provided a partial answer to this conjecture. He proved that every term of the OEIS sequence is in the palinpoint sequence. His proof now follows.

First, we need a lemma: n is in the OEIS sequence if and only if there are no carries in calculating n2. For let dk(n) be the digit of n in the 10k ‘s place, so that # where ck is the k-th carry occurring in the calculation (with c0 = 0). The sum of the digits of n2 is then # Thus, n is in the OEIS sequence if and only if there are no carries in calculating n2, in which case # 311                              113

x    311                        x    113

311                                                            339

311                                                            113

933__                          113__

# Therefore, n is a palinpoint of f(n) = n2. This completes the proof.

Is the converse true, that is to say, is every n in the palinpoint sequence also in the OEIS sequence? Equivalently, is the calculation of n2 without carries? This question is still unanswered. Israel has verified that all palinpoints not exceeding 9 x 105 are in the OEIS sequence. However, he observes that several palinpoints have carries in bases other than 10. In binary, for example, 3 = 112 is a base-2 palinpoint since it is a base-2 palindrome, but the base-2 digital sum of 32 = 9 = 10012 is not equal to the square of the base-2 digital sum of 3. Examples in other bases include:

1478 = 20002023

32 = 447

195 = 3038.

8. Fixated points of arithmetical functions

Most functions do not have any fixed points, and many have only one such point. (Recall that x is a fixed point of a function f if f(x) = x.)

The situation appears to be much rosier for "fixated points" of arithmetical functions. n is a fixated point of an arithmetical function f if, treated as strings, n and reverse(n) are both sub-strings of f(n).

The notion of fixated points can be seen as a generalization of palindronomic numbers. This is because the palindronomic numbers are exactly the fixated points of the identity function id(n) = n which do not end in the digit 0 (Those that end in 0 lose the 0 when reversed since leading 0's are ignored. E.g., 1410 is not palindronomic, but is a fixated point of id(n).)

For example, consider f(n) = 2n. Then n = 49 is a fixated point of f since f(49) = 249 = 562949953421312 in which both 49 and its reversal 94 appear as sub-strings. The sequence of fixated points of f begins

6, 10, 44, 49, 60, 67, 190, 191, 226, 252, 321, 373...

(A068588 in [S].) To take another example, let f(n) = Fibonacci(n), the n-th Fibonacci number. (Recall that f is defined recursively by f(1) = f(2) =1, f(n) = f(n-1) + f(n-2) for n > 2.) Then n = 43 is a fixated point of f since f(43) = Fibonacci(43) = 433494437 in which both 43 and its reversal 34 appear as sub-strings. The sequence of fixated points of f begins

1, 5, 41, 43, 65, 70, 85, 99, 101, 194, 214, 340, 368...

The reader can verify as an exercise that the sequence of fixated points of f(n) = n3 has first few terms

1, 4, 5, 6, 9, 10, 40, 50, 60, 90, 99, 100, 400, 500...

and the sequence of fixated points of f(n) = n4 begins

1, 5, 6, 10, 50, 60, 92, 100, 363, 500, 600, 636, 909, 1000...

As a rule of thumb, the faster f(n) grows with respect to n, the more digits f(n) will have as compared with n, hence, the likelier it is to contain n and reverse(n) as sub-strings. Thus, it is more interesting to consider f(n) which grows slowly with respect to n. One such function is given by f(n) = p(n), the n-th prime, which has a rate of growth with respect to n that is approximately equal to ln(n). The only fixated points of f not exceeding 107 are 7 and 6460. p(7) = 17, which contains both 7 and its reversal 7; and p(6460) = 64601, which contains both 6460 and its reversal 646 (= 0646). Can the reader find any more such points?

To aid in the search, here is Mathematica code to generate fixated points:

`r = {};`
```Do[m = Prime[n];```
```s = ToString[m];```
```If[StringPosition[s, ToString[n]] != {} && ```
```StringPosition[s, ToString[FromDigits[Reverse[IntegerDigits[n]]]]] != {},```
```r = Append[r, n]], {n, 1, 10^10}];```
```r ```

To use this code for a different function, just replace the "m = Prime[n]" by the appropriate expression.

Acknowledgments. I would like to thank Jens Kruse Andersen, Daniel Dockery, Mark Ganson, and Robert Israel for their valuable contributions to and interest in these math recreations; and Mohammad Khadivi for his suggestions to improve this paper.

# References

[An] Andersen, J. K. Personal Communication. 2002. (Appears in [Su])

[A] Andrews, G. “Number Theory”, Dover Publications, NY 1994.

[B] Beiler, A. “Recreations in the Theory of Numbers”, Dover Publications,

NY 1964.

[D] Dockery, D. Personal Communication. 2002. (Appears in [Su])

[G] Ganson, M. Personal Communication. 2002.  (Appears in [Su])

[Ga] Gardner, M. “The Magic Numbers of Dr. Matrix”, Prometheus Books, 1985.

[I] Israel, R. Personal Communication. 2002.

[P] Pe, J. “On a Generalization of Perfect Numbers”, to appear in The Journal of

Recreational Mathematics 31(3).

[S] Sloane, N. “The Online Encyclopedia of Integer Sequences” at the following

[Su] Systematic Undertaking to Find Picture-Perfect Numbers (Super) Message

Board at the following URL: http://disc.server.com/Indices/187886.html

[W] Wells, D. “The Penguin Dictionary of Curious and Interesting Numbers”,

Penguin Books, 1998.