*This is Part 2 of a set of three posts adapted from Mateja Prešern’s talk at The Burn in November 2011.*

In Part 1 we looked at the set of “lucky” numbers. Of course, there are many other sets of “interesting” numbers that we could define — Tanya Khovanova’s excellent Number Gossip website lists several dozen. Some of these sets are really just curiosities, while others have a lot of mathematical interest, and even touch on unsolved problems. In this post we’ll look at a few of them…

### Figurate numbers

The natural number is a *triangular* number if dots can be assembled into an equilateral triangle:

The first few triangular numbers are 1, 3, 6, 10, 15, 21, 28, 36, … The *n*th triangular number is given by

(A good exercise for the reader: prove this, by induction or otherwise!)

Similarly, a *square* number is one that counts the dots in a square. Clearly the *n*th square number is just . It’s perhaps less obvious that the triangular and square numbers are related: the *n*th square number is the sum of the *n*th and (*n*-1)th triangular numbers. Here’s why:

We wouldn’t be mathematicians, of course, if we didn’t generalise things wherever possible… A *polygonal* number is any number that counts the number of dots in a regular polygon: there are pentagonal numbers, hexagonal numbers and so on. The notion can also be generalised into three dimensions, giving (for example) the *tetrahedral* numbers, and still more generally to give the general concept of a *figurate* number. Finding ways to count these is a good exercise for any budding combinatoricists among you…

### Some ominously named numbers

**Vampire numbers.** The number is called a *vampire* number if there exists a factorization of using its digits. For example:

**Evil numbers.** The number is an *evil* number if it has an even number of 1s in its binary expansion. (If it has an odd number of 1s, it is *odious*. Sometimes you just can’t win.) For example, , , , , , and so on…

There are 4999 evil numbers below 10 000. (How could you work this out without listing them all?)

**Apocalyptic powers**. The number is an *apocalyptic power* if contains the consecutive digits 666. For example,

The first ten apocalyptic powers are: 157; 192; 218; 220; 222; 224; 226; 243; 245; 247.

### Happy numbers

After all that, it’s a relief to turn to something more cheerful! Take the sum of the squares of the digits of a natural number . If iterating this operation eventually leads to 1, then is a *happy* number. For example, 23 is happy:

The first few happy numbers are 1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70…

If is happy, then so is . For example,

If is happy, then so is any number with the same digits, and any amount of additional zero digits. For example, 167, 176, 617, 671, 716 and 761 are all happy; and so are 1670, 1607, 1067,…

You might have noticed that among the first few happy numbers listed above, the consecutive numbers 31 and 32 appear. A little later on, we find a sequence of three consecutive happy numbers: 1880, 1881, 1882. Further on still, we find 7839, 7840, 7841, 7842. In fact,

**Theorem**. There exist sequences of consecutive happy numbers of arbitrary length.

The proof is a little too involved to give here, but here’s a link to the paper by El-Sedy and Siksek (2000) that proves it.

The first sequence of five consecutive happy numbers starts at 44488. The first sequence of six consecutive happy numbers happens to be the first sequence of seven consecutive happy numbers, namely, the sequence that begins with 7899999999999959999999996. Happy numbers in the smallest sequence of eight have 159 digits, and we’re not going to list them here! (No sequences of 20 have been found, so that gives you something to do on a rainy afternoon.)

If *n* is not happy, then the sequence of sums of squares of digits does not go to 1. Such numbers are called — wait for it! — *unhappy*. It can be shown that the sequence for unhappy numbers *always* ends up in the cycle 4, 16, 37, 58, 89, 145, 42, 20. There are infinitely many happy numbers and infinitely many unhappy numbers.

(By the way, for anybody who doubts whether this sort of thing has practical applications, in the Doctor Who episode *42*, the sequence of happy primes 313, 331, 367, 379 is used as a code for unlocking a sealed door on a spaceship about to collide with a sun. So there.)

*Coming in Part 3: numbers go beyond happiness and reach perfection…*

(MP/DP)

Pingback: The private life of numbers (3): perfect numbers | Degree of Freedom

Hello

I really liked your blog and I’ll aquiu often in the future.

on this post, I would ask you, happy numbers can be expressed as recurrence relations, as well as the recursive formulas of the Fibonacci numbers???? Or is that impossible???

Goodbye and see you soon …

Hmm… There certainly can’t be a simple recurrence formula as there is for the Fibonacci numbers, because the property of “happiness” depends on the choice of base — happy numbers in base 7, say, wouldn’t be the same as happy numbers in base 10. Algebraic recurrence relations like that for the Fibonacci numbers, on the other hand, don’t care about the base that’s used.

This doesn’t mean there isn’t some very sneaky way to construct a recurrence relation that used some property of the base-10 representation of the numbers… all I can say is that I’ve never heard of one and I find it pretty hard to imagine how it could be constructed. But of course that doesn’t

proveanything!(DP)