is.square(n)
returns TRUE
if n
is a square number, that is, n = m^2
for some integer m
,
and returns FALSE
otherwise.
is.cube(n)
returns TRUE
if n
is the cube of an integer, n = m^3
for some integer m
,
and returns FALSE
otherwise.
is.power(n)
returns TRUE
if n
is an integer power of an integer, n = m^k
for some integers
m
and k
, and returns FALSE
otherwise.
These functions use the prime factorisation of n
and may be more reliable than testing where sqrt(n)
is an
integer, etc.
Negative values of n
are permitted.