1. Home
  2. PRIMEPOWER procedure

PRIMEPOWER procedure

Decomposes a positive integer into its constituent prime powers (I. Wakeling & R.W. Payne).

Option

PRINT = string token Controls printed output (decomposition); default *

Parameters

NUMBER = scalars Number to be decomposed
PRIMES = pointers Prime factors of NUMBER
POWERS = pointers Powers of the prime factors in NUMBER

Description

Procedure PRIMEPOWER decomposes the integer specified by the NUMBER parameter into its constituent prime powers. The results can be saved using the PRIMES and POWERS parameters. These return pointers to a set of scalars storing, respectively, the relevant prime numbers and their powers. If NUMBER is not a positive integer, the pointers will each contain a single scalar containing a missing value. The decomposition can also be printed by setting option PRINT=decomposition.

Option: PRINT.

Parameters: NUMBER, PRIMES, POWERS.

Method

PRIMEPOWER uses the standard Genstat calculation directives.

See also

Procedure: NCONVERT.

Commands for: Calculations and manipulation.

Example

CAPTION    'PRIMEPOWER example'; STYLE=meta
" a single prime "
PRIMEPOWER [PRINT=decomposition] 17; PRIMES=p; POWERS=n
" powers of a single prime "
PRIMEPOWER [PRINT=decomposition] 8; PRIMES=p; POWERS=n
" powers of several primes "
PRIMEPOWER [PRINT=decomposition] 12; PRIMES=p; POWERS=n
PRINT      p[],n[]; DECIMALS=0
Updated on March 6, 2019

Was this article helpful?