[Question]
  [
Given a positive integer number \$n\$ output its perfect radical.
# Definition
A perfect radical \$r\$ of a positive integer \$n\$ is the lowest integer root of \$n\$ of any index \$i\$:
$$r = \sqrt[i]{n}$$
where \$r\$ is an integer.
In other words \$i\$ is the maximum exponent such that \$r\$ raised to \$i\$ is \$n\$:
$$n = r^i$$
This is OEIS [A052410](http://oeis.org/A052410).
# Special cases
For \$n = 1\$ we don't really care about the degree \$i\$ as we are asked to return \$r\$ in this challenge.
* Just take \$r=1\$ for \$n=1\$.
* Since there is an OEIS for this and it starts from 1 you don't have to handle \$n=0\$.
# Note
A positive integer \$n\$ is expressed in the form \$100...000\$ if we convert it to base \$r\$
For example the perfect radical of \$128\$ is \$2\$ which is \$1000000\$ in base \$2\$, a \$1\$ followed by \$i -1\$ \$0\$s.
**Input:** a positive integer. You don't not have to handle inputs not supported by your language (obviously, abusing this is a [standard loophole](https://codegolf.meta.stackexchange.com/a/8245/66833).)
**Output:** the perfect radical of that number.
You may instead choose to take a positive integer \$n\$ and output the radicals of the first \$n\$ positive integers, or to output the infinite list of radicals.
# Test cases
This is a list of all numbers \$n \le 10000\$ where \$n \ne r\$ (expect for \$n = 1\$, included as an edge case, included also some cases where r==n for completeness sake ) :
```
[n, r]
[1, 1],
[2,2],
[3,3],
[4, 2],
[5,5],
[6,6],
[7,7],
[8, 2],
[9, 3],
[10,10],
[16, 2],
[25, 5],
[27, 3],
[32, 2],
[36, 6],
[49, 7],
[64, 2],
[81, 3],
[100, 10],
[121, 11],
[125, 5],
[128, 2],
[144, 12],
[169, 13],
[196, 14],
[216, 6],
[225, 15],
[243, 3],
[256, 2],
[289, 17],
[324, 18],
[343, 7],
[361, 19],
[400, 20],
[441, 21],
[484, 22],
[512, 2],
[529, 23],
[576, 24],
[625, 5],
[676, 26],
[729, 3],
[784, 28],
[841, 29],
[900, 30],
[961, 31],
[1000, 10],
[1024, 2],
[1089, 33],
[1156, 34],
[1225, 35],
[1296, 6],
[1331, 11],
[1369, 37],
[1444, 38],
[1521, 39],
[1600, 40],
[1681, 41],
[1728, 12],
[1764, 42],
[1849, 43],
[1936, 44],
[2025, 45],
[2048, 2],
[2116, 46],
[2187, 3],
[2197, 13],
[2209, 47],
[2304, 48],
[2401, 7],
[2500, 50],
[2601, 51],
[2704, 52],
[2744, 14],
[2809, 53],
[2916, 54],
[3025, 55],
[3125, 5],
[3136, 56],
[3249, 57],
[3364, 58],
[3375, 15],
[3481, 59],
[3600, 60],
[3721, 61],
[3844, 62],
[3969, 63],
[4096, 2],
[4225, 65],
[4356, 66],
[4489, 67],
[4624, 68],
[4761, 69],
[4900, 70],
[4913, 17],
[5041, 71],
[5184, 72],
[5329, 73],
[5476, 74],
[5625, 75],
[5776, 76],
[5832, 18],
[5929, 77],
[6084, 78],
[6241, 79],
[6400, 80],
[6561, 3],
[6724, 82],
[6859, 19],
[6889, 83],
[7056, 84],
[7225, 85],
[7396, 86],
[7569, 87],
[7744, 88],
[7776, 6],
[7921, 89],
[8000, 20],
[8100, 90],
[8192, 2],
[8281, 91],
[8464, 92],
[8649, 93],
[8836, 94],
[9025, 95],
[9216, 96],
[9261, 21],
[9409, 97],
[9604, 98],
[9801, 99],
[10000, 10]
```
# Rules
* Input/output can be given by [any convenient method](http://meta.codegolf.stackexchange.com/q/2447/42963).
* You can print it to STDOUT, return it as a function result or error message/s.
* Either a full program or a function are acceptable.
* [Standard loopholes](http://meta.codegolf.stackexchange.com/q/1061/42963) are forbidden.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so all usual golfing rules apply, and the shortest code (in bytes) wins.
[Sandbox](https://codegolf.meta.stackexchange.com/a/20521/84844)
  
[Answer]
# [J](http://jsoftware.com/), 14 bytes
```
(%+./)&.(_&q:)
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NVS19fQ11fQ04tUKrTT/a3JxpSZn5CtoWKdpKhibcSmAAFQoTcFEU8FWwQjOtUDlWoK4xnCuoRmqtJEpiG@K4Jujqjc2QlVvDNZvhrAcbL45nG@G7hpDNPsNDEAChgZc/wE "J – Try It Online")
```
(%+./)&.(_&q:)
      &.(_&q:) number to prime exponents
(%+./)         divide them by their GCD
      &.(_&q:) prime exponents to number
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
ÆEgƒ0:@ƊÆẸ
```
[Try it online!](https://tio.run/##RZRNilVBDIW38hbwwErlXxCcuAhpHIogvQGnDlpw2BNdhAtQp40NLqPdyPOepOr16Ia6t5IvOSf34/vb20@Xy8Pdmw@P9@Pl68evD3dPv39eHr68@nP/9Ov7328v/n3@8fZyuaHzid6dTzdyPk08Yz3zfGI8ydbB1PNJK/D1iud6xcc3VkmOW47Arulo5xnjqDQqnChKHe6sNHdlkuMydWhHQur7eRQhKQDa9SauU1MJr0pTr8iB696sSBoV4ss@NIBkkQNvFp7IcTp7KIE@KpfS7lbnkXVWKXWUKii7dmJ1WHw@9xi9MlX9qPxVNVGVq2qChWmN6nlWY@5R0kA73NMgNMnSk0NpXlPMPRtifh4zY5Dsa7xHRi4UUkjB2bNGVemqBt2k7zqUWXo4hJWOA2rLEgcWkFZnAEdalCFb1UlQTVo2iu2hSelb4jkHMhbl5IFK0dIOWopNBaQW5DQcK7Un8bl2JS8DNUwgpXb6BIHWORekFiQ/m5AJfagtx@BqG4XRt7Z92K@mY8GcNNtMQLNCY8dcrdA4gGO9KAkdjNtxuX0qpaBVSmEoa71OAsWtEMRgBCsEcZjF2rjlIW/nJvE2vA7YzKm9C/d5u5fhSW/7CqzqNREtA7u2reu8GDSw5r05mnW3N3xUzmjvV63szQdPFI@p7fU3B34UgoXm3jsLtBi9IwOth/TmACcKxxmTit4oxQSjELyEjujYt/E9Mfyo9DGe9zrqF5Qrzr3OMaFhUq8mdM4@N@ifRRYBX6T0zoIsiyzrV5TWsV3/GymwXXovNqyZRZkBy2buLe81/w8 "Jelly – Try It Online")
`ÆE:g/$ÆẸ` errors given 1.
```
ÆE            Take the exponents of the input's prime factorization.
     :@Ɗ      Divide each exponent by
  gƒ0         the exponents' GCD (or 0 in the case that there are none).
        ÆẸ    Let the result be the exponents of the output's prime factorization.
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 6 bytes
```
1|~^hℕ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSu9qhtw6Ompoe7Omsfbp3w37CmLi7jUcvU//@jDXUUTHQULHQULHUUDM10FIxMgdhcR8HYCIiBfBOguJlJLAA "Brachylog – Try It Online")
```
1|~^hℕ  with the implicit input n
1       input and output is 1
 |      or
  ~^    find two numbers [r, i] so that r^i = n
    h   return r
     ℕ  to limit the search space: r must be positive
```
Search tries lowest `i` first, so we get the maximum `r` for free.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~55~~ \$\cdots\$ ~~59~~ 57 bytes
Added 7 bytes to fix an error kindly pointed by [user](https://codegolf.stackexchange.com/users/95792/user).  
Saved 3 bytes thanks to [user](https://codegolf.stackexchange.com/users/95792/user)!!!
```
lambda n:{r**i:r for i in range(n)for r in range(n+1)}[n]
```
[Try it online!](https://tio.run/##TVHLcoMwDLznK3QDUncmEsZAZuiPkBzSFBqmrZMx9NBh@HZq@UHri@S1tbuSHj/T7a7ztW9O6@fl6/XtAvo4m/1@OBro7wYGGDSYi37vUp0xYP4BT5gtrT6vUzdOIzSQtijwLKAlAcQxF5BzlOFeCCg4KgGKYymg5FiF9zr8x4MAPLhMhSeKtVSGT/mmEulkHfhUFKxwY/yjJAsi@jSyIkUPKG0x@lRZQvT1tRVB6Qxg1CMuR@9Kxl6p2CxXXF56r0xauZR/elCxkdo5Z3vk7ElpUXL2ZMV9@Mlh7LYgy0pOqihZyplSWyfKgX685Aaa7a637vrRGV5RcvqmUl4TEOBSzJNsx4udRMerdbs87sAeXmmfTpm7PMygp7RP5mmB5xeYxwXmQNuOTdOdlyRbfwE "Python 3 – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 8 bytes
```
VȯεΣ`B¹ḣ
```
[Try it online!](https://tio.run/##ASIA3f9odXNr/23igoHigKYwIDEwMP9WyK/Otc6jYELCueG4o/// "Husk – Try It Online")
```
V           # index of first truthy element of
 ȯ          # applying 3 functions to
       ḣ    # 1...input
    `B¹     # convert input to this base
   Σ        # sum of digits
  ε         # is at most 1
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~8~~ ~~6~~ 5 bytes
```
bR§i1
```
[Try it online!](https://tio.run/##AS4A0f9qZWxsef//YlLCp2kx/8OH4oKsxZLhuZj//zEsIDQ5LCA2NCwgMjE2LCA5MjYx "Jelly – Try It Online")
Uses the fact that `n` in base `r` has the format `100...000`, meaning that the sum of the digits only equals 1 in base `r`
-1 byte (indirectly) thanks to [Dominic van Essen's answer](https://codegolf.stackexchange.com/a/215878/66833), make sure to give them an upvote
## How it works
```
bR§i1 - Main link. Takes n on the left
 R    - [1, 2, 3, ..., n]
b     - Convert n to each base 1, 2, 3, ..., n
  §   - Sum of the digits of each
   i1 - First index of 1
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~~~8~~~~ ~~11~~ 8 bytes
-3 thanks to @ovs!
```
L¦BíCXkÌ
```
[Try it online!](https://tio.run/##yy9OTMpM/f/f59Ayp8NrnSOyD/f8/29mZAoA)
I am trying to somehow implement a log function to check whether a number matches the regex `10*`, but that is too mathematical for me...
# Wait, how?
```
L              # Push all numbers natural numbers up to input          [1, 2, 3 ... I]
 ¦             # What is that 1 doing there? Remove it!                [2, 3, 4 ... I]
  B            # Convert the input to each of the bases e.g input: 9   [1001, 100, 21...]
   í           # Reverse each string                                   [1001, 001, 12...]
    C          # Convert each from binary to decimal                   [9, 1, 4...]              (How though! Can someone explain?)
     Xk        # Get first index of 1                                  1
       Ì       # Add 2                                                 3
```
[Answer]
# [k4](https://code.kx.com/q/ref/), ~~26~~ ~~24~~ ~~21~~ 18 bytes
-2 bytes by ignoring `n=0` case
-3 bytes by applying [@caird coinheringaahing's logic](https://codegolf.stackexchange.com/a/215859/98547)
-3 bytes by simplifying/combining operations
```
{(x{+/y\:x}'!x)?1}
```
Benefits from `list ? value` returning the count of the list if the value isn't present in it, and from convenient weirdness with the `n=0` and `n=1` edge cases.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 60 bytes
```
.+
$*
(?<=(?=((?=((1*)(?=\5\3+$)1)(\2*$))\4)*1$)^(..+)).*
1
```
[Try it online!](https://tio.run/##Hco9CsMwFAPgXedwwc8BE8lxfqAhYy9hSjt06NKh9P7Oo4MQSN/39Xt/nv0Sb4@eB4SEeFz3eOzxHybzbrWVIRgtNqVg1iZLDHaPOQ9mOQHsfQQhFEyomLFgxQaNkK@CCjRBFZqhBVqhDfSb/tMBXdAJ3dARXdEZtZ0 "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
.+
$*
```
Convert to unary.
```
(?<=(?=...$)^(..+)).*
```
Delete the earliest suffix leaving behind the smallest prefix \$r\$ (captured into `\5`) such that the \$n\$ matches the following:
```
((?=((1*)(?=\5\3+$)1)(\2*$))\4)*1
```
Find \$k\$ `\3` such that \$n-r\$ is divisible by \$k\$, but also \$n\$ is divisible by \$k+1\$ `\2`. Apparently this can only be satisfied by \$n=r(k+1)\$, but I can't find the answer where this is proved. \$(r-1)(k+1)\$ is then subtracted from \$n\$, resulting in \$k+1\$. This is then repeated until \$n\$ is reduced to \$1\$, which is matched at the end.
```
1
```
Convert to decimal.
[Answer]
# [R](https://www.r-project.org/), 47 bytes
```
n=scan();match(n,sapply(0:n,"^",1:n))%/%n-(n<2)
```
[Try it online!](https://tio.run/##jc3BCsIwDADQe78iVAYJVOwGXjr3JyKE2LKhZsPUg19fL3r3/A7v2ZpOJqxI44OrzKjBeNvub4xJg7/40Ccl6g6d7lFPA7Xh6JxwRX9WT24H11wWzcAGDOWlUpdVoa4gc5Yb1GwVhC1bcmX6OSr9t7kv96mPMRRqHw "R – Try It Online")
Struggled for ages trying to beat [Giuseppe's answer](https://codegolf.stackexchange.com/a/215862/95126), only to be totally outgolfed (seconds before posting) by Robin Ryder's comment (now an [answer](https://codegolf.stackexchange.com/a/215904/95126))...
[Answer]
# [R](https://www.r-project.org/), ~~37~~ 33 bytes
-4 bytes thanks to Dominic van Essen
```
match(T,!log(n<-scan(),1:n)%%1,1)
```
[Try it online!](https://tio.run/##Vc2xCsJADIDhPU8RK4UETmg2OfQtHF2OeGeLNS29OPj05yTo/MP3b609k@tIl7CblzvZ6VA1GXGQaNz3EoTbUQA0OXVX6xj2eMtlsoypYnmZ@rQY@oI6Zn2g5@qoqeYaoZy/nYz/Nz88QE3rOr9JogxDKNw@ "R – Try It Online")
A different (and shorter) approach than the one used in [Giuseppe's](https://codegolf.stackexchange.com/a/215862/86301) and [Dominic van Essen's](https://codegolf.stackexchange.com/a/215881/86301) R answers.
Finds the first integer `k` such that `log(n,k)` is an integer, or returns `1` if there is no such `k` (which corresponds to the special case `n=1`).
[Answer]
# JavaScript (ES7), 36 bytes
Recursively looks for the highest \$i\le n\$ such that \$k=n^{1/i}\$ is an integer. Then returns this \$k\$.
```
f=(n,i=n)=>(k=n**(1/i))%1?f(n,i-1):k
```
[Try it online!](https://tio.run/##FYxBDoIwEEX3nGIWmMyAIN2Ko1ehAWoqZMYAYdP07LWu/kvey//Y0@7j5r9HIzrNKTlGuXoW4icuLFWF5uaJLubl/qIxdF@S0w0FGEwPAo@8XZeprglCATCq7LrO7apvHCyWQSLluAz5geJAfRHTDw "JavaScript (Node.js) – Try It Online")
---
# JavaScript (ES7), 37 bytes
A slightly longer version that performs more recursive calls but is not subject to rounding errors.
```
n=>(g=k=>k**i-n?g(k-1||i--|n):k)(i=n)
```
[Try it online!](https://tio.run/##DcqxDoMgEIDh3ae4weFOQxNNutSefRWJCqGYo9GmC/DslOn/hv@tf/paT/f5KgnbXgwX4Rkte5591zklL4teDSk5pZLQwxM6FiomnCjAMEwg8Kwd71V9TxAbgDXIFY79dgSLi8Y2SqY6t9GgUF5oanL5Aw "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), ~~53~~ 51 bytes (thanks [@user](https://codegolf.stackexchange.com/users/95792/user) for pointing out extra spaces)
```
def r(n):
    i=n
    while(a:=n**(1/i))%1:i-=1
    return a
```
[Try it online!](https://tio.run/##K6gsycjPM7YoKPr/PyU1TaFII0/Tiksh0zaPS6E8IzMnVSPRyjZPS0vDUD9TU1PV0CpT19aQS6EotaS0KE8h8X9BUWZeiUaRhqGmJheMbYLEtkBiWyKxDc2QOEamyDxzI6DC/wA)
[Answer]
# [R](https://www.r-project.org/), ~~49~~ 44 bytes
```
n=scan();which(outer(1:n,n:1,"^")==n,T)[1,1]
```
[Try it online!](https://tio.run/##K/r/P8@2ODkxT0PTujwjMzlDI7@0JLVIw9AqTyfPylBHKU5J09Y2TydEM9pQxzD2v6GJyX8A "R – Try It Online")
Thanks to Dominic van Essen for pointing out a bug.
```
n <- scan()				# read input
arr <- outer(0:n,1:n,"^")		# create the array of powers (0^(1:n), 1^(1:n), ... n^(1:n))
arr <- t(arr)				# transpose, so the array is ((0:n)^1, (0:n)^2, ... (0:n)^n)
ind <- which(arr==n,T)			# get 1-based array indices where arr == n. So they are a matirx of rows of [i+1,r+1] pairs, sorted in increasing order of r
ind[1,2]-1				# extract the appropriate r.
```
[Answer]
# [Factor](https://factorcode.org/), 49 bytes
```
[ dup [1,b] 2dup '[ _ swap _ n^v member? ] find ]
```
[Try it online!](https://tio.run/##LYy9DoJAEAb7e4rPysaYgEZFC0tDQ2OsCJrzXJToHefegjHGZ8ffaqaYTKmN1Nxt1mm2mqPkO87Eji6wWk5D1u5I4ectfcoAzyRy91w5QaBrQ85QUAuVZnMEw1rMSakehIKgcr6RoB6IEGOEMRJEE8RTzCIkCZ5djkPjkUeDfYH4o/0cO4Sb9m@4bQtLdk@8RIGycgcU3f9cN/Jd23c5VOZCmrsX "Factor – Try It Online")
Slow for larger inputs because it tries to evaluate a large power.
```
[
  dup [1,b] 2dup       ! ( n 1..n n 1..n )
  '[                   ! Put stack items in the `_`s in the quotation
    _(n) swap _(1..n)  !   ( elt -- n elt 1..n )
    n^v member?        !   Test if n appears in elt^(1..n)
  ] find               ! Find the first number in 1..n that satisfies the above
]
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
Inspired by [SunnyMoon's answer](https://codegolf.stackexchange.com/a/215863/64121).
```
LÀ.ΔBR
```
[Try it online!](https://tio.run/##yy9OTMpM/f/f53CD3rkpTkH//xsCAA "05AB1E – Try It Online")
```
L         # push the range [1, 2, ..., n]
 À        # rotate the 1 to the back: [2, 3, ..., n, 1]
  .Δ      # find the first integer where ...
    B     #   the input converted to that base
     R    #   reversed
          #   implicit: is equal to 1 as a number
```
---
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
```
LÀ.Δ.n.ï
```
[Try it online!](https://tio.run/##yy9OTMpM/f/f53CD3rkpenkuh9cH/v9vaGkGAA "05AB1E – Try It Online") There was [a bug with `.ï`](https://github.com/Adriandmen/05AB1E/issues/160), which has recently been fixed, but the interpreter on TIO is not up to date.
```
L         # push the range [1, 2, ..., n]
 À        # rotate the 1 to the back: [2, 3, ..., n, 1]
  .Δ      # find the first integer where ...
    .n    #   the logarithm of the input in that base
      .ï  #   is an integer
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-g`](https://codegolf.meta.stackexchange.com/a/14339/), 10 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
I feel like I'm missing a trick here.
```
õ ï æ@¥Xrp
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWc&code=9SDvIOZApVhycA&input=NA)
```
õ ï æ@¥Xrp     :Implicit input of integer U
õ              :Range [1,U]
  ï            :Cartesian product with itself
    æ          :Get first pair that returns true
     @         :When passed through the following function as X
      ¥        :  Test U for equality with
       Xr      :  X reduced by
         p     :    Exponentiation
               :Implicit output of first element of that pair
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 10 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
┌Pèó~JRå▲ï
```
[Run and debug it](https://staxlang.xyz/#p=da508aa27e4a52861e8b&i=4%0A49%0A125&m=2)
## Explanation
```
R{xs|E|+1=}j
R            range 1..n
 {        }j get first number i where:
  xs|E       input(x) in base i digits
      |+     summed
        1=   equals 1
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 12 (10) [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ÓDā<Ør0š¿÷mP
```
Port of [*@UnrelatedString*'s Jelly answer](https://codegolf.stackexchange.com/a/215860/52210).
The `0š` shouldn't be necessary, but unfortunately [there is a bug in 05AB1E for `¿` with empty lists](https://github.com/Adriandmen/05AB1E/issues/178).
[Try it online](https://tio.run/##AR8A4P9vc2FiaWX//8OTRMSBPMOYcjDFocK/w7dtUP//MzI0) or [verify all test cases](https://tio.run/##PVQ7blRBELzKYyMsbTA9PdPTLSFtYBOQ8LHILAfYcuAAWTIIyQEBCQeAhJSYA0CCkFhIEWfgIstUzexGb7b3dVdNVfW7efXi4vpq9@bu7/eTzWr59/7Dstrsth9Pfr17sP10m35//vlj@/Xl093J5u7Pt2fXq@X@5c3t7dXl66PV9kv/9ejx8ZPT04fHz@8drd6ud2dnsl7kfH1W1kvuDx@PWC/aH2LjZ67rpeLZRl3zqGv/39Dc32/9afspMvtT6tMTThk4wtMcJnmCSeltwpP1QcLO6KOlAFMmSEajkEbRMT/XPUFHYyM1DHOc8BZLBuwAT/DJ4FNKr2Ve3EEaQ6rMa9Xcp2UA1AYA0LA9bWMJhFqeMjWOAKZzLKACUAqoALzKkOOgR8pTK0ngrry04D5aKA7wdOgUUwFRPaiokErbkK@PUsBLhcwalBJYhVgGPwrbGkQfWje4VXh0GFiG7vC0UPgECoWCpzK9ygI7Cv0Qn3HIEm36lnPCKPDKmgDgNCzJ8CJX0KqglQ3FKswVXq0EaEwDCThmVY4NwFZUlbQqaOkhSyqgXW0EAF00XnHFyjBo26dHC@SowWSAjYGNNkhnYKMOCsaAB2Q2ZXZihq3QG8OsonDMuAMFPhpwi8FcA25pcN8YPkaiMX0hOvNaEyLThPlDjhoTqMhWYwQLAtdw9coQtspgsgrg6lhHRr4G27iKicOc0SVEcEHBwcHBqs0ttQa6DlzzGnNXzHEfZ74TbumFmQcFB4WmEMS5CRUyOXAb/XPnsc3gtoC4jrGeDjvo/DzEOMbcPc9wJ4TLBPuCVYOpATLusDoKdwxkAmSCn4kwHm2/21GQoGjcQkQswCscwYuYGzlW8vw/).
**Explanation:**
```
Ó             # Get the prime exponents of the (implicit) input-integer
 D            # Duplicate this list of exponents
  ā           # Push a list in the range [1, length] (without popping the list itself)
   <          # Decrease each by one to make the range [0, length)
    Ø         # Get the n'th prime for each of these indices
     r        # Reverse the three lists on the stack
      0š      # Prepend a 0 (work-around for `¿` bug with empty lists)
        ¿     # Pop and get the greatest common divisor (gcd) of this list
         ÷    # Integer-divide all values in the list by this gcd
              # (we use integer-division due to another bug that isn't on TIO yet,
              #  as well as to get an integer output, instead of float)
          m   # Take the primes we created earlier to the power of these values
           P  # And take the product of that
              # (after which it is output implicitly)
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~65~~ ~~60~~ 58 bytes
Saved 5 bytes thanks to [Sisyphus](https://codegolf.stackexchange.com/users/48931/sisyphus)!!!
```
p;i;r;f(n){for(r=0;r++<n;)for(p=i=1;i++<n;p*=r)n=p-n?n:r;}
```
[Try it online!](https://tio.run/##XZTrbhs3EIX/5ykIAwEke43yfulG7Y@iT1EbhSGvUiHpRpAM1KjhV68633AtJBZAijucGZ45Z8jt7eft9nw@jPvxOO5W8/pl9@24Om7seLy5@TSPaz4Pm/3GjXs1HK43x/W8OdzOv84/H8fX898P@3m1Ni8fjPz285N5mk5Ppz/nP@7Nxry4wfjBhMHEwaTB5MGUwdTBtME4K0MMXuxerAFH@Y6yl8W9Onxw8qxwc15CXYwEkqERrjk0SQxk47M28olfwBayJIikipFVBYyT45IXv1QkIpMgsyrYCi4V50ZYyx0LYCxpneUE5zjM@Q4NMC4EPIOiiwo0KfqssVlrKlpFoUZXo9ZB3d5qETZWitKqXC3Mjdlb8fTBRgq18JrI6bOui9oLJ/qqno0MQXMG12dOEVbgJnB6CAV7BFVQhKGANlTyhEYV0VJX1BpjoN4YqT1meIhFqVWSYnPCdbKwlpxyHJTfCK1JGU5F1xWtU2M3WzwlmUN18uREzlzIn2vCp3JisUnlIU8JoCoJhEWrLpq5NPBXVaq6Pjc5q3pqrFH7KsNArbDRlJ@mPdQ857YIey3DZ6t20d2@jpf@np4P0/ZpenzX4P67Bu8WGrxb@/b7Ped009M8NA0to17uEuIKPaJxDlHJyIledz1O/WL53EPoHfRFS3eBELgESNoRcnDgxlVURmMZrsOIDO4r6nZ0secGYCxcH8WTLDJzhzruhPj8JwWEVgm32utRHVEXbSFj4QRE3L@CzDJU6F54cciN2DKQGOHzQgj7/COlVXzVd5Iqa3ROaC2DF6dq4XXhsHVaGnrzH9BdBr2QO8XcucZDpS/VIv/2r4fjtczT9st07Ppf3T3/7u@e228y0tVgvv8OV0ucPKJmRe/s58fpWcLsuCw/mdP@3@nbbrW8muuflu/rN8Nobm7U9@2NfevDWfK8vbXqcD/@sH@SfV70H62TWC8d/D7scBSX3erq46O5/cXI/PF0N0tR82BOw6XuabM53S9pXz@8nv/b7r4@fD6db//5Hw "C (gcc) – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 27 bytes
```
Most@*Internal`PerfectPower
```
[Try it online!](https://tio.run/##LZJBixRBDIX/Sp@lYSuVVCV1EObqQRjPIjgs7TrgzsLY4kH87W19GQ9dpKtfXt576dfL/n17vezX58vx8v74@PZzP737cNu3@@3y4@t5u3/bnvfz2@/tfnz6dd32z@f79bYvT6eXp9MfWRdbl1iXsS7S16W2@fi6aJ3PfLd530FMoJQyj0oFTOpsEzMa6R60J0eSmMLGawz4Jk65085MqMyoYn5oMse1OnHNZ0eHoFM5dw4kAA/aRn9oQUyBVgoTRBgm9SENMaIKUlOdpdCW6nv29vTk6cLxKGHpA9@1pIligal0JeGcg7OWiaxaDKNFcApn7Vl73jsTayRywKDJqfI4mTJTIRtluqpzb6jSVKiOWg14dODCCr4sPZri1wzv1snBPKPNkGzIzLoVUmuSGWvma8TaMuHmWQe7boOvvYCcZMLW4ekNzu7w92hggoleWq4HHldUeUOhp2tPZh/oj9xUyOMcc1ZUPIblf9VJIII0RuYz8h8albnDSG908hxR/u@9/P1yHP8A "Wolfram Language (Mathematica) – Try It Online")
-20 bytes from att
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 33 bytes
```
@(n)[~,j]=find((t=1:n)'.^t'==n,1)
```
[**Try it online!**](https://tio.run/##y08uSSxL/Z9mq6en999BI08zuk4nK9Y2LTMvRUOjxNbQKk9TXS@uRN3WNk/HUPN/moahJleahgWIMLEEkYZGlmYg2tLIDCgPAA "Octave – Try It Online")
### How it works
```
@(n)                               % anonymous function with input n
               (t=1:n)             % let t = [1, 2, ..., n] (row vector)
                       .^          % element-wise power with broadcast...
                      '            % of t transposed...
                         t         % raised to t. Gives n×n matrix of powers
                          '==n     % test each entry for equality with n
    [~,j]=find(               ,1)  % col index of the first true entry (in linear order)
```
[Answer]
# Scala, 50 bytes
Back to 50 bytes because n=0 doesn't have to be handled anymore!
```
n=>1.to(n)find(r=>1.to(n)exists(n==math.pow(r,_)))
```
[Try it online!](https://scastie.scala-lang.org/xDx1z2cBTnKTqoN8mIu68w)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~19~~ 16 bytes
```
ＮθＩ⊕⌕Ｅθ⎇ιΣ↨θ⊕ιθ¹
```
[Try it online!](https://tio.run/##S85ILErOT8z5/98zr6C0xK80Nym1SKNQ05oroCgzr0TDObG4RMMzL7koNTc1ryQ1RcMtMy9FwzexQKNQRyEktSgvsahSI1NHIbg0V8MpsTgVJIysPFNTU1NHoRBEGAKZmtb//xsamf7XLcsBAA "Charcoal – Try It Online") Link is to verbose version of code. Edit: Now back to a reformulation of my original answer. Works by converting `n` to each base `1..n` and finding the first 1-indexed value with a digit sum of `1`. Conveniently this automatically works for an input of `0` (the resulting list is empty, so the 1-indexed position is `0`), so the only edge case is base `1` as Charcoal cannot convert to unary, but the digit sum is always `n` in base `1` anyway. Explanation:
```
Ｎθ                  Input `n` as a number
      θ             `n`
     Ｅ              Map over implicit range
        ι           Current value
       ⎇      θ     If zero then `n` else
          ↨θ        `n` converted to base
            ⊕ι      Incremented value
         Σ          Sum of digits
    ⌕          ¹    Find first occurrence of literal `1`
   ⊕                Increment (convert to 1-indexing)
  Ｉ                 Cast to string
                    Implicitly print
```
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 34 bytes
```
++$\until grep"@F"==$\**$_,1..$_}{
```
[Try it online!](https://tio.run/##K0gtyjH9/19bWyWmNK8kM0chvSi1QMnBTcnWViVGS0slXsdQT08lvrb6/3/Df/kFJZn5ecX/dQsSAQ "Perl 5 – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 55 bytes
```
f=lambda n,r=1,i=1:r*(r**i==n)or f(n,r+(i>n),i>n or-~i)
```
[Try it online!](https://tio.run/##NZBNbsMgEIX3OcV0Z7vTlAGME0v0IlYWdhsrSDFE2F1kk6u7A3aRePw83jcjHs/lFrxa3fQIcYH5OR94HufrEq/fv3F2wd/d5JaCBI9yHe29n4afHjxGS@gstbEqYlU5a30ZIowFO@@F@/IlskCIHy/HObZ6HMB56DpCoAt2EiWrQsWqEdKhxprVoGFtsGE9bcYZIT0jgSTSarZrWSOkhGw2X8ntXrGfGJpziWJ2/on@OYJ7yCSZuqG822Ek96KkOUZ5ZxhEOXlmNOlUk/YiMgUpt6FV4l/aA7iRv6Iv3@zQ0qdY/wA "Python 3 – Try It Online")
My first golf in over a year! It's a bit longer than [this answer](https://codegolf.stackexchange.com/a/215919/82577), but doesn't use that nasty floating point. As many good code golf answers do, this hits the recursion limit pretty soon.
[Answer]
# [Python 3](https://docs.python.org/3/), 74 bytes
```
lambda n,r=round:r(n**[1/i for i in range(1,n+1)if r(n**(1/i))**i==n][-1])
```
[Try it online!](https://tio.run/##RVHLcoMwDLznK3QDU2caGWMgM/RHCIc0gYRp62QMOXQy@XZq@UF90cPS7kq6/87Xm86XoTks38efz/MRNDeNuT30eW9SnWUtvo8w3AyMMGowR33pU@T6Ddk4gKtIbQVjWTY2je7aLXZsmftpnqCBtEWOHYdWcBBkcw45WRnigkNBVnFQZEsOJdkq/NehHncccOc8Fb5E7BVlKMpXlggn64CnImGFK@I/pLBJRO9GVBRRA0rbjN5VFhB9f21JUDoBGPkEtaNXJeOsolglV9Reeq0EWjmXKn1SkZDaKSd5wsmT0maFkycrmsNvDuO0hbCowlEVJVE5UWqdRLmkX69wC2Wb07U/ffWGTpQcHqKUpwQ4OBfzhG3o4DPv6eTulvsN2EcnHdKZueBuRj2nQ/KcX7D9gOf0gmeAbaem6btXwpY/ "Python 3 – Try It Online")
This solution is longer but faster than this [answer](https://codegolf.stackexchange.com/a/215867/99104)
]