Ernie is a renowned polyglot. Why just last week I saw him helping out at a Mathematics conference by acting as a simultaneous translator for seven guests who only spoke Hungarian, Icelandic, Swahili, Tongan, Arabic, Cantonese and Basque respectively. So Imagine my surprise last night when we went to a newly opened French Bistro and Ernie had to ask the waiter to translate the blackboard menu, which consisted of very elementary French such as soupe du jour and porc avec pommes de terre. So after a fine main course I asked why he didn't know any French. "Ahh...", he said, with a look of reminiscence on his face, "it may not be fair, but I still blame the Geek Girl for that". Even for Ernie, that was a somewhat opaque statement so I asked him to explain a little more. And this is what he told me...
It all began on day one of my first Senior School Maths Olympiad. On the team for another school I saw the cutest geek girl you could imagine. I was smitten by the way her braces glinted in the sunlight. But the path to true love is not an easy one - I was younger than any of the other contestants and to my dismay she ignored me totally. At lunch time the older students played a game called 'Slice of Pi'. The rules were simple:
The caller would shout out "Slice of Pi" followed by one or more pairs of integers *(p1,q1), (p2,q2)...(pn,qn)*. The responder had to reply with a single string of digits consisting of the *q1* digits of pi starting at the *p1th* place after teh decimal point, concatenated with the *q2* digits of pi starting at digit *p2*,...etc. right out to *qn* digits starting at place *pn*.
"So," I asked, if someone said "Slice of Pi (3,3), (1,1) (7,2) the correct response would be 159165?" Ernie paused for several seconds (longer than I would normally expect for an answer to a simple maths question) and then replied "Correct - and an adjudicator would confirm the answer was right using a paper table of pi from an old maths book". He continued...
One of the boys was almost always the winner. "He has memorized all the digits out to the 200th decimal place", claimed the Geek Girl with a look of adulation on her face. I instantly decided this was my chance to impress her - "Oh that's nothing", I boasted, "I bet I could learn all the way out to the 2000th place by tomorrow morning!" The others laughed in disbelief. "Then we will test you on that tomorrow!" said the team leader.
On my way home in the bus that night I realized what a task I had set myself. Like any sensible engineer I only knew 9 digits of pi and even if I could learn a digit every twenty seconds it would take more than eight hours to memorize the remaining 1991. I also needed to swot up for the next day's Programming Contest and knew that without a good night's sleep my performance would be dismal. But then I found the solution to all my problems in the issue of Popular Science where I found an article on how 'sleep-learning' experiments had been trialed back in the 1950's - as soon as I read the Introduction I was convinced it would work!
By the time I got home I had the plan in place. Luckily, my computer project at my last Junior Olympiad had been text scanning, character recognition, and text to speech translation and I still had the old code. I pulled down my copy of Smith's "The First Million Digits Of Pi", and set my scanner onto it. Then I hacked out a quick routine that would repeatedly loop my text to speech algorithm through the first 2000 digits. My plan was to sleep for 12 hours with the digits playing to my subconscious mind as I slept, via a set of old headphones. The headphones were stereo, so I could play a second soundtrack into my other ear. Once the Pi file was ready I quickly scanned all three Volumes of Knuth's The art of Computer Programming using the same software and set up the Knuth file to play at 10 times normal speed so I could get through most of the series over-night. I got both files ready to run then hacked a 600 second delay in my text to speech program so I could get to sleep before the words began, set my alarm clock for 7:00 am, attached the earphones and fell into a deep sleep. What could possibly go wrong?
Unfortunately, the earphones blocked the sound of the alarm clock so it was 8:30 before I woke up. I had already missed the bus and had to cycle into town so never a chance to check if the sleep-learning had worked. I arrived at the Olympiad and joined the geek girl's team. "Right then", said the team leader, "time for your test Shorty. Let's start with something easy to begin with. Slice of Pi (1,9)". I opened my mouth (after all - I already knew the first 9 decimal places) and blurted out "112345569". I fled from the room in embarrassed. I also fell instantly out of love with the geek girl when I heard her donkey-like bray of laughter pursuing me out the door. It was a year before I was willing to show my face at another Olympiad.
"So the sleep learning didn't work?" I interrupted, "It just confused your mind?". "Not Quite", Ernie replied, and continued...
It took a few hours of investigation to discover what had happened. In my haste the night before I had confused the two files - so in one ear i had been hearing the same short section of Knuth repeated again and again and again all night - and simultaneously a vast number of digits of pi had been fed into my other ear (at 10x normal speed). The sleep learning had worked too well. My mind had absorbed all the digits of pi that I heard, but due to the multiple repetitions a quick-sort algorithm had been driven deep into my unconscious mind. Any time I tried to recollect a sequence of digits of pi (or a group of sequences), my subconscious automatically sorted the digits before relaying them to my conscious mind.
And there was another problem too. That evening I decided to take solace in Proust's 'À la recherche du temps perdu' in which I had been deeply engrossed over the previous few weeks, but was shocked to discover that I couldn't read a word of it. Every atom of the French language had been totally erased! I opened the Pop Sci magazine again and this time read the whole article. There was a short section near the end describing an unfortunate side effect of adding too many new memories in a short time. In some subjects the new memories displaced old memories. In my case all my knowledge of written and spoken French had been deleted!
At that moment I had to stop Ernie - "its a great tale", I said, chuckling with laughter "You almost had me believing you for a minute". "But it's true, Ernie asserted. "Test me if you like, and if it doesn't work like I told you I will buy you a good Whiskey - and to be fair, if it does work then you can shout me a bottle of Brandy."
So I quickly jotted down four numbers on a tissue so I could check them later and asked Ernie for the "Slice of Pi (p1,10), (p2,20), (p3,30), (p4,40)" Ernie paused for a moment and then replied " that would be...
0000000000
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
9999999999
"That's a bit unlikely", I said, "are you sure." "Of course I am!" Ernie replied, "You can check the digits online, if you don't believe me. What's more, if you can work out the minimum number of digits I must have learned to get the answer right, I will buy you a dozen bottles of Whiskey!".
Now I trust Ernie's word implicitly, so have already bought him the brandy, but I would love to get 12 bottles of whiskey in return. I decided to check out the numbers but realized I had left the tissue with the numbers p1, p2, p3, and p4 behind at the restaurant - the only thing I can remember about them was that p1 is less than p2 is less than p3 is less than p4*.
From the information provided can you confirm Ernie's digits could be correct for some p1,p2,p3 and p4, and if so is possible to calculate the minimum possible number of digits he knows?