Pages

Showing posts with label Palindrome. Show all posts
Showing posts with label Palindrome. Show all posts

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 22 + 02= 4, 42 = 16, 12 + 62=37, 32+72=58, 52 +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.

Thursday, 26 June 2014

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

There are many different types of numbers and classifications of numbers, some of which you will have heard of such as the obvious integers, negatives, evens and the like. However, there are also some rarer, more interesting types a few examples of which I will give now.
Vampire Numbers
Vampire Numbers are whole numbers which can be factorised into two numbers which together have the same digits as the original number. The two factors must have half the number of digits of the original number, and the number itself must therefore have an even number of digits (the factors must also not both have trailing zeroes). It is easier to explain these with an example, so I will give one. 1395 is a vampire number because it is 15 multiplied by 93 and 1395 has the same digits as 15 and 93.Similarly 1260 is a vampire number as it is 21 times 60 and 1435 is 35 multiplied by 41.
There are also different subsets of vampire numbers such as numbers which have two or more possible pairs of ‘fangs’ (as the factors are known). The first one of these is 125460 which is 204 × 615 and 246 × 510, the first number with three possible pairs of factors is 13078260, which equals 1620 × 8073, 1863 × 7020 and 2070 × 6318. I could go on. Also there are Pseudovampire numbers whose fangs are not equal to half the number of digits of the original number. There are lots of these, well infinitely many, such as 126 which equals 6×21. Finally, there are Prime vampire numbers whose fangs are its (only) prime factors as in 117067 which is 167*701.

Perfect Numbers
Perfect numbers are numbers whose divisors (not including itself) sum to the original number. The first example of this is the number 6, whose factors are 1, 2 and 3, which clearly add up to six, and the second perfect number is 28, which is 1 + 2 + 4 + 7 + 14. What is interesting about Perfect Numbers is that they are indefinitely linked with Mersenne Primes, which are primes which are 1 less than a power of 2 such as 3 which is 1 less than 4, 7 (1 less than 8) and 31 (1 less than 32). For every Mersenne Prime, m, m(m+1)/2 is a Perfect Number. For example, the first Mersenne Prime is 3 and 3(3+1)/2 = 12/2 = 6, the first Perfect Number. Leonhard Euler, one of my favourite mathematicians, proved that all perfect numbers are like this. As a concept, they are very old. The Greeks knew the first four (6, 28, 496, 8128), and the fifth was first recorded in the mid 15th century.

Amicable and Sociable Numbers
Perfect numbers are linked with Amicable and Sociable numbers, which both involving adding up the factors. Amicable numbers come in pairs, such as 220 and 284, where the sum of the factors of the first number is the second number and vice versa. Other pairs include 1184 and 1210 as well as 2620 and 2924. Sociable numbers are groups of numbers that form a chains so that the sum of the factors of A equals B, the sum of B equals C and the sum of C equals A. One such group is of four numbers; 1,264,460 -> 1,547,860 -> 1,727,636 -> 1,305,184 which goes back to 1,264,460. One delightful use of amicable numbers is as a nerdy, romantic gesture as shown by the people at Maths Gear - http://mathsgear.co.uk/products/amicable-numbers-pair-of-keyrings-nerd-romance.