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

Home > General
Cell Choices (Posted on 2013-03-05) Difficulty: 3 of 5
1	8	15	22	29	36	43
2	9	16	23	30	37	44
3	10	17	24	31	38	45
4	11	18	25	32	39	46
5	12	19	26	33	40	47
6	13	20	27	34	41	48
7	14	21	28	35	42	49
In the 7x7 array given above, select six numbers from six cells simultaneously satisfying the following conditions:
  1. No two numbers chosen should belong to the same row;
  2. No two numbers chosen should belong to the same column;
  3. In the set of numbers chosen, each of the ten digits appears once and only once.
For example, if the numbers selected are 7,9,18,26,30 and 45 then this violates the given conditions as 9 and 30 belong to the same row.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution Comment 4 of 4 |
The only way to get 10 digits is with 2 1-digit and 4 2-digit numbers.  Due to the column restriction, there must be one of 1,2,..,7  and one of either 8 or 9.  The numbers 10 to 14 cannot appear.  

The program below finds only one solution:
(6, 8, 17, 25, 30, 49)

---------------------
singles = [i for i in range(1,10)]
doubles = [i for i in range(15,50)]
from itertools import combinations

for sing in combinations(singles,2):
    if 8 not in sing and 9 not in sing:
        continue
    if 8 in sing and 9 in sing:
        continue
    alpha = str(sing[0]) + str(sing[1])
    for doub in combinations(doubles,4):
        numbers = sing + doub
        beta = str(doub[0]) + str(doub[1]) + str(doub[2]) + str(doub[3])
        string = alpha + beta
        if len(set(string)) != 10:
            continue
        rows = [num%7 for num in numbers]
        if len(set(rows)) != 6:
            continue
        cols = [(num-1)//7 for num in numbers]
        if len(set(cols)) != 6:
            continue
        print(numbers,rows,cols)

  Posted by Larry on 2024-02-01 10:24:19
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 (11)
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