Al Zimmermann's programming contests

Primal Squares

Gordon Lee's puzzle

Introduction

Given a positive integer n, fill the n*n square-grid with digits 0..9 such that as many distinct primes as possible are formed by joining consecutive digits in any horizontal, vertical or diagonal direction, forward or backward. Leading zeros are not taken into account.
See also: http://www.primepuzzles.net/puzzles/puzz_001.htm
http://web.archive.org/web/20041019045340/http://www.primepuzzles.net/puzzles/puzz_001.htm

The Scoring System

Part 1: For every distinct prime number, you get one point.

Part 2: For every distinct prime number, you get points equal to the length of the prime number.
For example, a 3 digits prime will give you 3 points.
Every even digit in the grid gives you one extra point.

The Task

You must submit grids of sizes 3*3 to 19*19 with the highest possible score.

Example:
In the following 3*3 grid:

4 9 2
3 5 7
8 1 6

We can find the following 17 primes:

4 primes with 1 digit: 2, 3, 5, 7
13 primes with 2 digits: 13, 17, 29, 31, 43, 53, 59, 61, 67, 71, 79, 83, 97
There are 4 even digits.

The total score for part 1, n=3, is 17 points
The total score for part 2, n=3, is (4*1)+(13*2)+4 = 34 points

Total Scoring

When you submit a grid, its score is automatically computed for both parts.
Both parts are scored independently. If you do not submit for a particular value of N, you will receive a 0 for that value of N.
On both parts, your score for a particular value of N will be equal to your score divided by the best score of any competitor for that value.
Hence the best total score you can get on each part is 17.

Prizes

First prize for each part is 125$, second prize is 75$ and third prize is 50$.
In case of a tie, the entrant who reached the tied score first wins.

Questions ?
Return to the index