Smallest Diversifying Exponent












20














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, 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 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









share|improve this question




















  • 3




    I want to point out a special case 1234567890 -> 1.
    – Bubbler
    Dec 20 '18 at 0:48










  • @Bubbler Added.
    – Conor O'Brien
    Dec 20 '18 at 3:03










  • are negative exponents off limits?
    – sudo rm -rf slash
    Dec 20 '18 at 11:51






  • 1




    Does something like 123456789 count as pandigital? It is equal to 0123456789, which is definitely pandigital.
    – wastl
    Dec 20 '18 at 18:08






  • 1




    @wastl no, it does not.
    – Conor O'Brien
    Dec 20 '18 at 19:17
















20














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, 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 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









share|improve this question




















  • 3




    I want to point out a special case 1234567890 -> 1.
    – Bubbler
    Dec 20 '18 at 0:48










  • @Bubbler Added.
    – Conor O'Brien
    Dec 20 '18 at 3:03










  • are negative exponents off limits?
    – sudo rm -rf slash
    Dec 20 '18 at 11:51






  • 1




    Does something like 123456789 count as pandigital? It is equal to 0123456789, which is definitely pandigital.
    – wastl
    Dec 20 '18 at 18:08






  • 1




    @wastl no, it does not.
    – Conor O'Brien
    Dec 20 '18 at 19:17














20












20








20


2





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, 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 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









share|improve this 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, 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 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






code-golf math






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 21 '18 at 15:39









Wît Wisarhd

34k10156365




34k10156365










asked Dec 20 '18 at 0:33









Conor O'Brien

29.1k263162




29.1k263162








  • 3




    I want to point out a special case 1234567890 -> 1.
    – Bubbler
    Dec 20 '18 at 0:48










  • @Bubbler Added.
    – Conor O'Brien
    Dec 20 '18 at 3:03










  • are negative exponents off limits?
    – sudo rm -rf slash
    Dec 20 '18 at 11:51






  • 1




    Does something like 123456789 count as pandigital? It is equal to 0123456789, which is definitely pandigital.
    – wastl
    Dec 20 '18 at 18:08






  • 1




    @wastl no, it does not.
    – Conor O'Brien
    Dec 20 '18 at 19:17














  • 3




    I want to point out a special case 1234567890 -> 1.
    – Bubbler
    Dec 20 '18 at 0:48










  • @Bubbler Added.
    – Conor O'Brien
    Dec 20 '18 at 3:03










  • are negative exponents off limits?
    – sudo rm -rf slash
    Dec 20 '18 at 11:51






  • 1




    Does something like 123456789 count as pandigital? It is equal to 0123456789, which is definitely pandigital.
    – wastl
    Dec 20 '18 at 18:08






  • 1




    @wastl no, it does not.
    – Conor O'Brien
    Dec 20 '18 at 19:17








3




3




I want to point out a special case 1234567890 -> 1.
– Bubbler
Dec 20 '18 at 0:48




I want to point out a special case 1234567890 -> 1.
– Bubbler
Dec 20 '18 at 0:48












@Bubbler Added.
– Conor O'Brien
Dec 20 '18 at 3:03




@Bubbler Added.
– Conor O'Brien
Dec 20 '18 at 3:03












are negative exponents off limits?
– sudo rm -rf slash
Dec 20 '18 at 11:51




are negative exponents off limits?
– sudo rm -rf slash
Dec 20 '18 at 11:51




1




1




Does something like 123456789 count as pandigital? It is equal to 0123456789, which is definitely pandigital.
– wastl
Dec 20 '18 at 18:08




Does something like 123456789 count as pandigital? It is equal to 0123456789, which is definitely pandigital.
– wastl
Dec 20 '18 at 18:08




1




1




@wastl no, it does not.
– Conor O'Brien
Dec 20 '18 at 19:17




@wastl no, it does not.
– Conor O'Brien
Dec 20 '18 at 19:17










20 Answers
20






active

oldest

votes


















9















Brachylog (v2), 9 bytes



;.≜^dl10∧


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)





