isIntpower | R Documentation |
Determine whether p
is the power of an integer.
isIntpower(p) isSquare(p) isSquarefree(p)
p |
any integer number. |
isIntpower(p)
determines whether p
is the power of an integer
and returns a tupel (n, m)
such that p=n^m
where m
is
as small as possible. E.g., if p
is prime it returns c(p,1)
.
isSquare(p)
determines whether p
is the square of an integer;
and isSquarefree(p)
determines if p
contains a square number
as a divisor.
A 2-vector of integers.
isIntpower(1) # 1 1 isIntpower(15) # 15 1 isIntpower(17) # 17 1 isIntpower(64) # 8 2 isIntpower(36) # 6 2 isIntpower(100) # 10 2 ## Not run: for (p in 5^7:7^5) { pp <- isIntpower(p) if (pp[2] != 1) cat(p, ":\t", pp, "\n") } ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.