isHappy = (n) => {
    let [ slow, fast ] = [ n, getNext(n) ];
    
    const hasCyle = () => ((fast === 1) || (slow === fast));
    while (!hasCyle()) {              /* Time O(log(N)) */
        slow = getNext(slow);         /* Time O(log(N)) */
        fast = getNext(getNext(fast));/* Time O(log(N)) */
    }

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