DIET PEPSI

While in law school, a local radio station held a contest.  The winner and guest would enjoy a week’s vacation at any Club Med location in North America!

The contest: how many words can you list using the letters in “DIET PEPSI”?

So I started thinking about the problem, and devised a solution that generated 987,654,321 possible combinations.

Here is how I solved it.

[SPOILER ALERT – if you want to try and solve the problem yourself, do not scroll down yet.]

[BIG HINT #1]

I noticed that the phrase “DIET PEPSI” has nine letters.

[BIG HINT #2]

And the solution required that no substitutions be made – this means that you don’t have “DDDD DDDDD” or “PPPP PPPPP” – so far so good?

[SPOILER ALERT – last chance!]

So why not substitute numbers for letters, such as:

  • “D=1”
  • “I=2”
  • “E=3”
  • “T=4”
  • “P=5”
  • “E=6”
  • “P=7”
  • “S=8” and
  • “I=9”.

And then count up from 1 to 987,654,321?

In theory, the list would look something like this:

1 (D), 2 (I), 3 (E), 4 (T), etc. and go all the way up to 987,654, 321 (ISPEP TEID).

To test my idea, I quickly wrote a Turbo Pascal program.  From the test, I determined that my idea worked fine. However, it would take my original IBM PC with an INTEL 8088 CPU running at 4.7 MHz over a month to complete, and the contest was in two weeks.

After checking around, I found a computer I could borrow.  My friend had a COMPAQ PC with an INTEL 80386 CPU running at 20 MHz, and it would only take a week!

So a week later I had my list of 987,654,321 numbers. Next, I deleted all the numbers that contained a zero or duplicated numbers (i.e. eleven, twenty-two, etc.), and then I substituted the numbers for letters.

I took the “alpha” list and imported it into Paradox for DOS – which eliminated all the duplicate “words”.  (The duplicates were a result of the repeated letters – two I’s (#2 and #9), two E’s (#3 and #6), and two P’s (#5 and #7).)

My list was complete and ready to print. The final product generated 128 legal-sized pages with four columns of compressed-print “words.”

I proudly turned in my list to the radio station, and waited for my call that never came.

The announced “winner” worked on the list for about 20 minutes and came up with more words.

Yeah, right. Do I believe that? Nope. I think someone at the radio station wanted to send a friend on a free vacation, and rigged the contest to make it happen.

When I called the radio station to complain, I was told the “decision of the judges is final.”

Hey Pepsi and Club Med – if you find this and want to make it right, I could still use a vacation!

UPDATE

I recently decided to learn the PERL programming language. So, I rewrote my old Turbo Pascal program using PERL instead.

Interestingly, PERL has a shortcut for initializing sequential numbers in an array using a range operator. For example, @variable_example = (1..10), will give load the numbers “1 2 3 4 5 6 7 8 9 10” into @variable_example.

So I tried @variable_example = (1..987654321).

I strongly recommend you don’t do that. I don’t know about you, but it crashed my computer.