Can someone explain to me what a happy number is? Wikipedia tried explaining it to me, but I’m still confused.
3, because if you tilt it sideways it looks like it’s smiling.
OK, maybe not.
To find if a given number is happy, you must perform the following algorithm:
- Start with a number n
- Find the sum of the squares of the digits of n
- If the result is 1, the number is happy, otherwise, reset n to the result, and goto 2.
For example, let’s try the number 23.
First find the sum of the squares of the digits:
2[sup]2[/sup] + 3[sup]2[/sup] = 4 + 9 = 13
Does 13 equal 1? Nope. So repeat:
1[sup]2[/sup] + 3[sup]2[/sup] = 1 + 9 = 10
10 is not 1, so
1[sup]2[/sup] + 0[sup]2[/sup] = 1 + 0 = 1
1 equals 1! So 23 is a happy number.
For numbers which are not happy, you just end up going in circles forever.
Step 2 confuses me. What is the sum of the squares? Wiki says for the number 7: 1) 72 = 49 2) 42 + 92 = 97 3 )92 + 72 = 130 How do they come up with 130? The first two steps, I understand now.
The “2”'s, are actually squares.
Start with 7. It has only one digit:
7[sup]2[/sup] = 49
49 has two digits:
4[sup]2[/sup] + 9[sup]2[/sup] = 16 + 81 = 97
97 has two digits:
9[sup]2[/sup] + 7[sup]2[/sup] = 81 + 49 = 130
The point is, you have to repeat the process until you get 1 or end up in a loop.
So, start with 7, which has only one digit. So the sum of the squares of the digits is
7[sup]2[/sup] + (nothing) = 49.
Then we take the digits of 49, and square them, and find their sum:
4[sup]2[/sup] + 9[sup]2[/sup] = 16 + 81 = 97
Now we find the sums of the squares of the digits of 97:
9[sup]2[/sup] + 7[sup]2[/sup] = 81 + 49 = 130
Now find the sum of the squares of the digits 1, 3 and 0:
1[sup]2[/sup] + 3[sup]2[/sup] + 0[sup]2[/sup] = 1 + 9 + 0 = 10
And finally:
1[sup]2[/sup] + 0[sup]2[/sup] = 1 + 0 = 1
Doesn’t 81 + 49 equal 930?
Not usually…
In today’s advanced exam, find a number base in which this equation is true. You may use all your fingers and toes.
I get 5/3.
Doesn’t work. Since the original equation has 9s in it, any base less than 10 doesn’t make sense. Starting with base 10, the sum of 81 and 49 is 130, and it needs to be 930. As we increase the base, 930 is going to grow significantly faster than the sum of 81 and 49. That’s because 930 is going to have 9 * base^2 as its largest term versus (8+4)*base for the sum. So the sum is never going to catch up to 930.
If we ignore the fact that having a base lower than 10 doesn’t make sense (since you can’t have a ‘9’ in a number in a base lower than 10) and just try and make the math work, there appears to be a solution with a non-integer base somewhere between 1 and 2.
Edit: Looks like Chessic Sense found it.
Just wondering, where/how in mathemetics are “Happy Numbers” used? What is the purpose of the “Happy Number” function?
Regards
FML
As far as I can see, no practical use exists. This is quite common with pure mathematics.
69 is a happy number.
I’m not sure why I thought yesterday that it was 930, but I think I finally understand it. Thanks all, I really appreciate it.
so… “That’s the beauty of it… it doesn’t do anything!” applies here?
grin
FML
You were probably joking, but…
69
36+81 = 117
1+1+49 = 51
25+1 = 26
4+36 = 40
16+0 = 16
1+36 = 37
9+49 = 58
25+64 = 89
64+81 = 145
1+16+25 = 42
16+4 = 20
4+0 = 4
16
So 69 loops back on itself.
How very appropriate – so it should be a pair of happy numbers
Dangerous word here. 15 years from now someone is going to have a slightly better coding algorithm based on happy numbers. Thus getting one more phone call per base station or slightly more bits per square centimeter on the disk drive platter.
Wow. That’s the first persuasive argument for numerology I’ve ever heard!