DreamCalc tm
Home Download Buy Now Support
User Guide: Contents Page Index of Functions

| # Number Theory Functions
> Functions related to number theory are listed in alphabetical order below. ## GCD GCD calculates the greatest common divisor of two values. Example:
>     98
>     [GCD]
>     140
>     [ENTER]
>     Displays: 14
> See also: LCM. ## fPart Fractional part. Returns the fraction part of a value. For example:
>     5.23237
>     [fPart]
>     Displays: 0.23237
> Note. This function always operates in a postfix manner on when used from the calculator keypad. However, the prefix form may be used instead when entering a function into the function graph entry box, for example, "fPart(x)". See also: iPart. ## HEAVY Returns 0 if the input value is less than or equal to zero, or +1 otherwise. This function can be entered using the [NUM] key. However, its main use is intended to be with graphing functions. See also: SIGN. ## iPart Integer part. Returns the integer part of a value. Example:
>     5.23237
>     [iPart]
>     Displays: 5
> Note. This function always operates in a postfix manner on when used from the calculator keypad. However, the prefix form may be used instead when entering a function into the function graph entry box, for example, "iPart(x)". The ROUND function can be used instead where nearest integer rounding is required. See also: fPart, ROUND. ## LCM LCM calculates the least common multiple of two values. Example:
>     5
>     [LCM]
>     3
>     [ENTER]
>     Displays: 15
> See also: GCD. ## MOD MOD returns the modulo value of the first argument with respect to the second (the remainder of the Euclidean division). Example:
>     27.87
>     [MOD]
>     12
>     [ENTER]
>     Displays: 3.87
> The following examples illustrate how negative input values are handled. 8 MOD 7 = 1 8 MOD -7 = -6 -8 MOD 7 = 6 -8 MOD -7 = -1 The Base-N REM function is similar, but handles signed input differently. ## nCr Calculates the number of ways of picking r unordered outcomes from n possibilities. Example: Determine how many 3 member groups can be organized in a group of 12 individuals.
>     12 [nCr] 3
>     [ENTER]
>     Displays: 220
> See also: nPr. ## nPr Calculates the number of ways of obtaining an ordered subset of r elements from a set of n elements. Example: Determine how many 4 digit values can be produced using the numbers 1 to 16.
>     16 [nPr] 4
>     [ENTER]
>     Displays: 43680
> See also: nCr. ## NUM The [NUM] key provides input for an additional range of number theory functions. Example: Random Number
>     [SHIFT] [NUM] (use with SHIFT key)
>     Select RAN
>     [ENTER]
>     Displays: 0.435... (random number)
> ## PRIME PRIME is available from the [NUM] function key. It uses the Sieve of Eratosthenes method to determine the nth prime, beginning with PRIME(1) = 2. The larger the value of n, the longer the time required to determine the result. Therefore, this function places an upper time limit on the calculation, and returns a Timeout error if the result cannot be determined in this time. This upper limit is configurable, and can be set with the 'Timeout' option in the configuration settings. Note that this function is not designed to generate huge primes and it will, therefore, return Range Error if the input value exceeds 20E6. Generally, however, a computer with a 2GHz CPU should be able to determine the millionth prime number within around 2 seconds. Example: What is the millionth prime number?
>     [NUM] and select PRIME
>     1E6
>     [ENTER]
>     Displays: 15485863
> See also: PRIMEQ. ## PRIMEQ PRIMEQ is available from the [NUM] function key. It returns +1 is the input value is prime, or zero otherwise. See also: PRIME. ## Ran RAN is available from the [NUM] function key. It returns a pseudo random number in the range, 0 <= n < 1. For example, to generate a random number between 1 and 47 inclusive, enter:
>     1 [+]
>     [NUM] and select Ran
>     [×] 47
>     [ENTER]
>     Displays: 17.187... (result is variable)
> Ran takes no input parameter. See also: GRan. ## ROUND Rounds value to the nearest integer. Example:
>     5.7
>     [ROUND]
>     Displays: 6
Note. This function always operates in a postfix manner on when used from the calculator keypad. However, the prefix form may be used instead when entering a function into the function graph entry box, for example, "ROUND(x)". The iPart function can be used instead where it is required to round down the value to an integer. See also: fPart, ROUND. ## SIGN Returns -1 if the input value is below 0, zero if the input is zero, or +1 if greater than zero. This function can be entered using the [NUM] key. However, its main use is intended to be with graphing functions. See also: HEAVY. See also: General Math Functions |