Forum archive 2000-2006

Gregg Klein - Greatest Common Factor

Gregg Klein - Greatest Common Factor

by Arnold Pizer -
Number of replies: 0
inactiveTopicGreatest Common Factor topic started 1/27/2003; 2:19:26 PM
last post 1/28/2003; 2:22:13 PM
userGregg Klein - Greatest Common Factor  blueArrow
1/27/2003; 2:19:26 PM (reads: 1391, responses: 2)
How can you evaluate if a number is the GCF of 2 random numbers.

<| Post or View Comments |>


userJohn Jones - Re: Greatest Common Factor  blueArrow
1/27/2003; 2:29:28 PM (reads: 1621, responses: 0)
Hi,

Is this what you mean?

 

$a = random(2,50);
$b = random(2, 50);
$ans = gcd($a, $b);

and then

 

ANS( num_cmp( $ans ) );

This will work as long as you load PGauxiliaryFunctions.pl at the top of the problem file.

John

<| Post or View Comments |>


userGregg Klein - Re: Greatest Common Factor  blueArrow
1/28/2003; 2:22:13 PM (reads: 1642, responses: 0)
Thanks

<| Post or View Comments |>