All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Grid Numbers Divisibility (Posted on 2025-01-19) Difficulty: 3 of 5
The 9 spots in a 3×3 grid are filled with distinct digits. Consider the 6 three-digit numbers obtained by reading left to right along rows, or down along columns. All 6 of these numbers are divisible by 6. How many are divisible by 5?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution | Comment 2 of 3 |
Attempt at analytical followed by computer method.

Call the digits:
    a b c
    d e f
    g h i

For each of the 6 3-digit numbers, the first digit cannot be zero, the sum of the 3 digits must be divisible by 3, and furthermore, the final digits [c,f,g,h,i] must each be even.  If those conditions are met, all 6 will be divisible by 6.
The digits [a,b,d,e] must each be odd.

To be divisible by 5, the final digit must be 0 or 5, but 5 is ruled out, since final digits must be even.

The sums of (abc), (def), and (ghi) must each be 0 mod 3.  So the sum of all 9 digits is 0 mod 3.  Given that all 9 digits are distinct, the missing digit must be 0 mod 3.  But the 5 cells in the right column and bottom row must all be even, so the missing digit must be odd and can only be either 3 or 9.

So far, we know that exactly one of [c,f,g,h,i] must be zero.  In 4 of these cases, 1 number is divisible by 5.  But if i=0 then 2 numbers are divisible by 5.


Analytic Method:  assume all ways of placing the 0 into those 5 positions is equally likely (probably not a valid assumption).
Then the number of 3-digit numbers divisible by 5 is the average of [1,1,1,1,2] = 1.2   <--  but this is wrong
    
Computer Method: confirm or refute with brute force program.
The computer program shows that the above assumption was indeed incorrect.
The brute force program shows that the 0 is never in the bottom right corner (i=0 never occurs) and so in each case, there is exactly one number divisible by 5.

Program output showing total, singles, doubles:
64 64 0

----------
from itertools import permutations
ct_all = 0 
ct_one = 0 
ct_two = 0 
evens = '02468'
for p in permutations('0123456789',9):    
    a = int(p[0])
    b = int(p[1])
    c = int(p[2])
    if c % 2 != 0:
        continue
    if (a+b+c) % 3 != 0:
        continue
    d = int(p[3])
    e = int(p[4])
    f = int(p[5])
    if f % 2 != 0:
        continue
    if (d+e+f) % 3 != 0:
        continue
    g = int(p[6])
    if g % 2 != 0:
        continue
    h = int(p[7])
    if h % 2 != 0:
        continue
    i = int(p[8] )
    if i % 2 != 0:
        continue
    if (g+h+i) % 3 != 0:
        continue
    if (a+d+g) % 3 != 0:
        continue
    if (b+e+h) % 3 != 0:
        continue
    if (c+f+i) % 3 != 0:
        continue
    ct_all += 1
    if c==0 or f==0 or g==0 or h==0:
        ct_one += 1
    if i==0:
        ct_two += 1
        print(a,b,c,d,e,f,g,h,i)
print(ct_all, ct_one, ct_two)   

  Posted by Larry on 2025-01-19 10:58:29
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information