Lesson 22.2 — Count Long Consecutive Ranges without Listing
连续自然数:不逐个列举地统计长区间
Count thousands of cases by organizing them into blocks, counting the easier opposite event, or letting place value do the work. The goal is not to list every number—it is to expose the repeated structure.
Choose the counting lens before you calculate
A long range is manageable when you identify what repeats. Four strategies appear throughout this lesson.
Count the easier “no” cases, then subtract from all cases.
Every block of length m has the same remainder pattern.
When digit choices are independent, multiply the number of choices.
Handle complete sections first, then a short leftover section.
Match each situation to its best first strategy
Worked example 1 — count carry cases by counting no-carry cases
Among the integers from 1 through 1999, how many produce at least one carry when added to 4567?
Pad every candidate to four digits
Temporarily use the full block 0000–1999. A number has no carry only when each digit stays below the cap set by the matching digit of 4567.
The temporary value 0000 is a no-carry case. Adding it to both the complete block and the no-carry count does not change the final number of carry cases in 1–1999.
Checkpoint
Guided Practice 1 — split the range at 2000
Among 2 through 2007, count the numbers that produce at least one carry when added to 1234.
Complete section: 0000–1999
The digit caps are 8, 7, 6, and 5, while the thousands digit is 0 or 1.
Short section: 2000–2007
Only 2000 through 2005 avoid a carry in the ones column.
Combine, then subtract
The requested range starts at 2, but 0 and 1 are both no-carry values. Removing them from both the total and the no-carry count leaves the same carry count.
Checkpoint
Use a general no-carry complement laboratory
Both range endpoints are included. Count a value once if its addition causes any carry, even if several columns carry. Leading zeros only align columns; they do not create extra values. The column caps below are necessary conditions: on a partial range, you cannot simply multiply them without also enforcing the endpoints.
Carry-count laboratory
Checkpoint: use 000–999 and fixed addend 246 for all four answers
Count ordinary remainder classes in complete blocks
Every block of four consecutive integers contains exactly one number with each remainder 0, 1, 2, and 3 modulo 4.
Multiples of 4 from 1 through 3998
There are 999 complete blocks, and the final two numbers do not add another multiple of 4. Therefore the count is 999.
General residue-block counter
Checkpoint
Count digit-sum remainder classes by fixing a suffix
The worked example now asks a different question over the same range: how many numbers have digit sum divisible by 4?
Pad the block as 0000–3999
Fix the last three digits bcd. Exactly one thousands digit a ∈ {0,1,2,3} makes a+b+c+d divisible by 4.
0000 qualifies and must be removed. The endpoint 3999 has digit sum 30, so it does not qualify. Thus 1–3998 contains 999 qualifying numbers.
General digit-sum remainder laboratory
Checkpoint
Subtract an easier forbidden set
Complement counting works for digit occurrences and for sums that exclude one regular residue class.
Count numbers containing a chosen digit
Use ordinary decimal writing without leading zeros. Count each number once, even if the digit appears twice; zero itself is written 0.
For 00–99, avoiding 5 gives 9×9=81 strings, so 100−81=19 contain a 5. Neither 00 nor 100 contains 5, so 1–100 also has 19.
Sum all values except multiples
Checkpoint
Locate a digit position and transform a whole range
The chapter closes with two range transformations: split numerals into individual digits, and insert decimal points in a regular residue class.
Locate one digit in the concatenated string
The worked example asks for the position of the ones digit 0 of 100 in the string 123456789101112… with no commas or spaces. Count its first digit as position 1.
Insert a decimal point in a residue class
Start with every integer from 10 through 99, including both endpoints. For each value that leaves remainder 2 when divided by 7, insert a decimal point between its digits; leave all other values unchanged.
How many digits appear in 123…3435?
Sum of all two-digit numbers
Checkpoint
Try it on your own — a new problem
This extra practice has its own saved checkpoint. Try it, check your answer, then use a hint or the separate worked review.
Among 00–99, how many numbers cause at least one carry when 37 is added?
Independent counting workshop
Use the shortest structural argument. Correct all eight answers to complete the mission.
Exit ticket and certificate
Answer every item correctly and complete the other nine missions to unlock your certificate.
Long-Range Counting Architect
This certifies that
completed Lesson 22.2 and used complements, blocks, and place value to count long consecutive ranges without listing every case.
Date:
original and adaptation note
The general calculators and visualizations are added instructional scaffolds.