<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>
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.
integer. Default value: 2. Lower bound (inclusive) of the prime range to select from.
numToSelectinteger. Default value: 1. How many prime numbers to select.
keyword. 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. |
integer. 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">
Other (6)
$s.excludenumberList. Primes to exclude from the selection.
$s.frominteger. Lower bound (inclusive) of the prime range to select from.
$s.numToSelectinteger. How many prime numbers to select.
$s.sorttext. Sort order applied to the selected primes.
$s.tointeger. 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 (4)
$s.doenetMLtext. The DoenetML source code that produced this component.
$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.