Problem

Source: Iberoamerican 2017 p.1

Tags: number theory, Iberoamerican, international competitions



For every positive integer $n$ let $S(n)$ be the sum of its digits. We say $n$ has a property $P$ if all terms in the infinite secuence $n, S(n), S(S(n)),...$ are even numbers, and we say $n$ has a property $I$ if all terms in this secuence are odd. Show that for, $1 \le n \le 2017$ there are more $n$ that have property $I$ than those who have $P$.