NextPrime (Float function)

From m204wiki
Revision as of 05:34, 4 February 2011 by Goff (talk | contribs) (match syntax diagram to template; fix tags and links)
Jump to navigation Jump to search

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 is initially rounded to the nearest integer before the next prime is determined.
  • NextPrime always returns a value higher than the method object value, even if the method object 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

  1. 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

    See also