Skip to main content
OlympiadHQ

Browse · MathNet

Print

North Macedonia

North Macedonia counting and probability

Problem

A natural number is called "happy" if the sum of its digits is . Let be the increasing sequence of happy numbers. If , compute .
Solution
We will use: Lemma 1. The number of solutions of the equation in the set of natural numbers is . Proof. Consider ones arranged in a row, and an arrangement of signs "+" between pairs of ones. This arrangement of the "+" signs can be done in ways while every such possibility arranges the ones in non-empty subsets. Let the number of ones in every one of the subsets be (clearly ). Then is a solution of the first equation and every solution can be obtained in this way. This ends the proof of the lemma. Lemma 2. The number of solutions of the equation in the set of non-negative integers is i.e. . Proof. The proof is obtained directly from Lemma 1 by substituting , . Lemma 3. The number of solutions of the equation in the set of non-negative integers , where is i.e. . Proof. We make substitutions , for ; , for Then the equation (1) is equivalent to the equation where clearly for it holds that i.e. the numbers are natural numbers for every . To every solution of equation (1) corresponds a unique solution of the equation (2) and vice-versa. Therefore we get that the number of solutions of equation (1) in the set of non-negative whole numbers under the condition is equal to the number of solutions of the equation (2) in the set of natural numbers which according to Lemma 1 is equal to i.e. . Now according to Lemma 3 for , the number of “lucky” numbers having digits is So we have , and . The number of four-digit “lucky” numbers in the form is actually equal to the number of solutions of the equation in the set of non-negative whole numbers and according to Lemma 2 that number is equal to . Now, is the least 4-digit “lucky” number of the form . Therefore is the -th in order “lucky” number. So i.e. which implies . Then we have , which implies that So there is a total of “lucky” numbers having at most digits. The least six “lucky” numbers arranged in decreasing order are , , , , and . Therefore, .
Final answer
52000

Techniques

Recursion, bijectionCounting two ways