in reply to OT: Finding Factor Closest To Square Root
Update: Ignore this, it doesn't work.
You'll have tp pretend that I have M::B::F::f_w().. CPAN's being boring.
#! perl -slw use strict; use List::Util qw[ reduce ]; my $root = sqrt 1000; my @pfs = ( 2, 2, 2, 5, 5, 5 ); my $near = reduce{ $a * $b < $root ? $a*$b : $a } reverse @pfs; print +( $root - $near ) < ( $near * $pfs[0] - $root ) ? $near : $near * $pfs[0];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: OT: Finding Factor Closest To Square Root
by Roy Johnson (Monsignor) on Feb 19, 2005 at 00:23 UTC | |
by BrowserUk (Patriarch) on Feb 19, 2005 at 00:32 UTC | |
by Roy Johnson (Monsignor) on Feb 19, 2005 at 00:48 UTC | |
by BrowserUk (Patriarch) on Feb 19, 2005 at 01:08 UTC | |
by Roy Johnson (Monsignor) on Feb 19, 2005 at 22:20 UTC | |
| |
by Limbic~Region (Chancellor) on Feb 26, 2005 at 06:52 UTC | |
| |
by Roy Johnson (Monsignor) on Feb 22, 2005 at 17:05 UTC | |
by Limbic~Region (Chancellor) on Feb 24, 2005 at 17:12 UTC |