Prime Pairs Plus

This project was inspired by the first video below (and featured in the second!), from the great series Matt Parker's Maths Puzzles. I recommend trying it on paper yourself first: order the numbers from 1 to 9 so that any two next to each other add up to a prime number. This tool finds solutions to this and a range of related problems.

Order the numbers from to

So that every numbers in a row add up to a positive


Total solutions:

Note that the "total solutions" counts each solution and its reverse as different, so you may wish to divide the answer given by two. If you uncheck "count solutions?", the program will stop as soon as it finds one that works. As such, in cases where such a solution exists, it can drastically speed up the calculation time.

Update! Matt mentioned this project in the solution video (at 4:12).