The range that loses its first number
transcript
Count the numbers in a range. Their digits must add up to a multiple of three. Count up to high, minus up to low. It looks right. Does it hold?
Take the range three to ten. Count up to ten, minus the count up to three. That counts the number three, then removes it.
The subtraction finds two. The truth is three: three, six and nine. One number is missing, and it is low.
The range includes low itself. The count up to low includes it too. So subtracting that count removes it. Subtract the count up to low minus one.
Count up to high. Count up to low minus one. Subtract the second from the first. Now the range is complete.
Test a low that qualifies. Test a range of one number. Test a low of one.
Low belongs to the range. So stop the subtraction one below it. Always test a low that qualifies. Then the range is exact. Full breakdown in the lecture.