Illustration: Jayachandran/Mint
Illustration: Jayachandran/Mint

Opinion | The years roll by, happily and autobiographically

  • 2019 is a ‘happy’ number (adding squares of each of its digits leads to 1), 2020 is autobiographical (digits tell you the number of each digit it has)
  • 2019 was ‘lucky’ as well. Lucky numbers are the survivors after a mathematical sieve sifts out certain numbers by applying a rule over and over

Some years ago, I wrote here about the Nashik mathematician D.R. Kaprekar. This man spent his life playing with numbers and deriving immense joy from them, and he named certain numbers “Harshad", Sanskrit for “giver of joy".

Ask of any number, is it divisible by the sum of its digits? If so, it is a Harshad number. As I wrote in that column, “The single digits, 1 through 9, are trivially Harshad numbers, and so are 10, 12, 133, 152 and 198. Take 133: 1 + 3 + 3 = 7, and 133 / 7 = 19. Or 198: 1 + 9 + 8 = 18, and 198 / 18 = 11."

Kaprekar’s exploits came to mind as the year, and the decade, turned over a couple of weeks ago. Because such turning is often an occasion for some mathematicians to explore the numerical properties of the year gone by, the new year, the decade past… whatever strikes their fancy about the years, really. Following some of these ruminations, I learnt a fair amount, numerically, about 2019 and 2020, some of which I’ll explain below. But what particularly reminded me of Kaprekar was a mention that 2019 is a “happy" number.

Hmm. Is it a Harshad, a giver of joy? No, because 2 + 0 + 1 + 9 = 12, and 2019 is not divisible by 12. Wait, there are some other numbers that mathematicians call “happy" and they are not givers of joy? Yes indeed! Do this with 2019: Take each digit and square it. Add those squares to get another number. Repeat. Keep doing this, and you will eventually reach 1:

2019: 22 + 02 + 12 + 92 = 86

86: 82 + 62 = 100

100: 12 = 1

A number that produces 1 when manipulated this way is called “happy". (We’re not certain where the name came from, though there’s a story that the daughter of an English mathematics professor called Reg Allenby heard it at her school and told dad.) Below 100, these are happy numbers: 1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94 and 97. Though as you can tell, a better way to enumerate them is to ignore zeros, or rearrangements of the digits, and that gives us this list: 1, 7, 13, 19, 23, 28, 44, 49, 68, 79. (If 19 is happy, 91 and 190 will be too).

About one-seventh of all numbers are happy. What of the rest? Try the iteration above. You’ll find that in every case, you end not with 1, but in this 8-step cycle:

4 - 16 - 37 - 58 - 89 - 145 - 42 - 20 - 4

As I’ve mentioned in this space before, where there’s a pattern among numbers, you’ll find mathematicians drawn there like moths to a flame—call them mothematicians—and asking intriguing questions. For example, we see that 31 and 32 are consecutive happy numbers. Are there others? (Answer: Yes. For example, 1880 and 1881). Are there examples of more than two consecutive happy numbers? (Answer: Yes. For example, 1880, 1881 and 1882). Do 1880, 1881 and 1882 make for the smallest example of three consecutive happy numbers? What about four consecutives? One-seventh of all numbers are happy, but what can we say about the gaps between successive happy numbers? Trivially, the smallest gap is 1. Below 100, the largest gap is 19, between 49 and 68. Are there larger gaps? Is there a largest gap?

I deliberately did not offer you answers, or even tips, to some of those questions. More interesting by far, I assure you, to investigate for yourself. But I hope this gives you some flavour of the quests number fans chase after.

So 2019 is “happy" in this one sense. It is also a “lucky" number in another sense. In different mathematical pursuits, you’ll run across the idea of a “sieve". Just as the one in your kitchen sifts out chaff from wheat, a mathematical sieve sifts out certain numbers by applying a rule over and over. Of the numbers that are left, you can, again, ask interesting questions. Lucky numbers are the survivors after one such sieve does its work, and it goes like this:

First, write out the odd numbers (i.e. we’ve already sifted out the evens): 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25 …

