All pastes #296057 Raw Edit

Untitled

public text v1 · immutable
#296057 ·published 2006-12-29 22:42 UTC
rendered paste body
use strict;
use warnings;

for (my $n = 0; $n <= 9; $n++) {
  print "\t$n\n";
  for (my $r = 0; $r <= 9; $r++) {
    print "$r\n";
    for (my $s = 0; $s <= 9; $s++) {
      for (my $a = 0; $a <= 9; $a++) {
        for (my $b = 0; $b <= 9; $b++) {
          for (my $h = 0; $h <= 9; $h++) {
            for (my $f = 0; $f <= 9; $f++) {
              for (my $k = 0; $k <= 9; $k++) {
#                 next unless (($n+$h) > 0 && ($n+$s) > 0);
#                 if (($n == (($a+$b) * ($f+$b)) - (($n * $f))) &&
#                    ($r == (($n+$h) * ($r+$h)) - ($n+$s)) &&
#                    ($s == (($a+$b) * ($n+$s)) - (($a+$b) + ($f+$b))) &&
#                    ($a == ($a+$b) - ($n+$s)) &&
#                    ($b == (($r+$h) + ($n+$s)) / ($n+$h)) &&
#                    ($h == (($n+$s) * ($r+$h)) - (($n+$f) * ($n+$h))) &&
#                    ($f == (($n+$f) + ($n+$h)) / ($n+$s)) &&
#                    ($k == ($n+$h) - ($f+$b))) {
#                      print "$n $r $s $a $b $h $f $k\n";
#                  }
                if (
                   (($n+$h) > 0 && ($n+$s) > 0) &&
                   ($n == (($a+$b) * ($f+$b)) - (($n * $f))) &&
                   ($r == (($n+$h) * ($r+$h)) - ($n+$s)) &&
                   ($s == (($a+$b) * ($n+$s)) - (($a+$b) + ($f+$b))) &&
                   ($a == ($a+$b) - ($n+$s)) &&
                   ($b == (($r+$h) + ($n+$s)) / ($n+$h)) &&
                   ($h == (($n+$s) * ($r+$h)) - (($n+$f) * ($n+$h))) &&
                   ($f == (($n+$f) + ($n+$h)) / ($n+$s)) &&
                   ($k == ($n+$h) - ($f+$b))
                   ) {
                     print "addition: $n $r $s $a $b $h $f $k\n";
                }
                if (
                   (($n-$h) > 0 && ($n-$s) > 0) &&
                   ($n == (($a-$b) * ($f-$b)) - (($n * $f))) &&
                   ($r == (($n-$h) * ($r-$h)) - ($n-$s)) &&
                   ($s == (($a-$b) * ($n-$s)) - (($a-$b) + ($f-$b))) &&
                   ($a == ($a-$b) - ($n-$s)) &&
                   ($b == (($r-$h) + ($n-$s)) / ($n-$h)) &&
                   ($h == (($n-$s) * ($r-$h)) - (($n-$f) * ($n-$h))) &&
                   ($f == (($n-$f) + ($n-$h)) / ($n-$s)) &&
                   ($k == ($n-$h) - ($f-$b))
                   ) {
                     print "subtraction: $n $r $s $a $b $h $f $k\n";
                }
              }
            }
          }
        }
      }
    }
  }
}