x = factorIntegerPower(n)
factors the number n into its perfect power xk and returns the base x. If several perfect
powers exist, x is returned for maximum k.
The function factorIntegerPower acts element-wise on array
input.
Factor 64 into its perfect power. If
several perfect powers exist for a number, the maximum k is
returned.
n = 64;
[x,k] = factorIntegerPower(n)
x =
2
k =
6
Find perfect powers of 7, 841, and
2541865828329.
n = [7 841 2541865828329];
[x,k] = factorIntegerPower(n)
x =
7 29 3
k =
1 2 26
Reconstruct the numbers. Return exact symbolic integers instead of
floating point by converting x to symbolic form.
sym(x).^k
ans =
[ 7, 841, 2541865828329]
If a number is not a perfect power,
factorIntegerPower returns the number itself as the
base with exponent 1. So, a number is a perfect power if it
does not equal its base.
Check if 125 is a perfect power.
isequal returns logical 0
(false), meaning 125 is not equal
to the returned base. Therefore, 125 is a perfect
power.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.