Learn R Programming

blocksdesign (version 3.7)

isPrimePower: Finds a prime power solution for N, if available.

Description

Tests if a given number N is a prime power and returns either the base prime p and power q or p = 0 and q = 0.

Usage

isPrimePower(N)

Arguments

N

is the number to be tested for primality

Value

Returns the base prime p and the power q if N is a prime power; otherwise returns p = 0 and q = 0.

Details

Finds the smallest integral solution for s = N**(1/i), which gives the smallest s such that s**i = N. Then, if s is a prime, the number N is a prime power with p = s and q = i.

Examples

Run this code
# NOT RUN {
isPrimePower(10000)
 
# }

Run the code above in your browser using DataLab