## Magic Sudoku

Everything about Sudoku that doesn't fit in one of the other sections

### Magic Sudoku

I'm delighted to share with you my discovery of magic Sudoku, a Sudoku which contains at least one 3x3 normal magic square anywhere in the solution grid (9x9), http://www.muljadi.org/MagicSudoku.htm.

If you find any magic squares in Sudoku, could you please e-mail me the solution grid?

Posts: 4
Joined: 15 July 2005

Paul,

1. Well done, that is the sort of thing that I like people to notice

2. Your hyperlink does not work because of the full stop you added at the end. To save you editing your post, I'll post the correct hyperlink here:

George
george-no1

Posts: 150
Joined: 20 May 2005

### Re: Magic Sudoku

muljadi wrote:I'm delighted to share with you my discovery of magic Sudoku, a Sudoku which contains at least one 3x3 normal magic square anywhere in the solution grid

"Magic sudokus" are easy to construct: take any ordinary sudoku and then relabel the digits to leave a magic square in the middle (say) of the grid.

You could go further and make a sudoku with 3 (but no more) magic squares in it. Here's one of a family of 283576 sudokus that have your particular 3x3 in each of the boxes on the leading diagonal:
Code: Select all
`492|163|578357|289|641816|745|239    <--- was ...|...|349 but now corrected (thanks george)---+---+---673|492|185281|357|964945|816|723---+---+---538|671|492164|928|357729|534|816`

Or you could be more ambitious. Take this, for example:
Code: Select all
`492|681|573357|249|168816|735|924---+---+---573|168|492168|924|357924|573|816---+---+---681|492|735249|357|681735|816|249`
This contains your 3x3 magic grid in three of the boxes. In the remaining 6, each mini-row/col and one mini-diag sums to 15. And finally, each of the two long diagonals contains all of the digits 1-9.
Last edited by Red Ed on Sat Jul 16, 2005 6:17 am, edited 1 time in total.
Red Ed

Posts: 633
Joined: 06 June 2005

### Re: Magic Sudoku

Red Ed wrote:492|163|578
357|289|641
816|745|349
---+---+---
673|492|185
281|357|964
945|816|723
---+---+---
538|671|492
164|928|357
729|534|816

Perhaps this is not at all relevant to your point, Red Ed, but this particular Su Doku is invalid, as you can see from the numbers I have marked in red. For the sake of completeness, I will try to work out how to make it valid and I will post the corrected example here later.

However, your second example is superb!

George
george-no1

Posts: 150
Joined: 20 May 2005

Here it is:

492 l 163 l 578
357 l 248 l 169
816 l 975 l 234
===========
561 l 492 l 783
289 l 357 l 641
743 l 816 l 925
===========
678 l 531 l 492
124 l 689 l 357
935 l 724 l 816

George
george-no1

Posts: 150
Joined: 20 May 2005

Is it possible to have all 9 boxes be magic squares?
Moschopulus

Posts: 256
Joined: 16 July 2005

Moschopulus wrote:Is it possible to have all 9 boxes be magic squares?
No, the max is three boxes: the middle digit of any 1-9 magic square is always 5, so you can't have more than one magic square in any horizontal/vertical line of three boxes.

PS: george - thanks for pointing out the typo.
Red Ed

Posts: 633
Joined: 06 June 2005

As Ed notes, construction of "magic sudokus" really is trivial by relabelling any ordinary sudoku. More interesting would be to insist that the magic squares didn't entirely lie within one 3x3 block, being spread over 2 or even 4 blocks. How many magic squares would it be possible to fit into a valid grid then? One could hope that (apart from the 5s at the edge of the grid) as many of the other 5s lie at the centre of a 3x3 magic square as possible.

Frazer
frazer

Posts: 46
Joined: 06 June 2005

### Magic Sudoku

frazer wrote:As Ed notes, construction of "magic sudokus" really is trivial by relabelling any ordinary sudoku. More interesting would be to insist that the magic squares didn't entirely lie within one 3x3 block, being spread over 2 or even 4 blocks. How many magic squares would it be possible to fit into a valid grid then? One could hope that (apart from the 5s at the edge of the grid) as many of the other 5s lie at the centre of a 3x3 magic square as possible.

Frazer

Correct. The keyword here is 'anywhere' in the solution grid.

And the magic doesn't end here. I also discovered that the n-queens problem in chess is related to magic squares because the magic constant of the n-queens problem is also the order-n magic constant for n > 3,

If we have 16x16 Sudoku, we can look for the 4x4 n-queens patterns, for example. Therefore, 16x16 or higher-order Sudoku is related to both normal magic squares and n-queens problem.

Posts: 4
Joined: 15 July 2005

