Intel Corporation Interview Question

they asked me the Happy number question from Leetcode