isHappy = (n) => {
    const hasCycle = () => ((n === 1) || (n === 4));
    while (!hasCycle()) {/* Time O(log(N)) */
        n = getNext(n);  /* Time O(log(N)) */
    }

    return n === 1;
}
Pointer - n === 1 || n === 4
Time O(log(N)) | Space O(1)
https://leetcode.com/problems/happy-number/
@param {number} n
@return {boolean}