Thursday, September 11, 2008

Evaluating Number Grids Using Perl On Linux Or Unix

Hey There,

And, we're back from an evening of teasing our brains. I was actually quite cruel to mine. Hopefully, it will forgive me ;)

Here's hoping everyone's having an enjoyable day at work (or, even better, an enjoyable drink on the beach :). I'm currently wading through a sea of bureaucracy the complexity of which demands to be taken in with nothing less than total awe. The term Byzantine been taken to another level of meaning for me. It's always an interesting thing in life when you realize that, just the other day, you thought you had it all figured out ;) But, on the flipside, managers and directors need to manage and direct, so I don't begrudge them their duties, even if they seem to be manufactured to a certain degree. I'll gladly fill out a few forms if it'll keep somebody's family in food and clothing with a roof over their heads. My nagging inner-voices are fickle, selfish, somewhat pedestrian and completely unrealistic. It's a good thing I realized this about myself so many years ago. Bless my mother and father for not giving up on my sorry tween-age behind. Having a few kids of my own, I realize ( a little more with each passing day ) why my parents kept me around and why, every once and a while, they wanted to kill me ;)

Anyway, this nightmare of form stamping, filing and dull aching headaches (Think Terry Gilliam's Brazil except not in the future and with nice bright halogen lighting to offset the bizarre floral-patterned non-threatening beige cubicle farms ;) hasn't given me any time to script out my answer to yesterday's brain teaser. Believe it or not, I actually did the original half on paper and then half in my head. Actually, you'll believe it. When you see it in print, it becomes pretty simple to see the pattern.

Hopefully, you didn't give the brain-teaser too much effort if the answer didn't appear to you quickly. Like I said, I wasted a lot of time looking for suitable number sequences ( golden strings, etc ), but, in the end, found that I could reasonably deduce the most economical 8 out of 56 lists by just looking at them. Admittedly, it's a lot easier to read now that I've grouped them together (looking at all 56 was alternately confusing and just bad for my eyesight in general ;) Actually, a lot of you can probably knock out a quick Perl or shell script for Linux or Unix to deal with the pattern matching and list collecting just from seeing the grid of lists in one place.

The simple answer to the question (without the equation part, which I promise I'll put out as an aside to a post on something else original so you won't have to hear about numbered lists any more after we post the script that takes the last 2 weeks of posts on number pools, probability, binomial theory and , of course, lists and automates them ...at least, until I get sick of stuff other than lists ;) is that these 8 lists combined the most dense and absolutely complete set of all 3 digit lists within my 56 5 digit lists. The list of all 3 digit lists is simple to chart out (even if our list wasn't just "1, 2, 3, 4, 5, 6, 7 ,8)" and is shown below:

123 124 125 126 127 128 134 135 136 137 138 145 146 147 148 156 157 158 167 168 178 234 235 236 237 238 245 246 247 248 256 257 258 267 268 278 345 346 347 348 356 357 358 367 368 378 456 457 458 467 468 478 567 568 578 678


We'll leave the group of 20 lists that make for the most economical group of lists for a 4 digit match alone (same principle), and take a look, again, at the 8 lists which most economically covered every single list within the 3 digit match list above (can I type list again? I think I can... ;) These 8 lists are listed in the format: five-digit-list (space) space-delimited listing of all 3 digit matches covered.

12346 123 124 126 134 136 146 234 236 246 346
12358 123 125 128 135 138 158 235 238 258 358
12478 124 127 128 147 148 178 247 248 278 478
13678 136 137 138 167 168 178 367 368 378 678
14567 145 146 147 156 157 167 456 457 467 567
23457 234 235 237 245 247 257 345 347 357 457
25678 256 257 258 267 268 278 567 568 578 678
34568 345 346 348 356 358 368 456 458 468 568


Now, compare that with the list of 8 random lists, taken from the same group of 56, below, in the same format.

12458 124 125 128 145 148 158 245 248 258 358
12457 124 125 127 145 147 157 245 247 257 457
12456 124 125 126 145 146 156 245 246 256 456
12378 123 127 128 137 138 178 237 238 278 378
45678 456 457 458 467 468 478 567 568 578 678
35678 356 357 358 367 368 378 567 568 578 678
34678 346 347 348 367 368 378 467 468 478 678
34578 345 347 348 357 358 378 457 458 478 578


One thing you'll notice, just by looking, is that every single 3 digit match can be found in the first 8 list set, but not all can be found in the second. As for the reason that my answers always come up identical, this may be a trick of circumstance caused by the numbers themselves. I started my parsing from the 1's up (for all 56 lists in numeric order) and found the 8 identified as being a nice tidy all-encompassing grid "first." And I quote first because I didn't bother to check and see if I could find another one afterward. It (and several others) may exist in the list of 56 lists, even after my conditions for completion are satisfied. In fact, by default, if you use all 56 lists, you're guaranteed the "absolute" best coverage of all 3 digit matches, because you'll be hitting every single one of them (all 56 unique variations of 3 digit lists using the numbers 1 through 8, with no repetition or duplication).

To see what I mean, just check for random 3 digit strings in both matrices (or lists of lists). For instance, see if you can find 134, 135 or 136 in both sets or if they only appear in the top one (the one that's supposed to cover all 56 variations).

Enjoy, and I'll crank out a little script to replicate what I have written on paper and stuck in my head for you in the next post or so. As long as you understand the purpose of the grids (covering all variations of the 56 3 digit lists) it becomes trivial for you to create your own complete lists of lists (from the 56 lists you can make of 5 digit lists spreading over 8 digits) and experience for yourself what it is to understand something and feel somewhat at a loss to adequately explain it ;)

Cheers,

, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.