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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.