This question is from RMO 1990.

N is a 50 digit number (in the decimal scale). All digits except the 26th digit (from the left) are 1. If N is divisible by 13, find the 26th digit.

Also post a solution, if you do this.

The answer is 3.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

As usual my solution is the worst and involves extreme bashing.I wont even bother to write it up nicely.

Given $N = 1111...a..1$ with $1$ occurring $25$ times before $a$ and $24$ times after it.Expanding it out we get

$N = (10^{49} + 10^{48} + \cdots + 10^{25}) + (a \times 10^{24}) + (10^{23} + \cdots + 1) = \dfrac{10^{25} ( 10^{25} - 1 ) }{9} + a \times 10^{24} + \dfrac{10^{24}-1}{9} = \dfrac{10^{25}( 10^{25}-1) + 9\times a\times 10^{24} + 10^{24} - 1}{9}$ If we use the Geometric Progression Sum formula.

Now clearly $9$ $\mid$ $\text{numerator}$ .Because of Fermat 's Little theorem.We must also have that $13$ $\mid$ $\text{numerator}$ .

Again using FLT we have $10^{12} \equiv 1 \pmod {13}$ . Now u have to use this congruence on the numerator and deduce that $9 \times a \times 10^{24} \equiv 1 \pmod {13}$ . Since we already have $10^{24} \equiv 1 \pmod {13}$ from FLT $\implies 9 \times a \equiv 1 \pmod {13}$ . Since $a$ is a digit thus $0 \leq a \leq 9$ .

Make $10$ cases for $a$ put each one of them and see which one leaves remainder $1$ on division by $13$ .

Clearly $9 \times 3 = 27 \equiv 1 (\mod 13)$ thus answer is $3$ .