[Question]
  [
While bored in high-school (when I was half my current age...), I found that \$f(x) = x^{x^{-1}}\$ had some interesting properties, including e.g. that the maximum \$f\$ for \$0 ‚â§ x\$ is \$f(e)\$, and that the [binding energy per nucleon](https://commons.wikimedia.org/wiki/File:Binding_energy_curve_-_common_isotopes.svg) of an isotope can be approximated as [\$6 √ó f(x √∑ 21)\$](http://www.wolframalpha.com/input/?i=Plot%5B6%20(x%2F21)%5E(x%2F21)%5E(-1),%20%7Bx,%200,%20140%7D%5D)...
Anyway, write the shortest function or program that calculates the xth root of x for any number in your language's domain.
## Examples cases
### [For all languages](https://www.wolframalpha.com/input/?i=x%5Ex%5E-1+for+x+from+0+to+5)
```
     -1   >       -1
   ¬Ø0.2   >    -3125
   ¬Ø0.5   >        4
    0.5   >     0.25
      1   >        1
      2   >    1.414
      e   >    1.444 
      3   >    1.442
    100   >    1.047
  10000   >    1.001
```
### [For languages that handle complex numbers](https://www.wolframalpha.com/input/?i=x%5Ex%5E-1+for+x+from+-5+to+5)
```
   -2   >        -0.7071i
    i   >            4.81         
   2i   >    2.063-0.745i
 1+2i   >   1.820-0.1834i
 2+2i   >   1.575-0.1003i
```
### For languages that handle infinities
```
-1/‚àû   >   0    (or ‚àû or ÃÉ‚àû)
   0   >   0    (or 1 or ‚àû)
 1/‚àû   >   0
   ‚àû   >   1
  -‚àû   >   1
```
### For languages that handle both infinities and complex numbers
```
 -‚àû-2i   >   1      (or ÃÉ‚àû)
```
---
 `ÃÉ‚àû` denotes [directed infinity](https://en.wikipedia.org/wiki/Directed_infinity).
  
[Answer]
# TI-BASIC, 3 bytes
```
Ans√ó‚àöAns
```
TI-BASIC uses tokens, so `Ans` and `√ó‚àö` are both one byte.
### Explanation
`Ans` is the easiest way to give input; it is the result of the last expression. `√ó‚àö` is a function for the x'th root of x, so for example `5√ó‚àö32` is 2.
[Answer]
# Jelly, 2 bytes
```
*ƒ∞
```
[Try it online!](http://jelly.tryitonline.net/#code=KsSw&input=&args=Mg)
### How it works
```
*ƒ∞    Main link. Input: n
 ƒ∞    Inverse; yield 1√∑n.
*     Power (fork); compute n ** (1√∑n).
```
[Answer]
# Javascript (ES2016), 11 bytes
```
x=>x**(1/x)
```
I rarely ever use ES7 over ES6.
[Answer]
## Python 3, 17 bytes
```
lambda x:x**(1/x)
```
Self-explanatory
[Answer]
# Haskell, ~~12~~ 11 bytes
Thanks @LambdaFairy for doing some magic:
```
(**)<*>(1/) 
```
My old version:
```
\x->x**(1/x)
```
[Answer]
# J, 2 bytes
```
^%
```
[Try it online!](https://tio.run/nexus/j#@5@mYGulEKf6PzU5I18hTUEj3lAh3kDPCESYKoCwoYKRgpGeuaGFkYWCsYKhgQEIGxhocsF1GCkYZBkCsZGCIRAbZRlp/gcA).
### How it works
```
^%  Monadic verb. Argument: y
 %  Inverse; yield 1√∑y.
^   Power (hook); compute y ** (1√∑y).
```
[Answer]
## Pyth, 3 bytes
```
@QQ
```
Trivial challenge, trivial solution...
### (noncompeting, 1 byte)
```
@
```
This uses the implicit input feature present in a version of Pyth that postdates this challenge.
[Answer]
# JavaScript ES6, 18 bytes
```
n=>Math.pow(n,1/n)
```
[Answer]
## Java 8, 18 bytes
```
n->Math.pow(n,1/n)
```
Java isn't in last place?!?!
Test with the following:
```
import java.lang.Math;
public class Main {
  public static void main (String[] args) {
    Test test = n->Math.pow(n,1/n);
    System.out.println(test.xthRoot(6.0));
  }
}
interface Test {
  double xthRoot(double x);
}
```
[Answer]
# R, ~~19~~ 17 bytes
```
function(x)x^x^-1
```
-2 bytes thanks to @Flounderer
[Answer]
# Java, 41 bytes
```
float f(float n){return Math.pow(n,1/n);}
```
Not exactly competitive because Java, but why not?
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 5 bytes
```
t-1^^
```
[**Try it online!**](http://matl.tryitonline.net/#code=dC0xXl4&input=Mmo)
```
t       % implicit input x, duplicate
 -1     % push -1
   ^    % power (raise x to -1): gives 1/x
    ^   % power (raise x to 1/x). Implicit display
```
[Answer]
# Mathematica, ~~8~~ ~~7~~ ~~4~~ 7 bytes
```
#^#^-1&
```
~~More [builtin-only](https://codegolf.stackexchange.com/questions/6228/arithmetic-sequences/74826#74826) answers, and now even shorter!~~ Nope.
~~By definition, the next answer should be 13 bytes. (Fibonacci!)~~ The pattern is still broken. :(
[Answer]
# Perl 5, 10 bytes
9 bytes plus 1 for `-p`
```
$_**=1/$_
```
[Answer]
# Ruby, 15 Bytes
```
a=->n{n**n**-1}
```
Ungolfed:
`->` is the *stabby* lambda operator where `a=->n` is equivalent to `a = lambda {|n|}`
[Answer]
# NARS APL, 2 bytes
```
‚àö‚ç®
```
NARS supports the `‚àö` function, which gives the ‚ç∫-th root of ‚çµ. Applying commute (‚ç®) gives a function that, when used monadically, applies its argument to both sides of the given function. Therefore `‚àö‚ç® x` ‚Üî `x ‚àö x`.
### Other APLs, 3 bytes
```
‚ä¢*√∑
```
This is a function train, i.e. `(F G H) x` ‚Üî `(F x) G H x`. Monadic `‚ä¢` is identity, dyadic `*` is power, and monadic `√∑` is inverse. Therefore, `‚ä¢*√∑` is *x* raised to 1/*x*. 
[Answer]
# Python 2 - 56 bytes
The first actual answer, if I'm correct. Uses Newton's method.
```
n=x=input();exec"x-=(x**n-n)/(1.*n*x**-~n);"*999;print x
```
[Answer]
# CJam, 6 bytes
```
rd_W##
```
[Try it online!](http://cjam.tryitonline.net/#code=cmRfVyMj&input=Mg)
### How it works
```
rd     e# Read a double D from STDIN and push it on the stack.
  _    e# Push a copy of D.
   W   e# Push -1.
    #  e# Compute D ** -1.
     # e# Compute D ** (D ** -1).
```
[Answer]
# [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 125 bytes
```
15k?ddsk1-A 5^*sw1sn0[A 5^ln+_1^+ln1+dsnlw!<y]syr1<y1lk/*sz[si1[li*li1-dsi0<p]spli0<p]so0dsw[lzlw^lwlox/+lw1+dswA 2^!<b]dsbxp
```
Unlike the other dc answer, this works for *all* real \$x\$ greater than or equal to \$1 (\$1 ‚â§ x$). Accurate to 4-5 places after the decimal.
I would have included a TIO link here, but for some reason this throws a segmentation fault with the version there (`dc 1.3`) whereas it does *not* with my local version (`dc 1.3.95`).
### Explanation
As **dc** does not support raising numbers to non-integer exponents to calculate \$x^\frac1x\$, this takes advantage of the fact that:
$$x^\frac1x = e^\frac{\ln x}x$$
So, to calculate \$\ln(x)\$, this also takes advantage of the fact that:
$$\int \frac1x dx = \ln(x) + c$$
whose definite integral from \$1\$ to \$b = x\$ is numerically-approximated in increments of \$10^{-5}\$ using the following summation formula:
$$\int\_1^b \frac1x dx = \sum\_{i=1}^{10^{5}(b-1)} \frac 1 {10^5 + i}$$
The resulting sum is then multiplied by \$\frac1x\$ to get \$\frac{\ln(x)}x\$. \$e^{\frac{\ln(x)}x}\$ is then finally calculated using the \$e^x\$ Maclaurin Series to 100 terms as follows:
$$e^x=\sum^{10^2}\_{n=0}\frac{x^n}{n!}$$
This results in our relatively accurate output of \$x^\frac1x\$.
[Answer]
## Seriously, 5 bytes
```
,;√¨@^
```
[Try it online!](http://seriously.tryitonline.net/#code=LDvDrEBe&input=NQ)
Explanation:
```
,;√¨@^
,;     input, dupe
  √¨@   1/x, swap
    ^  pow
```
[Answer]
# [Pylons](https://github.com/morganthrapp/Pylons-lang), 5 bytes.
```
ideAe
```
How it works.
```
i # Get command line input.
d # Duplicate the top of the stack.
e # Raise the top of the stack to the power of the  second to the top element of the stack.
A # Push -1 to the stack (pre initialized variable).
e # Raise the top of the stack to the power of the second to the top element of the stack.
  # Implicitly print the stack.
```
[Answer]
# Japt, 3 bytes
```
UqU
```
[Test it online!](http://ethproductions.github.io/japt?v=master&code=VXFV&input=NA==)
Very simple: `U` is the input integer, and `q` is the root function on numbers.
[Answer]
## C++, 48 bytes
```
#include<math.h>
[](auto x){return pow(x,1./x);}
```
The second line defines an anonymous lambda function. It can be used by assigning it to a function pointer and calling it, or just calling it directly.
[Try it online](http://ideone.com/fork/apfznO)
[Answer]
# [Milky Way 1.6.5](https://github.com/zachgates7/Milky-Way), 5 bytes
```
'1'/h
```
---
### Explanation
```
'      ` Push input
 1     ` Push the integer literal
  '    ` Push input
   /   ` Divide the STOS by the TOS
    h  ` Push the STOS to the power of the TOS
```
> 
>  x\*\*(1/x)
> 
> 
> 
---
### Usage
```
$ ./mw <path-to-code> -i <input-integer>
```
[Answer]
## [O](https://github.com/phase/o), 6 bytes
```
j.1\/^
```
No online link because the online IDE doesn't work (specifically, exponentiation is broken)
Explanation:
```
j.1\/^
j.      push two copies of input
  1\/   push 1/input (always float division)
     ^  push pow(input, 1/input)
```
[Answer]
# ùîºùïäùïÑùïöùïü, 5 chars / 7 bytes
```
–ú≈±‚ÅΩ√Ø√Ø
```
`[Try it here (Firefox only).](http://molarmanful.github.io/ESMin/interpreter3.html?eval=true&input=100&code=%D0%9C%C5%B1%E2%81%BD%C3%AF%C3%AF)`
Trivial.
[Answer]
## [Pyke](https://github.com/muddyfish/PYKE/commit/9e0140f09cee5922e3931615c31216eb387738ce) (commit 29), 6 bytes
```
D1_R^^
```
Explanation:
```
D      - duplicate top
 1_    - load -1
   R   - rotate
    ^  - ^**^
     ^ - ^**^
```
[Answer]
# C# - ~~18~~ ~~43~~ 41 bytes
```
float a(float x){return Math.Pow(x,1/x);}
```
-2 byes thanks to @VoteToClose
[Try it out](https://repl.it/Bp8C/9)
Note:
> 
>  First actual attempt at golfing - I know I could do this better.
> 
> 
> 
[Answer]
## C, 23 bytes
```
#define p(a)pow(a,1./a)
```
This defines a macro function `p` which evaluates to the `a`th root of `a`.
Thanks to Dennis for reminding me that `gcc` doesn't require `math.h` to be included.
Thanks to @E Ä…™·¥ã·¥õ ú·¥áG·¥è ü“ì·¥á Ä for reminding me that the space after the first `)` is not needed.
[Try it online](http://ideone.com/fork/8FHRht)
[Answer]
# PHP 5.6, ~~32~~ ~~30~~ 29 bytes
```
function($x){echo$x**(1/$x);}
```
or
```
function($x){echo$x**$x**-1;}
```
30->29, thank you Dennis!
]