Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: (Golf) mobile phone numbers - words

by tachyon (Chancellor)
on May 29, 2001 at 18:14 UTC ( [id://83934]=note: print w/replies, xml ) Need Help??


in reply to (Golf) mobile phone numbers -> words

Hi, I don't know about in the US but in AUS we have 10 digit moblile numbers. Given that each number has 3 possible letters you might use in round numbers the search space is 59049 letter combinations per number

Unfortunately the generation of the test keys is not *particularly* straight forward. Using my ten digit scenario for each of the 59049 test cases we might have:

one word (a) where a=10 letters

two words (a,b) where a+b=10 letters,

three words (a,b,c) where a+b+c = 10 letters

.....

ten words (a..j) where a+b+c+d+e+f+g+h+i+j=10 letters If you remember the binomial expansion (as I vaguely do - it was a while ago) you will remember the pyramid:

1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1

What this shows us is that while there is obviously only one test case for a ten letter match there are 9 possibilities for an a+b=10 letter match, 36 possibilities for an a+b+c=10 letter match....

Adding this up we find that there are 512 possibilities we need to consider for each of the 59049 10 letter combinations. The total search space is 30,233,088. I thought this might take a long time but that was when I thought it would be a somewhat larger search space. Should be doable in under a minute of CPU time.

more to follow...

tachyon

Replies are listed 'Best First'.
(tye)Re: (Golf) mobile phone numbers - words
by tye (Sage) on May 29, 2001 at 18:38 UTC

    The number of possible letter arrangements is 3**10, or 59,049, not anywere near 3e10! But even if there were 3e10 possible arrangements, that doesn't matter. You need to search the dictionary so instead of generating some huge list of possible words and then searching the dictionary to see if any of them are in it, instead go through the dictionary and see if any of the words would match the phone number!

            - tye (but my friends call me "Tye")

      Hi tye, lost the plot in the translation from 3exp10 as I wrote to decimal. Register error. I failed to register my error!

      To absolve myself from moronicity I will have to code a respnse now. Damn you (red baron)! I just hate it when people point out my calculations are a *mere* 50805 orders of magnitude off.

      Despite that fundamental error the basic binomial point is valid. For any ten digit number we are most likely to find a solution from several small words rather than one big word:

      For example, here are some 10 letter possibilities:

      Colt Firearms: very-big-gun; rat-a-tat-tat; you-are-dead;

      Perl Security: the-perl-kid; perl-hacker; naughty-boy; the-perl-man; perl-secure; now-at-intel; perl-busted; lawyer-crap; in-hot-water; im-ok-for-now; just-call-us; dont-foobar; we-know-perl;

      Perl lyrics: p-p-p-p-p-p-perl; shes-my-baby;.....p-p-p-perl, I don't mean maybe.

      Losing the plot: sleep(rand*28800)

      tachyon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://83934]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-26 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found