Capital One Interview Question

Q: Write an algorithm to determine is a number n is happy