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.)
Monte Carlo simulation of 4x4 probability Comment 7 of 7 |

Monte Carlo simulation of 4x4 probability:

DEFDBL A-Z
DECLARE SUB permute (a$)
CLS
a0$ = "123456789abcdefg": h$ = a$
DO
  src$ = a0$: a$ = ""
  FOR ii = 1 TO 16
    r = INT(RND(1) * LEN(src$) + 1)
    a$ = a$ + MID$(src$, r, 1)
    src$ = LEFT$(src$, r - 1) + MID$(src$, r + 1)
  NEXT
  a = INSTR("123456789abcdefg", MID$(a$, 1, 1))
  b = INSTR("123456789abcdefg", MID$(a$, 2, 1))
  c = INSTR("123456789abcdefg", MID$(a$, 3, 1))
  d = INSTR("123456789abcdefg", MID$(a$, 4, 1))
  e = INSTR("123456789abcdefg", MID$(a$, 5, 1))
  f = INSTR("123456789abcdefg", MID$(a$, 6, 1))
  g = INSTR("123456789abcdefg", MID$(a$, 7, 1))
  h = INSTR("123456789abcdefg", MID$(a$, 8, 1))
  i = INSTR("123456789abcdefg", MID$(a$, 9, 1))
  j = INSTR("123456789abcdefg", MID$(a$, 10, 1))
  k = INSTR("123456789abcdefg", MID$(a$, 11, 1))
  l = INSTR("123456789abcdefg", MID$(a$, 12, 1))
  m = INSTR("123456789abcdefg", MID$(a$, 13, 1))
  n = INSTR("123456789abcdefg", MID$(a$, 14, 1))
  o = INSTR("123456789abcdefg", MID$(a$, 15, 1))
  p = INSTR("123456789abcdefg", MID$(a$, 16, 1))
  n(1) = a + b + c + d
  n(2) = e + f + g + h
  n(3) = i + j + k + l
  n(4) = m + n + o + p
  n(5) = a + e + i + m
  n(6) = b + f + j + n
  n(7) = c + g + k + o
  n(8) = d + h + l + p
  n(9) = a + f + k + p
  n(10) = d + g + j + m
  good = 1
  FOR ii = 1 TO 9
   FOR jj = ii + 1 TO 10
    IF n(ii) = n(jj) THEN good = 0
   NEXT
  NEXT
  IF good THEN
    ctGood = ctGood + 1
  END IF
  ct = ct + 1
  PRINT ctGood; ct, ctGood / ct
LOOP

when stopped after running for a while, the last line of stats was:


461307  2080538             .2217248615502336

which would be consistent with a probability of 2/9, and of course many other possible fractions.

 

 


  Posted by Charlie on 2011-07-13 12:00:48
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 (12)
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