Happy Numbers
What's a Happy Number? Well, pick a number. Now square its digits and add them together. Is the result 1? Your number is Happy! Is the result 4? Your number is Unhappy! But what if your result isn't either 1 or 4? Well, you take that new number and you square the digits and add them together, just like you did with the original number. And you keep doing this until you reach either 1 or 4!Want to find out if a number is happy or not? Type it in below. And if you want to find out if a word is Happy, you can type that in as well. We use a variation on Hebrew Numerology called Gematria to calculate the word's value, and then we find out if that value is Happy.
A Proof: In the late 80's, I was taking a Number Theory course at the University of Maine, and since it was an independent study, my advisor/teacher permitted me to explore topics of my own choosing. I chose as one of my projects to prove that every number eventually reaches either 1 or 4. This was done in two steps: First, show that numbers 1000 or more produce a number less than 1000. Then I wrote a computer program to verify that every integer less than 1000 cycles to 1 or 4.
Happy Cubes: The same process can be done, but cubing the digits instead of squaring them. The results aren't as simple as the "normal" process. However, they do produce some interesting results, such as the number 153: 13 + 53 + 33 = 1 + 125 + 27 = 153!
Calculating Happy Words: To find out if a word is happy, assign each digit a number from 1 to 26, and then add those numbers together. Now begin the "Happy" process on that result!
Programming this Calculator: When building websites, it's always a good idea to avoid unneccessary calculations, as they waste server processing. Accordingly, I designed this calculator so that, instead of cycling all the way to 1 or 4, on each iteration I would check to see if the number was less than 100, and if it was, I would compare it against a table of values of Happy Numbers between 1 and 100 to determine whether the number is Happy or Unhappy.
More Information: An Article About Happy Numbers