Divisibility by $8$ for permutations of numbers 
Moderator's note: This is an on-going contest problem. Per usual protocol the answers have been hidden and the question is locked until after the contest ends. (21.03.2014)

Given an integer $N$. How to check if there is a permutation of digits of integer $N$ that is divisible by $8$?
Example: Let $N = 61$ then answer is "YES" as $16$ is a permutation of $N$ that is divisible by $8$.
What's the best way to check if $N$ can be very large.
 A: Criterion of divisibility by 8: the integer formed with the last 3 digits is divisible by 8.
Now if $N$ is large, try to find 3 digits to create a number with this particularity.
A: We can use a divisibility rule for 8:
Let $n=\ldots a_4a_3a_2a_1$.


*

*If $a_3$ is even, then $n$ is divisible by 8 if $a_2a_1$ is divisible by 8.

*If $a_3$ is odd, then $n$ is divisible by 8 if $a_2a_1$ is divisible by 4 but not 8.


The two digit numbers divisible by 8 are

00, 08, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,

and the two digit numbers divisible by 4 but not 8 are

04, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84, 92.

Thus a number with three or more digits has a permutation by its digits that is divisible by 8 if it


*

*contains a pair of digits present in the first list and at least one other digit that is even,


or if it


*

*contains a pair of digits present in the second list and at least one other digit that is odd.


Thus the number 6295 has such a permutation (9256), since it contains the digits 6 and 5 (as in 56) and the even number 2.
By the way, this would be soo much easier if we were checking for divisibility by 3 ;P