share|improve this answer































    7















    Python 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!






    share|improve this answer





























      5















      Perl 6, 32 bytes





      {first ($_** *).comb.Set>9,1..*}


      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





      share|improve this answer































        4















        JavaScript (Node.js),  51 46  43 bytes



        Takes input as a BigInt literal. Returns true instead of 1.





        f=(n,k=n)=>new Set(n+'').size>9||1+f(n*k,k)


        Try it online!






        share|improve this answer



















        • 2




          I keep forgetting JS has bigint's now :D
          – Conor O'Brien
          Dec 20 '18 at 0:44










        • I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
          – Sparr
          Dec 20 '18 at 1:43






        • 3




          @Sparr Here is the current consensus.
          – Arnauld
          Dec 20 '18 at 1:44










        • Thanks. I put a new Answer on my link referring to that.
          – Sparr
          Dec 20 '18 at 2:04



















        4















        Ruby, 41 bytes





        ->n{i=0;i+=1until(n**i).digits.uniq[9];i}


        Try it online!






        share|improve this answer





























          4














          Haskell, 50 bytes



          f a=until(b->all(`elem`show(a^b))['0'..'9'])(+1)1


          Try it online!



          Same byte count:



          f a=[b|b<-[1..],all(`elem`show(a^b))['0'..'9']]!!0





          share|improve this answer





























            3















            J, 25 bytes



            >:@]^:(10>#@~.@":@^)^:_&1


            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





            share|improve this answer





















            • (]+10>#@=@":@^)^:_*
              – FrownyFrog
              Dec 26 '18 at 13:18



















            2















            Tcl, 82 bytes



            proc X d {while {[llength [lsort -u [split [expr $d**[incr i]] ""]]]-10} {}
            set i}


            Try it online!






            share|improve this answer























            • You can save some more bytes with llength 82 bytes
              – david
              Dec 20 '18 at 12:45










            • Saved some bytes, thenks to @david
              – sergiol
              Dec 20 '18 at 14:02



















            2















            Racket, 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!






            share|improve this answer



















            • 1




              This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
              – Ultimate Hawk
              Dec 20 '18 at 14:23










            • @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
              – Galen Ivanov
              Dec 20 '18 at 14:31





















            2















            Python 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!






            share|improve this answer























            • Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
              – Veskah
              Dec 20 '18 at 21:01



















            2















            05AB1E (legacy), 10 9 bytes



            Saved 1 byte thanks to Mr. Xcoder



            XµINmÙgTQ


            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





            share|improve this answer



















            • 1




              Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
              – Mr. Xcoder
              Dec 20 '18 at 21:49










            • @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
              – Emigna
              Dec 20 '18 at 21:50



















            1















            Charcoal, 19 bytes



            WΦχ¬№IXIθLυIκ⊞υωILυ


            Try it online! Link is to verbose version of code. Explanation:



            WΦχ¬№IXIθLυIκ⊞υω


            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.



            ILυ


            Print the length of the list.






            share|improve this answer





















            • Why the downvote?
              – Luis Mendo
              Dec 20 '18 at 18:35



















            1















            K (ngn/k), 76 bytes



            {#{10>#?(+/|<|x)#x}{{+/2 99#,/|0 10x,0}/+/99 99#,/a*:x,0}a::|(99#10)x}


            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 10x,0}/ propagate carry:




            • { }/ keep applying until convergence


            • 0 10x divmod by 10 (a pair of lists)


            • |0 10x moddiv by 10


            • 2 99#,/|0 10x,0 moddiv by 10, with the "div" part shifted 1 digit to the right


            • +/ sum



            {10>#?(+/|<|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






            share|improve this answer































              1















              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!



              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 toCharArray, sorted with the -unique flag, then -joined together into a string is -notequal to the range 0..9 also -joined 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.






              share|improve this answer





























                1














                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!



                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.






                share|improve this answer























                • Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                  – Darrel Hoffman
                  Dec 20 '18 at 22:13










                • @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                  – Hypino
                  Dec 20 '18 at 22:17












                • Ah, alright. Been some time since I worked in Java, forgot that technicality.
                  – Darrel Hoffman
                  Dec 21 '18 at 13:27










                • You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                  – Kevin Cruijssen
                  Dec 22 '18 at 16:39





















                1














                Pyth, 10 8 bytes



                fq;l{`^Q


                Try it online here.



                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;






                share|improve this answer























                • You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                  – FryAmTheEggman
                  Dec 20 '18 at 15:30



















                0















                Jelly, 12 11 bytes



                1*@ṾØDfƑʋ1#


                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.





                share|improve this answer































                  0















                  Clean, 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!



                  Takes input as Integer, returns Int






                  share|improve this answer





























                    0















                    Wolfram Language (Mathematica), 48 bytes



                    (For[n=1,!AllTrue[DigitCount[#^n],#>0&],n++];n)&


                    Try it online!






                    share|improve this answer





























                      0















                      Attache, 27 bytes



                      ${Generate{#Unique[x^_]>9}}


                      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






                      share|improve this answer





















                        Your Answer





                        StackExchange.ifUsing("editor", function () {
                        return StackExchange.using("mathjaxEditing", function () {
                        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                        });
                        });
                        }, "mathjax-editing");

                        StackExchange.ifUsing("editor", function () {
                        StackExchange.using("externalEditor", function () {
                        StackExchange.using("snippets", function () {
                        StackExchange.snippets.init();
                        });
                        });
                        }, "code-snippets");

                        StackExchange.ready(function() {
                        var channelOptions = {
                        tags: "".split(" "),
                        id: "200"
                        };
                        initTagRenderer("".split(" "), "".split(" "), channelOptions);

                        StackExchange.using("externalEditor", function() {
                        // Have to fire editor after snippets, if snippets enabled
                        if (StackExchange.settings.snippets.snippetsEnabled) {
                        StackExchange.using("snippets", function() {
                        createEditor();
                        });
                        }
                        else {
                        createEditor();
                        }
                        });

                        function createEditor() {
                        StackExchange.prepareEditor({
                        heartbeatType: 'answer',
                        autoActivateHeartbeat: false,
                        convertImagesToLinks: false,
                        noModals: true,
                        showLowRepImageUploadWarning: true,
                        reputationToPostImages: null,
                        bindNavPrevention: true,
                        postfix: "",
                        imageUploader: {
                        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                        allowUrls: true
                        },
                        onDemand: true,
                        discardSelector: ".discard-answer"
                        ,immediatelyShowMarkdownHelp:true
                        });


                        }
                        });














                        draft saved

                        draft discarded


















                        StackExchange.ready(
                        function () {
                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177826%2fsmallest-diversifying-exponent%23new-answer', 'question_page');
                        }
                        );

                        Post as a guest















                        Required, but never shown

























                        20 Answers
                        20






                        active

                        oldest

                        votes








                        20 Answers
                        20






                        active

                        oldest

                        votes









                        active

                        oldest

                        votes






                        active

                        oldest

                        votes









                        9















                        Brachylog (v2), 9 bytes



                        ;.≜^dl10∧


                        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)





                        share|improve this answer




























                          9















                          Brachylog (v2), 9 bytes



                          ;.≜^dl10∧


                          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)





                          share|improve this answer


























                            9












                            9








                            9







                            Brachylog (v2), 9 bytes



                            ;.≜^dl10∧


                            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)





                            share|improve this answer















                            Brachylog (v2), 9 bytes



                            ;.≜^dl10∧


                            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)






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 20 '18 at 4:13


























                            community wiki





                            2 revs
                            ais523
























                                7















                                Python 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!






                                share|improve this answer


























                                  7















                                  Python 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!






                                  share|improve this answer
























                                    7












                                    7








                                    7







                                    Python 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!






                                    share|improve this answer













                                    Python 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!







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Dec 20 '18 at 2:13









                                    Dennis

                                    186k32296735




                                    186k32296735























                                        5















                                        Perl 6, 32 bytes





                                        {first ($_** *).comb.Set>9,1..*}


                                        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





                                        share|improve this answer




























                                          5















                                          Perl 6, 32 bytes





                                          {first ($_** *).comb.Set>9,1..*}


                                          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





                                          share|improve this answer


























                                            5












                                            5








                                            5







                                            Perl 6, 32 bytes





                                            {first ($_** *).comb.Set>9,1..*}


                                            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





                                            share|improve this answer















                                            Perl 6, 32 bytes





                                            {first ($_** *).comb.Set>9,1..*}


                                            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






                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited Dec 20 '18 at 1:54

























                                            answered Dec 20 '18 at 0:48









                                            Jo King

                                            20.7k247109




                                            20.7k247109























                                                4















                                                JavaScript (Node.js),  51 46  43 bytes



                                                Takes input as a BigInt literal. Returns true instead of 1.





                                                f=(n,k=n)=>new Set(n+'').size>9||1+f(n*k,k)


                                                Try it online!






                                                share|improve this answer



















                                                • 2




                                                  I keep forgetting JS has bigint's now :D
                                                  – Conor O'Brien
                                                  Dec 20 '18 at 0:44










                                                • I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
                                                  – Sparr
                                                  Dec 20 '18 at 1:43






                                                • 3




                                                  @Sparr Here is the current consensus.
                                                  – Arnauld
                                                  Dec 20 '18 at 1:44










                                                • Thanks. I put a new Answer on my link referring to that.
                                                  – Sparr
                                                  Dec 20 '18 at 2:04
















                                                4















                                                JavaScript (Node.js),  51 46  43 bytes



                                                Takes input as a BigInt literal. Returns true instead of 1.





                                                f=(n,k=n)=>new Set(n+'').size>9||1+f(n*k,k)


                                                Try it online!






                                                share|improve this answer



















                                                • 2




                                                  I keep forgetting JS has bigint's now :D
                                                  – Conor O'Brien
                                                  Dec 20 '18 at 0:44










                                                • I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
                                                  – Sparr
                                                  Dec 20 '18 at 1:43






                                                • 3




                                                  @Sparr Here is the current consensus.
                                                  – Arnauld
                                                  Dec 20 '18 at 1:44










                                                • Thanks. I put a new Answer on my link referring to that.
                                                  – Sparr
                                                  Dec 20 '18 at 2:04














                                                4












                                                4








                                                4







                                                JavaScript (Node.js),  51 46  43 bytes



                                                Takes input as a BigInt literal. Returns true instead of 1.





                                                f=(n,k=n)=>new Set(n+'').size>9||1+f(n*k,k)


                                                Try it online!






                                                share|improve this answer















                                                JavaScript (Node.js),  51 46  43 bytes



                                                Takes input as a BigInt literal. Returns true instead of 1.





                                                f=(n,k=n)=>new Set(n+'').size>9||1+f(n*k,k)


                                                Try it online!







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Dec 20 '18 at 1:46

























                                                answered Dec 20 '18 at 0:42









                                                Arnauld

                                                72.4k689305




                                                72.4k689305








                                                • 2




                                                  I keep forgetting JS has bigint's now :D
                                                  – Conor O'Brien
                                                  Dec 20 '18 at 0:44










                                                • I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
                                                  – Sparr
                                                  Dec 20 '18 at 1:43






                                                • 3




                                                  @Sparr Here is the current consensus.
                                                  – Arnauld
                                                  Dec 20 '18 at 1:44










                                                • Thanks. I put a new Answer on my link referring to that.
                                                  – Sparr
                                                  Dec 20 '18 at 2:04














                                                • 2




                                                  I keep forgetting JS has bigint's now :D
                                                  – Conor O'Brien
                                                  Dec 20 '18 at 0:44










                                                • I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
                                                  – Sparr
                                                  Dec 20 '18 at 1:43






                                                • 3




                                                  @Sparr Here is the current consensus.
                                                  – Arnauld
                                                  Dec 20 '18 at 1:44










                                                • Thanks. I put a new Answer on my link referring to that.
                                                  – Sparr
                                                  Dec 20 '18 at 2:04








                                                2




                                                2




                                                I keep forgetting JS has bigint's now :D
                                                – Conor O'Brien
                                                Dec 20 '18 at 0:44




                                                I keep forgetting JS has bigint's now :D
                                                – Conor O'Brien
                                                Dec 20 '18 at 0:44












                                                I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
                                                – Sparr
                                                Dec 20 '18 at 1:43




                                                I am slightly dubious regarding returning true instead of 1. That doesn't seem to match anything described at codegolf.meta.stackexchange.com/questions/9263/…
                                                – Sparr
                                                Dec 20 '18 at 1:43




                                                3




                                                3




                                                @Sparr Here is the current consensus.
                                                – Arnauld
                                                Dec 20 '18 at 1:44




                                                @Sparr Here is the current consensus.
                                                – Arnauld
                                                Dec 20 '18 at 1:44












                                                Thanks. I put a new Answer on my link referring to that.
                                                – Sparr
                                                Dec 20 '18 at 2:04




                                                Thanks. I put a new Answer on my link referring to that.
                                                – Sparr
                                                Dec 20 '18 at 2:04











                                                4















                                                Ruby, 41 bytes





                                                ->n{i=0;i+=1until(n**i).digits.uniq[9];i}


                                                Try it online!






                                                share|improve this answer


























                                                  4















                                                  Ruby, 41 bytes





                                                  ->n{i=0;i+=1until(n**i).digits.uniq[9];i}


                                                  Try it online!






                                                  share|improve this answer
























                                                    4












                                                    4








                                                    4







                                                    Ruby, 41 bytes





                                                    ->n{i=0;i+=1until(n**i).digits.uniq[9];i}


                                                    Try it online!






                                                    share|improve this answer













                                                    Ruby, 41 bytes





                                                    ->n{i=0;i+=1until(n**i).digits.uniq[9];i}


                                                    Try it online!







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Dec 20 '18 at 10:07









                                                    Kirill L.

                                                    3,6551319




                                                    3,6551319























                                                        4














                                                        Haskell, 50 bytes



                                                        f a=until(b->all(`elem`show(a^b))['0'..'9'])(+1)1


                                                        Try it online!



                                                        Same byte count:



                                                        f a=[b|b<-[1..],all(`elem`show(a^b))['0'..'9']]!!0





                                                        share|improve this answer


























                                                          4














                                                          Haskell, 50 bytes



                                                          f a=until(b->all(`elem`show(a^b))['0'..'9'])(+1)1


                                                          Try it online!



                                                          Same byte count:



                                                          f a=[b|b<-[1..],all(`elem`show(a^b))['0'..'9']]!!0





                                                          share|improve this answer
























                                                            4












                                                            4








                                                            4






                                                            Haskell, 50 bytes



                                                            f a=until(b->all(`elem`show(a^b))['0'..'9'])(+1)1


                                                            Try it online!



                                                            Same byte count:



                                                            f a=[b|b<-[1..],all(`elem`show(a^b))['0'..'9']]!!0





                                                            share|improve this answer












                                                            Haskell, 50 bytes



                                                            f a=until(b->all(`elem`show(a^b))['0'..'9'])(+1)1


                                                            Try it online!



                                                            Same byte count:



                                                            f a=[b|b<-[1..],all(`elem`show(a^b))['0'..'9']]!!0






                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered Dec 20 '18 at 15:15









                                                            nimi

                                                            31.4k32085




                                                            31.4k32085























                                                                3















                                                                J, 25 bytes



                                                                >:@]^:(10>#@~.@":@^)^:_&1


                                                                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





                                                                share|improve this answer





















                                                                • (]+10>#@=@":@^)^:_*
                                                                  – FrownyFrog
                                                                  Dec 26 '18 at 13:18
















                                                                3















                                                                J, 25 bytes



                                                                >:@]^:(10>#@~.@":@^)^:_&1


                                                                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





                                                                share|improve this answer





















                                                                • (]+10>#@=@":@^)^:_*
                                                                  – FrownyFrog
                                                                  Dec 26 '18 at 13:18














                                                                3












                                                                3








                                                                3







                                                                J, 25 bytes



                                                                >:@]^:(10>#@~.@":@^)^:_&1


                                                                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





                                                                share|improve this answer













                                                                J, 25 bytes



                                                                >:@]^:(10>#@~.@":@^)^:_&1


                                                                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






                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Dec 20 '18 at 0:47









                                                                Bubbler

                                                                6,282759




                                                                6,282759












                                                                • (]+10>#@=@":@^)^:_*
                                                                  – FrownyFrog
                                                                  Dec 26 '18 at 13:18


















                                                                • (]+10>#@=@":@^)^:_*
                                                                  – FrownyFrog
                                                                  Dec 26 '18 at 13:18
















                                                                (]+10>#@=@":@^)^:_*
                                                                – FrownyFrog
                                                                Dec 26 '18 at 13:18




                                                                (]+10>#@=@":@^)^:_*
                                                                – FrownyFrog
                                                                Dec 26 '18 at 13:18











                                                                2















                                                                Tcl, 82 bytes



                                                                proc X d {while {[llength [lsort -u [split [expr $d**[incr i]] ""]]]-10} {}
                                                                set i}


                                                                Try it online!






                                                                share|improve this answer























                                                                • You can save some more bytes with llength 82 bytes
                                                                  – david
                                                                  Dec 20 '18 at 12:45










                                                                • Saved some bytes, thenks to @david
                                                                  – sergiol
                                                                  Dec 20 '18 at 14:02
















                                                                2















                                                                Tcl, 82 bytes



                                                                proc X d {while {[llength [lsort -u [split [expr $d**[incr i]] ""]]]-10} {}
                                                                set i}


                                                                Try it online!






                                                                share|improve this answer























                                                                • You can save some more bytes with llength 82 bytes
                                                                  – david
                                                                  Dec 20 '18 at 12:45










                                                                • Saved some bytes, thenks to @david
                                                                  – sergiol
                                                                  Dec 20 '18 at 14:02














                                                                2












                                                                2








                                                                2







                                                                Tcl, 82 bytes



                                                                proc X d {while {[llength [lsort -u [split [expr $d**[incr i]] ""]]]-10} {}
                                                                set i}


                                                                Try it online!






                                                                share|improve this answer















                                                                Tcl, 82 bytes



                                                                proc X d {while {[llength [lsort -u [split [expr $d**[incr i]] ""]]]-10} {}
                                                                set i}


                                                                Try it online!







                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited Dec 20 '18 at 13:00

























                                                                answered Dec 20 '18 at 11:59









                                                                sergiol

                                                                2,4901925




                                                                2,4901925












                                                                • You can save some more bytes with llength 82 bytes
                                                                  – david
                                                                  Dec 20 '18 at 12:45










                                                                • Saved some bytes, thenks to @david
                                                                  – sergiol
                                                                  Dec 20 '18 at 14:02


















                                                                • You can save some more bytes with llength 82 bytes
                                                                  – david
                                                                  Dec 20 '18 at 12:45










                                                                • Saved some bytes, thenks to @david
                                                                  – sergiol
                                                                  Dec 20 '18 at 14:02
















                                                                You can save some more bytes with llength 82 bytes
                                                                – david
                                                                Dec 20 '18 at 12:45




                                                                You can save some more bytes with llength 82 bytes
                                                                – david
                                                                Dec 20 '18 at 12:45












                                                                Saved some bytes, thenks to @david
                                                                – sergiol
                                                                Dec 20 '18 at 14:02




                                                                Saved some bytes, thenks to @david
                                                                – sergiol
                                                                Dec 20 '18 at 14:02











                                                                2















                                                                Racket, 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!






                                                                share|improve this answer



















                                                                • 1




                                                                  This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
                                                                  – Ultimate Hawk
                                                                  Dec 20 '18 at 14:23










                                                                • @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
                                                                  – Galen Ivanov
                                                                  Dec 20 '18 at 14:31


















                                                                2















                                                                Racket, 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!






                                                                share|improve this answer



















                                                                • 1




                                                                  This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
                                                                  – Ultimate Hawk
                                                                  Dec 20 '18 at 14:23










                                                                • @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
                                                                  – Galen Ivanov
                                                                  Dec 20 '18 at 14:31
















                                                                2












                                                                2








                                                                2







                                                                Racket, 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!






                                                                share|improve this answer















                                                                Racket, 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!







                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited Dec 20 '18 at 14:32

























                                                                answered Dec 20 '18 at 7:58









                                                                Galen Ivanov

                                                                6,33711032




                                                                6,33711032








                                                                • 1




                                                                  This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
                                                                  – Ultimate Hawk
                                                                  Dec 20 '18 at 14:23










                                                                • @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
                                                                  – Galen Ivanov
                                                                  Dec 20 '18 at 14:31
















                                                                • 1




                                                                  This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
                                                                  – Ultimate Hawk
                                                                  Dec 20 '18 at 14:23










                                                                • @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
                                                                  – Galen Ivanov
                                                                  Dec 20 '18 at 14:31










                                                                1




                                                                1




                                                                This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
                                                                – Ultimate Hawk
                                                                Dec 20 '18 at 14:23




                                                                This can be shortened to 96 bytes by recursing on the function instead (define(f n[b 1])(if(= 10(length(remove-duplicates(string->list(~v(expt n b))))))b(f n(+ b 1))))
                                                                – Ultimate Hawk
                                                                Dec 20 '18 at 14:23












                                                                @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
                                                                – Galen Ivanov
                                                                Dec 20 '18 at 14:31






                                                                @UltimateHawk Thank you! I forgot about the default parameters...(although the helper function also used default parameter b...)
                                                                – Galen Ivanov
                                                                Dec 20 '18 at 14:31













                                                                2















                                                                Python 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!






                                                                share|improve this answer























                                                                • Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
                                                                  – Veskah
                                                                  Dec 20 '18 at 21:01
















                                                                2















                                                                Python 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!






                                                                share|improve this answer























                                                                • Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
                                                                  – Veskah
                                                                  Dec 20 '18 at 21:01














                                                                2












                                                                2








                                                                2







                                                                Python 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!






                                                                share|improve this answer















                                                                Python 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!







                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited Dec 20 '18 at 21:24

























                                                                answered Dec 20 '18 at 12:27









                                                                david

                                                                13419




                                                                13419












                                                                • Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
                                                                  – Veskah
                                                                  Dec 20 '18 at 21:01


















                                                                • Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
                                                                  – Veskah
                                                                  Dec 20 '18 at 21:01
















                                                                Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
                                                                – Veskah
                                                                Dec 20 '18 at 21:01




                                                                Just a heads up but you can just remove old code and put "<s>52</s> 47" in the header line. The edit log will retain the old versions if anyone is curious
                                                                – Veskah
                                                                Dec 20 '18 at 21:01











                                                                2















                                                                05AB1E (legacy), 10 9 bytes



                                                                Saved 1 byte thanks to Mr. Xcoder



                                                                XµINmÙgTQ


                                                                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





                                                                share|improve this answer



















                                                                • 1




                                                                  Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
                                                                  – Mr. Xcoder
                                                                  Dec 20 '18 at 21:49










                                                                • @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
                                                                  – Emigna
                                                                  Dec 20 '18 at 21:50
















                                                                2















                                                                05AB1E (legacy), 10 9 bytes



                                                                Saved 1 byte thanks to Mr. Xcoder



                                                                XµINmÙgTQ


                                                                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





                                                                share|improve this answer



















                                                                • 1




                                                                  Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
                                                                  – Mr. Xcoder
                                                                  Dec 20 '18 at 21:49










                                                                • @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
                                                                  – Emigna
                                                                  Dec 20 '18 at 21:50














                                                                2












                                                                2








                                                                2







                                                                05AB1E (legacy), 10 9 bytes



                                                                Saved 1 byte thanks to Mr. Xcoder



                                                                XµINmÙgTQ


                                                                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





                                                                share|improve this answer















                                                                05AB1E (legacy), 10 9 bytes



                                                                Saved 1 byte thanks to Mr. Xcoder



                                                                XµINmÙgTQ


                                                                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






                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited Dec 20 '18 at 21:54

























                                                                answered Dec 20 '18 at 7:07









                                                                Emigna

                                                                45.3k432138




                                                                45.3k432138








                                                                • 1




                                                                  Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
                                                                  – Mr. Xcoder
                                                                  Dec 20 '18 at 21:49










                                                                • @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
                                                                  – Emigna
                                                                  Dec 20 '18 at 21:50














                                                                • 1




                                                                  Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
                                                                  – Mr. Xcoder
                                                                  Dec 20 '18 at 21:49










                                                                • @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
                                                                  – Emigna
                                                                  Dec 20 '18 at 21:50








                                                                1




                                                                1




                                                                Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
                                                                – Mr. Xcoder
                                                                Dec 20 '18 at 21:49




                                                                Legacy saves 1 byte: 1µINmÙgTQ – Try it online!
                                                                – Mr. Xcoder
                                                                Dec 20 '18 at 21:49












                                                                @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
                                                                – Emigna
                                                                Dec 20 '18 at 21:50




                                                                @Mr.Xcoder: Oh yeah, we had the implicit output of N then. Thanks!
                                                                – Emigna
                                                                Dec 20 '18 at 21:50











                                                                1















                                                                Charcoal, 19 bytes



                                                                WΦχ¬№IXIθLυIκ⊞υωILυ


                                                                Try it online! Link is to verbose version of code. Explanation:



                                                                WΦχ¬№IXIθLυIκ⊞υω


                                                                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.



                                                                ILυ


                                                                Print the length of the list.






                                                                share|improve this answer





















                                                                • Why the downvote?
                                                                  – Luis Mendo
                                                                  Dec 20 '18 at 18:35
















                                                                1















                                                                Charcoal, 19 bytes



                                                                WΦχ¬№IXIθLυIκ⊞υωILυ


                                                                Try it online! Link is to verbose version of code. Explanation:



                                                                WΦχ¬№IXIθLυIκ⊞υω


                                                                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.



                                                                ILυ


                                                                Print the length of the list.






                                                                share|improve this answer





















                                                                • Why the downvote?
                                                                  – Luis Mendo
                                                                  Dec 20 '18 at 18:35














                                                                1












                                                                1








                                                                1







                                                                Charcoal, 19 bytes



                                                                WΦχ¬№IXIθLυIκ⊞υωILυ


                                                                Try it online! Link is to verbose version of code. Explanation:



                                                                WΦχ¬№IXIθLυIκ⊞υω


                                                                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.



                                                                ILυ


                                                                Print the length of the list.






                                                                share|improve this answer













                                                                Charcoal, 19 bytes



                                                                WΦχ¬№IXIθLυIκ⊞υωILυ


                                                                Try it online! Link is to verbose version of code. Explanation:



                                                                WΦχ¬№IXIθLυIκ⊞υω


                                                                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.



                                                                ILυ


                                                                Print the length of the list.







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Dec 20 '18 at 10:28









                                                                Neil

                                                                79.4k744177




                                                                79.4k744177












                                                                • Why the downvote?
                                                                  – Luis Mendo
                                                                  Dec 20 '18 at 18:35


















                                                                • Why the downvote?
                                                                  – Luis Mendo
                                                                  Dec 20 '18 at 18:35
















                                                                Why the downvote?
                                                                – Luis Mendo
                                                                Dec 20 '18 at 18:35




                                                                Why the downvote?
                                                                – Luis Mendo
                                                                Dec 20 '18 at 18:35











                                                                1















                                                                K (ngn/k), 76 bytes



                                                                {#{10>#?(+/|<|x)#x}{{+/2 99#,/|0 10x,0}/+/99 99#,/a*:x,0}a::|(99#10)x}


                                                                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 10x,0}/ propagate carry:




                                                                • { }/ keep applying until convergence


                                                                • 0 10x divmod by 10 (a pair of lists)


                                                                • |0 10x moddiv by 10


                                                                • 2 99#,/|0 10x,0 moddiv by 10, with the "div" part shifted 1 digit to the right


                                                                • +/ sum



                                                                {10>#?(+/|<|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






                                                                share|improve this answer




























                                                                  1















                                                                  K (ngn/k), 76 bytes



                                                                  {#{10>#?(+/|<|x)#x}{{+/2 99#,/|0 10x,0}/+/99 99#,/a*:x,0}a::|(99#10)x}


                                                                  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 10x,0}/ propagate carry:




                                                                  • { }/ keep applying until convergence


                                                                  • 0 10x divmod by 10 (a pair of lists)


                                                                  • |0 10x moddiv by 10


                                                                  • 2 99#,/|0 10x,0 moddiv by 10, with the "div" part shifted 1 digit to the right


                                                                  • +/ sum



                                                                  {10>#?(+/|<|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






                                                                  share|improve this answer


























                                                                    1












                                                                    1








                                                                    1







                                                                    K (ngn/k), 76 bytes



                                                                    {#{10>#?(+/|<|x)#x}{{+/2 99#,/|0 10x,0}/+/99 99#,/a*:x,0}a::|(99#10)x}


                                                                    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 10x,0}/ propagate carry:




                                                                    • { }/ keep applying until convergence


                                                                    • 0 10x divmod by 10 (a pair of lists)


                                                                    • |0 10x moddiv by 10


                                                                    • 2 99#,/|0 10x,0 moddiv by 10, with the "div" part shifted 1 digit to the right


                                                                    • +/ sum



                                                                    {10>#?(+/|<|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






                                                                    share|improve this answer















                                                                    K (ngn/k), 76 bytes



                                                                    {#{10>#?(+/|<|x)#x}{{+/2 99#,/|0 10x,0}/+/99 99#,/a*:x,0}a::|(99#10)x}


                                                                    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 10x,0}/ propagate carry:




                                                                    • { }/ keep applying until convergence


                                                                    • 0 10x divmod by 10 (a pair of lists)


                                                                    • |0 10x moddiv by 10


                                                                    • 2 99#,/|0 10x,0 moddiv by 10, with the "div" part shifted 1 digit to the right


                                                                    • +/ sum



                                                                    {10>#?(+/|<|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







                                                                    share|improve this answer














                                                                    share|improve this answer



                                                                    share|improve this answer








                                                                    edited Dec 20 '18 at 11:41

























                                                                    answered Dec 20 '18 at 11:05









                                                                    ngn

                                                                    6,94112559




                                                                    6,94112559























                                                                        1















                                                                        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!



                                                                        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 toCharArray, sorted with the -unique flag, then -joined together into a string is -notequal to the range 0..9 also -joined 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.






                                                                        share|improve this answer


























                                                                          1















                                                                          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!



                                                                          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 toCharArray, sorted with the -unique flag, then -joined together into a string is -notequal to the range 0..9 also -joined 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.






                                                                          share|improve this answer
























                                                                            1












                                                                            1








                                                                            1







                                                                            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!



                                                                            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 toCharArray, sorted with the -unique flag, then -joined together into a string is -notequal to the range 0..9 also -joined 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.






                                                                            share|improve this answer













                                                                            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!



                                                                            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 toCharArray, sorted with the -unique flag, then -joined together into a string is -notequal to the range 0..9 also -joined 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.







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered Dec 20 '18 at 16:01









                                                                            AdmBorkBork

                                                                            26.3k364228




                                                                            26.3k364228























                                                                                1














                                                                                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!



                                                                                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.






                                                                                share|improve this answer























                                                                                • Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                                                                                  – Darrel Hoffman
                                                                                  Dec 20 '18 at 22:13










                                                                                • @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                                                                                  – Hypino
                                                                                  Dec 20 '18 at 22:17












                                                                                • Ah, alright. Been some time since I worked in Java, forgot that technicality.
                                                                                  – Darrel Hoffman
                                                                                  Dec 21 '18 at 13:27










                                                                                • You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                                                                                  – Kevin Cruijssen
                                                                                  Dec 22 '18 at 16:39


















                                                                                1














                                                                                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!



                                                                                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.






                                                                                share|improve this answer























                                                                                • Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                                                                                  – Darrel Hoffman
                                                                                  Dec 20 '18 at 22:13










                                                                                • @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                                                                                  – Hypino
                                                                                  Dec 20 '18 at 22:17












                                                                                • Ah, alright. Been some time since I worked in Java, forgot that technicality.
                                                                                  – Darrel Hoffman
                                                                                  Dec 21 '18 at 13:27










                                                                                • You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                                                                                  – Kevin Cruijssen
                                                                                  Dec 22 '18 at 16:39
















                                                                                1












                                                                                1








                                                                                1






                                                                                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!



                                                                                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.






                                                                                share|improve this 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!



                                                                                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.







                                                                                share|improve this answer














                                                                                share|improve this answer



                                                                                share|improve this answer








                                                                                edited Dec 20 '18 at 22:32

























                                                                                answered Dec 20 '18 at 20:04









                                                                                Hypino

                                                                                22116




                                                                                22116












                                                                                • Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                                                                                  – Darrel Hoffman
                                                                                  Dec 20 '18 at 22:13










                                                                                • @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                                                                                  – Hypino
                                                                                  Dec 20 '18 at 22:17












                                                                                • Ah, alright. Been some time since I worked in Java, forgot that technicality.
                                                                                  – Darrel Hoffman
                                                                                  Dec 21 '18 at 13:27










                                                                                • You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                                                                                  – Kevin Cruijssen
                                                                                  Dec 22 '18 at 16:39




















                                                                                • Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                                                                                  – Darrel Hoffman
                                                                                  Dec 20 '18 at 22:13










                                                                                • @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                                                                                  – Hypino
                                                                                  Dec 20 '18 at 22:17












                                                                                • Ah, alright. Been some time since I worked in Java, forgot that technicality.
                                                                                  – Darrel Hoffman
                                                                                  Dec 21 '18 at 13:27










                                                                                • You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                                                                                  – Kevin Cruijssen
                                                                                  Dec 22 '18 at 16:39


















                                                                                Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                                                                                – Darrel Hoffman
                                                                                Dec 20 '18 at 22:13




                                                                                Don't Java vars start at 0 by default? Could save 2 bytes by eliminating the initialization.
                                                                                – Darrel Hoffman
                                                                                Dec 20 '18 at 22:13












                                                                                @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                                                                                – Hypino
                                                                                Dec 20 '18 at 22:17






                                                                                @DarrelHoffman Instance variables do, yes. Locally-scoped variables do not.
                                                                                – Hypino
                                                                                Dec 20 '18 at 22:17














                                                                                Ah, alright. Been some time since I worked in Java, forgot that technicality.
                                                                                – Darrel Hoffman
                                                                                Dec 21 '18 at 13:27




                                                                                Ah, alright. Been some time since I worked in Java, forgot that technicality.
                                                                                – Darrel Hoffman
                                                                                Dec 21 '18 at 13:27












                                                                                You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                                                                                – Kevin Cruijssen
                                                                                Dec 22 '18 at 16:39






                                                                                You can save 6 bytes by changing new java.math.BigDecimal(a).pow(++b).toString() to (new java.math.BigDecimal(a).pow(++b)+"") (and the trailing semi-colon doesn't have to be counted for lambda functions). Try it online
                                                                                – Kevin Cruijssen
                                                                                Dec 22 '18 at 16:39













                                                                                1














                                                                                Pyth, 10 8 bytes



                                                                                fq;l{`^Q


                                                                                Try it online here.



                                                                                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;






                                                                                share|improve this answer























                                                                                • You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                                                                                  – FryAmTheEggman
                                                                                  Dec 20 '18 at 15:30
















                                                                                1














                                                                                Pyth, 10 8 bytes



                                                                                fq;l{`^Q


                                                                                Try it online here.



                                                                                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;






                                                                                share|improve this answer























                                                                                • You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                                                                                  – FryAmTheEggman
                                                                                  Dec 20 '18 at 15:30














                                                                                1












                                                                                1








                                                                                1






                                                                                Pyth, 10 8 bytes



                                                                                fq;l{`^Q


                                                                                Try it online here.



                                                                                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;






                                                                                share|improve this answer














                                                                                Pyth, 10 8 bytes



                                                                                fq;l{`^Q


                                                                                Try it online here.



                                                                                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;







                                                                                share|improve this answer














                                                                                share|improve this answer



                                                                                share|improve this answer








                                                                                edited Dec 22 '18 at 20:28

























                                                                                answered Dec 20 '18 at 12:44









                                                                                Sok

                                                                                3,537722




                                                                                3,537722












                                                                                • You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                                                                                  – FryAmTheEggman
                                                                                  Dec 20 '18 at 15:30


















                                                                                • You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                                                                                  – FryAmTheEggman
                                                                                  Dec 20 '18 at 15:30
















                                                                                You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                                                                                – FryAmTheEggman
                                                                                Dec 20 '18 at 15:30




                                                                                You can use backtick to convert the number to a string instead of doing base conversion which will let you leave out the T in the power operation.
                                                                                – FryAmTheEggman
                                                                                Dec 20 '18 at 15:30











                                                                                0















                                                                                Jelly, 12 11 bytes



                                                                                1*@ṾØDfƑʋ1#


                                                                                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.





                                                                                share|improve this answer




























                                                                                  0















                                                                                  Jelly, 12 11 bytes



                                                                                  1*@ṾØDfƑʋ1#


                                                                                  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.





                                                                                  share|improve this answer


























                                                                                    0












                                                                                    0








                                                                                    0







                                                                                    Jelly, 12 11 bytes



                                                                                    1*@ṾØDfƑʋ1#


                                                                                    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.





                                                                                    share|improve this answer















                                                                                    Jelly, 12 11 bytes



                                                                                    1*@ṾØDfƑʋ1#


                                                                                    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.






                                                                                    share|improve this answer














                                                                                    share|improve this answer



                                                                                    share|improve this answer








                                                                                    edited Dec 20 '18 at 1:27

























                                                                                    answered Dec 20 '18 at 1:12









                                                                                    Dennis

                                                                                    186k32296735




                                                                                    186k32296735























                                                                                        0















                                                                                        Clean, 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!



                                                                                        Takes input as Integer, returns Int






                                                                                        share|improve this answer


























                                                                                          0















                                                                                          Clean, 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!



                                                                                          Takes input as Integer, returns Int






                                                                                          share|improve this answer
























                                                                                            0












                                                                                            0








                                                                                            0







                                                                                            Clean, 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!



                                                                                            Takes input as Integer, returns Int






                                                                                            share|improve this answer













                                                                                            Clean, 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!



                                                                                            Takes input as Integer, returns Int







                                                                                            share|improve this answer












                                                                                            share|improve this answer



                                                                                            share|improve this answer










                                                                                            answered Dec 20 '18 at 22:33









                                                                                            Οurous

                                                                                            6,44311033




                                                                                            6,44311033























                                                                                                0















                                                                                                Wolfram Language (Mathematica), 48 bytes



                                                                                                (For[n=1,!AllTrue[DigitCount[#^n],#>0&],n++];n)&


                                                                                                Try it online!






                                                                                                share|improve this answer


























                                                                                                  0















                                                                                                  Wolfram Language (Mathematica), 48 bytes



                                                                                                  (For[n=1,!AllTrue[DigitCount[#^n],#>0&],n++];n)&


                                                                                                  Try it online!






                                                                                                  share|improve this answer
























                                                                                                    0












                                                                                                    0








                                                                                                    0







                                                                                                    Wolfram Language (Mathematica), 48 bytes



                                                                                                    (For[n=1,!AllTrue[DigitCount[#^n],#>0&],n++];n)&


                                                                                                    Try it online!






                                                                                                    share|improve this answer













                                                                                                    Wolfram Language (Mathematica), 48 bytes



                                                                                                    (For[n=1,!AllTrue[DigitCount[#^n],#>0&],n++];n)&


                                                                                                    Try it online!







                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered Dec 26 '18 at 21:41









                                                                                                    Kelly Lowder

                                                                                                    2,998416




                                                                                                    2,998416























                                                                                                        0















                                                                                                        Attache, 27 bytes



                                                                                                        ${Generate{#Unique[x^_]>9}}


                                                                                                        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






                                                                                                        share|improve this answer


























                                                                                                          0















                                                                                                          Attache, 27 bytes



                                                                                                          ${Generate{#Unique[x^_]>9}}


                                                                                                          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






                                                                                                          share|improve this answer
























                                                                                                            0












                                                                                                            0








                                                                                                            0







                                                                                                            Attache, 27 bytes



                                                                                                            ${Generate{#Unique[x^_]>9}}


                                                                                                            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






                                                                                                            share|improve this answer













                                                                                                            Attache, 27 bytes



                                                                                                            ${Generate{#Unique[x^_]>9}}


                                                                                                            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







                                                                                                            share|improve this answer












                                                                                                            share|improve this answer



                                                                                                            share|improve this answer










                                                                                                            answered Dec 27 '18 at 0:38









                                                                                                            Conor O'Brien

                                                                                                            29.1k263162




                                                                                                            29.1k263162






























                                                                                                                draft saved

                                                                                                                draft discarded




















































                                                                                                                If this is an answer to a challenge…




                                                                                                                • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                  Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                More generally…




                                                                                                                • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                • …Avoid asking for help, clarification or responding to other answers (use comments instead).






                                                                                                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                                                                Please pay close attention to the following guidance:


                                                                                                                • Please be sure to answer the question. Provide details and share your research!

                                                                                                                But avoid



                                                                                                                • Asking for help, clarification, or responding to other answers.

                                                                                                                • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                To learn more, see our tips on writing great answers.




                                                                                                                draft saved


                                                                                                                draft discarded














                                                                                                                StackExchange.ready(
                                                                                                                function () {
                                                                                                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177826%2fsmallest-diversifying-exponent%23new-answer', 'question_page');
                                                                                                                }
                                                                                                                );

                                                                                                                Post as a guest















                                                                                                                Required, but never shown





















































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown

































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown







                                                                                                                Popular posts from this blog

                                                                                                                Morgemoulin

                                                                                                                Scott Moir

                                                                                                                Souastre