Pages

Sunday 8 February 2015

What are vampire/perfect/happy/palindromic numbers? - Part 2

Continuing my previous post, we will now look at happy and palindromic numbers...

Happy Numbers
For any number, if you add up the squares of each digit and repeat this you will eventually either reach 1 or start an endlessly repeating loop. Numbers which result in a value of 1 are called Happy Numbers.
For example, 19 is a happy number because 12 + 92 = 82, 82 + 22 = 68, 62 + 82 = 100, 12 + 02 + 02 = 1. As you can see, this ends in 1 and 19 is therefore a happy number.
20, however, is not a happy number as 2+ 02= 4, 4= 16, 1+ 62=37, 32+72=58, 5+82=89, 82+92=145, 12+42+52=42, 42+22=20  which is back where we began. In fact, every non-happy number ends up in this sequence; 20, 4, 16, 37, 58, 89, 145, 42, 20.
The first 10 happy numbers are 1, 7, 10, 13, 19, 23, 28, 31, 32 and 44. Happy numbers which are also prime are, inventively, called Happy Primes; examples of which are 7 and 19. 


Palindromic Numbers
Palindromic numbers, in the same way as palindromic words or phrases, are numbers which are the same when reversed, e.g. 131.
In themselves they may not be that interesting, there are infinitely many and quite regular, but they can be combined with other sets of numbers to give interesting results. For example Palindromic Primes (palprimes) include 313, 797 and Belphegor's Prime: 1000000000000066600000000000001.

By their nature, all Mersenne and Fermat primes are palindromic when written in binary as they are either a run of '1's or a run of '0's with '1's at both ends. For example 31, 11111, is a Mersenne prime and 17, 10001, is a Fermat prime.
Combining these gives Palindromic Happy Prime Nunbers, the first one being 10150006 + 7426247×1075000 + 1 which has over 150 thousand digits.

2 comments:

  1. This is so awesome! I have never heard of happy numbers. I showed my students this in class and we had so much fun exploring and finding happy numbers. They all wanted to know if their favorite numbers were happy or not haha. Thanks!

    ReplyDelete
  2. Really pleased to hear this! Thanks for telling me :)

    ReplyDelete