Can a monkey type Shakespeare's works by only using words randomly appearing from the digits of Pi
? I think it's a challenge...
But perhaps we can use Pi
to define a restricted subset of the English Language....
Here is a function (MonkeyPiWords[nLetters, wordLength]
) that takes Pi
and generates the random english words that can be conjured up from Pi
's digits. nLetters
are generated from Pi
in the sequence they are derived from the digits fo Pi
, and then all english words of wordLength
letters long from that sequence (in order, partitioned in sets wordLength
letters long) are returned (taking into account tht the algorithm has an ambiguity of 3 positions for where to start).
So the challenge is to take the vocabulary returned by this for a fixed number of input letters and write a significant story with only those words...
Here is a function to define the problem: (Note: see bug fixed version later in this thread)
MonkeyPiWords[nLetters_Integer, wordLength_Integer] :=
Module[{characteCodes, characteCodesRules, piDigitsAsCharacterCodes1,
piDigitsAsCharacterCodes2, piDigitsAsCharacterCodes3,
monkeyCharacters1, monkeyWords1, monkeyCharacters2, monkeyWords2,
monkeyCharacters3, monkeyWords3, monkeyWords},
characteCodes = ToCharacterCode["abcdefghijklmnopqrstuvwxyz"];
characteCodesRules =
Thread[Range[Length[characteCodes]] -> characteCodes];
piDigitsAsCharacterCodes1 =
Mod[#, 26] & /@
FromDigits /@
Partition[First[RealDigits[N[\[Pi], 3 nLetters]]], 3] /.
characteCodesRules;
piDigitsAsCharacterCodes2 =
Mod[#, 26] & /@
FromDigits /@
Partition[Rest@First[RealDigits[N[\[Pi], 3 nLetters]]], 3] /.
characteCodesRules;
piDigitsAsCharacterCodes3 =
Mod[#, 26] & /@
FromDigits /@
Partition[Rest@Rest@First[RealDigits[N[\[Pi], 3 nLetters]]],
3] /. characteCodesRules;
monkeyCharacters1 = FromCharacterCode /@ piDigitsAsCharacterCodes1;
monkeyWords1 =
StringJoin /@ Partition[monkeyCharacters1, wordLength];
monkeyCharacters2 = FromCharacterCode /@ piDigitsAsCharacterCodes2;
monkeyWords2 =
StringJoin /@ Partition[monkeyCharacters2, wordLength];
monkeyCharacters3 = FromCharacterCode /@ piDigitsAsCharacterCodes3;
monkeyWords3 =
StringJoin /@ Partition[monkeyCharacters3, wordLength];
Union@Flatten[{DictionaryLookup[#, IgnoreCase -> True] & /@
monkeyWords1,
DictionaryLookup[#, IgnoreCase -> True] & /@ monkeyWords2,
DictionaryLookup[#, IgnoreCase -> True] & /@ monkeyWords3}]
]
Here are the results for words of 4 letters or greater using 100000 letters in sequence derived from Pi
using the above algorithm: (Assume you can use any 1, 2 or 3 letter words, but you can restrict yourself by doing those computations as well):
4-Letter words
MonkeyPiWords[100000, 4]
gives
{"Abel", "able", "ably", "achy", "acid", "acne", "Adam", "Afro", \
"agar", "AIDS", "Ajax", "Alar", "Alex", "Alpo", "also", "alum", \
"Alva", "ammo", "arcs", "arid", "Arne", "ates", "Audi", "Avon", \
"ayes", "Bach", "back", "bags", "bait", "bank", "bans", "bare", \
"bark", "bash", "Bass", "bath", "bats", "beam", "Beck", "Bede", \
"belt", "berm", "bibs", "bids", "Biko", "Biro", "bits", "bock", \
"Boer", "Bond", "bone", "boor", "Boru", "boss", "bowl", "brat", \
"Bret", "Buck", "buds", "buff", "bump", "burg", "burk", "burp", \
"Burt", "bury", "Bush", "buss", "byes", "cafe", "camp", "Caph", \
"cask", "cast", "Cebu", "ceca", "cell", "chat", "chew", "chip", \
"chug", "clad", "Clay", "clod", "Cobb", "coed", "Colo", "cony", \
"cope", "cord", "Cork", "Cote", "craw", "Cray", "Cree", "cubs", \
"dads", "damn", "damp", "dams", "Dana", "Dare", "darn", "Dave", \
"days", "Debs", "dews", "dewy", "dibs", "dice", "Dick", "dike", \
"Dina", "dine", "dint", "dire", "docs", "doll", "dome", "dots", \
"Doug", "dour", "dram", "duck", "duel", "dues", "duff", "duns", \
"duos", "duty", "Dyer", "dyes", "earn", "eats", "eave", "eBay", \
"echo", "eels", "Elam", "Elia", "elks", "emus", "Enid", "Enif", \
"ergo", "ergs", "errs", "etas", "even", "expo", "fame", "faro", \
"fast", "fate", "fats", "fave", "file", "fink", "fish", "flap", \
"flay", "flue", "flux", "Fons", "form", "foul", "fret", "Frye", \
"gabs", "garb", "gash", "geed", "gels", "Gish", "give", "glad", \
"glam", "glee", "glut", "gnat", "goad", "gone", "Goth", "gout", \
"govs", "grab", "gram", "grip", "gust", "guys", "Haas", "hags", \
"hake", "half", "Hans", "hard", "harp", "hasp", "hast", "heat", \
"Herr", "hick", "high", "hilt", "hims", "hips", "hire", "Hiss", \
"honk", "hove", "howl", "hows", "HTTP", "huge", "Hugh", "hugs", \
"hump", "hums", "Hung", "hurl", "Hyde", "hymn", "Iago", "icky", \
"iffy", "Igor", "ills", "imps", "inky", "Iraq", "ires", "isms", \
"Iyar", "Jack", "jags", "jamb", "Jame", "jaws", "jerk", "Jock", \
"Jose", "Karl", "kart", "kegs", "Kent", "Kern", "Kerr", "Kiel", \
"kind", "Klee", "knob", "know", "kook", "Kory", "Kroc", "lacs", \
"lade", "Lady", "lair", "lame", "Lang", "lank", "Laud", "Leda", \
"Left", "lest", "lido", "lids", "lief", "Lima", "limo", "Lind", \
"lips", "Lisa", "lisp", "live", "loaf", "loam", "loch", "lock", \
"logo", "Lois", "Lola", "loll", "lone", "loot", "Lora", "lose", \
"Luce", "luff", "lugs", "Lvov", "Lyon", "Mack", "maim", "malt", \
"Mani", "Mann", "many", "Mark", "mask", "mast", "math", "Matt", \
"mean", "meat", "meed", "menu", "mine", "mini", "moat", "Moll", \
"mosh", "moth", "mows", "Mses", "muns", "nabs", "nags", "naif", \
"nail", "Nell", "neon", "Nile", "Nola", "none", "nuke", "oaks", \
"Obie", "odor", "oiks", "oils", "Olga", "open", "opts", "oral", \
"Oran", "orgy", "Otis", "ouch", "oven", "Ovid", "pacy", "pals", \
"pave", "pear", "peas", "peek", "pews", "Pike", "pink", "pips", \
"Pisa", "pith", "Pius", "plan", "ploy", "plug", "poem", "pool", \
"pore", "poxy", "prig", "prod", "punt", "purl", "purr", "quid", \
"race", "rack", "raid", "rail", "rang", "rare", "rash", "rats", \
"redo", "regs", "Reno", "revs", "rhos", "rift", "Riga", "rile", \
"rims", "riot", "robe", "roil", "role", "Rolf", "roof", "rook", \
"Rory", "Roth", "rove", "rows", "RSVP", "Ruby", "ruck", "saga", \
"sago", "sags", "Saks", "Sang", "sank", "saps", "sash", "Sask", \
"says", "Sean", "sear", "seed", "Sega", "Serb", "shad", "shim", \
"shiv", "shop", "shot", "skid", "slaw", "slay", "slum", "Snow", \
"sock", "spot", "spur", "star", "stun", "suck", "sued", "suit", \
"suns", "sure", "Suva", "swab", "swan", "tabs", "talc", "tall", \
"taps", "teal", "tear", "teen", "than", "tics", "tier", "Tina", \
"toed", "toes", "toms", "tong", "toot", "tore", "tori", "toss", \
"tots", "Tran", "trug", "twas", "twit", "undo", "unto", "urns", \
"Utes", "vars", "vats", "veil", "vise", "Vlad", "wait", "wane", \
"wart", "ween", "weir", "when", "whey", "whit", "whys", "Will", \
"wilt", "wink", "Wise", "Witt", "wive", "wold", "worm", "yeas", \
"yips", "Yoko", "Yugo", "Yuma"}
5-Letter Words
MonkeyPiWords[100000, 5]
gives
{"build", "carom", "chaps", "coons", "Corby", "crank", "Derry", \
"Dolby", "dotes", "drier", "found", "Golgi", "honks", "jacks", \
"Josef", "Kenny", "Magoo", "Major", "Mavis", "parka", "pates", \
"plebe", "queue", "Reese", "ruing", "scarp", "smirk", "smugs", \
"souse", "sward", "teens", "Tulsa", "vivid", "Willa", "writs"}
6-Letter words
MonkeyPiWords[100000, 6]
gives
{"alkyds", "churns", "paring", "toupee"}
Beyond that there are no (up to 10 letter words) further words.