An EMIRP Game/ Puzzle for Prime enthusiasts

As most math enthusiasts know, EMIRPs are Prime Numbers which are also prime numbers when reversed. Like 17 which when reversed to 71 is also a prime number.

Here is a Game or Puzzle based on 5 digit EMIRPs and borrowing part of Sudoku.

It involves a Grid shown below

The grid has a center BLACK box with 3 x 3 grid. It is surrounded by FOUR RED boxes with 1 x 3 (or 3 x 1) spaces.

The Black box needs to be filled out with numbers 1 thru 9 (NO REPEATS) The RED boxes will be filled out with numbers 1, 3, 7 or 9.

After filling out the numbers all the Rows and all the Columns MUST REPRESENT 5 DIGIT EMIRPS. Also the 3 numbers in the individual RED box cannot repeat, they must be distinct.

Example: Top one is the puzzle/game and bottom one is one answer. ALL 5 digit numbers in the three rows and columns are EMIRPS

There are hundreds of permutations and combinations but if numbers are chosen for the grid you get unique answers.

Here is one puzzle

• I don't see a question in here. Jul 17, 2017 at 16:42
• I guess the puzzle at the end needs solving
– DrD
Jul 17, 2017 at 16:44

One solution I found:
Numbers in bold represent the predefined values.

Strategy.
I took all the 5 digit prime numbers from here

Processed the list (using a simple script that I'm too ashamed to post here) to exclude numbers that have the reversed value not prime, the numbers that have repeating digits between positions 2 and 4 (main 3x3 square in the problem) and the ones that had a 0 in them.
I ended up with 764 numbers (out of 8k+).
Then I brute forced everything.
Just kidding.
I started from the first column in the main 3x3 square.
I needed to find among my numbers the ones that start with 34.
There are 22 of them. I excluded the ones that end in 9 not to contradict the lower side 3x1 rectangle and ended up with 18 of them.
Here is where the semi-brute force started.
I took them 1 by 1 and see what fit. (luckily the fifth fit).
I say it's semi brute force because after selecting a number (let's say 34123), I can easily check the third line that contains the main 3x3 square. I need to find the numbers that start with 92 in this example and have a 9 on the forth position.

I did it the same, semi-brute forcing it.
Now the grid looks like this:

Now I could easily start on the middle column. I have the first (or last) 3 digits of the number I need.

Now the center 3x3 square is missing only 2 numbers. I put them randomly and searched for numbers to fit my criteria.

The rest of the values are easy to fill in because we already have 3 or 4 digits from the numbers so we don't have that many combinations.

If at one point I ran out of numbers I would take a step back and try with the next number that fit the previous step. Classical backtracking.

Bonus:
Here are all the numbers that can be used in such puzzles no matter what the fixed points are. (if someone wants in the future to create other puzzles like this, this answer can be used as reference to not filter the numbers again).

11243 11257 11329 11353 11423 11489 11497 11579 11587 11593
11621 11657 11677 11699 11731 11783 11789 11833 11839 11897
11923 11927 11933 11939 11953 11959 11969 11971 11981 12149
12373 12437 12491 12547 12577 12611 12619 12641 12659 12689
12697 12713 12743 12757 12763 12799 12841 12893 12919 12983
13147 13151 13159 13163 13259 13267 13291 13297 13457 13469
13477 13499 13513 13523 13591 13597 13619 13693 13697 13711
13751 13757 13759 13781 13789 13829 13841 13873 13963 14153
14177 14251 14293 14323 14327 14387 14519 14563 14591 14593
14621 14629 14633 14657 14713 14717 14821 14831 14879 14891
14897 14923 14929 14939 14957 15131 15139 15149 15241 15263
15289 15299 15349 15377 15383 15461 15493 15497 15643 15649
15679 15683 15731 15733 15737 15791 15919 15937 15973 16127
16193 16217 16249 16427 16433 16451 16453 16481 16493 16547
16573 16729 16747 16829 16879 16937 16943 16979 17383 17393
17417 17467 17491 17519 17599 17627 17681 17683 17827 17839
17863 17911 17923 17939 17959 18133 18169 18191 18199 18253
18269 18329 18353 18379 18413 18427 18439 18461 18539 18593
18637 18671 18691 18719 18731 18743 18749 18757 18911 18913
19163 19181 19219 19231 19237 19249 19421 19423 19471 19477
19489 19531 19541 19543 19577 19681 19687 19751 19759 19763
19813 19841

