Paul Lutus wrote: > Peter Hickman wrote: > >> Problem is that from the quiz it states that you either get a 1 or an >> infinite loop and that an unhappy number is "obvious". Which is a sign >> that something has not been explained clearly. Given that the Wolfram >> page was clearer than the quiz at to what constitutes happy don't be >> surprised if some people go off down the wrong path. > > As I understand the Wolfram article, an unhappy number never hits 1 as a > result, whereas a happy number eventually hits 1: What you have described here is the halting problem. Good luck with that. > "Unhappy numbers have eventually periodic sequences of s(sub)i which never > reach 1." And what stops it from being a 1x10^50 length period, or any arbitrary length? > The quiz item emphasizes a criterion that is only mentioned in passing on > the Wolfram page, that is, there are degrees of happiness, and a number > that has many happy predecessors is, umm, more happy. So a relatively large > number that eventually results in 1, but with a lot of steps along the way > (therefore more happy ancestors), is happier. And what the quiz neglected to mention is that there is an easy test for unhappy number, which the mathworld page enumerates: Iterating this sum-of-squared-digits map always eventually reaches one of the 10 numbers 0, 1, 4, 16, 20, 37, 42, 58, 89, or 145 (Sloane's A039943; Porges 1945). So if you hit one of those unhappy numbers you know you're in an unhappy loop.