Prove that there is a finite number of values of n that satisfy
n = 4s(n) + 3s(s(n)) + 2s(s(s(n))) + 1
where n is a positive integer and s(n) denotes the sum of the digits of n. Also, determine analytically, all values of n that satisfy the equation.
By the way, s(n) is the "casting out 9's" function.
n mod 9 = s(n) mod 9 = s(s(n)) mod 9 etc.
So, (4s(n) + 3s(s(n)) + 2s(s(s(n)))) mod 9 = 9n mod 9 = 0
So, n mod 9 must equal 1.
There are only 21 possible n's to check: 1, 10, 19, ... 181. (Given Charlie's limit).
For all of these 21, s(n) is either 1 or 10, s(s(n)) = 1, and s(s(s(n))) = 1, so n can only be 10 or 46, and both of these work.