iperfpow - Maple Programming Help

iperfpow

determine if an integer is a perfect power

 Calling Sequence iperfpow(n) iperfpow(n, 'p')

Parameters

 n - expression p - name

Description

 • If n is a positive integer and n = r^k, where r and k are positive integers, then iperfpow(n) returns r.  If the second argument, 'p', is specified in the calling sequence, it is assigned the value k.
 • It is an error for n to evaluate to a numeric which is not a positive integer.
 • This function returns FAIL if it is not able to establish that n is a perfect power of an integer.
 • In all other cases, the function returns unevaluated.

Examples

 > $\mathrm{iperfpow}\left(256\right)$
 ${16}$ (1)
 > $\mathrm{iperfpow}\left(125,'p'\right)$
 ${5}$ (2)
 > $p$
 ${3}$ (3)