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

Home > Probability
3x3 Grid Near Magic (Posted on 2009-12-05) Difficulty: 2 of 5
N is a 3x3 square grid which is constituted by using each of the digits from 1 to 9 exactly once.

Determine the probability that the first digit minus the second digit plus the third digit in each row (reading left to right), each column (reading top to bottom), and each main diagonal (reading top to bottom) of N is the same.

See The Solution Submitted by K Sengupta    
Rating: 4.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
A different computer listing. | Comment 3 of 6 |
The program below provides the following set being rotations and reflections of the same set (both Charlie and Daniel offer these too, and with the constant 5).

My use of the program was primarily to determine what could be the possible constants, and how they were formed.

The program is follows very closely a model which Charlie so often uses.

We note that there are 9! permutations for this and with only 8 solutions we therefore the probability of this occurring only 8/9! cases.

 2  1  4
 3  5  7
 6  9  8

 2  3  6
 1  5  9
 4  7  8

 4  1  2
 7  5  3
 8  9  6

 4  7  8
 1  5  9
 2  3  6

 6  3  2
 9  5  1
 8  7  4

 6  9  8
 3  5  7
 2  1  4

 8  7  4
 9  5  1
 6  3  2

 8  9  6
 7  5  3
 4  1  2

OPEN "probgrid.txt" FOR OUTPUT AS #1
CLS

FOR a = 1 TO 9
IF used(a) = 0 THEN
  used(a) = 1
  FOR b = 1 TO 9
  IF used(b) = 0 THEN
    used(b) = 1
    FOR c = 1 TO 9
    IF used(c) = 0 THEN
      used(c) = 1
      FOR d = 1 TO 9
      IF used(d) = 0 THEN
    used(d) = 1
    FOR e = 1 TO 9
    IF used(e) = 0 THEN
      used(e) = 1
      FOR f = 1 TO 9
      IF used(f) = 0 THEN
        used(f) = 1
        FOR g = 1 TO 9
        IF used(g) = 0 THEN
          used(g) = 1
          FOR h = 1 TO 9
          IF used(h) = 0 THEN
        used(h) = 1
        FOR i = 1 TO 9
        IF used(i) = 0 THEN
          used(i) = 1

          s = a - b + c
          t = d - e + f
          u = g - h + i
          v = a - d + g
          w = b - e + h
          x = c - f + i
          y = a - e + i
          z = c - e + g
          IF (s = t AND t = u AND u = v AND v = w AND w = x AND x = y AND y = z) THEN
          PRINT a; b; c
          PRINT d; e; f
          PRINT g; h; i
          PRINT
          PRINT #1, a; b; c
          PRINT #1, d; e; f
          PRINT #1, g; h; i
          PRINT #1,
          END IF

          used(i) = 0
          END IF
          NEXT
        used(h) = 0
        END IF
        NEXT
          used(g) = 0
          END IF
          NEXT
        used(f) = 0
        END IF
        NEXT
      used(e) = 0
      END IF
      NEXT
     used(d) = 0
     END IF
     NEXT
    used(c) = 0
    END IF
    NEXT
      used(b) = 0
      END IF
      NEXT
    used(a) = 0
    END IF
    NEXT

    CLOSE 1








  Posted by brianjn on 2009-12-05 19:31:33
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

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