Count Numbers with Exact or Modular Digit Sums
第21讲 数字和 · Lesson 21.3
Turn a digit-sum condition into a finite, organized count. Use a complete case table when the sum must equal a target, and use remainder classes when only divisibility matters.
Choose the right kind of digit-sum condition
An exact condition names one total. A modular condition asks only which remainder class the digit sum belongs to.
Exact digit sum
The digits must add to exactly 24. A complete count usually needs a table of cases.
Modular digit sum
The digit sum may be 0, 5, 10, 15, 20, … . Zero is a multiple of 5 too; whether it can occur depends on the allowed numbers. Only the remainder matters.
Live condition scanner
Checkpoint
Need a hint for Mission 1?
Add the digits first, then reduce only if a remainder is requested.
Check your method
1+5+8+9=23;23=5×4+3. Equal remainders can come from different sums. 23;equals one target;3;no.
Build remainder counts instead of guessing
For one displayed digit 0–9, the counts for remainders 0,1,2,3 modulo 4 are 3,3,2,2. Appending a digit adds its remainder. For two displayed digits, remainder 0 has 3×3+3×2+2×2+2×3=25 possibilities. Applying the same four-case multiplication to each target gives counts 25,26,25,24. Repeat once more for three digits to obtain 249,251,251,249. These are counts of fixed-width suffixes including leading zeros, not three-digit positive numbers.
Count four-digit numbers whose digit sum is divisible by 5
The worked example fixes the first three digits, then counts which units digits complete the required remainder.
original problem
How many four-digit positive whole numbers have a digit sum divisible by 5?
Why exactly two units digits?
| Prefix sum mod 5 | Units digits that finish at remainder 0 |
|---|---|
| 0 | 0, 5 |
| 1 | 4, 9 |
| 2 | 3, 8 |
| 3 | 2, 7 |
| 4 | 1, 6 |
Try a first-three-digit prefix
Rebuild the worked example count
Need a hint for Mission 2?
Every fixed three-digit prefix has two valid units digits modulo5.
Check your method
There are900 prefixes100–999. For314, the prefix sum8 needs units remainder2, so digits2 and7 work. 900;2;1800;list2,7 in either order.
Use a fixed-length modular counting laboratory
For moduli other than 5, the remainder classes need not be equally large. Dynamic counting keeps every place and leading-digit rule organized.
Count fixed-length positive whole numbers
Checkpoint
Need a hint for Mission 3?
The counts in this checkpoint exclude leading zero.
Check your method
Three-digit multiples of3 run102–999:300 numbers. Five-digit prefixes1000–9999 each allow two units digits modulo5. 300;18000;largest remainder6;no.
Count exact digit sum 24 below 2000
An exact sum requires a complete case table. Here the leading digit is forced, so the hundreds digit controls the remaining two-digit sum.
original problem
How many four-digit positive whole numbers below 2000 have digit sum 24?
Why h starts at 5
The final two digits can total at most 18. Therefore:
The possible hundreds digits are 5, 6, 7, 8, and 9.
Complete candidate list
| Hundreds digit h | Required t+u | Ordered (tens, ones) pairs; reversing different digits makes a different number | Count |
|---|---|---|---|
| Total | 15 | ||
Rebuild the worked example argument
Need a hint for Mission 4?
Use four-digit numbers1000–1999; repeated digits are allowed.
Check your method
After the leading1, h+t+u=23. Hundreds digits5–9 leave1,2,3,4,5 ordered pairs respectively. 1;23;5;total15.
Complete the guided practice for digit sum 26
The worked example excludes 1997 after the complete count. Count first; remove the named value second.
Extra practice
How many other four-digit positive whole numbers below 2000 have the same digit sum as 1997?
All qualifying values
Named value removed
Other values
Checkpoint
Need a hint for Mission 5?
Count all four-digit sum-26 values before excluding1997.
Check your method
The six are1799,1889,1898,1979,1988,1997. 26;six;exclude1997;five remain.
Use a general exact digit-sum enumerator
Choose the number of digits and a target. The laboratory counts every numeral exactly once and organizes the total by leading digit.
Exact-sum laboratory
The first digit cannot be zero. Digits may repeat unless “Require no repeated digit” is selected. The checkpoint below allows repeated digits and uses its printed lengths and sums.
| Leading digit | Number of completions |
|---|
Candidate numerals
Checkpoint
Need a hint for Mission 6?
These checkpoints allow repeated digits.
Check your method
Sum25 gives799,889,898,979,988,997. For sum10, hundreds digits1–9 give10,9,8,7,6,5,4,3,2 choices. 6;54;smallest799;largest997.
Count a digit-sum remainder over a bounded range
A range may cross several leading-digit blocks. Count each block with the remainder needed from its suffix.
original exercise
From 1999 through 5999, how many positive whole numbers have a digit sum divisible by 4?
Suffix counts for 000–999
Assemble the range
General bounded-range modular laboratory
Both endpoints are included. If you include 0, its digit sum is 0. A target remainder must be less than its modulus.
Checkpoint
Need a hint for Mission 7?
Both endpoints1999 and5999 are included.
Check your method
Three-place suffix remainder counts modulo4 are249,251,251,249. Include1999 once, then the four thousand-blocks. 249;251;original total1001;range1–200 modulo7 count26.
Add a distinct-digit restriction
Distinct digits add a “used digit” condition. The smallest possible sum of five distinct digits is 0+1+2+3+4=10, so a target sum of 7 can use at most four digits.
Transfer problem
How many positive whole numbers have digit sum 7 and no repeated digit?
Count by numeral length
Distinct-digit exact-sum explorer
Rebuild the worked example-transfer count
Need a hint for Mission 8?
No leading zero and no repeated digit anywhere.
Check your method
One digit:7. Two digits:16,25,34,43,52,61,70. Three-digit sets {0,1,6},{0,2,5},{0,3,4} give4 orders each, and{1,2,4} gives6. Four-digit set{0,1,2,4} gives24−6=18 orders. Counts1,7,18,18;total44. Five distinct digits already sum to at least10.
Try a new problem before the workshop
How many two-digit numbers have digit sum 17? Explain why your list is complete.
Compare your reasoning after trying
Only 89 and 98 work. A tens digit below 8 would require a units digit above 9. There are 2.
Independent workshop
Digits may repeat unless a question explicitly requires distinct digits; a numeral cannot begin with zero. Correct all eight answers to complete the workshop.
Need a hint for Mission 9?
The sum24 and sum26 questions concern four-digit numbers below2000.
Check your method
Keep the original ranges, leading-digit rules and exclusion of1997. 2;1800;15;6;5;6;1001;44.
Objective exit ticket
Answer all five correctly and complete the other nine missions to unlock the certificate.
Optional reflection — not automatically graded
Digit-Sum Counting Architect
This certifies that Student completed all ten missions and can count numbers under exact, modular, bounded-range, and distinct-digit sum conditions.
Chapter 21 • Digit Sums
Need a hint for Mission 10?
Each counting question asks how many numbers, not for a list.
Check your method
The two-digit sum16 values are79,88,97; repeated digits are allowed. 15;1800;54;26;three.