Classic contest, open for good. The 2012 contest is over: its final standings are on the Contest End tab. Records stay open forever, so you can still beat one. Found a bug? Tell us on Discord.
Classic contest · first run 2012

Prime Sums.

Charles must mow his lawn side to side, front to back, and diagonally, and the three mathematicians judging it want a prime cut. Fill an N × N grid with the numbers 1 to N² so its lines add up to primes.

The rules

  • Put the numbers 1 to N² in an N × N grid, each once, for any N from 5 to 29.
  • The grid has 4N lines of N cells: N rows, N columns, and N broken diagonals in each direction. A broken diagonal wraps around the edges, so every diagonal has N cells.
  • A line's score is the sum of its numbers. S is the sum of the distinct line scores that are prime.
  • A grid is valid only if it has exactly 2N distinct prime line scores. The same prime may turn up on more than one line.
  • Every size has two parts. Part 1: make S as big as you can. Part 2: make S as small as you can. One valid grid counts for both.
  • Send the numbers row by row, separated by commas, spaces or new lines.
  • Each part of each size keeps its own record: the biggest S for Part 1, the smallest for Part 2.
  • The contest itself ended in 2012, so there's no running score now: it's all about the records. Match one and you're on its history page; beat one and it's yours.
  • Two leaderboards: you choose one when you send your first grid. By Satellite: any method, AI included. By Lantern: no AI (what counts as AI). You take a short pledge, and if you finish near the top, you explain to the community how you did it. By Lantern entries count on both leaderboards. How the two leaderboards work.

Thanks to André Wauters for the 2012 contest idea, and to Roy van Rijn, who wrote the original scoring code. Dmitry Kamenetsky and Alex Chernov both finished 2012 with a perfect 50, so every record on the board was reached by both of them.

See how it works

The scoring code

As on the original site, here is the code that scores every entry, so you can check your own before you send it. It's written to be easy to read, not fast. Each version reads one entry per line and prints its score. We've checked all six against the site on all 261 of Dmitry Kamenetsky's 2012 grids, plus hundreds of broken ones.