[Question]
  [
A *pandigital number* is an integer which contains every digit from 0 to 9 at least once. 1234567890, 1902837465000000, and 9023289761326634265 are all pandigital. For the purposes of this challenge, numbers such as 123456789 are not pandigital, since they do not contain a 0, even though 123456789 = 0123456789.
A *diverse* pair of integers is a pair of integers \$(a, b)\$ such that \$a^b\$ is pandigital. \$b\$ is called the *diversifying exponent*.
**Challenge:** Given an integer \$a\$, find the **smallest** corresponding diversifying exponent \$b\$. This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest program in bytes wins.
(You may assume that there exists such an exponent, that is, your program will not be given invalid input, such as a power of 10.)
Your solution must be able to handle at the minimum the given test cases, but it should theoretically handle all valid inputs.
This is [A090493](http://oeis.org/A090493) on OEIS.
## Test cases
```
2 -> 68
3 -> 39
4 -> 34
5 -> 19
6 -> 20
7 -> 18
8 -> 28
9 -> 24
11 -> 23
12 -> 22
13 -> 22
14 -> 21
15 -> 12
16 -> 17
17 -> 14
18 -> 21
19 -> 17
20 -> 51
21 -> 17
22 -> 18
23 -> 14
24 -> 19
25 -> 11
26 -> 18
27 -> 13
28 -> 11
29 -> 12
30 -> 39
31 -> 11
32 -> 14
33 -> 16
34 -> 14
35 -> 19
36 -> 10
1234567890 -> 1
```
  
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog) (v2), 9 bytes
```
;.≜^dl10∧
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/31rvUeecuJQcQ4NHHcv//zf9HwUA "Brachylog – Try It Online")
This is a function submission. The TIO link contains a wrapper that makes a function into a full program.
## Explanation
```
;.≜^dl10∧
 .≜        Brute-force all integers, outputting the closest to 0
;  ^         for which {the input} to the power of the number
    d        has a list of unique digits
     l10     of length 10
        ∧  (turn off an unwanted implicit constraint)
```
[Answer]
# [Python 2](https://docs.python.org/2/), 44 bytes
```
f=lambda n,k=1:11>len(set(`k`))and-~f(n,n*k)
```
Input has to be a long, as `​`k`​` behaves differently for longs and ints.
[Try it online!](https://tio.run/##DcxBDoIwFEXRMa7iOWjoV0hoUVGSshFjQg0UCfhLEAZO3HpleJOTO32Xl2cdgjOjfT8bC04Go0qlqrFl@WkXWQ81keUm/TnJCR8GCs7PYPSM2XLXSp0gLwhH3JXOT@dLcb1lj3IX9W5TewOVbRFNc88LYqGyFWkFodcYAtsSTo6eO8lEFP4 "Python 2 – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 25 bytes
```
>:@]^:(10>#@~.@":@^)^:_&1
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/7awcYuOsNAwN7JQd6vQclKwc4jTjrOLVDP9rcnGlJmfkK5hZKNgqpCkYVUC4RgZgrhmUa2oIkTWA8o0twXxjGN8QotzYrOI/AA "J – Try It Online")
Single monadic verb. The input should be an extended-precision integer (e.g. `2x`).
### How it works
```
>:@]^:(10>#@~.@":@^)^:_&1    Monadic verb. Input: base a
    ^:              ^:_      Good old do-while loop.
                       &1    Given 1 as the starting point for b,
>:@]                         increment it each step
      (            )         and continue while the condition is true:
               ":@^          Digits of a^b
            ~.@              Unique digits
          #@                 Count of unique digits
       10>                   is less than 10
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 32 bytes
```
{first ($_** *).comb.Set>9,1..*}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwvzots6i4REFDJV5LS0FLUy85PzdJLzi1xM5Sx1BPT6v2vzVXcWKlgoaRnp6epaadnZ5aGkQkTcPQyNjE1MzcwtJA8z8A "Perl 6 – Try It Online")
Pretty self-explanatory.
### Explanation
```
{                              }  # Anonymous code block
first                     ,1..*   # First positive number that
      ($_** *)    # When the input is raised to that power
              .comb.Set    # The set of digits
                       >9  # Is longer than 9
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~51 46~~ 43 bytes
Takes input as a BigInt literal. Returns [**true** instead of **1**](https://codegolf.meta.stackexchange.com/a/9067/58563).
```
f=(n,k=n)=>new Set(n+'').size>9||1+f(n*k,k)
```
[Try it online!](https://tio.run/##NYxBDoIwEADvvGJNCHQtEuBmtHzCD9Bga7BkayjRxNK31xrjbWYOc5dP6cZleqwHslcVoxaMKiMIRU/qBRe1MuJlibWb3qo/blvLNaO9qQxGbRdGIKCjExCcoW2a5oucI/gMUtuJFAmK4s8/GS05O6t6tjc2SJZ7Cpg@uU9rDANmIX4A "JavaScript (Node.js) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 41 bytes
```
->n{i=0;i+=1until(n**i).digits.uniq[9];i}
```
[Try it online!](https://tio.run/##BcFJCoAgFADQq7Qsq482R9hFxEVzH0IadBHp2e2924yvX7lPe/Uhpx3GnBml8QgVIRjBjBvqB4zCS7SyQ@dDQTKAvEpYnhVlVTctlalgVEawDNP@WW3PYBVaOv8D "Ruby – Try It Online")
[Answer]
## Haskell, 50 bytes
```
f a=until(\b->all(`elem`show(a^b))['0'..'9'])(+1)1
```
[Try it online!](https://tio.run/##BcFLCoAgEADQq8wiUMki3bmwi1jRCErSaNGHjm/vbXjvgajWCGjf8iTik@9GJOJroJDXezs@josXwrGB9T0zbBa8VULVjKmAhfNK5YEGMp4QwWlppB6kVnP9AQ "Haskell – Try It Online")
Same byte count:
```
f a=[b|b<-[1..],all(`elem`show(a^b))['0'..'9']]!!0
```
[Answer]
# [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), ~~10~~ 9 bytes
Saved 1 byte thanks to *Mr. Xcoder*
```
XµINmÙgTQ
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/4tBWT7/cwzPTQwL//zc2BQA "05AB1E (legacy) – Try It Online")
**Explanation**
```
Xµ           # find the first positive integer N that
  INm        # when the input is raised to N
     Ù       # and duplicate digits are removed
      g      # has a length
       TQ    # equal to 10
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 19 bytes
```
ＷΦχ¬№ＩＸＩθＬυＩκ⊞υωＩＬυ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/788IzMnVUHDLTOnJLVIw9BAR8Evv0TDOb80D0gmFpdoBOSXAyXAzEJNHQWf1Lz0kgyNUk1NIAcsmq0JAgoBpcVAYR2Fck1rroCiTJh2JPXW//8b/dctywEA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＷΦχ¬№ＩＸＩθＬυＩκ⊞υω
```
Repeatedly push the empty string to the empty list until there are no digits that the power of the input to the length of the list does not contain.
```
ＩＬυ
```
Print the length of the list.
[Answer]
# [K (ngn/k)](https://gitlab.com/n9n/k), 76 bytes
```
{#{10>#?(+/|\0<|x)#x}{{+/2 99#,/|0 10\x,0}/+/99 99#,/a*\:x,0}\a::|(99#10)\x}
```
[Try it online!](https://tio.run/##NVDBboMwDL3vK5DYAUYnYjsEEk/bhxSk9kI1deqkqodUwH6dBZOc3svz87Od6/vtclvX0U35BOoz/yqqeu7Vx@zL3C/TVNWYWZsf6llloHp/UEtd1dbu4vmtd5vUn52biyCBKnu/rA83vR6ff3c3Zp5Pv1cuTuP5@4c9P/leDsvL44hsuiEgMdkNNZPesGGQt2FUG7YM4usYBS2j@AAYSQgyohBKRDOCkBC2K4ahFRLi9vYueWwsoeJGFISkYJyNFLtQx@0wJO9mkzwhWfbBLpVsnE4q3kgQS4QxkEKyEaKTkj6AQrLaDyTdmLazimFY/wE "K (ngn/k) – Try It Online")
`{` `}` function with argument `x`
`|(99#10)\x` we represent numbers as reversed lists of 99 decimal digits - do that to the argument
`a::` assign to global variable `a` (k has no closures. we need `a` to be global so we can use it in subfunctions)
`{` `}{` `}\` while the first function returns falsey, keep applying the second function (aka while loop), preserving intermediate results
`a*\:x` each of `a`'s digits multiplied by each of `x`'s digits ("outer product")
`99 99#a*\:x,0` add an extra column of 0s and reshape again to 99x99, this shifts the i-th row by i items to the right, inserting 0s on the left (this works for the tests, for larger inputs 99x99 might lead to overflows)
`+/` sum
`{+/2 99#,/|0 10\x,0}/` propagate carry:
* `{` `}/` keep applying until convergence
* `0 10\x` divmod by 10 (a pair of lists)
* `|0 10\x` moddiv by 10
* `2 99#,/|0 10\x,0` moddiv by 10, with the "div" part shifted 1 digit to the right
* `+/` sum
`{10>#?(+/|\0<|x)#x}` - check for (not) pandigital:
* `|x` reverse `x`
* `0<` which digits are non-zero
* `|\` partial maxima
* `+/` sum - this counts the number of leading 0s in `x`
* `10>` are they fewer than 10?
`#` length of the sequence of powers - this is the result
[Answer]
# Pyth, ~~10~~ 8 bytes
```
fq;l{`^Q
```
Try it online [here](https://pyth.herokuapp.com/?code=fq%3Bl%7B%60%5EQ&input=36&debug=0).
```
fq;l{`^QT   Implicit: Q=eval(input())
            Trailing T inferred
f           Return (and print) the first positive integer where the following is true:
      ^QT     Raise input to the current number-th power
     `        Convert to string
    {         Deduplicate
   l          Take the length
 q            Is the above equal to...
  ;           10
```
*Saved 2 bytes thanks to FryAmTheEggman, previous code `fq;l{j^QT;`*
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 11 bytes
```
λ?neSUL₀=;ṅ
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=&code=%CE%BB%3FneSUL%E2%82%80%3D%3B%E1%B9%85&inputs=2&header=&footer=)
```
λ               ;ṅ                # First truthy integer n where  
  ?ne                              # When raised to input^n
        SUL₀=                   # Length of unique digits is 10
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~12~~ 11 bytes
```
1*@ṾØDfƑʋ1#
```
[Try it online!](https://tio.run/##AUEAvv9qZWxsef//MSpA4bm@w5hEZsaRyosxI/8yIHIgMzYg4bifIDEwIDsgMTIzNDU2Nzg5MCDCtSA7IiDDh@KCrCBH/w "Jelly – Try It Online")
### How it works
```
1*@ṾØDfƑʋ1#  Main link. Argument: n
1            Set the return value to 1.
         1#  Call the link to the left for k = 1, 2, ... and with right argument n,
             until it returns a truthy value.
        ʋ      Combine the four links to the left into a dyadic chain.
 *@              Compute n**k.
   Ṿ             Convert it to its string representation.
    ØD           Yield "0123456789".
      fƑ         Filter and return 1 is the result is equal to the left argument.
```
[Answer]
# [Tcl](http://tcl.tk/), 82 bytes
```
proc X d {while {[llength [lsort -u [split [expr $d**[incr i]] ""]]]-10} {}
set i}
```
[Try it online!](https://tio.run/##hcxBCoMwFIThfU4xBFeCoLa11pMIaVYa6oNUQ/KkBcnZ04LYbdfzzc@DTcn5ZUCPEdtrImuwKWvN/OAJyobFM4oVKjhLDGXeziMb81zRPHiQ1pBSa11UZcQWRTAMimkfBdPzm3MrB8jj0EH1yEjLiFbsHlX5j9bNz9an86W5trdS7Dqj7n7A9AE "Tcl – Try It Online")
[Answer]
# [Racket](https://racket-lang.org/), 110 96 bytes
-14 bytes thanks to UltimateHawk! 
```
(define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
```
[Try it online!](https://tio.run/##dY67DsIwDEV3vsIqiyNUqQ8oMMCPAENanBKRmigJFSz8OqQUIRY8@VjyudfJ5kzhOTWSW3Aj4JGUZkIFvKshPwjUCjeQZ2iI23BCR92lp/R4tUY3MpBHH5zmNt0a7QM@eqSbDcBQi/fUgwpnEGUDxgDtrZF3iPdCiMmXkz0nP4idtKDgkxcLxDX2JCigrEbX/18FeVHOF9Vytc5i5gs "Racket – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~52~~ 47 bytes
thanks to @BMO
```
f=lambda n,i=1:len({*str(n**i)})>9or 1+f(n,i+1)
```
[Try it online!](https://tio.run/##JclBDsIgEEDRPacYdzOURSlqWxK8C8aik9Rpg2yM8exI4t@9/P1dHpu4WlNY4/N6iyCGg/XrIvjRr5JRtGb60mXeMtguYfudpZoaGVggR7kvOBhwI3kFLU7tHALYHjzsmaUgG0jIREr9ndAO7ng6j9PcE9Uf "Python 3 – Try It Online")
[Answer]
# Java, 108 bytes
```
a->{int b=0;while(new java.math.BigDecimal(a).pow(++b).toString().chars().distinct().count()<10);return b;};
```
[Try it online!](https://tio.run/##fZRNb4MgGMfP66fgiGlqBJzVOHdYdt1pOzRZdkDLWjqLBrFt0vSrz6GQLV0KHiB5fjxv/0fY0QNd7NZfw9D2Zc0rUNW068AL5QKcZ0B/XCgmP2nFwMparBUIOK40yCfrZTZtnaJKh1mBEygAXTyexzNlEeXHLa8ZFOwIdjpnuKdqGz7xzTOr@J7WkAZh2xzhfF4GoWpeleRiA4Ow2lLZ6X3NO8VFpUZT0wu9P6AoyCVTvRSgzC@5SW@7sFUcGr4Ge90LNAHfPwCVmy7QjdyxE6t6xd5Yp3SCqx5ayQ9Usaso18enY39qaMmYVPAUCogDUBQgSW3Ef5RMlGS3aWxofJveTxQ5fJOJ4ug2XRpfR1Wp8XXQzFBHVQgZTBzY6IGxAxM/Nopg5MBWEpe30QQtHdiK4mos9efOvMH1IEZ87/DGyO@NvfPCxFs5jr1/CraquUpL/Lmtao5549QfPPNOjETe@0GQNzjBXlmIVS1x4Njv7b9@xKoW/b4kl2EYvptW8UZ0w4LRYXxTfwA "Java (JDK) – Try It Online")
**Explanation**
Brute force, looping a^b until it finds a string with 10 (or more, but that's impossible as there will only be 0 through 9) unique characters.
`BigDecimal` is required both because `Math.pow` is not accurate enough (fails on case `11`), and also because converting a `Double` to a String by default shows scientific notation, which breaks this method of finding a pandigital number.
[Answer]
## [W](https://github.com/A-ee/w) `d`, ~~8~~ 5 bytes
This answer was made to fullfill lirtosiast's bounty.
```
Ö↕,╣⌡
```
Uncompressed:
```
xUT=iX
```
## Explanation
```
    iX % For every item in the range from 1 to infinity:
x      % Exponentiate b with a
 U     % Uniquify the value (Numbers are cast to a string)
  T=   % Is the length equal to 10?
       % (Due to the unique mechanism in W, this finds the length
       % of the string before the operation is done.)
       % If that's true, output the number and halt.
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 107 bytes
```
param([bigint]$a)for([bigint]$b=1;-join("$([bigint]::pow($a,$b))"|% t*y|sort -u)-ne-join(0..9);$b=$b+1){}$b
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/vyCxKDFXIzopMz0zryRWJVEzLb8IwU2yNbTWzcrPzNNQUoGLWlkV5JdrqCTqqCRpairVqCqUaFXWFOcXlSjolmrq5qVCNBjo6VlqWgNNUEnSNtSsrlVJ@v//vzkA "PowerShell – Try It Online")
Pretty straightforward, just a shame we need to use `[bigint]` everywhere. We take input `$a`, then setup a `for` loop with initializer `$b=1`.
Each iteration we increment `$b` after checking whether `$a ^ $b` (via `pow`) sent `t`oCharArra`y`, `sort`ed with the `-u`nique flag, then `-join`ed together into a string is `-n`ot`e`qual to the range `0..9` also `-join`ed into a string.
That's a mouthful. For example, this would compare `7 ^ 5 = 16807 --> "01678"` against `"0123456789"`, determine they're not equal, and continue the loop.
Once we're out of the loop, we've determined which `$b` suits our input, and so leave that on the pipeline. Output is implicit.
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~107~~ 101 bytes
```
import StdEnv,Data.Integer
$a=hd[b\\b<-[1..]|length(removeDup[c\\c<-:toString(prod(repeatn b a))])>9]
```
[Try it online!](https://tio.run/##Lc27CsIwFIDh3ac4g0ODNnhBoaJOdRAchI5phtM0toXciEdB8NmNBR1//uFTRqNL1rcPo8Hi4NJgg48EFbUn95yXSMjPjnSn42SKh74VTV03@1wsOZdvo11HfRa19U9dPoJQda32@Y58RXFwXRaib8cdNJKDBpAxyY6FTBXhiBxGMkA2BQ/k/wqDTKw4LyTMZiCWI7PeSpY@6mawu6f8fEnly6Ed1C@uBunmo015nzaLhf0C "Clean – Try It Online")
Takes input as `Integer`, returns `Int`
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 48 bytes
```
(For[n=1,!AllTrue[DigitCount[#^n],#>0&],n++];n)&
```
[Try it online!](https://tio.run/##DcnBCsIgGADgZwlBiv3QbLWKWCwWHTpFdBMDCbcE/Q1xJ9le3bx@n5Xhq6wM@iNT36TlzXmODYPFxZiXHxW/6kGHzo0YOHmjAHIuqQAsCnHCFU0Pr/NEAn1LJrpuO2d/RlmV8SlxULyqBUQGrJzEfHca58g21XZX7w/HTOkP "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 27 bytes
```
${Generate{#Unique[x^_]>9}}
```
[Try it online!](https://tio.run/##SywpSUzOSP2fpmBl@1@l2j01L7UosSS1Wjk0L7OwNDW6Ii4@1s6ytva/X2pqSnG0SkFBcnosV0BRZl5JSGpxiXNicWpxdJqOgpGVsZm6oZGxiamZuYWlQVycoUHsfwA "Attache – Try It Online")
## Explanation
```
${Generate{#Unique[x^_]>9}}
${                        }    lambda, input: x
  Generate{              }     first natural number _ satisfying...
                   x^_             the input to that number
            Unique[   ]          unique digits of ^
           #                   length of ^
                       >9      is greater than 9
                               i.e.: has 10 distinct digits
```
## Alternatives
**28 bytes:** `${Generate{Unique@S[x^_]@9}}`
**29 bytes:** `${Generate{Unique[S[x^_]]@9}}`
**30 bytes:** `${Generate{#Unique[S[x^_]]>9}}`
**31 bytes:** `Generate@${{#Unique[S[x^_]]>9}}`
**32 bytes:** `${Generate[{#Unique[S[x^_]]>9}]}`
**33 bytes:** `${If[#Unique[x^y]>9,y,x&$!-~y]}&0`
**34 bytes:** `${If[#Unique[x^y]>9,y,$[x,y+1]]}&0`
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 20 bytes
```
:i;0{).i\?`.|,10<}do
```
My first stab at it, pretty happy with my solution.
TLDR; Takes i as the base, and makes a 0. Open block. Incrememnt that 0 by 1, then put it as an exponent of i. Turn it into a string, then check how many characters there are. If 10, stop. If not, repeat block.
Successful exponent printed on program termination.
[Try it online!](https://tio.run/##S8/PSStOLsosKPlv/N8q09qgWlMvM8Y@Qa9Gx9DApjYl//9/AA "GolfScript – Try It Online")
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 18 bytes
```
rir0?^{NBL[10==}fi
```
[Try it online!](https://tio.run/##Dcw7CsJAFIbR/lvN3P/OswiCtbiBgIUQIRAFI6lC1j5mAec8t3WZft9t6stn7@u8hstjv19vo4VhOF5zP95jF04kkSlUGmaYMMcilrCMFaxiDQVkSMhRRAllVFBFDQ@44efneMQTflp5TLnUFv4 "Burlesque – Try It Online")
```
ri      # Read input as int
r0      # Range [0,inf]
?^      # Raise to power
{
 NB     # Unique digits
 L[10== # Length == 10
}fi     # Find index of first which
```
[Answer]
# [Perl 5](https://www.perl.org/) `-Mbigint -n`, ~~61~~ 43 bytes
```
$t=$_**($p+=1)while grep$t!~/$_/,0..9;say$p
```
[Try it online!](https://tio.run/##K0gtyjH9/1@lxFYlXktLQ6VA29ZQszwjMydVIb0otUClRLFOXyVeX8dAT8/SujixUqXg/3@jf/kFJZn5ecX/dX1N9QwMDYB0UmZ6Zl7Jf908AA "Perl 5 – Try It Online")
]