31259 31267 31277 31327 31393 31481 31531 31543 31627 31643
31649 31721 31723 31741 31799 31859 31873 31891 31957 31963
31981 32143 32173 32189 32341 32353 32369 32377 32411 32467
32479 32491 32497 32531 32537 32563 32579 32633 32647 32687
32693 32713 32749 32783 32869 32911 32933 32939 32941 32971
32983 33181 33199 33287 33461 33589 33617 33623 33641 33751
33767 33811 33857 33863 33911 33923 34123 34129 34159 34211
34267 34273 34367 34513 34583 34589 34591 34613 34651 34673
34687 34721 34757 34781 34897 34919 34961 34963 35129 35141
35149 35267 35281 35311 35317 35323 35327 35363 35381 35419
35437 35461 35729 35911 35969 35983 36131 36187 36191 36217
36251 36277 36353 36373 36473 36479 36523 36541 36599 36721
36739 36791 36833 36871 36877 36913 36931 36943 36973 37123
37199 37243 37321 37363 37463 37489 37547 37549 37561 37589
37619 37643 37813 37831 37847 37897 37951 37963 38219 38239
38327 38329 38351 38371 38377 38393 38459 38543 38629 38639
38651 38671 38711 38723 38737 38917 38921 38923 38953 38977
39157 39161 39217 39241 39313 39359 39371 39383 39419 39439
39451 39461 39511 39541 39581 39623 39631 39749 39821 39827
39829 39839 39869 39877

71257 71261 71263 71293 71329 71347 71353 71359 71387 71389
71399 71437 71471 71537 71569 71633 71741 71789 71899 71983
72161 72313 72341 72353 72379 72383 72461 72481 72497 72547
72577 72613 72671 72689 72869 72871 72893 72911 73277 73291
73417 73421 73453 73517 73523 73597 73681 73751 73783 73819
73849 73867 73951 73961 74131 74167 74197 74317 74357 74377
74521 74527 74561 74573 74623 74759 74761 74869 74873 74897
74959 75167 75169 75193 75211 75217 75239 75289 75329 75347
75431 75611 75629 75641 75721 75731 75743 75767 75781 75797
75833 75869 75913 75941 76147 76157 76213 76231 76243 76253
76259 76343 76379 76387 76423 76471 76487 76733 76757 76819
76829 76837 76919 77141 77213 77237 77263 77323 77347 77351
77369 77383 77431 77491 77521 77527 77587 77591 77611 77863
77893 77899 77983 78139 78163 78179 78233 78259 78317 78341
78367 78439 78467 78511 78569 78577 78623 78643 78649 78691
78697 78929 78979 79147 79231 79319 79349 79379 79411 79423
79427 79451 79531 79537 79549 79589 79621 79631 79687 79757
79769 79811 79841 79843 79847 79873

91249 91283 91291 91397 91453 91459 91493 91541 91571 91621
91631 91673 91781 91837 91867 91921 91943 91951 91967 92143
92153 92189 92311 92317 92357 92369 92381 92383 92459 92479
92489 92639 92641 92657 92683 92753 92761 92789 92831 92861
92867 92893 92899 92941 92959 92987 93151 93187 93199 93257
93283 93481 93487 93493 93581 93629 93683 93763 93811 93871
93893 93911 93923 93941 93971 94121 94151 94153 94169 94219
94261 94291 94351 94397 94399 94573 94597 94613 94651 94687
94723 94781 94793 94837 95131 95143 95213 95231 95267 95279
95287 95317 95393 95419 95429 95479 95483 95621 95731 95747
95791 95813 95911 95929 95947 95971 96149 96157 96179 96181
96281 96289 96323 96329 96377 96431 96517 96587 96797 96823
96827 96847 96857 96893 96911 96953 97169 97187 97259 97327
97367 97381 97397 97423 97429 97459 97463 97511 97523 97651
97841 97861 97961 97987 98123 98129 98251 98257 98269 98299
98317 98411 98429 98473 98491 98533 98543 98573 98597 98621
98627 98711 98717 98729 98731 99133 99139 99173 99181 99251
99289 99317 99349 99431 99563 99571 99611 99713 99721 99817
99829 99877
• You da man Marius. This was a hard one
– DrD
Aug 24, 2017 at 10:34