10
$\begingroup$

Quite a few years ago (I can't remember the date but it was obviously some time after I first met Ernie at a New Years Eve party in 2001) I got an unexpected phone call late one afternoon. It was Ernie. He told me that it was his wedding anniversary and he had secretly bought two tickets to see the famous psychic Madame Mu as a surprise for his wife. Unfortunately, his wife was called out of town on unexpected business wouldn't be able to attend. Ernie was in need of company, so if I wanted to see the show with him, I should turn up at the Palais no later than 8.30 pm that evening.

I arrived in time to meet Ernie and we entered the auditorium . The lights dimmed and the curtain rose to show Madame Mu, dressed in a scarlet robe and emerald turban, standing center-stage. The show was very entertaining. A search-light would raster across the audience before stopping on someone who would be invited to speak with Madame Mu. She would ask them to introduce themselves and then, by "communing with the spirit world", she would reveal various facts about them.

About halfway into the show, the spot-light landed on Ernie, who rose and walked down to the stage. He introduced himself as an inventor and amateur mathematician, and Madame Mu announced she would attempt something "a little special" here and would try to "channel the great German mathematician, Carl Fredrich Gauss". The lights dimmed, Madame Mu slumped slightly - seemingly in deep meditation - there was a short pause, then she raised her head again.

enter image description here

"Good evening Ernest", said Mu/Gauss in a strong German accent, "let me entertain you with a little mind reading and lightning calculation". The following conversation then took place:

Mu/Gauss: "If you concatenate the day (1..31), month (1..12), and year of your birth (4 digits), in that order, you will get a number divisible by 7. Correct?".

Ernie: "That is true - but there is a 1 in 7 chance it would be true for any random birthday".

Mu/Gauss: "If you concatenate the year, month, and day of your birth, in that order, you will get a number divisible by 11. Correct?".

Ernie: "Correct".

Mu/Gauss: "If you concatenate the month, day, and year of your birth, in that order, you will get a number divisible by 13. Correct?".

Ernie: "Correct - and only about 1 in 1000 you could get that right by chance".

Mu/Gauss: "If you add together, those three numbers you just calculated plus your age in whole years, you will get a prime."

Ernie (after a short pause for calculation): "You're right again - the calculation works as you say!"

Mu/Gauss: "And by an amazing coincidence, the same five facts are also true for your father - correct?"

Ernie (after another pause): "Amazing - all true!"

Mu/Gauss: "Thank you Ernest, please return to your seat and enjoy the rest of the show. But as you go, can you confirm your father is currently twice your age in years?"

Ernie: (returning to his seat) "In whole years, yes, that's true."

Later Ernie told me exactly how Mu did her trickery: something to do with internet searches, a hidden radio earpiece, and an accomplice with a "top model clockwork calculator", but that isn't the mystery of this story. As you probably know by now, I'm great at recollecting conversations, but hopeless at remembering numbers. I want to send Ernie a card on his next birthday. I can't remember the date but believe there is sufficient information in this story to calculate not only is date of birth. Can you help me?

PS - As an added note, it may help to know that Ernie's father is alive and well and nothing out of the ordinary in years of age.

ADDENDUM: in case it isn't clear, according to what Ernie told me after the show "those three numbers" refer to the three numbers divisible by 7, 11, and 13 respectively, not the three numbers that make up the date.

$\endgroup$
  • $\begingroup$ Does January count as "01" or just "1"? $\endgroup$ – mdc32 Nov 24 '14 at 3:12
  • $\begingroup$ As Mu/Gauss says in her first question "the day (1..31),", so in answer, strip off any leading zeros before concatenating. $\endgroup$ – Penguino Nov 24 '14 at 3:15
  • $\begingroup$ Also, does whole years refer to the integer part of the year or the year rounded? $\endgroup$ – mdc32 Nov 24 '14 at 3:21
  • 1
    $\begingroup$ So DMY is divisible by 7, YMD by 11, MDY by 13, while DMY + YMD + MDY is prime and DMY + YMD + MDY + age is perfect square? $\endgroup$ – SQB Nov 24 '14 at 11:09
  • 1
    $\begingroup$ So for instance, if Ernie was born on 9 December 1966, we'd have 9121966 (divisible by 7), 1966129 (divisible by 11), and 1291966 (divisible by 13) which would fit, but their sum would be 12380061, which is divisible by 3, so not a prime and not the right date. Is that correct? If so, an exhaustive search from the late 19th century to the early 21st, yields no candidates. $\endgroup$ – SQB Nov 24 '14 at 11:16
5
$\begingroup$

After the new information, it seems possible to find a valid solution after also using the calculation for the dad.

The birthday is:

21/06/1985

while the events in the story happened in the year:

2013

and his father's birthday is:

11/12/1957

Explanation for all the conditions:

2013 - 1985 = 28 => 28*2 = 56 => 2013-56 = 1957 ::: This makes the dad twice as old.
2161985 is divisible by 7
1985621 is divisible by 11
6211985 is divisible by 13
2161985 + 1985621 + 6211985 = 10359591 + 28 = 10359619 => prime number

I wrote quite a long, poorly written/formatted and probably completely inefficient SAS program for it, but it worked and gave me the results. :)

