10.12 SmallestRootInt

SmallestRootInt( n )

SmallestRootInt returns the smallest root of the integer n.

The smallest root of an integer n is the integer r of smallest absolute value for which a positive integer k exists such that n = r^k.

    gap> SmallestRootInt( 2^30 );
    2
    gap> SmallestRootInt( -(2^30) );
    -4        # note that $(-2)^{30} = +(2^{30})$
    gap> SmallestRootInt( 279936 );
    6
    gap> LogInt( 279936, 6 );
    7
    gap> SmallestRootInt( 1001 );
    1001 

SmallestRootInt can be used to identify and decompose powers of primes as is demonstrated in the following example (see IsPrimePowerInt)

    p := SmallestRootInt( q );  n := LogInt( q, p );
    if not IsPrimeInt(p) then Error("GF: <q> must be a primepower"); fi;

Previous Up Top Next
Index

GAP 3.4.4
April 1997