Happy number is a positive integer that gives the final number as 1 when certain steps ( square and sum the digits ) are performed continuously. Checking a Happy Number Step 1 : Consider any number. Step 2 : Square the number and replace the resultant with the sum of the squares of its digits. Step 3 : Repeat the steps. The final number will be 1, or the steps will loop endlessly in a cycle. Those numbers (considered in Step 1) that give the final number as 1 are Happy numbers . Examples Example 1 Step 1 : Consider number 1. Step 2 : Square the number => 1 2 => 1 x 1 => 1. Step 3 : Repeat the steps. 1 2 => 1 x 1 => 1 Repeating the steps gives the final number as 1. Therefore, the number considered in Step 1 is a Happy number . Example 2 Step 1 : Consider number 2. Step 2 : Square the number => 2 2 => 2 x 2 => 4. Step 3 : Repeat the steps. 4 2 => 4 x 4 => 16 1 2 + 6 2 => 1 + 36 => 37 3 2 + 7 2 => 9 + 49 => 58 5 2 + 8 => 2...
The blog "The Amazing Concepts" is all about the amazing technological, mathematical, and astronomical concepts.