URL: https://fivethirtyeight.com/features/how-many-crossword-puzzles-can-you-make/

Riddler Express:

From Tyler Barron, you spin me right round, numbers, right round:

Given a two-character, seven-segment display, like you might find on a microwave clock, how many numbers can you make that are not ambiguous if the display happens to be upside down?

For example, the number 81 on that display would not fit this criterion — if the display were upside down it’d appear like 18. The number 71, however, would be OK. It’d appear something like 1L — not a number.

Approach:

Identify all numbers that can’t be turned upside down:

same if flipped = 0, 1, 2, 5, 8

opposites - 6, 9

not ambiguous: 3, 4, 7

Than, simply create all two digit combinations and mark them as not_ambiguous if either one or both of the digits is not ambiguous.

#  Numbers that can't be turned upside down
not_ambiguous <- c(3,4,7)

#These are not ambiguous since they are the same # upside down
one_offs <- c(00, 11, 22, 55, 88, 69, 96)

combos <- crossing(digit_1 = 0:9,
                   digit_2 = 0:9) %>% 
  mutate(combined = as.numeric(paste0(digit_1, digit_2)),
          not_ambiguous_indicator = if_else(digit_1 %in% not_ambiguous, TRUE, 
                                           ifelse(digit_2 %in% not_ambiguous,TRUE, 
                                                  ifelse(combined %in% one_offs, TRUE,  FALSE))))
total
sum(combos$not_ambiguous_indicator)

Riddler Express Answer:

58 combinations