The answer would be 381654729 and this is the only one.
I did this two ways, first by working through the equations thennumerically with a program.
First the equations way. Now I found this a bit long and feelthere must be a simpler way.
Let n1 be the first digit, n2 the second ..... n9 the 9th.Let equation 1 be n1, equation 2 be 10*n1 + n2,equation 3 be 100*n1 + 10 * n2 + n3 ...etc
Now look at equation 5, this is divisible by 5. 10,000*n1 + 1,000*n2 + 100*n3 + 10*n4 + n5Each of the first 4 terms is divisible by 5 (as 5|10 ...)Since each is divisible by 5, n5 must also be divisableby 5. The only single digit divisable by 5 is 0 and 5,and 0 is not one of our digits, so n5 = 5.
No looking at equations 2, 4, 6 and 8 each must be divisable by 2 as each is divisable by an even number. Therefore each mustend in an even number. Therefore n2, n4, n6 and n8 must be 2 or 4 or 6 or 8 in some order.Similary each of n1, n3, n7 and n9 must be 1 or 3 or 7 or 9.
Looking at equation 4
Looking at equation 8
Now if n4 and n8 are both either 2 or 6 thenn2 and n6 are either 4 or 8.
Look at equation 6
Now we have 2 possiblities for n4, Lets try bothTry n4 = 2 and n8 = 6.From equation 6, 100*2 + 10*5 + n6 is divisable by 6so n6 is 2 or 8, but can't be 2 as n4 is 2.So n6 = 8 and n2 = 4
now try n4 = 6 and n8 = 2Again solve for equation 6 toget n6 = 4 and n2 = 8
at this point we have two possible partialsolutions as follows
n1 n2 n3 n4 n5 n6 n7 n8 n9 #1 4 2 5 8 6#2 8 6 5 4 2Now we cannot glean anything from equation 1 as all digits are divisable by 1Also we get no information from equation 9as all combinations of the nine digits aredivisable by 9 (clearly :)
Then I ran the following program which alsogave the answer.
#include#include int main(int argc, char *argv[]);void Check(CString front, CString end);int main(int argc, char *argv[]){ Check("", "123456789"); return 0;}// CString is a string class in the Microsoft Foundation Classes(MFC)void Check(CString front, CString end){ if (end.GetLength() > 0) { CString newFront, newEnd; for (int i = 0 ; i < end.GetLength(); i++) { newFront = front + end[i]; newEnd = end.Left(i) + end.Right(end.GetLength()-i-1); Check(newFront, newEnd); } } else { bool valid = true; for (int i = 1; i <= front.GetLength() ; i++) { if (atoi(front.Left(i)) % i != 0) { valid = false; break; } } if (valid) { cout << front << " is a valid combination" << endl; } }}
Back to the Math home page