Prime & Composite Parameters

Top  Previous  Next

Prime and Composite parameters allow you to easily define just prime or composite numbers in a particular range.

 

$p=prime(low,high)

$c=composite(low,high)

 

Notes:

low and high do NOT need to be prime or composite to use the commands.
Neither command will return a 1.

 

Examples:

 

$p=prime(1,10)                $p will be chosen from the set {2,3,5,7}.

$c=composite(1,10)                $c will be chosen from the set {4,6,8,9,10}.

 

You can also use the primeex and compositeex commands to include negative numbers.

 

$p=primeex(1,10)                $p will be chosen from the set {-7,-5,-3,-2,2,3,5,7}.

$c=compositeex(1,10)                $c will be chosen from the set {-10,-9,-8,-6,-4,4,6,8,10}.