Coprime Parameters

Top  Previous  Next

Coprime parameters allow you to access sets of coprime numbers.






the coprimes command will return AT MOST ten coprime numbers. If the range of available numbers is less than 20, the number of coprimes returned will be AT MOST half of the available range.
Individual coprime numbers are accessed using references.
The coprimesex parameter will return positive and negative coprime numbers.




$p=coprimes(2,10)                $p will be a random set of AT MOST 4 coprime numbers. It might return {6,5,7}  or {4,9,7,5}.

$p=coprimesex(2,100)        $p will be a random set of 10 coprime numbers.  It might return {27,-8,-73,49,-97,71,-41,59,-65,11} or {-67,-5,12,73,-97,31,-89,13,-83,-7}


Using Coprime Parameters

If you just use the parameter $p, you will have the full list of coprimes inserted into your equation. Normally, you will instead use references to the individual numbers.


$p[1] and $p[2] are coprime


might return


6 and 5 are coprime.


You can confidently use $p[1], $p[2] and $p[3] in most situations. If you have a small range of numbers available, going beyond this can result in undefined references