Skip to main content
deleted 474 characters in body
Source Link

Prime Power Switch

Input: A positive integer n=p^q where p and q are prime.

Output: Output the result of q^p

Test cases (in, out):

4, 4 8, 9 25, 32 27, 27 49, 128 121, 2048 125, 243 343, 2187 1331, 177147 3125, 3125, 16807, 78125, 823543, 823543 161051, 48828125 19487171, 1977326743 

Mathematica Example Implementation

Power@@Reverse@Flatten@FactorInteger[#]&; 

Scoring:
This is , so may the shortest code in bytes win!Posted: Prime Power Switch

Prime Power Switch

Input: A positive integer n=p^q where p and q are prime.

Output: Output the result of q^p

Test cases (in, out):

4, 4 8, 9 25, 32 27, 27 49, 128 121, 2048 125, 243 343, 2187 1331, 177147 3125, 3125, 16807, 78125, 823543, 823543 161051, 48828125 19487171, 1977326743 

Mathematica Example Implementation

Power@@Reverse@Flatten@FactorInteger[#]&; 

Scoring:
This is , so may the shortest code in bytes win!

Source Link

Prime Power Switch

Input: A positive integer n=p^q where p and q are prime.

Output: Output the result of q^p

Test cases (in, out):

4, 4 8, 9 25, 32 27, 27 49, 128 121, 2048 125, 243 343, 2187 1331, 177147 3125, 3125, 16807, 78125, 823543, 823543 161051, 48828125 19487171, 1977326743 

Mathematica Example Implementation

Power@@Reverse@Flatten@FactorInteger[#]&; 

Scoring:
This is , so may the shortest code in bytes win!