0
$\begingroup$

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))

$\endgroup$
1
  • $\begingroup$ Discussion of this question on meta $\endgroup$
    – bobble
    May 24, 2022 at 14:25

1 Answer 1

5
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ But how many numbers satisfy the solution? $\endgroup$
    – I'm Nobody
    May 23, 2022 at 10:35
  • $\begingroup$ @I'mNobody I didn't realise that was the question. (The last sentence in the problem statement is not very clear.) I've counted them now in an edit. $\endgroup$ May 23, 2022 at 11:14
  • $\begingroup$ Shouldn't it be $2^{k-1}$ ways? $\endgroup$ May 23, 2022 at 11:37
  • $\begingroup$ @JaapScherphuis Yes. Thank you. I've edited it. $\endgroup$ May 23, 2022 at 12:07
  • $\begingroup$ Now that is correct. $\endgroup$
    – I'm Nobody
    May 23, 2022 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.