# Happy Numbers

**Difficulty:**

Medium

**Tags:**

arithmetic

**Instructions:**

Happy numbers are positive integers that follow a particular formula: take each individual digit,
square it, and then sum the squares to get a new number. Repeat with the new number and eventually,
you might get to a number whose squared sum is 1. This is a happy number. An unhappy number (or
sad number) is one that loops endlessly. Write a function that determines if a number is happy or not.

**Hidden Code:**

There is hidden code with assertions that is also being run to test out your code.

**Code:**

___ assert_equal happy_number?(7), true assert_equal happy_number?(986543210), true assert_equal happy_number?(2), false assert_equal happy_number?(189), false

## Your Solution

Back to Problems