Question 8

Let $$n$$ be the smallest integer such that the sum of digits of $$n$$ is divisible by $$5$$ as well as the sum of digits of $$(n+1)$$ is divisible by $$5$$. What are the first two digits of $$n$$ in the same order?


Correct Answer: 49

Let $$S(x)$$ denote the sum of the digits of an integer $$x$$.

Given: $$S(n)$$ is divisible by $$5$$ and $$S(n+1)$$ is also divisible by $$5$$.

If the last digit of $$n$$ is not $$9$$, then adding $$1$$ simply increases the digit-sum by $$1$$: $$S(n+1)=S(n)+1.$$ Two consecutive multiples of $$5$$ cannot differ by $$1$$, so the last digit must be $$9$$. Hence $$n$$ ends with at least one $$9$$.

Suppose $$n$$ ends with exactly $$k$$ consecutive $$9$$’s:
$$n=\dotsc\,d\,\underbrace{99\ldots9}_{k\text{ times}}$$ where $$d$$ (the digit just before the block of $$9$$’s) is $$0\le d\le 8$$.

When we add $$1$$:
• each of those $$k$$ digits $$9$$ becomes $$0$$ (loss of $$9k$$ in the digit-sum),
• the digit $$d$$ becomes $$d+1$$ (gain of $$1$$ in the digit-sum).
Thus

$$S(n+1)=S(n)+1-9k\tag{1}$$

Both $$S(n)$$ and $$S(n+1)$$ are multiples of $$5$$, so their difference must also be a multiple of $$5$$. Using (1):

$$1-9k \equiv 0 \pmod{5} \; \Longrightarrow\; 1-4k \equiv 0 \pmod{5} \; \Longrightarrow\; 4k \equiv 1 \pmod{5}.$$

The inverse of $$4$$ modulo $$5$$ is $$4$$ (since $$4\cdot4=16\equiv1$$), giving

$$k \equiv 4 \pmod{5}.$$

The smallest positive $$k$$ is therefore $$k=4$$. So the least possible $$n$$ must end with exactly four $$9$$’s:

$$n=\dotsc\,d\,9999.$$

Let the digit-sum of all more significant digits (if any) before $$d$$ be $$P$$. Then

$$S(n)=P+d+9\cdot4=P+d+36,$$ $$S(n+1)=P+(d+1).$$

Because $$36\equiv1\pmod5$$, the condition $$S(n)\equiv0\pmod5$$ becomes

$$P+d+1\equiv0\pmod5 \;\Longrightarrow\; P+d\equiv4\pmod5.\tag{2}$$

To obtain the smallest integer $$n$$ we keep the number of leading digits minimal. Thus take no extra digits before $$d$$, i.e. $$P=0$$. Equation (2) simplifies to $$d\equiv4\pmod5$$ with $$0\le d\le8$$. The smallest such $$d$$ is $$d=4$$.

Therefore

$$n=49999.$$

Verification: $$S(49999)=4+9+9+9+9=40$$ and $$S(50000)=5$$, both multiples of $$5$$. Hence $$49999$$ is indeed the least integer satisfying the given condition.

The first two digits of $$n$$ are $$49$$.

Answer: 49

Get AI Help

Book Free CAT Mentorship

Get personalized CAT strategy from a 99%iler

500+ students mentored
CAT mentor
banner

banner

50,000+ JEE Students Trusted Our Score Calculator

Predict your JEE Main percentile, rank & performance in seconds

Ask AI