# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1605: Every month

From New Scientist #2770, 24th July 2010 [link]

As a novelty calendar, I have made three cubes, and on each of the 18 sides I have painted one different capital letter, with at least one vowel on each cube. These are packed in a rectangular box, on one of whose sides is a picture of how the three cubes might look if laid side-by-side in a row displaying the first three letters of one month: for example, JAN for January. The first three letters of all the remaining months can be formed by shuffling and turning the cubes.

(a) What month is actually on the box?

(b) What other letters, in alphabetical order, are on the cube carrying the N?

[enigma1605]

### 3 responses to “Enigma 1605: Every month”

1. jimrandell 7 January 2012 at 6:32 pm

The following Python program runs in 442ms.

```from itertools import combinations

months = ( 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' )
vowels = ( 'A', 'E', 'I', 'O', 'U' )

# reject: should we reject this cube because it doesn't have exactly one letter for each remaining month
def reject(c, m):
s = set(c)
if not s.intersection(vowels): return True # each cube must have a vowel
for x in months:
if x == m: continue # ignore the missing month
if len(s.intersection(x)) != 1: return True # must be exactly one letter on each cube
return False

# find the missing month
for m in months:
s = set()
for x in months:
if x == m: continue # skip the missing month
s.update(list(x)) # collect the letters from the others
if len(s) > 18: continue # too many letters to fit on three cubes

# so m could be a missing month
# find a way of distributing the other letters so that all other months can be made

# choose six letters for the first cube
for c1 in combinations(s, 6):
if reject(c1, m): continue
c1s = ''.join(sorted(c1))
# and choose six letters for the second cube
for c2 in combinations(s.difference(c1), 6):
c2s = ''.join(sorted(c2))
if not(c1s < c2s): continue
if reject(c2, m): continue
# the third cube is whatever is left
c3 = s.difference(c1, c2)
c3s = ''.join(sorted(c3))
if not(c2s < c3s): continue
if reject(c3, m): continue

print("{m} {c}".format(m=m, c=(c1s, c2s, c3s)))
```

Solution: (a) AUG, (b) E L R T Y.

2. Hugh Casement 18 April 2016 at 9:02 am

Using a ‘brute force’ program in Basic (which I’m sure nobody wants to see) I found that B and F can be swapped, so there are two overall solutions.
I then relaxed the condition that each cube must have a vowel, and found four more.
A, S, and U must go on one cube, M and P on another, E, R, T, and Y on the third.
That allows MAR, APR, MAY, SEP. Clearly J, A, N and so on must be on different cubes.
D and O must go together on the first or second cube, L and N together on the second or third.
It doesn’t help to let U double as V or a sideways C, nor even to misuse C as G: AUG remains impossible.  In fact that follows if both JAN and JUN are to be possible.  The twelve months between them use 19 letters, so something has to give.

• Hugh Casement 30 June 2017 at 11:05 am

In his book The Magic Numbers of Dr Matrix Martin Gardner showed how it can be done with lower-case letters, where n can be turned upside down to make u, and p to make d.
The letters on his three cubes were f g j m o p; a e l t u v; b c n r s y.

This site uses Akismet to reduce spam. Learn how your comment data is processed.