Prime Pairs Plus

This project was inspired by the below video in the series Matt Parker's Maths Puzzles. I recommend trying it yourself first: order the numbers from 1 to 9 so that any two next to each other add up to a prime number. The below 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).