Package COM.INFORMATIMAGO.COMMON-LISP.ARITHMETIC.PRIMES

```
Compute primes and factorize numbers.

AGPL3

Copyright Pascal J. Bourguignon 2003 - 2012

This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>
```
 (compute-primes-to n) function
```DO:     Compute an Eratostene sieve to find all prime numbers up to N.
RETURN: An array of prime numbers.
```
 (divisors n) function
```RETURN: a list of divisors of N from 1 to N.
```
 (factorize n &optional primes) function
```N:        an INTEGER
PRIMES:   a VECTOR of prime factors sorted in increasing order.
RETURN:   a SEXP of the form: (* uncomensurate-factor
[ prime | (EXPT prime exponent) ]… [ -1 ] )
```
 (print-factorization exponents primes) function
```EXPONENTS:  A sequence: ( uncommensurate-factor  exponents… )
PRIMES:     A sequence: ( prime-factors… )
PRE:        (= (LENGTH EXPONENTS) (1+ (LENGTH PRIMES)))
DO:         Prints on *STANDARD-OUTPUT* an expression of the number.
```
 (str-decode num primes) function
```RETURN:  A string decoding the integer NUM factorized with the PRIMES.
```
 (str-encode str primes) function
```RETURN:  An integer encoding the string STR factorized with the PRIMES.
```