Others have described the general framework for the design (finite projective plane) and shown how to generate finite projective planes of prime order. I would just like to fill in some gaps.
Finite projective planes can be generated for many different orders, but they are most straightforward in the case of prime order p
. Then the integers modulo p
form a finite field which can be used to describe coordinates for the points and lines in the plane. There are 3 different kinds of coordinates for points: (1,x,y)
, (0,1,x)
, and (0,0,1)
, where x
and y
can take on values from 0
to p-1
. The 3 different kinds of points explains the formula p^2+p+1
for the number of points in the system. We can also describe lines with the same 3 different kinds of coordinates: [1,x,y]
, [0,1,x]
, and [0,0,1]
.
We compute whether a point and line are incident by whether the dot product of their coordinates is equal to 0 mod p
. So for example the point (1,2,5)
and the line [0,1,1]
are incident when p=7
since 1*0+2*1+5*1 = 7 == 0 mod 7
, but the point (1,3,3)
and the line [1,2,6]
are not incident since 1*1+3*2+3*6 = 25 != 0 mod 7
.
Translating into the language of cards and pictures, that means the picture with coordinates (1,2,5)
is contained in the card with coordinates [0,1,1]
, but the picture with coordinates (1,3,3)
is not contained in the card with coordinates [1,2,6]
. We can use this procedure to develop a complete list of cards and the pictures that they contain.
I think it's easier to think of pictures as points and cards as lines, but there's a duality in projective geometry between points and lines so it really doesn't matter. However, in what follows I will be using points for pictures and lines for cards.
The same construction works for any finite field. We know that there is a finite field of order q
if and only if q=p^k
, a prime power. The field is called GF(p^k)
which stands for "Galois field". The fields are not as easy to construct in the prime power case as they are in the prime case.
Fortunately, the hard work has already been done and implemented in free software, namely Sage Math. To get a projective plane design of order 4, for example, just type
PG = designs.ProjectiveGeometryDesign(2,1,GF(4),point_coordinates=0)
PG.blocks()
and you'll obtain output that looks like
[[0,1,2,3,20], [0,4,8,12,16], [0,5,10,15,19], [0,6,11,13,17],
[0,7,9,14,18], [1,4,11,14,19], [1,5,9,13,16], [1,6,8,15,18],
[1,7,10,12,17], [2,4,9,15,17], [2,5,11,12,18], [2,6,10,14,16],
[2,7,8,13,19], [3,4,10,13,18], [3,5,8,14,17], [3,6,9,12,19],
[3,7,11,15,16], [4,5,6,7,20], [8,9,10,11,20], [12,13,14,15,20],
[16,17,18,19,20]]
I interpret the above as follows: there are 21 pictures labelled from 0 to 20. Each of the blocks (lines in projective geometry) tells me which pictures appears on a card. For example, the first card will have pictures 0, 1, 2, 3, and 20; the second card will have pictures 0, 4, 8, 12, and 16; and so on.
The system of order 7 can be generated by
PG = designs.ProjectiveGeometryDesign(2,1,GF(7),point_coordinates=0)
PG.blocks()
which generates the output
[[0, 1, 2, 3, 4, 5, 6, 56], [0, 7, 14, 21, 28, 35, 42, 49],
[0, 8, 16, 24, 32, 40, 48, 50], [0, 9, 18, 27, 29, 38, 47, 51],
[0, 10, 20, 23, 33, 36, 46, 52], [0, 11, 15,
26, 30, 41, 45, 53], [0, 12, 17, 22, 34, 39, 44, 54], [0, 13, 19, 25,
31, 37, 43, 55], [1, 7, 20, 26, 32, 38, 44, 55], [1, 8, 15, 22, 29, 36,
43, 49], [1, 9, 17, 25, 33, 41, 42, 50], [1, 10, 19, 21, 30, 39, 48,
51], [1, 11, 14, 24, 34, 37, 47, 52], [1, 12, 16, 27, 31, 35, 46, 53],
[1, 13, 18, 23, 28, 40, 45, 54], [2, 7, 19, 24, 29, 41, 46, 54], [2, 8,
14, 27, 33, 39, 45, 55], [2, 9, 16, 23, 30, 37, 44, 49], [2, 10, 18, 26,
34, 35, 43, 50], [2, 11, 20, 22, 31, 40, 42, 51], [2, 12, 15, 25, 28,
38, 48, 52], [2, 13, 17, 21, 32, 36, 47, 53], [3, 7, 18, 22, 33, 37, 48,
53], [3, 8, 20, 25, 30, 35, 47, 54], [3, 9, 15, 21, 34, 40, 46, 55], [3,
10, 17, 24, 31, 38, 45, 49], [3, 11, 19, 27, 28, 36, 44, 50], [3, 12,
14, 23, 32, 41, 43, 51], [3, 13, 16, 26, 29, 39, 42, 52], [4, 7, 17, 27,
30, 40, 43, 52], [4, 8, 19, 23, 34, 38, 42, 53], [4, 9, 14, 26, 31, 36,
48, 54], [4, 10, 16, 22, 28, 41, 47, 55], [4, 11, 18, 25, 32, 39, 46,
49], [4, 12, 20, 21, 29, 37, 45, 50], [4, 13, 15, 24, 33, 35, 44, 51],
[5, 7, 16, 25, 34, 36, 45, 51], [5, 8, 18, 21, 31, 41, 44, 52], [5, 9,
20, 24, 28, 39, 43, 53], [5, 10, 15, 27, 32, 37, 42, 54], [5, 11, 17,
23, 29, 35, 48, 55], [5, 12, 19, 26, 33, 40, 47, 49], [5, 13, 14, 22,
30, 38, 46, 50], [6, 7, 15, 23, 31, 39, 47, 50], [6, 8, 17, 26, 28, 37,
46, 51], [6, 9, 19, 22, 32, 35, 45, 52], [6, 10, 14, 25, 29, 40, 44,
53], [6, 11, 16, 21, 33, 38, 43, 54], [6, 12, 18, 24, 30, 36, 42, 55],
[6, 13, 20, 27, 34, 41, 48, 49], [7, 8, 9, 10, 11, 12, 13, 56], [14, 15,
16, 17, 18, 19, 20, 56], [21, 22, 23, 24, 25, 26, 27, 56], [28, 29, 30,
31, 32, 33, 34, 56], [35, 36, 37, 38, 39, 40, 41, 56], [42, 43, 44, 45,
46, 47, 48, 56], [49, 50, 51, 52, 53, 54, 55, 56]]
If you want up to 57 cards you can use GF(7). If you want 58 cards you'll have to use a larger field. Since 8 is a power of a prime, you could use GF(8)
. Note that the projective plane based on GF(8)
will have 8^2 + 8 + 1 =
73 points and 73 lines. You can make 73 cards, but then just throw away 15 of them if you want a set of exactly 58 cards. If you want between 73 and 91 cards you could use GF(9)
, etc. There is no GF(10)
because 10 is not a power of a prime. GF(11)
is next, then GF(13)
, then GF(16)
because 16=2^4
, and so on.
By the way, I have a theory that the original Spot It deck uses 55, not 57, because they contracted a playing card manufacturer which was already tooled for decks of 55 cards (52 regular cards in a deck, plus two jokers and a title card).