$\endgroup$
  • 1
    $\begingroup$ "All correct", as Ernie might say. Guess it was easier after I fixed the question. That shows the dangers of doing the calculations on one PC and then writing the question on another one entirely. $\endgroup$ – Penguino Nov 25 '14 at 1:00
4
$\begingroup$

Ernie was born on

9 December 1966

  • DMMYYYY: 9121966 is divisible by 7 (9121966 = 7 × 1303138).
  • YYYYMMD: 1966129 is divisible by 11 (1966129 = 11 × 178739).
  • MMDYYYY: 1291966 is divisible by 13 (1291966 = 13 × 99382).
  • YYYY + MM + D: 1966 + 12 + 9 = 1987 (prime number)
  • The next perfect square larger than 1987 is 2025 = 45², so Erwin's age was 2025 - 1987 = 38, and the show was in 2004 or 2005.

I found this result by running a script over all possible date combinations between 1950-01-01 and 1999-01-01.

$\endgroup$
  • $\begingroup$ I believe you got it wrong on your last point. Adding 3 numbers together will bring you to 1987. Adding his age will bring the number to a perfect square (2025). However, 2025 minus 1987 is 38, not 45. $\endgroup$ – FortMauris Nov 24 '14 at 6:58
  • $\begingroup$ @FortMauris just seen that, thanks for your comment. $\endgroup$ – GOTO 0 Nov 24 '14 at 7:00
  • $\begingroup$ Your answer is the right one. I forget to check the last part which is to add his age to his birthyear and see if it passes 2001. $\endgroup$ – FortMauris Nov 24 '14 at 7:02
  • $\begingroup$ @FortMauris Another option is 9 April 1920. That would make Erwin 92 and his father dead. Even with my result I can't make much sense of the father's age. $\endgroup$ – GOTO 0 Nov 24 '14 at 7:19
  • $\begingroup$ I can't make this fit for his father: "the same five facts are also true for your father" and "your father is currently twice your age in years"; what's his father's date of birth? $\endgroup$ – user5971 Nov 24 '14 at 10:57
4
$\begingroup$

I believe his birthday is:

1956/4/27 (27 April 1956)

I arrived at this answer after looking up the possible primes and the nearest perfect square possible for any human to be alive.

This is what i have found:

45 x 45 = 2025 (Nearest perfect square for human kind to be alive at 20th century)

I then looked up on prime numbers nearest to this number, subtracted the numbers to find the possible age that can be multiplied by 2 and still be alive (his dad) and found the following numbers:

1979 1987 1993 1997 2003.

The rest is just coding, running from 1950 up all the way to 2014. :)

EDIT

