# what's this maths puzzle doing in my craft cupboard?

March 29, 2013 10:42 PM Subscribe

So, I am making a quilt and have a puzzle. I am kind of copying this one.

It is seven by seven squares. I have six squares each of seven colours, and seven squares of one colour. Obviously the final colour needs to be in every row, and the other colours need to be in all-but-one row each. I don't want any of the same colours directly next to each other, or directly diagonal to each other.

I have been spending the afternoon with a pen and trial and error, but is there a better way? And what about in the future, when I have 18 colours and 400 squares?

Computer people, would this be easy to write a program for? Or does something like this already exist? I am sure I'm not the only quilty person who would say a big thank you.

It is seven by seven squares. I have six squares each of seven colours, and seven squares of one colour. Obviously the final colour needs to be in every row, and the other colours need to be in all-but-one row each. I don't want any of the same colours directly next to each other, or directly diagonal to each other.

I have been spending the afternoon with a pen and trial and error, but is there a better way? And what about in the future, when I have 18 colours and 400 squares?

Computer people, would this be easy to write a program for? Or does something like this already exist? I am sure I'm not the only quilty person who would say a big thank you.

AAAAAAAA BCDEFGHI HIBCDEFG FGHIBCDE DEFGHIBC BCDEFGHI HIBCDEFGOr what irishcoffee said, on preview

posted by sbutler at 11:18 PM on March 29, 2013

sbutler, I believe the A's should also be non-adjacent and non-diagonal. (I'm fiddling with it manually in excel, but don't have a good pattern yet.)

posted by ceribus peribus at 11:21 PM on March 29, 2013

posted by ceribus peribus at 11:21 PM on March 29, 2013

Ohh, yeah. For some reason I read it as "the final color needs to be the final row". n/m

posted by sbutler at 11:22 PM on March 29, 2013

posted by sbutler at 11:22 PM on March 29, 2013

1 6 3 8 5 7 4

2 7 4 1 6 8 5

3 8 5 2 7 1 6

4 1 6 3 8 2 7

5 2 7 4 1 3 8

6 3 8 5 2 4 1

7 4 1 6 3 5 2

(Seven #1's, six each of #2-#8)

That was just from making coloured squares in excel and manually shuffling it for a while. An algorithm could be programmed, but I fear you'd end up with a very random looking solution.

posted by ceribus peribus at 11:33 PM on March 29, 2013

2 7 4 1 6 8 5

3 8 5 2 7 1 6

4 1 6 3 8 2 7

5 2 7 4 1 3 8

6 3 8 5 2 4 1

7 4 1 6 3 5 2

(Seven #1's, six each of #2-#8)

That was just from making coloured squares in excel and manually shuffling it for a while. An algorithm could be programmed, but I fear you'd end up with a very random looking solution.

posted by ceribus peribus at 11:33 PM on March 29, 2013

Here's a modification to sbutler's pattern that fits all the constraints:

HBCDEFG

FGABHDE

DHFGABC

BCDEFHA

GAHCDEF

EFGABCH

CDEHGAB

Alternately, if you don't want color H (the eighth one, which you have seven of) in the corner, you can cut off the bottom three rows and shift them to the top.

posted by baf at 11:35 PM on March 29, 2013

HBCDEFG

FGABHDE

DHFGABC

BCDEFHA

GAHCDEF

EFGABCH

CDEHGAB

Alternately, if you don't want color H (the eighth one, which you have seven of) in the corner, you can cut off the bottom three rows and shift them to the top.

posted by baf at 11:35 PM on March 29, 2013

2nd attempt. Lay it out as if you have 7 squares each of 7 colors and no 8th color. Do what irishcoffee suggested:

I think that works.

posted by sbutler at 11:35 PM on March 29, 2013

ABCDEFG FGABCDE DEFGABC BCDEFGA GABCDEF EFGABCD CDEFGABNow, take one square from each row and replace it with your 8th color, X, going through A for the first row, B for the second, etc.

XBCDEFG FGAXCDE DEFGABX BCXEFGA GABCDXF EXGABCD CDEFXAB

I think that works.

posted by sbutler at 11:35 PM on March 29, 2013

Essentially what you want is a 7 x 7 Latin square which you can then do sbutler's replacement algorithm on.

There are lots of Latin squares!

Here is a somewhat obscure link to 7x7 Latin squares: you have to scroll down to the bottom and click through the links that say 4-1 etc. what you will then see is various 7x7 Latin squares (with the property that if you stack them on top of each other, no square in the stack will have the same pair of numbers. Which might be interesting for future quilt designing.)

posted by leahwrenn at 12:28 AM on March 30, 2013

There are lots of Latin squares!

Here is a somewhat obscure link to 7x7 Latin squares: you have to scroll down to the bottom and click through the links that say 4-1 etc. what you will then see is various 7x7 Latin squares (with the property that if you stack them on top of each other, no square in the stack will have the same pair of numbers. Which might be interesting for future quilt designing.)

posted by leahwrenn at 12:28 AM on March 30, 2013

Can you apply irishcoffee's shift-two-spaces strategy to a trip around the world construction? Trip around the world blocks are indeed stupid easy to make, so they might be the way to go in your 18 colors/400 squares scenario.

posted by clavicle at 6:29 AM on March 30, 2013

posted by clavicle at 6:29 AM on March 30, 2013

When you get the the larger quilt, where the rows are longer than 7 squares, to guarantee that you won't repeat, you pick a "shift" number that has no factors in common with the number of squares in the row. (You're clear with 7 because 7 is prime.)

Example: If you had 18-square rows, and shifted 3 each time, you would have

posted by Wulfhere at 11:35 AM on March 30, 2013

Example: If you had 18-square rows, and shifted 3 each time, you would have

**six**distinct rows, but your 7th row would be the same as the first (since 6x3=18.) If, instead, you shifted**five**, each of your 18 rows would be distinct, since 5 has no factors in common with 18.posted by Wulfhere at 11:35 AM on March 30, 2013

This thread is closed to new comments.

posted by irishcoffee at 11:16 PM on March 29, 2013