This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A380167 #30 Mar 31 2025 12:30:14 %S A380167 1,1,2,3,5,8,12,12,13,14,16,19,23,26,30,36,41,47,54,62,71,81,92,104, %T A380167 117 %N A380167 Maximum number of sets for the SET card game for n cards with 3 properties where each can take 3 values. %C A380167 Also the maximum number of lines for n points in F_3^3 where a line is defined as three points p, q, r such that p+q+r = 0. %H A380167 Justin Stevens and Duncan Wilson, <a href="https://arxiv.org/abs/2501.12565">The Maximum Number of Sets for 12 Cards is 14</a>, arXiv:2501.12565 [math.CO], 2025. %H A380167 Jim Vinci, <a href="https://www.setgame.com/sites/default/files/teacherscorner/SETPROOF.pdf">The maximum number of sets for n cards and the total number of internal sets for all partitions of the deck</a>, 2009. %e A380167 For n=3, the maximum number of SETs with 3 cards is 1 hence a(3)=1. %e A380167 For n=4, no additional SETs can be formed, hence a(4)=1. %e A380167 For n=5, we can take a 3-card SET, say {p, q, r}. Then, for two additional cards, s and t, outside of the SET, the only possible way this can form a SET is if we have one element from the first SET plus s and t form a SET. An example of this with the 4 properties being coordinates from 0 to 2 in mod 3 (in the equivalent definition of a SET) is the points {(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 0, 2), (0, 0, 1, 0), (0, 0, 2, 0)} which form 2 SETs. Hence a(5)=2. %o A380167 (Python) %o A380167 from itertools import combinations %o A380167 def add_mod3(a, b, c): %o A380167 """Component-wise addition mod 3 of two 3D tuples.""" %o A380167 return tuple((a[i] + b[i] + c[i]) % 3 for i in range(3)) %o A380167 def is_set(a,b,c): %o A380167 """Returns true if three elements form a set.""" %o A380167 return add_mod3(a,b,c) == (0,0,0) %o A380167 if __name__ == "__main__": %o A380167 all_points = [(x,y,z) for x in range(3) for y in range(3) for z in range(3)] %o A380167 max_sets = 0 %o A380167 for n in range(3, 28): %o A380167 for comb in combinations(all_points, n): %o A380167 num_sets = 0 %o A380167 for possible_set in combinations(comb, 3): %o A380167 if is_set(possible_set[0], possible_set[1], possible_set[2]): %o A380167 num_sets += 1 %o A380167 if num_sets > max_sets: %o A380167 max_sets = num_sets %o A380167 print("Max sets for %d cards: %d"%(n, max_sets)) %Y A380167 Cf. A090245 for a complementary sequence of the maximum number of cards with no sets. %Y A380167 Cf. A182240 for the number of ways to select n cards which is the search space complexity of this sequence for 4 properties instead of 3. %K A380167 nonn,fini,full %O A380167 3,3 %A A380167 _Justin Stevens_, Jan 22 2025