# The Lucky Number

Lucky numbers are 4 digit numbers that have the following property: they are equal to the sum of the fourth power of their digits. Therefore, they can be expressed as follows:

$$1000a+100b+10c+d = a^4+b^4+c^4+d^4$$

What are all the lucky numbers? Please don’t use computers.

Hints:

Use Euler’s theorem.

Observe that every 4th power is

congruent to one of $$0,1,5,6$$ modulo 10. This is because $$1,3,7,9$$ go to $$1$$ by Euler's theorem, $$2,4,6,8$$ go to $$6$$ since $$2^4=16$$ and $$6^2=36$$, and $$5$$ goes to $$5$$ and $$0$$ goes to $$0$$. This places a lot of restrictions on the sum, and knowing $$d$$ significantly reduces the possibilities for the set $$\{a,b,c,d\}$$.

If one of $$a,b,c,d$$ is $$9$$, then

all the others must be at most $$7$$ (otherwise the RHS is too big), and $$a$$ must be at least $$6$$ (from the LHS) therefore at least $$7$$ (from the RHS).

• If there is a $$7$$, then we must have $$a=9$$, so the other two digits are at most $$4$$ (from the RHS). Here there is

one solution, namely $$9474=9^4+4^4+7^4+4^4$$.

• If there is no $$7$$, then we must have either $$a=6$$ or $$a=9$$; since $$6^4+9^4>7000$$, it must be $$a=9$$. The LHS is over 9000, so the other three numbers must be $$6,6,?$$ or $$6,5,5$$.

There are no possibilities here.

In the remaining cases, none of $$a,b,c,d$$ can be $$9$$. If two of them are $$8$$, then

$$a=8$$ and the other two numbers must be at most $$5$$.

• If there is a $$5$$, then $$8^4+8^4+5^4>8800$$ so $$a=b=8$$.

No possibilities here.

• If there is no $$5$$, then $$8^4+8^4+4^4+4^4<8800$$, so $$b\neq8$$, so $$b\leq4$$. Quickly checking possibilities, we find that

having a $$4$$ isn't workable, nor is having a $$3$$, and indeed the only possibility here is $$8208=8^4+2^4+0^4+8^4$$.

Now we're left with smaller possibilities: none of $$a,b,c,d$$ is $$9$$ and at most one of them is $$8$$.

Modulo $$3$$, we know

$$x^4\equiv1$$ by Fermat's little theorem, so $$a+b+c+d\equiv1$$ if all of $$a,b,c,d$$ are coprime with $$3$$ or if three of them are multiples of $$3$$, $$\equiv0$$ if one of them or all of them are multiples of $$3$$, $$\equiv2$$ if two of them are multiples of $$3$$.

• If three or four of them are multiples of $$3$$, then

there are just three choices for each of the four digits: $$\{0,3,6\},\{0,3,6\},\{0,3,6\},\{1,4,7\}$$ if three are multiples of $$3$$, $$\{0,3,6\},\{0,3,6\},\{0,3,6\},\{0,3,6\}$$ if all four are, and these can be eliminated by hand.

• If exactly one of them is a multiple of $$3$$, then

the other three sum to a multiple of $$3$$, so they must be all the same modulo $$3$$. We have one of $$\{0,3,6\}$$ and either three of $$\{1,4,7\}$$ or three of $$\{2,5,8\}$$. Again these can be eliminated by hand.

• If none of them are multiples of $$3$$, then

one of them is congruent to $$1$$ mod $$3$$ and the other three sum to a multiple of $$3$$ so they must be all the same modulo $$3$$. We have one of $$\{1,4,7\}$$ and either three more of $$\{1,4,7\}$$ or three of $$\{2,5,8\}$$. Again these can be eliminated by hand.

• Finally we have the case where two of the digits are multiples of $$3$$ and two aren't, so

we must have two of $$\{0,3,6\}$$ and two of $$\{1,4,7\}$$. Playing around with the possibilities, we find that the only option here is $$1634=1^4+6^4+3^4+4^4$$.

Overall then, the lucky numbers are

$$1634,8208,9474$$.

• Beautiful explanation! – shanylong Aug 4 at 7:41
• Hi. how did you format proper MathJax in your spoilers? I have tried to do it with \$ but failed. – aminabzz Aug 6 at 21:01
• @aminabzz MathJax should work in exactly the same way inside a spoilertag as outside. What sometimes messes up inside spoilertags is linebreaks - maybe that's what caused your failure? You can click the edit button on this post to see how the formatting is done. – Rand al'Thor Aug 6 at 21:02