# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #!/usr/bin/perl use Test::More; $value1 = 3206; $value2 = 4368; if ($value1 > $value2) { $smallest = $value2; $biggest = $value1; } else { if ($value1 == $value2) { die "Values are the same, dumbass.\n"; } else { $smallest = $value1; $biggest = $value2; } } $start = $smallest; print ("Starting at: ", $start, "\n"); while ($start > 0) { if (is_int($smallest / $start)) { if (is_int($biggest / $start)) { print ("Found: ", $start, "\n"); print ($smallest, " / ", $start, " = ", $smallest/$start, "\n"); print ($biggest, " / ", $start, " = ", $biggest/$start); die "\n"; } } $start--; } sub is_int { return ( $_[0] eq int( $_[0] ) && $_[0] > 0 ); }