What will be the one's digit of the remainder in: $\left|5555^{2222} + 2222^{5555}\right|\div 7=?$ What will be the ones digit of the remainder in: $$\frac{\left|5555^{2222} + 2222^{5555}\right|} {7}$$
 A: This is not a solution. I was trying to find out the possible values of $n$ such that $${\underbrace{22\cdots22}_{n\text{ digits }}}^{\underbrace{55\cdots55}_{n\text{ digits }}}+{\underbrace{55\cdots55}_{n\text{ digits }}}^{\underbrace{22\cdots22}_{n\text{ digits }}}$$ is divisible by $7$.
Let $$\underbrace{11\cdots11}_{n\text{ digits }} =\frac{10^n-1}9=M$$ 
Clearly $M$ is odd.
Now, $$(2M)^{5M}+(5M)^{2M}\equiv (2M)^{5M}+(-2M)^{2M}\pmod 7\equiv (2M)^{5M}+(2M)^{2M}=(2M)^{2M}\{(2M)^{3M}+1\}$$ which will be divisible by $7$
if (i) $7\mid \{(2M)^{3M}+1\}\iff 7\mid \{M^{3M}+1\}$ as $2^3\equiv1$
$\iff 7\mid \{\left(\frac{10^n-1}9\right)^{3M}+1\}\iff 7\mid \{(10^n-1)^{3M}+1\}$ as $9^3=3^6\equiv1\pmod 7$
So, we need $(10^n-1)^{3M}\equiv-1\pmod 7\implies (10^n-1)^3\equiv-1$ as $3M\equiv3\pmod {\phi(7)}$ as $M$ is odd.
Taking Discrete Logarithm wrt a primitive root $3\mod 7,$
$3\cdot ind_3(10^n-1)\equiv 3\pmod 6=6c+3$ for some integer $c$
So, $$ ind_3(10^n-1)=2c+1$$
So, $10^n-1\equiv 3^{2c+1}\pmod 7\equiv 3,6,5\iff 10^n\equiv4,6,7\pmod7$
$10^n\not\equiv7\pmod 7$ as $(10,7)=1$
$10^1\equiv3,10^2\equiv3^3\equiv2,10^3\equiv2\cdot10\equiv6,10^4\equiv2^2=4,10^5\equiv2\cdot6\equiv5,10^6\equiv 6^2\equiv1\pmod 7$
So, $n\equiv3,4\pmod 6$
or if (ii)$7\mid (2M)^{2M}\iff 7\mid M^{2M}\implies 7\mid M\implies 10^n\equiv1\pmod 7\iff 6\mid n$ 
So, if $n\equiv0,3,4\pmod 6,$ $${\underbrace{22\cdots22}_{n\text{ digits }}}^{\underbrace{55\cdots55}_{n\text{ digits }}}+{\underbrace{55\cdots55}_{n\text{ digits }}}^{\underbrace{22\cdots22}_{n\text{ digits }}}$$ is divisible by $7$.
A: Hint: $ 5555 \equiv 4 \pmod{7}$, $2222 \equiv 3 \pmod{7}$.  
Edit: Calculate that $4^3 \equiv 1, 3^6 \equiv 1 \pmod{7}$. Hence, this implies that $4^{3k} \equiv (4^3)^k \equiv 1^k \equiv 1 \pmod{7}, 3^{6j} \equiv (3^6)^j \equiv 1^j \equiv \pmod{7}$.
Now, $2222 \equiv 2 \pmod{3}$, and $5555 \equiv 5 \pmod{6}$. Hence, 
$$ 5555^{2222} + 2222^{5555} \equiv 4^{2222} + 3^{5555} \equiv 4^ 2 + 3^ 5 \pmod{7}.$$
A: in this question i would use remainder theorem since 5555 and 2222 are positive integers the expression is positive so we have find remainder of expression (5555^2222+22222^5555) when divided by 7
5555 divided by 7 leaves remainder 4
2222 diided by 7 leaves remiander 3
remainder will be of for 4^2222+ 3^5555
so expression can be written as 16^ 1111+ 243^ 1111 is always divisible by 7
A: ${\rm mod}\ 7\!:\   4^{2222}\!+(-4)^{5555} \equiv 4^{2222}(1-4^{3333})\equiv 4^{2222}(1-(\color{#c00}{2^6})^{1111})\equiv 0\,$ by $\,\color{#c00}{2^6\equiv 1}$
${\rm mod}\ 7\!:\  \ \ a^{k}+\ (-a)^{k+3n} \ \equiv\ \,a^k\, (1\,-\,a^{3n})\ \ \equiv\ \ a^k\, (1\,-\,(\color{#c00}{b^6})^{n})\equiv 0\,$ by $\ \color{#c00}{b^6\equiv 1}\,$ if $\,0\not\equiv a\equiv b^2$
