# Category:ALGOL 68-primes

**Library**

This is an example of a library. You may see a list of other libraries used on Rosetta Code at Category:Solutions by Library.

**ALGOL 68-Primes** is a set of prime related routines and operators for use in ALGOL 68 programs.

To use this in a program, copy the source code from the Talk page to a text file called *primes.incl.a68*, putting it in the same directory as the importing program.

Then add `PR read "primes.incl.a68" PR`

to the source of the program.

If you are using ALGOL_68G or another compiler/interpreter that supports the read pragmatic comment, then the program can be run as usual.

For other compilers, the ALGOL 68 pre-processor in Compiler/Simple file inclusion pre processor can be used (see the instructions on that page).

**Note**: with ALGOL 68G version 3, the default has changed to --warnings (before it was --nowarnings) so the code here will probably generate warnings about unused operators and procedures.

The following are contained in this library:

### Operators

- OP(INT)[]BOOL PRIMESIEVE

- Returns a sieve of primes from 0 to the specified limit.

- OP(INT)INT APPROXIMATESIEVESIZEFOR

- Returns the approximate sivze of sieve required for the specified number of primes.

### Procedures

- PROC(LONG LONG INT)BOOL is probably prime

- Miller-Rabin primality test.

Also contains modes and operators for extracting a list of pries from a sieve of primes.

## Pages in category "ALGOL 68-primes"

The following 73 pages are in this category, out of 73 total.

### C

### F

### P

- Palindromic primes
- Palindromic primes in base 16
- Pell numbers
- Penta-power prime seeds
- Pierpont primes
- Piprimes
- Prime numbers which contain 123
- Prime reciprocal sum
- Prime words
- Primes which contain only one odd digit
- Primes whose first and last number is 3
- Primes with digits in nondecreasing order
- Primes: n*2^m+1

### S

- Safe and Sophie Germain primes
- Sequence of primorial primes
- Smallest multiple
- Smallest number k such that k+2^m is composite for all m less than k
- Sort primes from list to a list
- Special neighbor primes
- Sphenic numbers
- Strange unique prime triplets
- Substring primes
- Sum of primes in odd positions is prime
- Sum of square and cube digits of an integer are primes
- Sum of two adjacent numbers are primes
- Summarize primes
- Summation of primes