Why would you do that? It's happy if it ever reaches 1. If it gets into a different loop, it's unhappy. However, you are correct that 8 is not happy in base 10: 8 => 64 => 52 => 29 => 85 => 89 => 145 => 42 => 20 => 4 => 16 => 37 => 58 => 89, at which point we have a cycle (89 appeared twice).
But 7 IS happy in base 10: 7 => 49 => 97 => 130 => 10 => 1 On Sep 12, 1:18 am, Mahendra Kariya <[email protected]> wrote: > I guess in the first ques of Round 1A, we have to check only until the sum > of squares of digits is not a single digit integer. Say, for sum number, if > we get the sum of square of digits 8, we stop there and declare it to be > unhappy without doing 8*8 = 64 . > > Regards, > Mahendra Kariyahttp://www.mahendrakariya.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-code?hl=en -~----------~----~----~----~------~----~------~--~---
