June 14, 2009

Feynman Division

Filed under: Puzzles — Mark @ 7:53 pm

From ‘Perfectly Reasonable Deviations from the Beaten Track, the Letters of Richard P. Feynman‘, a nicely edited collection from his daughter, Michelle Feynman. In an November 1939 letter to his mother, Lucille:

“And while you’re telling Pop, give him this problem in LONG DIVISION. EACH OF THE DOTS REPRESENTS SOME DIGIT (ANY DIGIT). EACH OF THE A’S REPRESENT THE SAME DIGIT (for example, a 3) NONE OF THE DOTS ARE THE SAME AS THE A (i.e., no dot can be a 3 if A is a 3).”

[the caps are his] The problem is then given as (I’m using asterisks ‘*’ as dots, and please excuse the crude character rendering of the division!):

         **A*
    +--------
*A* | ****A**
      **AA
      ----
       ***A
        **A
       -----
        ****
        *A**
        ----
         ****
         ****
         ----
            0

As of this moment, I have no idea how to solve this. My instinct is to start at the bottom and work backwards, but I’m not sure. Submit answers in the comments. I’ll update the original post if I think of something clever.

[Actually, I'm a dope ... it's a 3 digit number times a four digit number that results in a 7 digit number, with constraints all over the place, so a brute-force script will probably do it.  To quote Groucho:  "Why, a four-year-old child could understand this.  Somebody run out and get a four-year-old child ... I can't make head or tails out of it."]

UPDATE:  It will take a little more than simple brute force.  The following script checks all the combinations of 7-digit numbers divided by 3-digit numbers that yield a 4-digit number where the 5th, 2nd, and 3rd digits, respectively, match.  There are 69,269 such (down from about 8.1MM original combos to check, so not a bad start).  Next step will be to enforce that all of the other digits DO NOT repeat the matched digit.

#!/usr/bin/perl -w
use strict;

my ($i, $j, $k);
my ($a, $b, $c);
my  $cctr = 0;

for ($i = 100;$i < 1000;$i++) {
    for ($j = 1000;$j < 10000;$j++) {
        $k = $i * $j;

        if (length($k) != 7) {
            next;
        }

        $a = substr($i,1,1);
        $b = substr($j,2,1);
        $c = substr($k,4,1);

        if (($a eq $b) && ($b eq $c)) {
            # print "Candidate: $i * $j = $k\n";
            $cctr++;
        }
    }
}

print "\nThere were $cctr original candidates!\n\n";

June 10, 2009

Oh jeez …

Filed under: Oh, man — Mark @ 9:26 pm

Welcome to the worst blog software upgrade in recorded history … my provider shifted from Fantastico to SimpleScripts and, as of right now, it seems to have lost all my stuff.  Progress will be reported if and when I have any …