#C3523. Happy Number Checker
Happy Number Checker
Happy Number Checker
A happy number is defined by the following process: Starting with any positive integer \(n\), replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1. In mathematical notation, let \(f(n) = \sum_{d \in D(n)} d^2\), where \(D(n)\) is the set of digits of \(n\). If repeatedly applying \(f\) eventually results in 1, then \(n\) is a happy number. Otherwise, it is not happy.
Your task is to determine whether the given number is a happy number or not.
inputFormat
The input consists of a single line containing one integer \(n\) (\(0 \le n \le 10^9\)).
outputFormat
Output True
if the number is a happy number, and False
otherwise. The result should be printed to standard output.
19
True