<selectPrimeNumbers/>
<selectPrimeNumbers/> is a Math
component that selects prime numbers at random from a specified range. Selections generate variants of the document.
Attributes and Properties
Attributes for <selectPrimeNumbers>
Number display (5)
avoidScientificNotationIn developmentboolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.
displayDecimalsIn developmentinteger. Default value: 2. Number of decimal places to display when rendering this number.
displayDigitsIn developmentinteger. Default value: 3. Number of significant digits to display when rendering this number.
displaySmallAsZeroIn developmentnumber. Default value: 1e-14. Threshold below which numbers are displayed as zero.
padZerosIn developmentboolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Other (8)
asListboolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).
numberList. Primes to exclude from the selection.
_listOfNumberLists. Combinations of values that should not be selected together.
fromAdded in 0.7.13integer. Default value: 2. Lower bound (inclusive) of the prime range to select from.
numToSelectinteger. Default value: 1. How many prime numbers to select.
sortAdded in 0.7.14keyword. Sort order applied to the selected primes.
| Value | Description |
|---|---|
unsorted (default) | Preserve the random selection order. |
increasing | Sort the selected primes in increasing order. |
decreasing | Sort the selected primes in decreasing order. |
toAdded in 0.7.13integer. Default value: 100. Upper bound (inclusive) of the prime range to select from.
boolean. Default value: false. Whether the same prime can be selected more than once.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <selectPrimeNumbers name="s">
Number display (5)
$s.avoidScientificNotationIn developmentboolean. Whether to render numbers in full decimal form rather than scientific notation.
$s.displayDecimalsIn developmentinteger. Number of decimal places to display when rendering this number.
$s.displayDigitsIn developmentinteger. Number of significant digits to display when rendering this number.
$s.displaySmallAsZeroIn developmentnumber. Threshold below which numbers are displayed as zero.
$s.padZerosIn developmentboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Other (6)
$s.excludenumberList. Primes to exclude from the selection.
$s.fromAdded in 0.7.13integer. Lower bound (inclusive) of the prime range to select from.
$s.numToSelectinteger. How many prime numbers to select.
$s.sortAdded in 0.7.14text. Sort order applied to the selected primes.
$s.toAdded in 0.7.13integer. Upper bound (inclusive) of the prime range to select from.
$s.withReplacementboolean. Whether the same prime can be selected more than once.
Common to all components (8)
$s.disabledIn developmentboolean. Whether this component is disabled and cannot be interacted with.
$s.doenetMLtext. The DoenetML source code that produced this component.
$s.fixedIn developmentboolean. Whether this component's value is fixed and cannot be modified.
$s.fixLocationIn developmentboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$s.hideboolean. Whether to hide this component from the rendered output.
$s.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$s.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Default <selectPrimeNumbers/>
The default <selectPrimeNumbers/> has a sequence range from to .
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Example: Generate multiple selections
Three numbers that are selected between and . Individual selections can be accessed using array notation.
Example: Assigning descriptive names to multiple selections
The numToSelect attribute allows for selection of multiple values within the range of a single <selectPrimeNumbers/>
component. Multiple selections are made without replacement. Selections can be assigned more descriptive names by defining individual components
which reference the selected values.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Examples
Attribute Example: sort
The sort attribute determines how selected results are sorted. It accepts three values:
"unsorted"(default) - results are in the order they were selected"increasing"- results are sorted in increasing order"decreasing"- results are sorted in decreasing order
Alternatively, sort and sort="true" are equivalent to sort="increasing", and sort="false" is equivalent to sort="unsorted".
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: from, to
The from and to attributes specify the endpoints of the selection interval. These endpoints are not required to be prime numbers.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: exclude
The exclude attribute specifies values to exclude in the selection.
Doenet will throw an error if sufficient primes are not available in the selection interval without
replacement. If repetitions are allowed, the withReplacement attribute can be used.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: withReplacement
If selection with replacement is the desired behavior, use the withReplacement attribute.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: excludeCombinations
The excludeCombinations attribute can be used to exclude undesired combinations of prime numbers.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.