Problem:
Let be a fixed positive integer. For a nonempty string of base-ten digits , let be the number of ways to split into contiguous nonempty strings of digits such that the base-ten number represented by each string is divisible by . These strings are allowed to have leading zeroes.
In terms of , what are the possible values that can take?
For example, if , then as the splits and are valid, while the other six splits are invalid.
, 2018
Solution
Solution:
Answer: and for all nonnegative integer
First, we note that and if there are zeroes in the string. Now we show that these are the only possibilities. Note that a split can be added if and only if the string before this split (ignoring all other splits) represents a multiple of (if there is a split before it, then removing the digits before this preceding split is equivalent to subtracting the removed number times a power of , which will also be a multiple of , so the remaining number between the two splits remains a multiple of ). Thus, whether we can add a split or not depends only on the string itself and no other splits, so is if the number is not divisible by and a power of two otherwise.
Want a route through all this instead of an archive? The track
puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.