There is an easy way of converting the prime numbers into a (multi-)deck of cards, that can be memorized using any 2-card system (e.g., shadow-system or ben-system) of your liking. Below, I will use the shadow system to illustrate this method.
Excluding the single digit primes (2, 3, 5, and 7) all primes end in 1, 3, 7, or 9. A number ending in any of these digits either exists in a decade or it does not, so we have 2^4=16 combinations (just like we do suit pairs in 2-card systems.)
To convert the unit digits, we assign the first two (1 and 3) to the left card and the second two (7 and 9) to the right card. We say that we have a \color{blue}black\ suit if the first number exists (e.g., 41, 67, etc.) and a \color{red}red\ suit if it does not exist (e.g., 21, 57, etc.)
Initial values for black and red are \spadesuit and \heartsuit respectively. The second number works like the shift key on your keyboard, except that instead of an uppercase \spadesuit you are looking at a \clubsuit and instead of an uppercase \heartsuit you are looking at a \diamondsuit .
Mappings
\begin{array}{cc|cc|cc} 11&13&17&19&\clubsuit\clubsuit\to K\ (decade\ 01)\\ &23&&29&{\color{red}{\diamondsuit}}\diamondsuit\to K\ (decade\ 02)\\ 31&&37&&\spadesuit\spadesuit\to S\ (decade\ 03)\\ 41&43&47&&\clubsuit\spadesuit\to N\ (decade\ 04)\\ &53&&59&{\color{red}{\diamondsuit}}\diamondsuit\to K\ (decade\ 05)\\ 61&&67&&\spadesuit\spadesuit\to S\ (decade\ 06)\\ 71&73&&79&\clubsuit\diamondsuit\to P\ (decade\ 07)\\ &83&&89&{\color{red}{\diamondsuit}}\diamondsuit\to K\ (decade\ 08)\\ &&97&&{\color{red}{\heartsuit}}\spadesuit\to T\ (decade\ 09)\\ &&&&\ \\ 101&103&107&109&\clubsuit\clubsuit\to K\ (decade\ 10)\\ \end{array}
The mappings of suit pairs to major code letters follows the standard order given in the original post on the shadow-system. We use these for the suit pairs and the card rank is determined by the tenth digit and the unit digit of the decade for the left card and the right card, respectively.
Encoding
A pair starting with a red suit tells us to move to the next location
-
location
\left[ \begin{array}{c|c} \color{gray}{1}\color{black}{0}&A\\ \clubsuit&\clubsuit \end{array} \right] \left[ \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&2\\ {\color{red}{\diamondsuit}}&\diamondsuit \end{array} \right> \to KST, KSN -
location
\left> \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&3\\ \spadesuit&\spadesuit \end{array} \right] \left[ \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&4\\ \clubsuit&\spadesuit \end{array} \right] \left[ \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&5\\ {\color{red}{\diamondsuit}}&\diamondsuit \end{array} \right> \to SSM, NSR, KSL -
location
\left> \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&6\\ \spadesuit&\spadesuit \end{array} \right] \left[ \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&7\\ \clubsuit&\diamondsuit \end{array} \right] \left[ \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&8\\ {\color{red}{\diamondsuit}}&\diamondsuit \end{array} \right> \to SSJ, PSK, KSK -
location
\left> \begin{array}{c|c} \color{lightgray}{1}\color{black}{0}&9\\ {\color{red}{\heartsuit}}&\spadesuit \end{array} \right> \to TSP -
location
\left> \begin{array}{c|c} A&\color{lightgray}{1}\color{black}{0}\\ \clubsuit&\clubsuit \end{array} \right| ...
Note that for the decades 01-09 we need to add a zero to get a value for the left card. It’s okay to use 10 for this purpose, because 10 is not otherwise in use as our last decade will be 99. With 99 decades (read card pairs), we are just shy of 4 decks of cards when compared to a regular 52 deck (i.e., 26 card pairs.)
Decoding
Sequential access
If you want to recite the primes in order (after you’ve said “2, 3, 5, 7, …”), you simply start with the image in the first location. This is no different from putting your recall decks back in order. Say that your first image was “a ghost (KST) scaring your cousin (KSN).”
The decade is K:ST = 01 , so the potential primes are 011, 013, 017, and 019… and of course you can drop the leading zero that we’ve added during encoding. The leading K tells us that the suit pair is \clubsuit\clubsuit, so we have a \color{blue}black\ suit in both cases, so 11 and 17 exist. Also, we are looking at \clubsuit (shifted) not \spadesuit , so both 13 and 19 also exist.
The next decade is K:SN = 02 , so the potential primes are 021, 023, 027, and 029. The leading K tells us that the suit pair is \diamondsuit\diamondsuit , because this time we are in the last position, so we have a \color{red}red\ suit in both cases, so 21 and 27 do NOT exist. But, we are looking at \diamondsuit (shifted) not \heartsuit , so both 23 and 29 do exist.
Direct access
If you want to know if 329 is prime, you first drop the unit digit to get the decade 32. Then you quickly cycle through the 8 suit pairs: S:MN, T:MN, … immediately, you recall a blinking and beeping Simon (SMN) game. This tells us hat the suit pair is \spadesuit\spadesuit, no wait… you also recall that this was the last item in the sequence at that location, so make that \heartsuit\heartsuit instead.
So we have a \color{red}red\ suit in both cases, so 321 and 327 do NOT exist. Also, we are looking at \heartsuit (NOT shifted), so 323 and 329 do NOT exist either. You have thus determined that 329 is not a prime number.
Advantages
Direct
Continuing the above example you can now look at what comes before and after that 80s Simon game to get the masking for the previous (31_) and the next (33_) decade. So even though 329 is not prime, you can say that 317 and 331 are the next prime numbers to the left and the right of 329.
This is similar to the pi matrix challenge where you are given a 5-digit sequence and have to name the 5 digits to the left and the right of it. In both scenarios you are combining direct access followed by sequential access.
The decades within a palace are unique, so you can’t mix them up because there is only one pair of cards 3x 2x, so if you already found the Simon (S:MN) game in the above example, you don’t need to go hunt for Lemons (L:MN) anymore.
Indirect
On a meta level you also have the advantage that you can use your existing 3-digit major system or if you don’t have one, but plan to set one up… you have a nice playground. Obviously, training prime numbers this way will by proxy train your shadow system for cards as well.
Extension
A set of memory palaces
If you want to go past the primes up to 1,000 all you have to do is set up additional memory palaces for each cluster of 1,000 (i.e., 100 decades)… say 9 more to get to 10,000 because you want to start a prime matrix challenge similar to the aforementioned pi matrix challenge. The palace then gives you the millennium.
So if you want to want to know if 4,853 is prime, first you pick the palace for the 5th millennium (4,001 - 5,000) out of your set of palaces. Then you look for the decade 85 by prefixing the suit pairs: SFL, TFL, etc… and you recall Soufflé (SFL) and the fact that it was last in that location. So just like with Simon above, the mask is \heartsuit\heartsuit and 4,851, 4,853, 4,857, 4,859 are all not prime.
Feasibility
The primes up to 10,000 require thus: 10 palaces = 9 x 100 decades + 1 x 99 decades for a total of 999 card pairs, which is equivalent to ~38.5 decks of cards. That is just one deck more than the world record for one hour cards… but nobody said that you have to do it all in one hour. The pi matrix challenge requires 2,000 locations with 5 digits each, which is more than twice as many locations. Conclusion, this is definitely doable with reasonable effort.
Further reading
I’ve discussed this concept of reverse lookup across multiple memory palaces before in this post:
Shortcuts
Sequential access
If you want to save on locations and the overall size of the memory palaces, you can skip prime gaps that span over an entire decade. The examples Simon and Soufflé are two such cases. There is no benefit to encoding them, because ( \begin{smallmatrix} ? & ? \\ \heartsuit & \heartsuit \end{smallmatrix}) card pairs just tell you that there is no primes in the decade and because they are \color{red}red require you to move to the next location.
Direct access
Check to see if the number is divisible by 3 before starting a reverse lookup. Had the number in the Soufflé example been 4,851 instead of 4,853 you could have immediate gotten the answer by quickly adding up all it’s digits. 4+8+5+1=18 which is a multiple of 3, so it can’t be prime. No need to use any memory palaces at all… in fact somebody without your system could have told you that 4,851 is not prime.