• Uncategorized 19.09.2005

    You gotta love PHP when your mind does not seem to work any more but you need to figure out what 3 digit number ending with the digit 4 multiplied by a single digit number equals 1242. A simple script figured it out for me in less than 2 seconds.


    $t = 104;
    $b = 1;

    $answer = ‘f’;
    while ($answer == ‘f’) {
    if ($t > 994) {
    $t = 104;
    $b++;
    }
    if ($b > 9) {
    exit(”\n\nThere is no answer!\n\n”);
    }

    echo “$t * $b = “;
    $tmp = $t * $b;
    echo $tmp;
    if ($tmp != 1242) {
    echo ” False…\n”;
    }
    else {
    echo ” TRUE!!!!!\n\n”;
    echo “THE ANSWER HAS BEEN FOUND #########\n”;
    $answer = $tmp;
    }

    $ft = substr($t, 0, 2);
    $ft++;
    $t = (int)$ft . 4;
    }
    ?>

    PHP’s always there is your time of need :) - Sometimes it’s easier to write a script than figure it out manually.

    Posted by Arthur @ 11:00 pm

    Tags:

  • Leave a Comment

    Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.