## `numlib::prevprime` -- next smaller prime

#### Introduction

For an integer `a` `numlib::prevprime``(a)` returns the greatest prime number . If `a` then `numlib::prevprime``(a)` returns `FAIL`.

#### Call(s)

`numlib::prevprime(a)`
`numlib::prevprime(symb)`

#### Parameters

`a` | - | an integer

#### Returns

`numlib::prevprime``(a)` returns either a natural number or `FAIL`.

#### Related Functions

`isprime`, `ithprime`, `nextprime`, `numlib::proveprime`

#### Details

- `numlib::prevprime` returns the function call with evaluated argument if the argument is not a number.
- `numlib::prevprime` returns an error if the argument evaluates to a number which is not an integer.

#### Example 1

Computing the largest prime <=15485865:

    >> numlib::prevprime(15485865)

                                     15485863

#### Example 2

There are no primes :

    >> numlib::prevprime(1)

                                       FAIL

#### Background

- `numlib::prevprime` uses `isprime`.

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000