beautypg.com

Prime – HP Prime Graphing Calculator User Manual

Page 339

background image

Functions and commands

335

Factors

Returns the prime factor decomposition of an integer.

ifactor(Intg(a))

Example:

ifactor(150)

returns

[2*3*5

Factor List

Returns the list of prime factors of an integer or a list of

integers, with each factor is followed by its multiplicity.

ifactors(Intg(a)

or

(LstIntg))

Example:

ifactors(150)

returns

[2, 1, 3, 1, 5, 2]

GCD

Returns the greatest common divisor of two or more integers.

gcd((Intg(a),Intg(b)...Intg(n))

Example:

gcd(32,120,636)

gives

4

LCM

Returns the lowest common multiple of two or integers.

lcm((Intg(a),Intg(b)...Int(n))

Example:

lcm(6,4)

gives

12

Prime

Test if Prime

Tests whether or not a given integer is a prime number.

isPrime(Intg(a))

Example:

isPrime(1999)

returns

1

Nth Prime

Returns the nth prime number less than 10000.

ithprime(Intg(n)) where n is between 1 and 1229

Example:

ithprime(5)

returns

11

Next Prime

Returns the next prime or pseudo-prime after an integer.

nextprime(Intg(a))

Example:

nextprime(11)

returns

13