# Thread: Sudoku 4 by 4 combination lister?

1. ## Sudoku 4 by 4 combination lister?

I am trying to make a c++ program to list all possible combinations for a 4x4 sudoku square. This is how a 4x4 sudoku works (if you don't already know),

You have 16 numbers that make a square, each one is a different number 1-16. All numbers in row, column, and diagonal have to add up to 34, and the 4 squares have to add up to 34. Example:

1 4 14 15
13 16 2 3
8 5 11 10
12 9 7 6

So I'm trying to make a program that will find all the possible combinations, store them in a multidimensional array, and then print out a few of them to make sure it works.

Does anybody have any tips for me on how I could accomplish this? Or has anybody made/could make a program that already does this that I could look off of and learn from?

Thanks a lot.

2. This has nothing to do with a Sudoku or even a part thereof. They never involve suming up values, they only have to be unique per square.
I suggest changing your thread title (if possible).

3. I believe that is called a magic square. I remember there was a nice tutorial on how to list them recursively (and what optimizations and shortcuts are available), but I haven't been able to find it lately.

Popular pages Recent additions