Ernie and the Calendar

I had taken an extended summer break over the Christmas New Year period but finally returned to the city at the end of January, feeling relaxed and tanned. I was looking forwards to getting back in touch with friends I hadn't seen in a while so on the following Sunday morning I dropped in on Ernie to see how things were going with him.

"First of February", I commented as I entered the workshop to find Ernie peering into a brass microscope. Ernie looked up to greet me, asked how my break had been, then requested that I tear off the January page on his calendar to get it up to date.

I was happy to assist. But as I ripped off the old page, perched on a stool in order to reach it, I noticed something rather curious. On the January page Ernie had crossed out the N in JAN (with the bright red marker pen he only used when something was "wrong"), so it now appeared as JA. I riffled through the rest of the pages and discovered that this wasn't the only alteration he had made. The last letter G was also scribbled out from AUG to leave AU. He had been even more extreme with FEB, SEP, OCT, NOV, and DEC, which had each been reduced to their first letter - F, S, O, N, and D, respectively. MAR, MAY, and JUL, had been left untouched. But curiously, for the months of April and June, he had added a letter to convert APR to APRI and JUN to JUNE.

Ernie's behavior is considered rather odd at times (by some people), but I have never found his actions to be random or haphazard or arbitrary so I knew there must be some logic behind the alterations. So, being the curious sort, I asked him why he had done this.

"Well, you know how I despise unnecessary redundancy!", Ernie began, "For example, you can distinguish January uniquely from June and July by its first two letters JA, no need for the redundant N. And similarly, February is the only month beginning with an F, so there is no need for the EB. So, I have edited the calendar by getting rid of superfluous letters."

I wasn't totally convinced, "That explains most of your changes", I replied, "but what about the extra letters in APRI and JUNE? I can't see that you need them". Ernie paused for a moment then continued. "The letters ADFJLMNOPRSUY would be enough to identify the names of the months efficiently, but by adding E and I, I can also spell out ERNIE ... and that also helped with the synesthesia."

I remembered Ernie explaining some time ago how some people has a sort of sensory mix-up in their brains and as a result they could "see" letters as colours, or hear tones when they observed colours, or could even taste musical notes. Ernie had a rare condition that meant he could hear numbers - he had told me that, for example, when he scanned the digits of pi they formed a musical progression that sounded like a Bach Toccata ("a lovely melody", he had commented at the time), and that the logarithmic constant e had something of an "oompah-band" theme ("a rather hideous, endless, polka", he had added with a slight wince).

"Also, when I look at a word, if there is a numerical connotation with it, I hear the sound of the associated number. So January (being the first month) always sounds like the number 1, February sounds like 2, and so on to December which sounds like 12. And just to complicate things, when I see a set of words that can be spelled out with 16 letters or less, my mind automatically substitutes a hexadecimal digit for each letter (the same digit for the same letter in each case of course) to convert the words into hexadecimal numbers - and then for each of those numbers my mind plays the sound of one of its divisors in my head. And the problem was that in my original efficient calendar every hexadecimal substitution produced a dreadful disharmony between the two sounds for at least one month!"

Ernie paused for a moment as my mind reeled - sometimes Ernie seemed to have a very complicated life. Then he continued. "But with the extra E and I, everything is nice and harmonic. The letters JA can convert to a hexadecimal number that is divisible by 1, F is divisible by 2, MAR is divisible by 3, and so on right up to D which is divisible by 12. And as an extra bonus, ERNIE is divisible by 13 - which is my second most favorite number."

"Ummm, I see (I think).", I replied. "Is there more than one way to substitute hexadecimal digits for the letters in your calendar that would have the same result?", I asked. "As a matter of fact, there is", Ernie replied, "but my mind always seem to choose the unique substitution that doesn't use the hexadecimal digit 0 and that also also makes my middle name equal to my most favourite number!".

Ernie then told me his what his favourite number was. Unfortunately it has slipped my mind already, but I do remember that he told me it was a prime. If I told you that Ernie's middle name is DAN, do you think there is any way to work out what his favorite number is?

• I absolutely love these puzzles. Never smart enough to solve them though lol. Feb 2, 2015 at 23:25
• "The letters ADFJNMOPRSUY would be enough to identify the names of the months efficiently" — missing "L"? Feb 3, 2015 at 0:32
• No need for an L (which you would only find in April anyway), as A U and P are sufficient to distinguish April AP from August AU. Feb 3, 2015 at 3:55
• How about JUL and JUN? Feb 3, 2015 at 9:03
• Yes of course, my mistake in mis-remembering what Ernie said. Obviously, as you point out (and squemish o must have noticed, the L was required (and had already appeared in the JUL month). Feb 3, 2015 at 9:31

(Hexadecimal digits will be represented as lowercase letters a-f, while the unknown letters will be uppercase.)

We are given:

JA is divisible by 1, F is divisible by 2, MAR is divisible by 3, APRI is divisible by 4, MAY is divisible by 5, JUNE is divisible by 6, JUL is divisible by 7, AU is divisible by 8, S is divisible by 9, O is divisible by 10, N is divisible by 11, D is divisible by 12, ERNIE is divisible by 13, and DAN is prime.

ADEFIJLMNOPRSUY are the digits 123456789abcdef in some order.

We can quickly identify SOND as 9abc respectively. U must be 8, because it can't be 0. Then I must be 4, because it is the last digit left divisible by 4. F and E must both be divisible by 2, so they are 2, 6, or e.

Try each of these values for E and solve for the value of R from ERNIE (ERb4E): 2bb42, 68b46, e2b4e, and efb4e are each divisible by 13. But R cannot be b or 8, because both numbers are already taken. Therefore E is e and R is either 2 or f. F is either 2 or 6.

Testing each remaining value for A, only 5 and f make DAN (cAb) a prime.

We know that JUNE (J8be) is divisible by 6. This requires J to be 3, 6 or f. If J is 6, then L must be 2 for JUL to be divisible by 7. But this leaves no value for F. If J is 3, then L is 7, while if J is f, then L is 1.

If J is f and L is 1, then R is 2, A is 5, and F is 6. But no value is left for M so that MAR is divisible by 3.

If instead J is 3 and L is 7, then regardless of whether A is 5 or f, M and Y must be 2 and d in some order for MAY to be divisible by 5. F must then be 6, and R must be f. A must be 5, and P is 1 by elimination. M must be d for MAR to be divisible by 3, and so Y is 2.

ADEFIJLMNOPRSUY end up corresponding to 5ce6437dba1f982. Ernie's favorite number is hexadecimal c5b, or decimal 3163.

• Correct - that is Ernie's favorite number. Your solution is very nice. I was impressed that your post was up only 2-3 hours after the original question apeared. Feb 4, 2015 at 23:23