B002: Prime Numbers and Prime Factor Decomposition

Author(s): K.S. Kölbig Library: MATHLIB
Submitter: Submitted: 15.11.1995
Language: Fortran Revised:

Subroutine subprogram PRMFCT

Note that this allows in particular to handle quotients of factorials of rather large numbers in an exact way.

Structure:

SUBROUTINE subprogram
User Entry Names: PRMFCT
Files Referenced: Unit 6

Usage:

    CALL PRMFCT(MODE,N,NPRIME,NPOWER,M)
tex2html_wrap_inline124 Sets the first n prime numbers into an array.
N
(INTEGER) The number n of prime numbers requested.
NPRIME
(INTEGER) One-dimensional array of length tex2html_wrap_inline130 . On exit, NPRIME(j), ( tex2html_wrap_inline132 ) contains the j-th prime numbers tex2html_wrap_inline136 , where tex2html_wrap_inline138
NPOWER
(INTEGER) One-dimensional array of length tex2html_wrap_inline140 . On exit, NPOWER(j), ( tex2html_wrap_inline142 ) contains the value 1.
M
(INTEGER) Contains, on exit, the number n.
tex2html_wrap_inline146 Performs the decomposition of N ( tex2html_wrap_inline150 ) or N! ( tex2html_wrap_inline154 ) into its prime factors.
N
(INTEGER) The number N itself ( tex2html_wrap_inline158 ) or its factorial ( tex2html_wrap_inline160 ) to be decomposed into prime factors.
NPRIME
(INTEGER) One-dimensional array of length tex2html_wrap_inline162 . On exit, NPRIME(j), ( tex2html_wrap_inline164 ) contains the j-th prime numbers tex2html_wrap_inline168 , where tex2html_wrap_inline170 .
NPOWER
(INTEGER) One-dimensional array of length tex2html_wrap_inline172 . On exit, NPOWER(j), ( tex2html_wrap_inline174 ) contains the power tex2html_wrap_inline176 corresponding to the prime number tex2html_wrap_inline178 .
M
(INTEGER) Contains, on exit, the index tex2html_wrap_inline180 defined by tex2html_wrap_inline182 and tex2html_wrap_inline184 for j>M.

Restrictions:

tex2html_wrap_inline188 tex2html_wrap_inline190 .
tex2html_wrap_inline192 or tex2html_wrap_inline194 tex2html_wrap_inline196 .

Error handling:

Error B002.1: tex2html_wrap_inline198 and tex2html_wrap_inline200 and tex2html_wrap_inline202 .
Error B002.2: tex2html_wrap_inline204 out of range.
In both cases, NPRIME(j) and NPOWER(j), ( tex2html_wrap_inline206 ) are set to zero and a message is written on
[4] Unit 6, unless subroutine MTLSET (N002) has been called.
tex2html_wrap_inline208


Michel Goossens Fri Jun 7 08:13:13 METDST 1996