Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 75

Can You Crack The Case Of The Crescent Moon?

Riddler Express

Each card is an equilateral triangle with a digit (0099) on each of its three sides, no digit repeated on a card. Two cards are the same if one can be rotated onto the other. How many distinct cards can a deck hold? Extra credit: if a digit may appear two or three times on a card?

Solution

A card is a choice of digits for the three sides, read up to rotation of the triangle. With three distinct digits, first choose the set of three from ten in (103)\binom{10}{3} ways. Each set can be placed on the three sides in 3!=63! = 6 orders, but a triangle has three rotations, so those six orders collapse into 6/3=26/3 = 2 genuinely different cards (the two cyclic orders, clockwise and counter-clockwise). Hence 2(103)=240.2\binom{10}{3} = \boxed{240}. Allowing repeats adds two more kinds of card. A card with one digit on all three sides: 1010 of them. A card with one digit twice and another once: choose the two digits in (102)\binom{10}{2} ways and pick which is doubled (22 choices), and rotation makes the single arrangement unique, giving 2(102)=902\binom{10}{2} = 90. Adding these, 240+90+10=340.240 + 90 + 10 = \boxed{340}.

The computation

Enumerate all digit triples, reduce each to its smallest rotation as a canonical form, and count the distinct ones (with and without allowing repeats).

from itertools import product
def count(allow_repeats):
    seen = set()
    for t in product(range(10), repeat=3):
        if not allow_repeats and len(set(t)) < 3: continue
        seen.add(min(t, t[1:] + t[:1], t[2:] + t[:2]))   # canonical rotation
    return len(seen)
print(count(False), count(True))               # 240, 340