The first odd number greater than 1 in this resulting list is 3, so remove every third number, leaving: 1, 3, 7, 9, 13, 15, 19, 21, 25 …

The first odd number greater than 3 in this list is 7, so remove every seventh number, leaving: 1, 3, 7, 9, 13, 15, 21, 25 …

Next we strike out every ninth number, then every 13th, etc. The numbers left after this somewhat diabolical sifting process are … well, you could say they are lucky to survive. 2019 is one. Again, there are plenty of questions to ask about the luckies. For example, we’ve learned this interesting thing about them: while many luckies are not prime— 2019 isn’t, nor are 9, 15, 21 and 25 above—the list of lucky numbers shares some of the properties of prime numbers. For one, they are distributed among all numbers exactly as densely (or sparsely, if you prefer) as the primes. For another, twin luckies—pairs that are separated by 2, like 7 and 9, or 13 and 15—occur about as frequently among the numbers as twin primes do.

But the even more interesting thing is that this idea of a mathematical sieve itself seems to have something to do with primes. The best-known sieve is the Sieve of Eratosthenes. It systematically eliminates, first, the multiples of 2 greater than 2 (the even numbers), then the multiples of 3 greater than 3, the multiples of 5 greater than 5, and so on. Clearly what’s left, then, are the primes. But there are other sieves, like the one above for luckies. They produce numbers that, collectively, seem to display characteristics much like the primes do. Why so? What is the connection between the sieving process and prime numbers? More quests for mathematicians to chase.

So there we have it: 2019 was both happy and lucky. Call it happy-go-lucky. By now, you should be familiar enough with mathematicians’ ways to know that if you point out this about 2019, the question they’ll ask is: “what’s the next happy-go-lucky year, eh?" Answer: 2115. Not even a century away, so set your alarm clocks.

Believe me, there’s plenty more to say about 2019. But let’s turn, like the calendar did, to 2020. What’s intriguing about our New Year? That is, apart from the wordplay about T20 and 20/20 vision that we are likely to hear all year?

For one thing, it does not lend itself easily to palindromic dates. In 2019, for example, you could write the 9th of January as 9-1-19, the 9th of November as 9-11-19, the 9th of October as 9-10-19 or 9-10-2019. All palindromes. But in 2020, you’re out of palindromic luck.

But if that’s trivial, here’s a formula that generates a series of numbers, 2020 included, that might be familiar.

Say you want the 10th number in this series. Take the square root of 10 (3.162…). Add 1/2 (3.162… + 0.5 = 3.562…). Drop the decimal part (3) and add 10 (3 + 10). You get 13, and that’s the 10th number. The 16th? Take the square root of 16 (4). Add 1/2 (4.5). Drop the decimal part (4) and add 16. You get 20. Etc.

In general, the nth number in this series is, written mathematically, [sqrt(n) + 0.5] + n.

This formula generates 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20 … and yes, I assure you 2020 figures: it is the 1976th of those numbers. But do you notice anything about the series?

No doubt you did. We could have generated it with a sieve too: eliminate all the squares (1, 4, 9, 16, 25 …). So why does that formula generate only non-squares? I’ll leave that for you to ponder.

But maybe you’re not impressed by simply learning that 2020 isn’t a square. Fine: it’s also an autobiographical number. That is, its first digit (from the left) tells you how many zeroes it has, its second how many ones, its third how many twos, etc. 2020: 2 zeroes, 0 ones, 2 twos and 0 threes.

Nice? Well, try this. There has been only one autobiographical year before this one: 1210. I doubt your alarm clock will work for the next one: 21200. And there are only 7 autobiographical numbers in total: 1210, 2020, 21200, 3211000, 42101000, 521001000 and 6210001000.

You see, it’s a pretty exclusive little club we’re in, this year. I think DR Kaprekar would have been thrilled.

PS: Answers to the puzzles in my last column? Soon.

Once a computer scientist, Dilip D’Souza now lives in Mumbai and writes for his dinners.

My Reads Logout