Let S be a function such that S(N) is the sum of digits of N. N belongs to natural numbers, and N < 10²³. N does not contain a zero digit in it. The numbers are in base 10.
Find the number of N that satisfies the equation: S(N) = S(S(N))
Puzzling Stack Exchange is a question and answer site for those who create, solve, and study puzzles. It only takes a minute to sign up.
Sign up to join this communityLet S be a function such that S(N) is the sum of digits of N. N belongs to natural numbers, and N < 10²³. N does not contain a zero digit in it. The numbers are in base 10.
Find the number of N that satisfies the equation: S(N) = S(S(N))
S(N) ≤ N with equality iff N ≤ 9, so the solutions are {N : S(N) ≤ 9 ∧ 0 ∉ digits(N)}. This set is {1, 2, …, 8, 9, 11, 12, …, 17, 18, 21, …}.
Denote the concatenation operator by ∥. S(N) = k iff N can be uniquely expressed as 1 ∥ 1 + 1 + 1 ∥ 1 + … + 1 for some combination of operators with k 1s. There are 2k − 1 ways to do this. So the cardinality of the set is 20 + … + 28 = 29 − 1 = 511.