Digit Reversal and Divisibility by 10

THE PROBLEM

Let f(n)f(n) be a function that reverses the digits of nn. For example, f(112)=211f(112)=211 and f(100)=001=1f(100)=001=1. Find the number of positive integers m≤100m\le100 such that f(m)+mf(m)+m is divisible by 1010.

Difficulty: Olympiad Prequalifier · ★★☆☆☆
Source: Olympiad Prequalifier Practice Set
Topics: Number Theory · Digit Manipulation · Modular Arithmetic
Answer: 1010


THE KEY IDEA

You never need to actually reverse the number. The last digit of f(m)f(m) is simply the first digit of mm. Since divisibility by 1010 depends only on the units digit, only the first and last digits of mm matter — everything in between is irrelevant.


THE SOLUTION

Let the first digit of mm be aa and its last digit be bb.

When we reverse the digits, the digit aa moves to the units place. So the units digit of f(m)f(m) is aa, while the units digit of mm is bb. Therefore,

m+f(m)≡a+b(mod10).m+f(m)\equiv a+b\pmod{10}.

For m+f(m)m+f(m) to be divisible by 1010, we needa+b≡0(mod10).a+b\equiv0\pmod{10}.

Since a≥1a\ge1, b≥0b\ge0, and both are digits,1≤a+b≤18.1\le a+b\le18.

The only multiple of 1010 in this range is 1010, soa+b=10.a+b=10.

Now count by number of digits.

Case 1: One-digit numbers

For m=1,2,…,9m=1,2,\dots,9, we have a=b=ma=b=m. Thus,a+b=2m.a+b=2m.

This equals 1010 only when m=5m=5.

So there is 1 such number.

Case 2: Two-digit numbers

For m=10,11,…,99m=10,11,\dots,99, we needa+b=10,a+b=10,

wherea∈{1,…,9},b∈{0,…,9}.a\in\{1,\dots,9\},\qquad b\in\{0,\dots,9\}.

For every choice of aa, there is exactly one valid choiceb=10−a.b=10-a.

Thus there are 9 such numbers.

Case 3: m=100m=100

Here a=1a=1 and b=0b=0, soa+b=1≠10.a+b=1\ne10.

Thus there are 0 such numbers.

Adding the cases,1+9+0=10.1+9+0=10.

Therefore,10\boxed{10}


WHY THE OBVIOUS APPROACH IS SLOW

The natural instinct is to compute f(m)f(m) for every m=1,2,…,100m=1,2,\dots,100, add it to mm, and check divisibility by 1010. That is 100 reversals and 100 additions — slow, error-prone, and completely unnecessary.

The problem only asks about divisibility by 1010, so only the units digit of the sum matters. And the units digit of f(m)f(m) is controlled entirely by the first digit of mm. The middle digits never enter the calculation.


THE INSIGHT

When a problem involves divisibility by 1010, immediately isolate the units digit. If a complicated operation such as digit reversal appears, ask:

Which digits of the original number actually affect that units digit?

Usually, most of the number is irrelevant. This same instinct applies to any “last digit” or “mod 1010” problem — reduce the problem to the digits that matter before computing anything.


GENERALIZATION

What if we replaced 1010 with 99?

Then we would needa+b≡0(mod9),a+b\equiv0\pmod9,

and the count would change because a+ba+b can now equal 99 or 1818. The structure of the argument is identical — only the arithmetic of the digit sum changes.

This works because9∣10−1,9\mid10-1,

so digit sums control divisibility by 99. For a general modulus kk, the units digit alone is usually not enough; the useful digits depend on the modulus.


CHALLENGE

Find the number of positive integers $m < 10^4$ such that $m + f(m)$ is divisible by 9.

Scroll to Top