# Cross Number Math Square with Primes

I am trying to create a puzzle using the prime numbers (from 1 to 50): $2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47$ . No repeats allowed.

I want it to look like this: The other operations can be filled in any way (either + or -). Just to clarify the totals must also be primes from the list.

If it helps, the 2 can be positioned somewhere else.

I have tried for several hours but I can't make one without using repeats or non primes.

If not possible, is it possible to make one using primes from 1-100 instead?

• Can you say anything about why you have the particular constraints you do? E.g., why multiplications rather than +/- in those two places? Jan 11 '18 at 23:02
• I was making this puzzle so that BIDMAS would have been be used somewhere. And the only number this can apply with is the 2. I chose one to be before the 2 and one after.
– Bob
Jan 11 '18 at 23:03
• Only the numbers in the boxes need to be prime right? And not the ones outside the box?
– user44233
Jan 12 '18 at 4:39
• "The other operations can be filled in any way (either + or -)"; so the other operations are not multiplication? Jan 12 '18 at 20:50
• The accepted answer does not have the '2' or operations listed in the image. If these are not required, please edit your question to make this clear. ('other operations' -> 'operations', etc.) Jan 13 '18 at 2:35

2  +  3 * 5  = 17
*     +   +
7  + 47 - 11 = 43
+     -   +
23 + 31 - 13 = 41
=     =   =
37   19   29

2  + 3  *  5 = 17
*    +     +
7  + 47 - 13 = 41
+    -     +
23 + 31 - 11 = 43
=    =    =
37   19   29

• Thank you. How did you find these? Trial and error or did you use some sort of program/code?
– Bob
Jan 12 '18 at 17:09
• I think it almost impossible to find it by hand, because there is no math formula to find it easily, so I use Haskell to find the solution. Jan 13 '18 at 3:00
• Which numbers should I include so that the puzzle is possible to solve without guessing? I was thinking the 3, 17, 23 and 19 - any more?
– Bob
Jan 14 '18 at 1:27
 2 *  3 + 37 = 43
*    +    -
5 -  7 + 19 = 17
+    +    +
13 - 31 + 29 = 11
=    =    =
23   41   47

2 *  3 + 37 = 43
*    +    -
5 - 41 + 47 = 11
+    -    +
7 - 13 + 29 = 23
=    =    =
17   31   19

2 *  3 + 37 = 43
*    +    -
5 - 41 + 47 = 11
+    -    +
19 - 13 + 17 = 23
=    =    =
29   31    7

etc.


These were generated with a python script available here (press run).

• How can I change the code so that I can find puzzles with more than one solution? What I mean is if I have a grid with the operations fixed then there's two possible answers e.g. the accepted answer.
– Bob
Jan 14 '18 at 2:05
• @Bob Here is a (probably rather inefficient) version of the script that generates filled-in squares, then find other numerical solutions with the same operations. Groups of same-operation-squares are preceded by the list of operators they use (horizontal right-down, then vertical down-right order). Jan 14 '18 at 3:40
• Thanks. I ran the code for a while and saw it repeating some solutions. Can this be fixed?
– Bob
Jan 14 '18 at 14:30
• @Bob I updated the link in my other comment Jan 14 '18 at 20:39
• I get the following error: Traceback (most recent call last): File "python", line 15 O,P,Q,R,S,T,U,V,W,X,Y,Z = op_list ^ TabError: inconsistent use of tabs and spaces in indentation
– Bob
Jan 14 '18 at 21:45