1
(where it will stay), or it loops endlessly in a cycle which does not include 1
. Those numbers for which this process ends in 1
are happy numbers, while those that do not end in 1
are unhappy numbers.
happy
should be a function.
testString: assert(typeof happy === 'function');
- text: happy(1)
should return a boolean.
testString: assert(typeof happy(1) === 'boolean');
- text: happy(1)
should return true.
testString: assert(happy(1));
- text: happy(2)
should return false.
testString: assert(!happy(2));
- text: happy(7)
should return true.
testString: assert(happy(7));
- text: happy(10)
should return true.
testString: assert(happy(10));
- text: happy(13)
should return true.
testString: assert(happy(13));
- text: happy(19)
should return true.
testString: assert(happy(19));
- text: happy(23)
should return true.
testString: assert(happy(23));
- text: happy(28)
should return true.
testString: assert(happy(28));
- text: happy(31)
should return true.
testString: assert(happy(31));
- text: happy(32)
should return true:.
testString: assert(happy(32));
- text: happy(33)
should return false.
testString: assert(!happy(33));
```