frazer wrote:More interesting would be to insist that the magic squares didn't entirely lie within one 3x3 block, being spread over 2 or even 4 blocks. How many magic squares would it be possible to fit into a valid grid then?
You can fit 5 magic squares into the grid, but it has to be the same magic square in each case and subject to strict positional constraints (unless there's a hideous bug in my code ...). It actually works out quite nicely:

1. pick one of the eight 1-9 magic squares, call it M, and place it in the middle of the grid.

2. now place a copy of M in the top row band indented by 1 or 2 places from either the left or right side of the grid (4 choices). Place another copy of M in the bottom row band, idented by the *same* amount from the other (right or left) side of the grid.

3. place a copy of M in the lefthand column stack idented by 1 or 2 places from the 'free' end (top or bottom) of that stack (your only choice is the indentation level; not top/bottom). Finally, place your last copy of M in the righthand column stack indented by the *same* amount.

That's 8 x 4 x 2 = 64 choices. For example:
Code: Select all
`...|..4|38....|..9|51.438|..2|76.---+---+---951|438|...276|951|438...|276|951---+---+---.43|8..|276.95|1..|....27|6..|...`

Now all you need to do is fill in the remaining cells. Turns out, for each of the 64 possible arrangements, there is always precisely one way of completing the grid. Here's the solution for the partial grid above:
Code: Select all
`519|764|382762|389|514438|512|769---+---+---951|438|627276|951|438384|276|951---+---+---143|895|276695|127|843827|643|195`

This is fun ... beats Harry Potter any day
Red Ed

Posts: 633
Joined: 06 June 2005

So, could you make a Magic Square Su Doku puzzle, which would be a standard-looking Su Doku that's unsolvable in the normal way, but can be solved if you know there's a magic square in the middle? Or if you know there's a magic square in it somewhere, but aren't told where?
PaulIQ164

Posts: 533
Joined: 16 July 2005

PaulIQ164 wrote:So, could you make a Magic Square Su Doku puzzle, which would be a standard-looking Su Doku that's unsolvable in the normal way, but can be solved if you know there's a magic square in the middle? Or if you know there's a magic square in it somewhere, but aren't told where?

Exactly! In fact if you don't *need* the additional information, I don't see the point. One should also be able to create a Magic Sudoku with fewer than the record 17 clues for a standard puzzle.
tso

Posts: 798
Joined: 22 June 2005

### Re: Magic Sudoku

frazer wrote:As Ed notes, construction of "magic sudokus" really is trivial by relabelling any ordinary sudoku
Correct. The keyword here is 'anywhere' in the solution grid.

Paul, I really don't think you're telling us anything new here. I wouldn't object except that you've inserted this trivial observation, with your name against it, in the Sudoku entry of Wikipedia! Come on now, a little self-restraint (and removal of the Wikipedia insert) might be in order ...
Red Ed

Posts: 633
Joined: 06 June 2005

The "magic square" aspect is a red herring as ANY specific sequence could be used.

A Sudoku could be created that could NOT be solved without using the additional information from ANY stipulation such as any of these:
-- "The central square in the solution MUST will be a magic square."
-- "At lease ONE of the 9 boxes will hold a magic square."
-- "There will be a 3x3 magic square SOMEWHERE in the solution, not necessarily restricted to a single box."
-- "The central column will have all it's digits in sequential order."
-- "Exactly one row or column will have all its digits in sequential order."
-- "NO row or column will have all its digits in sequential order."
Especially interesting would be a puzzle with letters rather than numbers that could NOT be solved with out using the additional information that a 9 letter word -- that is NOT given -- will be spelled out -- either in a specified row or anywhere in the grid. The puzzle as given might NOT even have all 9 letters in the initial grid. (Yes, we've all seen Sudoku with letters in place of numbers, some of which spell out words, but I've yet to see one that still couldn't be solved if you converted the letters back to numbers -- they don't *require* the solver to use the fact that they are letters and must form a word.) A real genius might create a Word Sudoku with DUAL solutions -- the word that is spelled out in one solution being an anagram of the one spelled in the other!
tso

Posts: 798
Joined: 22 June 2005

I just want to praise Red Ed for showing all the elegant grids like the one with magic squares in 3 boxes and 6 almost magic ones in the remaining boxes with 2 perfect long diagonals. Just wonder is it the unique one with all these features (barring those which are essentially the same)?

Also, I think the 64 5-magic-square grids you shown could be essentially grouped into 3:

Code: Select all
`+ 4 9 2 + + + + ++ 3 5 7 + + 4 9 2+ 8 1 6 + + 3 5 7+ + + 4 9 2 8 1 6+ + + 3 5 7 + + +4 9 2 8 1 6 + + +3 5 7 + + 4 9 2 +8 1 6 + + 3 5 7 ++ + + + + 8 1 6 ++ 4 9 2 + + + + ++ 3 5 7 + + + + ++ 8 1 6 + + 4 9 2+ + + 4 9 2 3 5 74 9 2 3 5 7 8 1 63 5 7 8 1 6 + + +8 1 6 + + 4 9 2 ++ + + + + 3 5 7 ++ + + + + 8 1 6 ++ + 4 9 2 + + + ++ + 3 5 7 + + + ++ + 8 1 6 + 4 9 2+ + + 4 9 2 3 5 74 9 2 3 5 7 8 1 63 5 7 8 1 6 + + +8 1 6 + 4 9 2 + ++ + + + 3 5 7 + ++ + + + 8 1 6 + +`

All of the remaining 61 can be transformed into one of these 3 by repeatedly applying rotation, reflection and substitution. Have I mistaken or not?

Anyway I love elegant and unique/rare number patterns like these so do post some more if there are. Cheers.
udosuk

Posts: 2698
Joined: 17 July 2005

Next