Refactor happy number