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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.