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

Home > Probability
Antimagic square (Posted on 2011-07-12) Difficulty: 4 of 5
Let us place at random the digits from 1 to 9 into the cells of 3x3 square.
What is the probability of getting a configuration such that the 8 sums (3 rows, 3 columns and 2 main diagonals) will be represented by 8 distinct numbers?
Construct at least one such square.

Extra challenge:
Same two tasks for 4x4 square , numbers 1 to 16 and 10 distinct sums.

No Solution Yet Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 7

DEFDBL A-Z
DECLARE SUB permute (a$)
CLS
a$ = "123456789": h$ = a$
DO
  a = VAL(MID$(a$, 1, 1))
  b = VAL(MID$(a$, 2, 1))
  c = VAL(MID$(a$, 3, 1))
  d = VAL(MID$(a$, 4, 1))
  e = VAL(MID$(a$, 5, 1))
  f = VAL(MID$(a$, 6, 1))
  g = VAL(MID$(a$, 7, 1))
  h = VAL(MID$(a$, 8, 1))
  i = VAL(MID$(a$, 9, 1))
  n(1) = a + b + c
  n(2) = d + e + f
  n(3) = g + h + i
  n(4) = a + d + g
  n(5) = b + e + h
  n(6) = c + f + i
  n(7) = a + e + i
  n(8) = g + e + c
  good = 1
  FOR i = 1 TO 7
   FOR j = i + 1 TO 8
    IF n(i) = n(j) THEN good = 0
   NEXT
  NEXT
  IF good THEN
    ctGood = ctGood + 1
  END IF
  ct = ct + 1
  permute a$
LOOP UNTIL a$ = h$
PRINT ctGood, ct, ctGood / ct, ct / ctGood

finds

 24960         362880        6.878306878306878D-02       14.53846153846154
 

meaning 24960 of the 362880 possible ways of arranging the 9 digits had all eight totals different, for a probability of approx. 0.06878306878306878  or 1 in 14.53846153846154. The fraction reduces to 13/189.


  Posted by Charlie on 2011-07-12 16:29:00
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 (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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