Work modulo
8 and
125. For
n≥3 we have
2n≡0(mod8), so we need
n≡5n(mod8). If
n is even then
5n≡1, forcing the even number
n to be
≡1(mod8), impossible; so
n is odd,
5n≡5, and
n≡5(mod8). Also
5n≡0(mod125) for
n≥3, so we need
n≡2n(mod125).
The order of
2 is
4 modulo
5, 20 modulo
25, and
100 modulo
125. Since
n≡5(mod8) gives
n≡1(mod4), we get
2n≡2(mod5), so
n≡2(mod5) and hence
n≡17(mod20). Then
2n≡217=210⋅27 ≡(−1)(3)≡22(mod25), so
n≡22(mod25), which with
n≡1(mod4) gives
n≡97(mod100). Finally
210≡24, 220≡76, 240≡26, 280≡51(mod125), so
2n≡297=280⋅210⋅27≡51⋅24⋅3≡47(mod125), giving
n≡47(mod125).
Combining
n≡47(mod125) with
n≡5(mod8) yields
n≡797(mod1000), and
n=1,2 fail by direct check, so the least such
n is
797.