My answer is wrong. Look at GOTO 0's solution.

$\endgroup$
4
$\begingroup$

The answer is what GOTO 0 said. Since I'm learning Python, I also used a script to figure out the answer for some practice. One tricky part is deciding between

27 April 1956 and 9 December 1966.

They both work when the age is 38. Using the two dates 1956 and 1966, Ernie's age in 2001 could have been either 45 or 35, respectively. He had to have been 35 if this event happened when he was 38, so his birth date is 9 December 1966.

The Python script is included below for anyone interested. It should run as is if it is copied and pasted into a .py file. Cheers!

print 'So when was Ernie born?'

# determines if a number is a perfect square
def is_square(apositiveint):
    x = apositiveint // 2
    seen = set([x])
    while x * x != apositiveint:
        x = (x + (apositiveint // x)) // 2
        if x in seen: return False
        seen.add(x)
    return True

# determines if a number is prime
def isprime(n):
    '''check if integer n is a prime'''
    # make sure n is a positive integer
    n = abs(int(n))
    # 0 and 1 are not primes
    if n < 2:
        return False
    # 2 is the only even prime number
    if n == 2: 
        return True    
    # all other even numbers are not primes
    if not n & 1: 
        return False
    # range starts with 3 and only needs to go up the squareroot of n
    # for all odd numbers
    for x in range(3, int(n**0.5)+1, 2):
            if n % x == 0:
                return False
    return True

# This is where the magic happens... 
days = xrange(1, 32)    # 1-31
months = xrange(1,13)   # 1-12
years = xrange(1900, 2020)  # 1900-2019
ages = xrange(10,99)    # 10-98

# These are possible dates that might solve the riddle
possibleDates = []

# boolean flag
dateIsBad = False

for year in years:
    for month in months:
        for day in days:
            for age in ages:

                date = str(day) + ' ' + str(month) + ' ' + str(year)
                ageAndDate = 'age = ' + str(age) + ' date = ' + date

                concat1 = int(str(day) + str(month) + str(year))
                if concat1 % 7 != 0:
                    dateIsBad = True

                concat2 = int(str(year) + str(month) + str(day))
                if concat2 % 11 != 0:
                    dateIsBad = True

                concat3 = int(str(month) + str(day) + str(year))
                if concat3 % 13 != 0:
                    dateIsBad = True

                number1 = day + month + year
                if isprime(number1) and is_square(number1 + age):
                    pass
                else:
                    dateIsBad = True

                if not dateIsBad:
                    print 'found one! ' + ageAndDate
                    possibleDates.append(ageAndDate)

                # reset the boolean flag
                dateIsBad = False

print possibleDates
$\endgroup$
  • $\begingroup$ Nice work! I used PHP to do mine. Having code knowledge is a ++ :D $\endgroup$ – FortMauris Nov 24 '14 at 9:01
  • 1
    $\begingroup$ General hint: If you want to see how someone did something in their post, click edit under their post. (Just don't submit the edit after you figure it out). $\endgroup$ – Dennis Jaheruddin Nov 24 '14 at 10:34
2
$\begingroup$

I always pictured Ernie as kind of a Doc Brown: an eccentric, older inventor.

But as it turns out, he's only

29

now, since he was

28

when this happened, in

late 2013 or the first half of 2014.

You see, he was born on

the 21st of June, in 1985.

His father was born on

the 11th of December, in 1957.

The show with Madame Mu took place some day between

his dad's latest birthday (that day included), and his own latest birthday (that day excluded), or to be exact: [11 December 2013 - 20 June 2014]. During that period, he was 28 while his father was (and still is) 56.


I verified this using a rather long SQL query because why not, and you can do a lot more in SQL than you may think. I added prime factors to check for until I was down to one set of dates, which I checked on WolframAlpha.

I know there already is an answer, but I did this independent of it, and looking at the answer now, I see I'm a bit more precise on when the events took place.

WITH
   dates AS (
      SELECT
         TRUNC(SYSDATE) AS today,
         TO_DATE('20011231', 'YYYYMMDD') AS nye
      FROM dual
   ),
   days AS (
      SELECT today - LEVEL AS that_day
      FROM dates
      CONNECT BY LEVEL <= 50000
   ),
   day_nrs AS (
      SELECT
         that_day,
         TO_NUMBER(
               TO_NUMBER(TO_CHAR(that_day, 'DD')) 
            || TO_NUMBER(TO_CHAR(that_day, 'MM')) 
            || TO_CHAR(that_day, 'YYYY')
         ) AS dmy,
         TO_NUMBER(
               TO_CHAR(that_day, 'YYYY') 
            || TO_NUMBER(TO_CHAR(that_day, 'MM')) 
            || TO_NUMBER(TO_CHAR(that_day, 'DD'))
         ) AS ymd,
         TO_NUMBER(
               TO_NUMBER(TO_CHAR(that_day, 'MM')) 
            || TO_NUMBER(TO_CHAR(that_day, 'DD')) 
            || TO_CHAR(that_day, 'YYYY')
         ) AS mdy
      FROM days
   ),
   valid_days AS (
      SELECT
         nr.that_day AS dob,
         nr.dmy,
         nr.ymd,
         nr.mdy,
         TRUNC(MONTHS_BETWEEN(dd.that_day, nr.that_day) / 12) AS age,
         dd.that_day AS mu_day
      FROM day_nrs nr
      CROSS JOIN days dd
      CROSS JOIN dates d 
      WHERE nr.that_day <= d.nye
        AND MOD(nr.dmy,  7) = 0
        AND MOD(nr.ymd, 11) = 0
        AND MOD(nr.mdy, 13) = 0
        AND dd.that_day > d.nye
   ),
   ages AS (
      SELECT 
         ernie.dob AS dob_ernie,
         ernie.age AS age_ernie,
         TRUNC(MONTHS_BETWEEN(d.today, ernie.dob) / 12) AS curr_age_ernie,
         daddy.dob AS dob_daddy,
         daddy.age AS age_daddy,
         TRUNC(MONTHS_BETWEEN(d.today, daddy.dob) / 12) AS curr_age_daddy,
         MIN(ernie.mu_day) AS min_date,
         MAX(ernie.mu_day) AS max_date
      FROM valid_days ernie
      JOIN valid_days daddy
         ON (   ernie.dob > daddy.dob 
            AND ernie.mu_day = daddy.mu_day
            AND ernie.age * 2 = daddy.age)
      CROSS JOIN dates d 
      WHERE MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age,  2) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age,  3) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age,  5) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age,  7) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 11) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 13) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 17) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 19) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 23) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 29) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 31) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 37) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 41) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 43) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 47) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 53) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 59) <> 0
        AND MOD(ernie.dmy + ernie.ymd + ernie.mdy + ernie.age, 61) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age,  2) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age,  3) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age,  5) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age,  7) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 11) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 13) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 17) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 19) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 23) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 29) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 31) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 37) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 41) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 43) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 47) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 53) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 59) <> 0
        AND MOD(daddy.dmy + daddy.ymd + daddy.mdy + daddy.age, 61) <> 0
      GROUP BY
         ernie.dob,
         daddy.dob,
         ernie.age,
         daddy.age,
         d.today
   ) 
SELECT
   min_date,
   max_date,
   dob_ernie,
   age_ernie,
   dob_daddy,
   age_daddy,
   curr_age_daddy
FROM ages
WHERE curr_age_daddy <= 120
ORDER BY
   min_date,
   max_date;
$\endgroup$
  • $\begingroup$ I'm glad that you had a picture of Ernie in your mind - it means that these questions are achieving one of my aims (even if he didn't quite match your expectations). My plan has always been to slowly develop a feasible character over time. Who knows what secrets may be revealed in the future. $\endgroup$ – Penguino Nov 26 '14 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.