OpenMusic Reference
prime-ser

prime-ser
(series module) -- generates a list of prime numbers
Syntax
prime-ser max &optional numelem
Inputs
| name | data type(s) | comments |
|---|---|---|
| max | a non-negative number | The upper limit of the series. Defaults to 100 |
| numelem | a number | optional; the maximum number of elements to return (unless) max is reached. Defaults to 10 |
Output
| output | data type(s) | comments |
|---|---|---|
| first | a list of primes |
Description
Returns a list of prime numbers, ranging from 0 up to max .
The optional parameter numelem limits the maximum number of elements.
Examples
Calculating the first twenty-one prime numbers

Here we see prime-ser set to produce all the primes before 100 (of which there are 26). The optional input numelem is set to 20, which will limit the list to 21 terms. It returns
? OM->(1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71)
| Prev | Home | Next |
|---|---|---|
| prime? | Up | range-filter |