NextPrime (Float function): Difference between revisions
Jump to navigation
Jump to search
m (match syntax diagram to template; fix tags and links) |
m (usage notes) |
||
Line 14: | Line 14: | ||
==Usage notes== | ==Usage notes== | ||
<ul><li>The method object value is initially rounded to the nearest integer before the next prime is determined. | <ul><li>The method object value, <var>number</var>, is initially rounded to the nearest integer before the next prime is determined. | ||
<li><var>NextPrime</var> always returns a value higher than the | <li><var>NextPrime</var> always returns a value higher than the current <var>number</var>, even if the current <var>number</var> value is prime. | ||
<li>If | <li>If <var>number</var> is a negative value or is greater than 2<sup>31</sup>-1, the request is cancelled. | ||
<li><var>NextPrime</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3.</ul> | <li><var>NextPrime</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3.</ul> | ||
Line 30: | Line 30: | ||
end for | end for | ||
end | end | ||
</p> | </p></ol> | ||
==See also== | ==See also== | ||
{{Template:Float:NextPrime footer}} | {{Template:Float:NextPrime footer}} |
Revision as of 08:25, 23 February 2011
Find smallest prime greater than this number (Float class)
The NextPrime intrinsic function returns the next prime number after the method object value.
Syntax
%number = float:NextPrime
Syntax terms
%number | A numeric variable to receive the method result. |
---|---|
float | A Float value. |
Usage notes
- The method object value, number, is initially rounded to the nearest integer before the next prime is determined.
- NextPrime always returns a value higher than the current number, even if the current number value is prime.
- If number is a negative value or is greater than 231-1, the request is cancelled.
- NextPrime is available as of "Sirius Mods" Version 7.3.
Examples
- The following request displays the first one hundred prime numbers after 1000:
begin %i is float %n is float %n = 1000 for %i from 1 to 100 %n = %n:nextPrime printText {%n} end for end