DO: Compute an Eratostene sieve to find all prime numbers up to N. RETURN: An array of prime numbers.
FACTORIZE (N &OPTIONAL (PRIMES NIL))
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)
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)
RETURN: A string decoding the integer NUM factorized with the PRIMES.
STR-ENCODE (STR PRIMES)
RETURN: An integer encoding the string STR factorized with the PRIMES.
FACTORIZE-VECTOR (N PRIMES)
N: an INTEGER PRIMES: a VECTOR of prime factors sorted in increasing order. RETURN: a VECTOR of length (1+ (LENGTH PRIMES)), with the uncommensurate factor in the slot 0, and the exponents of the primes in the following slots. (PRIMES could have a 1 in the first slot!)
WHILE (CONDITION &BODY BODY)