Home > Pandiagonal Magic Squares of Prime Numbers > Description

## Pandiagonal Magic Squares of Prime Numbers

### This contest is brought to you by...

The Guest Host for Pandiagonal Magic Squares of Prime Numbers is Natalia Makarova.

### What are pandiagonal magic squares of prime numbers?

A pandiagonal magic square of prime numbers is a square array of primes such that:

• no prime appears more than once, and
• the sum of the primes in every row, column, main diagonal and broken diagonal is the same.

The common sum of each row, column and diagonal is called the magic constant.

This is an example of a 4 x 4 pandiagonal magic square of primes with magic constant 240:

 7 107 23 103 89 37 73 41 97 17 113 13 47 79 31 83

### The Contest

For each value of n from 6 through 20, submit (see How to Enter, below) an n x n pandiagonal magic square of prime numbers with the smallest magic constant you can find. There are thus 15 distinct problems for which you are asked to submit solutions. For database-related reasons, all primes must be less than 9007199254740992 (which I'm sure most of you recognize as 253).

You can submit more than one solution for the same problem, but if you do we count only your best solution. There is no penalty for submitting multiple solutions for the same problem.

See The Scoring System, below, to learn how we determine the winner.

### The Prizes

The prizes for this contest are being provided by the guest host, Natalia Makarova.

First prize, as determined by the scoring system (see below), is \$50.

An additional prize of \$25 will be awarded to the person who breaks the largest number of existing records for the 15 contest problems. In case of a tie, Natalia will determine the winner of this prize. The existing records, as determined by Natalia, are as follows:

nSmallest Known Magic Constant
6450
71597
81584
924237
103594
1118191
128820
131394767
14No known solution
1518231
1648048
175675102246930958811
1854054
197769339597062329721
2065100

### How to Enter

Just paste your magic squares into the large box on the Submit page and click the Submit Entry button. Format your magic squares as follows:

• An individual magic square consists of a comma-delimited list of rows.
• A row consists of a comma-delimited list of primes, enclosed in parentheses.
• Submit multiple magic squares in a single entry by separating them with semicolons. Do not put a semicolon after your last magic square.
• Include spaces and line breaks anywhere you like (except within a number) to improve readability.

For example, if 4 x 4 magic squares were allowed, you could submit the one from above by entering: `(7, 107, 23, 103), (89, 37, 73, 41), (97, 17, 113, 13), (47, 79, 31, 83)`

Do not submit entries under more than one account. This is important. Do not submit entries under more than one account.

### The Scoring System

We give a raw score to each solution you submit. The raw score is the square's magic constant. For instance, if you were allowed to submit solutions for n = 4, the above example would receive a raw score of 240.

Each time you submit a solution we will merge it with your prior solutions, if any. The result will be a virtual entry containing your best solutions for each of the 15 problems. We will give each of these 15 solutions a subscore from 0 to 1 and their sum will be your contest score.

We calculate subscores for the individual solutions as follows. If your solution has the lowest raw score that was submitted for that problem, we give it 1 point; otherwise we give it only a fraction of a point. The fraction is the solution's raw score divided into the lowest raw score submitted by anyone for that same problem.

Let's walk through a simplified example. Suppose that we modify the contest by asking you to submit solutions for values of n from 4 through 6 -- that is, to submit squares of sizes 4 x 4, 5 x 5 and 6 x 6.

Further suppose that we have 3 entrants (Nicole, Morgan and Victoria) and that their best solutions have raw scores as follows:

4 x 4 5 x 5 6 x 6
Nicole 250 450 900
Morgan 230 500 1600
Victoria 240 400 2500

We note the lowest raw score for each problem, as follows:

4 x 4 5 x 5 6 x 6
Lowest Raw Score 230 400 900

Finally, we compute the subscores and contest score for each entrant:

4 x 4 5 x 5 6 x 6 Contest Score
Nicole 230 / 250 = 0.9200 400 / 450 = 0.8889 900 / 900 = 1.0000 2.8089
Morgan 230 / 230 = 1.0000 400 / 500 = 0.8000 900 / 1600 = 0.5625 2.3625
Victoria 230 / 240 = 0.9583 400 / 400 = 1.0000 900 / 2500 = 0.3600 2.3183

If two entrants have the same contest score, we break the tie by giving preference to the entrant whose last improvement was submitted least recently.

First, check the FAQ section below. If you can't find the information you need there, send your question to the discussion group. If your question is of a personal nature, and not of general interest, send an email directly to Al Zimmermann.

### The Discussion Group

If you think you might enter the contest, you should join the contest discussion group. You can join either by sending a blank email here or by visiting the group on groups.io. The discussion group serves two purposes. First, it allows contestants to ask for clarifications to the rules. Be aware that sometimes these requests result in changes to the rules, and the first place those changes are announced is in the discussion group. Second, the discussion group allows contestants to interact with each other regarding programming techniques, results and anything else relevant to the contest.

### My Lawyer Would Want Me To Say This

I reserve the right to discontinue the contest at any time. I reserve the right to disqualify any entry or entrant for any reason that suits me. I reserve the right to interpret the rules as I see fit. I reserve the right to change the contest rules in mid-contest. In all matters contest-related, my word is final.

Can I enter the contest more than once, using different accounts?

No. Submitting entries from more than one account is not permitted.

Can teams enter the contest?

Collaboration is allowed. However, only one of the collaborators may register. If two contestants are found to have collaborated, even if this occurred before one or both registered, both will be disqualified.

What information about my solutions can I share in the discussion group?

There are two types of information that you are forbidden to post. The first is specific solutions. The second is code. You may post scores, so if you want to tell everyone that you got a raw score of 50000 for n = 20 (whether true or not), go right ahead. You may also discuss the algorithms you are using.

How can I find out what my individual subscores are?

You can't. I know this is frustrating, but it's a long standing policy that isn't going to change. Over the years it's been hotly debated in the discussion group and the contest administrator appears to have very strong feelings on the matter. You're going to have to learn to live with it. And I'd think twice before raising the issue yet again.

After I submit a solution, the scorer shows me the solution's "canonical representation". What is that?

After the scorer calculates your raw score it transforms it (by rotating it, reflecting it and/or reordering its rows and columns) to form a standard (that is, canonical) representation. Having canonical representations makes it easier to notice when two seemingly different solutions are fundamentally the same.