Of all 5-digit integers, how many of them are multiples of 2, 3, 4, 5, 6, 7, 8, 9 for each 5-digit integer? Thank you.
The easiest and simplest way of finding out the integers in question is simply to multiply the small primes by each other to see if you can get 5-digit numbers. That is : 2, 3, 5, 7. The problem is that it is time consuming, since you have to try many different exponents such as: 2^3 x 3^2 x 5 x 7^2 =17640, which is divisible by 2, 3, 4, 5, 6, 7, 8, 9.......etc.
Since, it would take some time to find them all, I wrote a small computer program to accomplish the same task, execept it takes the computer a few milliseconds to find them:
a=1;b=0;c=0;d=0;e=0;p=0; cycle:n= a*10000+b*1000+c*100+d*10+e;if(n%2==0 and n%3==0 and n%4==0 and n%5==0 and n%6==0 and n%7==0 and n%8==0 and n%9==0, goto loop, goto next); loop:printn,", ",;p=p+1; next:e++;if(e<10, goto cycle, 0);e=0;d++;if(d<10, goto cycle, 0);e=0;d=0;c++;if(c<10, goto cycle,0);c=0;d=0;e=0;b++;if(b<10, goto cycle,0);e=0;d=0;c=0;b=0;a++;if(a<10, goto cycle,0);print"Total = ",p
OUTPUT =( 10080 , 12600 , 15120 , 17640 , 20160 , 22680 , 25200 , 27720 , 30240 , 32760 , 35280 , 37800 , 40320 , 42840 , 45360 , 47880 , 50400 , 52920 , 55440 , 57960 , 60480 , 63000 , 65520 , 68040 , 70560 , 73080 , 75600 , 78120 , 80640 , 83160 , 85680 , 88200 , 90720 , 93240 , 95760 , 98280)> Total = 36