home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!network.ucsd.edu!ucsbcsl!iota!marcos
- From: marcos@iota.Berkeley.EDU (Marcos Valerio)
- Newsgroups: sci.math
- Subject: latin square-like problem
- Keywords: magic squares, latin squares
- Message-ID: <6722@ucsbcsl.ucsb.edu>
- Date: 16 Nov 92 19:38:44 GMT
- Article-I.D.: ucsbcsl.6722
- Sender: root@ucsbcsl.ucsb.edu
- Reply-To: marcos@iota.Berkeley.EDU (Marcos Valerio)
- Lines: 50
-
- I have a nice little problem for you.
-
- I need an algorithm to build n*n latin squares with two extra properties:
-
- P1: All the elements in the main diagonal are different and equal to the row
- (or column) which they belong.
-
- P2: If for each row we select the element equals to row-1, they will all be in
- different columns.
-
- For example:
-
- n=3:
- ----
-
- 0 2 1
- 2 1 0
- 1 0 2
-
- n=5:
- ----
-
- 0 2 4 1 3
- 4 1 3 0 2
- 3 0 2 4 1
- 2 4 1 3 0
- 1 3 0 2 4
-
- Please observe that in both cases the elements in the main diagonal are:
- 0, 1, 2, ..., n-1 and also if we select the Aii-1 elements from each row,
- they are in different columns.
-
- There is no solution for n=4.
-
- In my solution there is a separate algorithm for odd and even numbers, but
- I don't think it is the best one. That's why I'm posting the problem to you.
-
- I came across this problem when trying to simulate broadcast in a ring
- based network. Details can be given upon request.
-
- Thanks,
-
- --
- Marcos de Macedo Valerio
- Center for Distributed Systems
- Department of Computer Engineering
- University of California, Santa Barbara
- Phone : (805) 893-4461 office
- (805) 685-9677 home
- email address : marcos@nu.ece.ucsb.edu
-