A ​Note ​on ​N!












32












$begingroup$


J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):




If $A$ is any positive integer having $m$ digits, there exists a positive integer $N$ such that the first $m$ digits of $N!$ constitute the integer $A$.




Challenge



Your challenge is given some $A geqslant 1$ find a corresponding $N geqslant 1$.



Details





  • $N!$ represents the factorial $N! = 1cdot 2 cdot 3cdot ldots cdot N$ of $N$.

  • The digits of $A$ in our case are understood to be in base $10$.

  • Your submission should work for arbitrary $Ageqslant 1$ given enough time and memory. Just using e.g. 32-bit types to represent integers is not sufficient.

  • You don't necessarily need to output the least possible $N$.


Examples



A            N
1 1
2 2
3 9
4 8
5 7
6 3
7 6
9 96
12 5
16 89
17 69
18 76
19 63
24 4
72 6
841 12745
206591378 314


The least possible $N$ for each $A$ can be found in https://oeis.org/A076219












share|improve this question











$endgroup$








  • 26




    $begingroup$
    I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose?
    $endgroup$
    – Magic Octopus Urn
    Apr 25 at 19:53






  • 11




    $begingroup$
    @MagicOctopusUrn Never dealt with a number theorist before, have you?
    $endgroup$
    – Brady Gilg
    Apr 26 at 16:16






  • 2




    $begingroup$
    Here's the proof it anyone's interested.
    $endgroup$
    – Esolanging Fruit
    Apr 29 at 2:39
















32












$begingroup$


J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):




If $A$ is any positive integer having $m$ digits, there exists a positive integer $N$ such that the first $m$ digits of $N!$ constitute the integer $A$.




Challenge



Your challenge is given some $A geqslant 1$ find a corresponding $N geqslant 1$.



Details





  • $N!$ represents the factorial $N! = 1cdot 2 cdot 3cdot ldots cdot N$ of $N$.

  • The digits of $A$ in our case are understood to be in base $10$.

  • Your submission should work for arbitrary $Ageqslant 1$ given enough time and memory. Just using e.g. 32-bit types to represent integers is not sufficient.

  • You don't necessarily need to output the least possible $N$.


Examples



A            N
1 1
2 2
3 9
4 8
5 7
6 3
7 6
9 96
12 5
16 89
17 69
18 76
19 63
24 4
72 6
841 12745
206591378 314


The least possible $N$ for each $A$ can be found in https://oeis.org/A076219












share|improve this question











$endgroup$








  • 26




    $begingroup$
    I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose?
    $endgroup$
    – Magic Octopus Urn
    Apr 25 at 19:53






  • 11




    $begingroup$
    @MagicOctopusUrn Never dealt with a number theorist before, have you?
    $endgroup$
    – Brady Gilg
    Apr 26 at 16:16






  • 2




    $begingroup$
    Here's the proof it anyone's interested.
    $endgroup$
    – Esolanging Fruit
    Apr 29 at 2:39














32












32








32


2



$begingroup$


J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):




If $A$ is any positive integer having $m$ digits, there exists a positive integer $N$ such that the first $m$ digits of $N!$ constitute the integer $A$.




Challenge



Your challenge is given some $A geqslant 1$ find a corresponding $N geqslant 1$.



Details





  • $N!$ represents the factorial $N! = 1cdot 2 cdot 3cdot ldots cdot N$ of $N$.

  • The digits of $A$ in our case are understood to be in base $10$.

  • Your submission should work for arbitrary $Ageqslant 1$ given enough time and memory. Just using e.g. 32-bit types to represent integers is not sufficient.

  • You don't necessarily need to output the least possible $N$.


Examples



A            N
1 1
2 2
3 9
4 8
5 7
6 3
7 6
9 96
12 5
16 89
17 69
18 76
19 63
24 4
72 6
841 12745
206591378 314


The least possible $N$ for each $A$ can be found in https://oeis.org/A076219












share|improve this question











$endgroup$




J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):




If $A$ is any positive integer having $m$ digits, there exists a positive integer $N$ such that the first $m$ digits of $N!$ constitute the integer $A$.




Challenge



Your challenge is given some $A geqslant 1$ find a corresponding $N geqslant 1$.



Details





  • $N!$ represents the factorial $N! = 1cdot 2 cdot 3cdot ldots cdot N$ of $N$.

  • The digits of $A$ in our case are understood to be in base $10$.

  • Your submission should work for arbitrary $Ageqslant 1$ given enough time and memory. Just using e.g. 32-bit types to represent integers is not sufficient.

  • You don't necessarily need to output the least possible $N$.


Examples



A            N
1 1
2 2
3 9
4 8
5 7
6 3
7 6
9 96
12 5
16 89
17 69
18 76
19 63
24 4
72 6
841 12745
206591378 314


The least possible $N$ for each $A$ can be found in https://oeis.org/A076219









code-golf math number integer factorial






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 26 at 15:21







flawr

















asked Apr 25 at 19:44









flawrflawr

27.8k670198




27.8k670198








  • 26




    $begingroup$
    I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose?
    $endgroup$
    – Magic Octopus Urn
    Apr 25 at 19:53






  • 11




    $begingroup$
    @MagicOctopusUrn Never dealt with a number theorist before, have you?
    $endgroup$
    – Brady Gilg
    Apr 26 at 16:16






  • 2




    $begingroup$
    Here's the proof it anyone's interested.
    $endgroup$
    – Esolanging Fruit
    Apr 29 at 2:39














  • 26




    $begingroup$
    I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose?
    $endgroup$
    – Magic Octopus Urn
    Apr 25 at 19:53






  • 11




    $begingroup$
    @MagicOctopusUrn Never dealt with a number theorist before, have you?
    $endgroup$
    – Brady Gilg
    Apr 26 at 16:16






  • 2




    $begingroup$
    Here's the proof it anyone's interested.
    $endgroup$
    – Esolanging Fruit
    Apr 29 at 2:39








26




26




$begingroup$
I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose?
$endgroup$
– Magic Octopus Urn
Apr 25 at 19:53




$begingroup$
I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose?
$endgroup$
– Magic Octopus Urn
Apr 25 at 19:53




11




11




$begingroup$
@MagicOctopusUrn Never dealt with a number theorist before, have you?
$endgroup$
– Brady Gilg
Apr 26 at 16:16




$begingroup$
@MagicOctopusUrn Never dealt with a number theorist before, have you?
$endgroup$
– Brady Gilg
Apr 26 at 16:16




2




2




$begingroup$
Here's the proof it anyone's interested.
$endgroup$
– Esolanging Fruit
Apr 29 at 2:39




$begingroup$
Here's the proof it anyone's interested.
$endgroup$
– Esolanging Fruit
Apr 29 at 2:39










21 Answers
21






active

oldest

votes


















14












$begingroup$


Python 2, 50 bytes





f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1


Try it online!



This is a variation of the 47-byte solution explained below, adjusted to return 1 for input '1'. (Namely, we add 1 to the full expression rather than the recursive call, and start counting from n==2 to remove one layer of depth, balancing the result out for all non-'1' inputs.)




Python 2, 45 bytes (maps 1 to True)





f=lambda a,n=2,p=1:`-a`in`-p`or-~f(a,n+1,p*n)


This is another variation, by @Jo King and @xnor, which takes input as a number and returns True for input 1. Some people think this is fair game, but I personally find it a little weird.



But it costs only 3 bytes to wrap the icky Boolean result in +(), giving us a shorter "nice" solution:




Python 2, 48 bytes





f=lambda a,n=2,p=1:+(`-a`in`-p`)or-~f(a,n+1,p*n)



This is my previous solution, which returns 0 for input '1'. It would have been valid if the question concerned a non-negative N.




Python 2, 47 bytes (invalid)





f=lambda a,n=1,p=1:`p`.find(a)and-~f(a,n+1,p*n)


Try it online!



Takes a string as input, like f('18').



The trick here is that x.find(y) == 0 precisely when x.startswith(y).



The and-expression will short circuit at `p`.find(a) with result 0 as soon as `p` starts with a; otherwise, it will evaluate to -~f(a,n+1,p*n), id est 1 + f(a,n+1,p*n).



The end result is 1 + (1 + (1 + (... + 0))), n layers deep, so n.







share|improve this answer











$endgroup$













  • $begingroup$
    Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
    $endgroup$
    – Shaggy
    Apr 25 at 20:58






  • 1




    $begingroup$
    For your True-for-1 version, you can shorten the base case condition taking a as a number.
    $endgroup$
    – xnor
    Apr 27 at 3:40










  • $begingroup$
    @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
    $endgroup$
    – Lynn
    Apr 27 at 14:20










  • $begingroup$
    If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
    $endgroup$
    – negative seven
    yesterday





















9












$begingroup$


Brachylog, 3 5 bytes



ℕ₁ḟa₀


Try it online!



Takes input through its output variable, and outputs through its input variable. (The other way around, it just finds arbitrary prefixes of the input's factorial, which isn't quite as interesting.) Times out on the second-to-last test case on TIO, but does fine on the last one. I've been running it on 841 on my laptop for several minutes at the time of writing this, and it hasn't actually spit out an answer yet, but I have faith in it.



         The (implicit) output variable
a₀ is a prefix of
ḟ the factorial of
the (implicit) input variable
ℕ₁ which is a positive integer.


Since the only input ḟa₀ doesn't work for is 1, and 1 is a positive prefix of 1! = 1, 1|ḟa₀ works just as well.



Also, as of this edit, 841 has been running for nearly three hours and it still hasn't produced an output. I guess computing the factorial of every integer from 1 to 12745 isn't exactly fast.






share|improve this answer











$endgroup$









  • 2




    $begingroup$
    The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
    $endgroup$
    – Fatalize
    Apr 26 at 9:28












  • $begingroup$
    Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
    $endgroup$
    – Unrelated String
    Apr 26 at 9:37



















7












$begingroup$


C++ (gcc), 107 95 bytes, using -lgmp and -lgmpxx



Thanks to the people in the comments for pointing out some silly mishaps.





#import<gmpxx.h>
auto f(auto A){mpz_class n,x=1,z;for(;z!=A;)for(z=x*=++n;z>A;z/=10);return n;}


Try it online!



Computes $n!$ by multiplying $(n-1)!$ by $n$, then repeatedly divides it by $10$ until it is no longer greater than the passed integer. At this point, the loop terminates if the factorial equals the passed integer, or proceeds to the next $n$ otherwise.






share|improve this answer











$endgroup$













  • $begingroup$
    You don't need to count flags anymore, so this is 107 bytes.
    $endgroup$
    – AdmBorkBork
    Apr 26 at 12:37










  • $begingroup$
    Why do you need the second semicolon before return?
    $endgroup$
    – Ruslan
    Apr 26 at 15:34










  • $begingroup$
    You could use a single character name for the function, save a couple of bytes.
    $endgroup$
    – Shaggy
    Apr 26 at 16:38



















6












$begingroup$


Jelly, 8 bytes



1!w⁼1ʋ1#


Try it online!



Takes an integer and returns a singleton.






share|improve this answer









$endgroup$





















    6












    $begingroup$


    05AB1E, 7 bytes



    ∞.Δ!IÅ?


    Try it online or verify -almost- all test cases (841 times out, so is excluded).



    Explanation:





    ∞.Δ      # Find the first positive integer which is truthy for:
    ! # Get the factorial of the current integer
    IÅ? # And check if it starts with the input
    # (after which the result is output implicitly)





    share|improve this answer









    $endgroup$





















      2












      $begingroup$

      Pyth - 8 bytes



      f!x`.!Tz

      f filter. With no second arg, it searches 1.. for first truthy
      ! logical not, here it checks for zero
      x z indexof. z is input as string
      ` string repr
      .!T Factorial of lambda var


      Try it online.






      share|improve this answer









      $endgroup$





















        2












        $begingroup$

        JavaScript, 47 43 bytes



        Output as a BigInt.



        n=>(g=x=>`${x}`.search(n)?g(x*++i):i)(i=1n)


        Try It Online!



        Saved a few bytes by taking Lynn's approach of "building" the factorial rather than calculating it on each iteration so please upvote her solution as well if you're upvoting this one.






        share|improve this answer











        $endgroup$













        • $begingroup$
          Sadly, _Ês bU}f1 in Japt doesn't work
          $endgroup$
          – Embodiment of Ignorance
          Apr 25 at 21:12










        • $begingroup$
          @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
          $endgroup$
          – Shaggy
          Apr 25 at 21:13










        • $begingroup$
          @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
          $endgroup$
          – Shaggy
          Apr 25 at 21:45










        • $begingroup$
          3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
          $endgroup$
          – vrugtehagel
          May 2 at 16:08












        • $begingroup$
          @vrugtehagel, that wouldn't be reusable.
          $endgroup$
          – Shaggy
          May 2 at 20:12



















        2












        $begingroup$


        C# (.NET Core), 69 + 22 = 91 bytes





        a=>{var n=a/a;for(var b=n;!(b+"").StartsWith(a+"");b*=++n);return n;}


        Try it online!



        Uses System.Numerics.BigInteger which requires a using statement.



        -1 byte thanks to @ExpiredData!






        share|improve this answer











        $endgroup$









        • 1




          $begingroup$
          69 + 22
          $endgroup$
          – Expired Data
          Apr 26 at 16:56



















        1












        $begingroup$


        Jelly, 16 bytes



        ‘ɼ!³;D®ß⁼Lḣ@¥¥/?


        Try it online!



        Explanation



        ‘ɼ                | Increment the register (initially 0)
        ! | Factorial
        ³; | Prepend the input
        D | Convert to decimal digits
        ⁼ ¥¥/? | If the input diguts are equal to...
        Lḣ@ | The same number of diguts from the head of the factorial
        ® | Return the register
        ß | Otherwise run the link again





        share|improve this answer











        $endgroup$





















          1












          $begingroup$


          Perl 6, 23 bytes





          {+([*](1..*).../^$_/)}


          Try it online!



          Explanation



          {                     }  # Anonymous code block
          [*](1..*) # From the infinite list of factorials
          ... # Take up to the first element
          /^$_/ # That starts with the input
          +( ) # And return the length of the sequence





          share|improve this answer









          $endgroup$





















            1












            $begingroup$


            Charcoal, 16 bytes



            ⊞υ¹W⌕IΠυθ⊞υLυI⊟υ


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



            ⊞υ¹


            Push 1 to the empty list so that it starts off with a defined product.



            W⌕IΠυθ


            Repeat while the input cannot be found at the beginning of the product of the list...



            ⊞υLυ


            ... push the length of the list to itself.



            I⊟υ


            Print the last value pushed to the list.






            share|improve this answer









            $endgroup$





















              1












              $begingroup$


              Perl 5 -Mbigint -p, 25 bytes





              1while($.*=++$)!~/^$_/}{


              Try it online!






              share|improve this answer









              $endgroup$





















                1












                $begingroup$


                J, 28 22 bytes



                -6 bytes thanks to FrownyFrog



                (]+1-0{(E.&":!))^:_&1x


                Try it online!



                original answer J, 28 bytes



                >:@]^:(-.@{.@E.&":!)^:_ x:@1


                Try it online!





                • >:@] ... x:@1 starting with an extended precision 1, keep incrementing it while...


                • -.@ its not the case that...


                • {.@ the first elm is a starting match of...


                • E.&": all the substring matches (after stringfying both arguments &":) of searching for the original input in...


                • ! the factorial of the number we're incrementing






                share|improve this answer











                $endgroup$













                • $begingroup$
                  (]+1-0{(E.&":!))^:_&1x
                  $endgroup$
                  – FrownyFrog
                  Apr 26 at 14:07










                • $begingroup$
                  I love that use of "fixed point" to avoid the traditional while.
                  $endgroup$
                  – Jonah
                  Apr 26 at 14:15



















                1












                $begingroup$


                C (gcc) -lgmp, 161 bytes





                #include"gmp.h"
                f(a,n,_,b)char*a,*b;mpz_t n,_;{for(mpz_init_set_si(n,1),mpz_init_set(_,n);b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n));}


                Try it online!






                share|improve this answer









                $endgroup$













                • $begingroup$
                  Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                  $endgroup$
                  – ceilingcat
                  Apr 26 at 22:07



















                1












                $begingroup$


                Python 3, 63 bytes





                f=lambda x,a=2,b=1:str(b).find(str(x))==0and a-1or f(x,a+1,b*a)


                Try it online!



                -24 bytes thanks to Jo King



                -3 bytes thanks to Chas Brown






                share|improve this answer











                $endgroup$













                • $begingroup$
                  @JoKing nice, thanks
                  $endgroup$
                  – HyperNeutrino
                  Apr 26 at 1:13










                • $begingroup$
                  61 bytes
                  $endgroup$
                  – Chas Brown
                  Apr 26 at 8:17










                • $begingroup$
                  @ChasBrown thanks
                  $endgroup$
                  – HyperNeutrino
                  Apr 26 at 17:43










                • $begingroup$
                  I think the f= that you've got in the header is supposed to count towards your bit count.
                  $endgroup$
                  – mypetlion
                  May 1 at 22:20










                • $begingroup$
                  @mypetlion You are correct; thanks for catching that.
                  $endgroup$
                  – HyperNeutrino
                  May 1 at 22:33



















                0












                $begingroup$


                Jelly, 11 bytes



                ‘ɼµ®!Dw³’µ¿


                Try it online!






                share|improve this answer











                $endgroup$





















                  0












                  $begingroup$


                  Clean, 88 bytes



                  import StdEnv,Data.Integer,Text
                  $a=hd[n\n<-[a/a..]|startsWith(""<+a)(""<+prod[one..n])]


                  Try it online!



                  Defines $ :: Integer -> Integer.



                  Uses Data.Integer's arbitrary size integers for IO.






                  share|improve this answer









                  $endgroup$





















                    0












                    $begingroup$


                    Wolfram Language (Mathematica), 62 bytes



                    (b=1;While[⌊b!/10^((i=IntegerLength)[b!]-i@#)⌋!=#,b++];b)&


                    Try it online!






                    share|improve this answer











                    $endgroup$





















                      0












                      $begingroup$


                      Ruby, 40 bytes





                      ->n{a=b=1;a*=b+=1until"%d"%a=~/^#{n}/;b}


                      Try it online!






                      share|improve this answer









                      $endgroup$





















                        0












                        $begingroup$


                        Icon, 65 63 bytes



                        procedure f(a);p:=1;every n:=seq()&1=find(a,p*:=n)&return n;end


                        Try it online!






                        share|improve this answer











                        $endgroup$





















                          0












                          $begingroup$

                          Haskell, 89 bytes



                          import Data.List
                          a x=head$filter(isPrefixOf$show x)$((show.product.(x->[1..x]))<$>[1..])


                          If anyone knows how to bypass the required import, let me know.






                          share|improve this answer









                          $endgroup$













                          • $begingroup$
                            It seems that you output $N!$ and not $N$ as required.
                            $endgroup$
                            – flawr
                            May 3 at 21:49












                          Your Answer






                          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%2f184776%2fa-note-on-n%23new-answer', 'question_page');
                          }
                          );

                          Post as a guest















                          Required, but never shown

























                          21 Answers
                          21






                          active

                          oldest

                          votes








                          21 Answers
                          21






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          14












                          $begingroup$


                          Python 2, 50 bytes





                          f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1


                          Try it online!



                          This is a variation of the 47-byte solution explained below, adjusted to return 1 for input '1'. (Namely, we add 1 to the full expression rather than the recursive call, and start counting from n==2 to remove one layer of depth, balancing the result out for all non-'1' inputs.)




                          Python 2, 45 bytes (maps 1 to True)





                          f=lambda a,n=2,p=1:`-a`in`-p`or-~f(a,n+1,p*n)


                          This is another variation, by @Jo King and @xnor, which takes input as a number and returns True for input 1. Some people think this is fair game, but I personally find it a little weird.



                          But it costs only 3 bytes to wrap the icky Boolean result in +(), giving us a shorter "nice" solution:




                          Python 2, 48 bytes





                          f=lambda a,n=2,p=1:+(`-a`in`-p`)or-~f(a,n+1,p*n)



                          This is my previous solution, which returns 0 for input '1'. It would have been valid if the question concerned a non-negative N.




                          Python 2, 47 bytes (invalid)





                          f=lambda a,n=1,p=1:`p`.find(a)and-~f(a,n+1,p*n)


                          Try it online!



                          Takes a string as input, like f('18').



                          The trick here is that x.find(y) == 0 precisely when x.startswith(y).



                          The and-expression will short circuit at `p`.find(a) with result 0 as soon as `p` starts with a; otherwise, it will evaluate to -~f(a,n+1,p*n), id est 1 + f(a,n+1,p*n).



                          The end result is 1 + (1 + (1 + (... + 0))), n layers deep, so n.







                          share|improve this answer











                          $endgroup$













                          • $begingroup$
                            Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
                            $endgroup$
                            – Shaggy
                            Apr 25 at 20:58






                          • 1




                            $begingroup$
                            For your True-for-1 version, you can shorten the base case condition taking a as a number.
                            $endgroup$
                            – xnor
                            Apr 27 at 3:40










                          • $begingroup$
                            @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
                            $endgroup$
                            – Lynn
                            Apr 27 at 14:20










                          • $begingroup$
                            If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
                            $endgroup$
                            – negative seven
                            yesterday


















                          14












                          $begingroup$


                          Python 2, 50 bytes





                          f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1


                          Try it online!



                          This is a variation of the 47-byte solution explained below, adjusted to return 1 for input '1'. (Namely, we add 1 to the full expression rather than the recursive call, and start counting from n==2 to remove one layer of depth, balancing the result out for all non-'1' inputs.)




                          Python 2, 45 bytes (maps 1 to True)





                          f=lambda a,n=2,p=1:`-a`in`-p`or-~f(a,n+1,p*n)


                          This is another variation, by @Jo King and @xnor, which takes input as a number and returns True for input 1. Some people think this is fair game, but I personally find it a little weird.



                          But it costs only 3 bytes to wrap the icky Boolean result in +(), giving us a shorter "nice" solution:




                          Python 2, 48 bytes





                          f=lambda a,n=2,p=1:+(`-a`in`-p`)or-~f(a,n+1,p*n)



                          This is my previous solution, which returns 0 for input '1'. It would have been valid if the question concerned a non-negative N.




                          Python 2, 47 bytes (invalid)





                          f=lambda a,n=1,p=1:`p`.find(a)and-~f(a,n+1,p*n)


                          Try it online!



                          Takes a string as input, like f('18').



                          The trick here is that x.find(y) == 0 precisely when x.startswith(y).



                          The and-expression will short circuit at `p`.find(a) with result 0 as soon as `p` starts with a; otherwise, it will evaluate to -~f(a,n+1,p*n), id est 1 + f(a,n+1,p*n).



                          The end result is 1 + (1 + (1 + (... + 0))), n layers deep, so n.







                          share|improve this answer











                          $endgroup$













                          • $begingroup$
                            Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
                            $endgroup$
                            – Shaggy
                            Apr 25 at 20:58






                          • 1




                            $begingroup$
                            For your True-for-1 version, you can shorten the base case condition taking a as a number.
                            $endgroup$
                            – xnor
                            Apr 27 at 3:40










                          • $begingroup$
                            @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
                            $endgroup$
                            – Lynn
                            Apr 27 at 14:20










                          • $begingroup$
                            If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
                            $endgroup$
                            – negative seven
                            yesterday
















                          14












                          14








                          14





                          $begingroup$


                          Python 2, 50 bytes





                          f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1


                          Try it online!



                          This is a variation of the 47-byte solution explained below, adjusted to return 1 for input '1'. (Namely, we add 1 to the full expression rather than the recursive call, and start counting from n==2 to remove one layer of depth, balancing the result out for all non-'1' inputs.)




                          Python 2, 45 bytes (maps 1 to True)





                          f=lambda a,n=2,p=1:`-a`in`-p`or-~f(a,n+1,p*n)


                          This is another variation, by @Jo King and @xnor, which takes input as a number and returns True for input 1. Some people think this is fair game, but I personally find it a little weird.



                          But it costs only 3 bytes to wrap the icky Boolean result in +(), giving us a shorter "nice" solution:




                          Python 2, 48 bytes





                          f=lambda a,n=2,p=1:+(`-a`in`-p`)or-~f(a,n+1,p*n)



                          This is my previous solution, which returns 0 for input '1'. It would have been valid if the question concerned a non-negative N.




                          Python 2, 47 bytes (invalid)





                          f=lambda a,n=1,p=1:`p`.find(a)and-~f(a,n+1,p*n)


                          Try it online!



                          Takes a string as input, like f('18').



                          The trick here is that x.find(y) == 0 precisely when x.startswith(y).



                          The and-expression will short circuit at `p`.find(a) with result 0 as soon as `p` starts with a; otherwise, it will evaluate to -~f(a,n+1,p*n), id est 1 + f(a,n+1,p*n).



                          The end result is 1 + (1 + (1 + (... + 0))), n layers deep, so n.







                          share|improve this answer











                          $endgroup$




                          Python 2, 50 bytes





                          f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1


                          Try it online!



                          This is a variation of the 47-byte solution explained below, adjusted to return 1 for input '1'. (Namely, we add 1 to the full expression rather than the recursive call, and start counting from n==2 to remove one layer of depth, balancing the result out for all non-'1' inputs.)




                          Python 2, 45 bytes (maps 1 to True)





                          f=lambda a,n=2,p=1:`-a`in`-p`or-~f(a,n+1,p*n)


                          This is another variation, by @Jo King and @xnor, which takes input as a number and returns True for input 1. Some people think this is fair game, but I personally find it a little weird.



                          But it costs only 3 bytes to wrap the icky Boolean result in +(), giving us a shorter "nice" solution:




                          Python 2, 48 bytes





                          f=lambda a,n=2,p=1:+(`-a`in`-p`)or-~f(a,n+1,p*n)



                          This is my previous solution, which returns 0 for input '1'. It would have been valid if the question concerned a non-negative N.




                          Python 2, 47 bytes (invalid)





                          f=lambda a,n=1,p=1:`p`.find(a)and-~f(a,n+1,p*n)


                          Try it online!



                          Takes a string as input, like f('18').



                          The trick here is that x.find(y) == 0 precisely when x.startswith(y).



                          The and-expression will short circuit at `p`.find(a) with result 0 as soon as `p` starts with a; otherwise, it will evaluate to -~f(a,n+1,p*n), id est 1 + f(a,n+1,p*n).



                          The end result is 1 + (1 + (1 + (... + 0))), n layers deep, so n.








                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 27 at 14:32

























                          answered Apr 25 at 20:10









                          LynnLynn

                          51.7k8101237




                          51.7k8101237












                          • $begingroup$
                            Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
                            $endgroup$
                            – Shaggy
                            Apr 25 at 20:58






                          • 1




                            $begingroup$
                            For your True-for-1 version, you can shorten the base case condition taking a as a number.
                            $endgroup$
                            – xnor
                            Apr 27 at 3:40










                          • $begingroup$
                            @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
                            $endgroup$
                            – Lynn
                            Apr 27 at 14:20










                          • $begingroup$
                            If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
                            $endgroup$
                            – negative seven
                            yesterday




















                          • $begingroup$
                            Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
                            $endgroup$
                            – Shaggy
                            Apr 25 at 20:58






                          • 1




                            $begingroup$
                            For your True-for-1 version, you can shorten the base case condition taking a as a number.
                            $endgroup$
                            – xnor
                            Apr 27 at 3:40










                          • $begingroup$
                            @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
                            $endgroup$
                            – Lynn
                            Apr 27 at 14:20










                          • $begingroup$
                            If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
                            $endgroup$
                            – negative seven
                            yesterday


















                          $begingroup$
                          Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
                          $endgroup$
                          – Shaggy
                          Apr 25 at 20:58




                          $begingroup$
                          Nice solution by the way. I was working on the same method but calculating the factorial on each iteration; implementing your approach saved me a few bytes so +1 anyway.
                          $endgroup$
                          – Shaggy
                          Apr 25 at 20:58




                          1




                          1




                          $begingroup$
                          For your True-for-1 version, you can shorten the base case condition taking a as a number.
                          $endgroup$
                          – xnor
                          Apr 27 at 3:40




                          $begingroup$
                          For your True-for-1 version, you can shorten the base case condition taking a as a number.
                          $endgroup$
                          – xnor
                          Apr 27 at 3:40












                          $begingroup$
                          @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
                          $endgroup$
                          – Lynn
                          Apr 27 at 14:20




                          $begingroup$
                          @xnor I would have not thought of `` -ain-p ``, that's a neat trick :)
                          $endgroup$
                          – Lynn
                          Apr 27 at 14:20












                          $begingroup$
                          If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
                          $endgroup$
                          – negative seven
                          yesterday






                          $begingroup$
                          If the proof still holds if N is restricted to even values, then this 45 byte solution will always output a number.
                          $endgroup$
                          – negative seven
                          yesterday













                          9












                          $begingroup$


                          Brachylog, 3 5 bytes



                          ℕ₁ḟa₀


                          Try it online!



                          Takes input through its output variable, and outputs through its input variable. (The other way around, it just finds arbitrary prefixes of the input's factorial, which isn't quite as interesting.) Times out on the second-to-last test case on TIO, but does fine on the last one. I've been running it on 841 on my laptop for several minutes at the time of writing this, and it hasn't actually spit out an answer yet, but I have faith in it.



                                   The (implicit) output variable
                          a₀ is a prefix of
                          ḟ the factorial of
                          the (implicit) input variable
                          ℕ₁ which is a positive integer.


                          Since the only input ḟa₀ doesn't work for is 1, and 1 is a positive prefix of 1! = 1, 1|ḟa₀ works just as well.



                          Also, as of this edit, 841 has been running for nearly three hours and it still hasn't produced an output. I guess computing the factorial of every integer from 1 to 12745 isn't exactly fast.






                          share|improve this answer











                          $endgroup$









                          • 2




                            $begingroup$
                            The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
                            $endgroup$
                            – Fatalize
                            Apr 26 at 9:28












                          • $begingroup$
                            Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
                            $endgroup$
                            – Unrelated String
                            Apr 26 at 9:37
















                          9












                          $begingroup$


                          Brachylog, 3 5 bytes



                          ℕ₁ḟa₀


                          Try it online!



                          Takes input through its output variable, and outputs through its input variable. (The other way around, it just finds arbitrary prefixes of the input's factorial, which isn't quite as interesting.) Times out on the second-to-last test case on TIO, but does fine on the last one. I've been running it on 841 on my laptop for several minutes at the time of writing this, and it hasn't actually spit out an answer yet, but I have faith in it.



                                   The (implicit) output variable
                          a₀ is a prefix of
                          ḟ the factorial of
                          the (implicit) input variable
                          ℕ₁ which is a positive integer.


                          Since the only input ḟa₀ doesn't work for is 1, and 1 is a positive prefix of 1! = 1, 1|ḟa₀ works just as well.



                          Also, as of this edit, 841 has been running for nearly three hours and it still hasn't produced an output. I guess computing the factorial of every integer from 1 to 12745 isn't exactly fast.






                          share|improve this answer











                          $endgroup$









                          • 2




                            $begingroup$
                            The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
                            $endgroup$
                            – Fatalize
                            Apr 26 at 9:28












                          • $begingroup$
                            Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
                            $endgroup$
                            – Unrelated String
                            Apr 26 at 9:37














                          9












                          9








                          9





                          $begingroup$


                          Brachylog, 3 5 bytes



                          ℕ₁ḟa₀


                          Try it online!



                          Takes input through its output variable, and outputs through its input variable. (The other way around, it just finds arbitrary prefixes of the input's factorial, which isn't quite as interesting.) Times out on the second-to-last test case on TIO, but does fine on the last one. I've been running it on 841 on my laptop for several minutes at the time of writing this, and it hasn't actually spit out an answer yet, but I have faith in it.



                                   The (implicit) output variable
                          a₀ is a prefix of
                          ḟ the factorial of
                          the (implicit) input variable
                          ℕ₁ which is a positive integer.


                          Since the only input ḟa₀ doesn't work for is 1, and 1 is a positive prefix of 1! = 1, 1|ḟa₀ works just as well.



                          Also, as of this edit, 841 has been running for nearly three hours and it still hasn't produced an output. I guess computing the factorial of every integer from 1 to 12745 isn't exactly fast.






                          share|improve this answer











                          $endgroup$




                          Brachylog, 3 5 bytes



                          ℕ₁ḟa₀


                          Try it online!



                          Takes input through its output variable, and outputs through its input variable. (The other way around, it just finds arbitrary prefixes of the input's factorial, which isn't quite as interesting.) Times out on the second-to-last test case on TIO, but does fine on the last one. I've been running it on 841 on my laptop for several minutes at the time of writing this, and it hasn't actually spit out an answer yet, but I have faith in it.



                                   The (implicit) output variable
                          a₀ is a prefix of
                          ḟ the factorial of
                          the (implicit) input variable
                          ℕ₁ which is a positive integer.


                          Since the only input ḟa₀ doesn't work for is 1, and 1 is a positive prefix of 1! = 1, 1|ḟa₀ works just as well.



                          Also, as of this edit, 841 has been running for nearly three hours and it still hasn't produced an output. I guess computing the factorial of every integer from 1 to 12745 isn't exactly fast.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 26 at 9:14

























                          answered Apr 26 at 6:16









                          Unrelated StringUnrelated String

                          2,190313




                          2,190313








                          • 2




                            $begingroup$
                            The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
                            $endgroup$
                            – Fatalize
                            Apr 26 at 9:28












                          • $begingroup$
                            Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
                            $endgroup$
                            – Unrelated String
                            Apr 26 at 9:37














                          • 2




                            $begingroup$
                            The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
                            $endgroup$
                            – Fatalize
                            Apr 26 at 9:28












                          • $begingroup$
                            Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
                            $endgroup$
                            – Unrelated String
                            Apr 26 at 9:37








                          2




                          2




                          $begingroup$
                          The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
                          $endgroup$
                          – Fatalize
                          Apr 26 at 9:28






                          $begingroup$
                          The implementation of the factorial predicate in Brachylog is a bit convoluted so that it can be used both ways with acceptable efficiency. One could implement a much faster algorithm to compute the factorial, but it would be extremely slow running the other way (i.e. finding the original number from the factorial).
                          $endgroup$
                          – Fatalize
                          Apr 26 at 9:28














                          $begingroup$
                          Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
                          $endgroup$
                          – Unrelated String
                          Apr 26 at 9:37




                          $begingroup$
                          Oh, cool! Looking at the source for it, I can't tell what all it's doing, but I can tell you put a lot of good thought into it.
                          $endgroup$
                          – Unrelated String
                          Apr 26 at 9:37











                          7












                          $begingroup$


                          C++ (gcc), 107 95 bytes, using -lgmp and -lgmpxx



                          Thanks to the people in the comments for pointing out some silly mishaps.





                          #import<gmpxx.h>
                          auto f(auto A){mpz_class n,x=1,z;for(;z!=A;)for(z=x*=++n;z>A;z/=10);return n;}


                          Try it online!



                          Computes $n!$ by multiplying $(n-1)!$ by $n$, then repeatedly divides it by $10$ until it is no longer greater than the passed integer. At this point, the loop terminates if the factorial equals the passed integer, or proceeds to the next $n$ otherwise.






                          share|improve this answer











                          $endgroup$













                          • $begingroup$
                            You don't need to count flags anymore, so this is 107 bytes.
                            $endgroup$
                            – AdmBorkBork
                            Apr 26 at 12:37










                          • $begingroup$
                            Why do you need the second semicolon before return?
                            $endgroup$
                            – Ruslan
                            Apr 26 at 15:34










                          • $begingroup$
                            You could use a single character name for the function, save a couple of bytes.
                            $endgroup$
                            – Shaggy
                            Apr 26 at 16:38
















                          7












                          $begingroup$


                          C++ (gcc), 107 95 bytes, using -lgmp and -lgmpxx



                          Thanks to the people in the comments for pointing out some silly mishaps.





                          #import<gmpxx.h>
                          auto f(auto A){mpz_class n,x=1,z;for(;z!=A;)for(z=x*=++n;z>A;z/=10);return n;}


                          Try it online!



                          Computes $n!$ by multiplying $(n-1)!$ by $n$, then repeatedly divides it by $10$ until it is no longer greater than the passed integer. At this point, the loop terminates if the factorial equals the passed integer, or proceeds to the next $n$ otherwise.






                          share|improve this answer











                          $endgroup$













                          • $begingroup$
                            You don't need to count flags anymore, so this is 107 bytes.
                            $endgroup$
                            – AdmBorkBork
                            Apr 26 at 12:37










                          • $begingroup$
                            Why do you need the second semicolon before return?
                            $endgroup$
                            – Ruslan
                            Apr 26 at 15:34










                          • $begingroup$
                            You could use a single character name for the function, save a couple of bytes.
                            $endgroup$
                            – Shaggy
                            Apr 26 at 16:38














                          7












                          7








                          7





                          $begingroup$


                          C++ (gcc), 107 95 bytes, using -lgmp and -lgmpxx



                          Thanks to the people in the comments for pointing out some silly mishaps.





                          #import<gmpxx.h>
                          auto f(auto A){mpz_class n,x=1,z;for(;z!=A;)for(z=x*=++n;z>A;z/=10);return n;}


                          Try it online!



                          Computes $n!$ by multiplying $(n-1)!$ by $n$, then repeatedly divides it by $10$ until it is no longer greater than the passed integer. At this point, the loop terminates if the factorial equals the passed integer, or proceeds to the next $n$ otherwise.






                          share|improve this answer











                          $endgroup$




                          C++ (gcc), 107 95 bytes, using -lgmp and -lgmpxx



                          Thanks to the people in the comments for pointing out some silly mishaps.





                          #import<gmpxx.h>
                          auto f(auto A){mpz_class n,x=1,z;for(;z!=A;)for(z=x*=++n;z>A;z/=10);return n;}


                          Try it online!



                          Computes $n!$ by multiplying $(n-1)!$ by $n$, then repeatedly divides it by $10$ until it is no longer greater than the passed integer. At this point, the loop terminates if the factorial equals the passed integer, or proceeds to the next $n$ otherwise.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 27 at 18:58

























                          answered Apr 26 at 4:38









                          Neil A.Neil A.

                          1,668222




                          1,668222












                          • $begingroup$
                            You don't need to count flags anymore, so this is 107 bytes.
                            $endgroup$
                            – AdmBorkBork
                            Apr 26 at 12:37










                          • $begingroup$
                            Why do you need the second semicolon before return?
                            $endgroup$
                            – Ruslan
                            Apr 26 at 15:34










                          • $begingroup$
                            You could use a single character name for the function, save a couple of bytes.
                            $endgroup$
                            – Shaggy
                            Apr 26 at 16:38


















                          • $begingroup$
                            You don't need to count flags anymore, so this is 107 bytes.
                            $endgroup$
                            – AdmBorkBork
                            Apr 26 at 12:37










                          • $begingroup$
                            Why do you need the second semicolon before return?
                            $endgroup$
                            – Ruslan
                            Apr 26 at 15:34










                          • $begingroup$
                            You could use a single character name for the function, save a couple of bytes.
                            $endgroup$
                            – Shaggy
                            Apr 26 at 16:38
















                          $begingroup$
                          You don't need to count flags anymore, so this is 107 bytes.
                          $endgroup$
                          – AdmBorkBork
                          Apr 26 at 12:37




                          $begingroup$
                          You don't need to count flags anymore, so this is 107 bytes.
                          $endgroup$
                          – AdmBorkBork
                          Apr 26 at 12:37












                          $begingroup$
                          Why do you need the second semicolon before return?
                          $endgroup$
                          – Ruslan
                          Apr 26 at 15:34




                          $begingroup$
                          Why do you need the second semicolon before return?
                          $endgroup$
                          – Ruslan
                          Apr 26 at 15:34












                          $begingroup$
                          You could use a single character name for the function, save a couple of bytes.
                          $endgroup$
                          – Shaggy
                          Apr 26 at 16:38




                          $begingroup$
                          You could use a single character name for the function, save a couple of bytes.
                          $endgroup$
                          – Shaggy
                          Apr 26 at 16:38











                          6












                          $begingroup$


                          Jelly, 8 bytes



                          1!w⁼1ʋ1#


                          Try it online!



                          Takes an integer and returns a singleton.






                          share|improve this answer









                          $endgroup$


















                            6












                            $begingroup$


                            Jelly, 8 bytes



                            1!w⁼1ʋ1#


                            Try it online!



                            Takes an integer and returns a singleton.






                            share|improve this answer









                            $endgroup$
















                              6












                              6








                              6





                              $begingroup$


                              Jelly, 8 bytes



                              1!w⁼1ʋ1#


                              Try it online!



                              Takes an integer and returns a singleton.






                              share|improve this answer









                              $endgroup$




                              Jelly, 8 bytes



                              1!w⁼1ʋ1#


                              Try it online!



                              Takes an integer and returns a singleton.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Apr 25 at 20:45









                              Erik the OutgolferErik the Outgolfer

                              33.5k430106




                              33.5k430106























                                  6












                                  $begingroup$


                                  05AB1E, 7 bytes



                                  ∞.Δ!IÅ?


                                  Try it online or verify -almost- all test cases (841 times out, so is excluded).



                                  Explanation:





                                  ∞.Δ      # Find the first positive integer which is truthy for:
                                  ! # Get the factorial of the current integer
                                  IÅ? # And check if it starts with the input
                                  # (after which the result is output implicitly)





                                  share|improve this answer









                                  $endgroup$


















                                    6












                                    $begingroup$


                                    05AB1E, 7 bytes



                                    ∞.Δ!IÅ?


                                    Try it online or verify -almost- all test cases (841 times out, so is excluded).



                                    Explanation:





                                    ∞.Δ      # Find the first positive integer which is truthy for:
                                    ! # Get the factorial of the current integer
                                    IÅ? # And check if it starts with the input
                                    # (after which the result is output implicitly)





                                    share|improve this answer









                                    $endgroup$
















                                      6












                                      6








                                      6





                                      $begingroup$


                                      05AB1E, 7 bytes



                                      ∞.Δ!IÅ?


                                      Try it online or verify -almost- all test cases (841 times out, so is excluded).



                                      Explanation:





                                      ∞.Δ      # Find the first positive integer which is truthy for:
                                      ! # Get the factorial of the current integer
                                      IÅ? # And check if it starts with the input
                                      # (after which the result is output implicitly)





                                      share|improve this answer









                                      $endgroup$




                                      05AB1E, 7 bytes



                                      ∞.Δ!IÅ?


                                      Try it online or verify -almost- all test cases (841 times out, so is excluded).



                                      Explanation:





                                      ∞.Δ      # Find the first positive integer which is truthy for:
                                      ! # Get the factorial of the current integer
                                      IÅ? # And check if it starts with the input
                                      # (after which the result is output implicitly)






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Apr 26 at 7:05









                                      Kevin CruijssenKevin Cruijssen

                                      45.1k576226




                                      45.1k576226























                                          2












                                          $begingroup$

                                          Pyth - 8 bytes



                                          f!x`.!Tz

                                          f filter. With no second arg, it searches 1.. for first truthy
                                          ! logical not, here it checks for zero
                                          x z indexof. z is input as string
                                          ` string repr
                                          .!T Factorial of lambda var


                                          Try it online.






                                          share|improve this answer









                                          $endgroup$


















                                            2












                                            $begingroup$

                                            Pyth - 8 bytes



                                            f!x`.!Tz

                                            f filter. With no second arg, it searches 1.. for first truthy
                                            ! logical not, here it checks for zero
                                            x z indexof. z is input as string
                                            ` string repr
                                            .!T Factorial of lambda var


                                            Try it online.






                                            share|improve this answer









                                            $endgroup$
















                                              2












                                              2








                                              2





                                              $begingroup$

                                              Pyth - 8 bytes



                                              f!x`.!Tz

                                              f filter. With no second arg, it searches 1.. for first truthy
                                              ! logical not, here it checks for zero
                                              x z indexof. z is input as string
                                              ` string repr
                                              .!T Factorial of lambda var


                                              Try it online.






                                              share|improve this answer









                                              $endgroup$



                                              Pyth - 8 bytes



                                              f!x`.!Tz

                                              f filter. With no second arg, it searches 1.. for first truthy
                                              ! logical not, here it checks for zero
                                              x z indexof. z is input as string
                                              ` string repr
                                              .!T Factorial of lambda var


                                              Try it online.







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Apr 25 at 21:43









                                              MaltysenMaltysen

                                              21.6k445118




                                              21.6k445118























                                                  2












                                                  $begingroup$

                                                  JavaScript, 47 43 bytes



                                                  Output as a BigInt.



                                                  n=>(g=x=>`${x}`.search(n)?g(x*++i):i)(i=1n)


                                                  Try It Online!



                                                  Saved a few bytes by taking Lynn's approach of "building" the factorial rather than calculating it on each iteration so please upvote her solution as well if you're upvoting this one.






                                                  share|improve this answer











                                                  $endgroup$













                                                  • $begingroup$
                                                    Sadly, _Ês bU}f1 in Japt doesn't work
                                                    $endgroup$
                                                    – Embodiment of Ignorance
                                                    Apr 25 at 21:12










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:13










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:45










                                                  • $begingroup$
                                                    3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
                                                    $endgroup$
                                                    – vrugtehagel
                                                    May 2 at 16:08












                                                  • $begingroup$
                                                    @vrugtehagel, that wouldn't be reusable.
                                                    $endgroup$
                                                    – Shaggy
                                                    May 2 at 20:12
















                                                  2












                                                  $begingroup$

                                                  JavaScript, 47 43 bytes



                                                  Output as a BigInt.



                                                  n=>(g=x=>`${x}`.search(n)?g(x*++i):i)(i=1n)


                                                  Try It Online!



                                                  Saved a few bytes by taking Lynn's approach of "building" the factorial rather than calculating it on each iteration so please upvote her solution as well if you're upvoting this one.






                                                  share|improve this answer











                                                  $endgroup$













                                                  • $begingroup$
                                                    Sadly, _Ês bU}f1 in Japt doesn't work
                                                    $endgroup$
                                                    – Embodiment of Ignorance
                                                    Apr 25 at 21:12










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:13










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:45










                                                  • $begingroup$
                                                    3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
                                                    $endgroup$
                                                    – vrugtehagel
                                                    May 2 at 16:08












                                                  • $begingroup$
                                                    @vrugtehagel, that wouldn't be reusable.
                                                    $endgroup$
                                                    – Shaggy
                                                    May 2 at 20:12














                                                  2












                                                  2








                                                  2





                                                  $begingroup$

                                                  JavaScript, 47 43 bytes



                                                  Output as a BigInt.



                                                  n=>(g=x=>`${x}`.search(n)?g(x*++i):i)(i=1n)


                                                  Try It Online!



                                                  Saved a few bytes by taking Lynn's approach of "building" the factorial rather than calculating it on each iteration so please upvote her solution as well if you're upvoting this one.






                                                  share|improve this answer











                                                  $endgroup$



                                                  JavaScript, 47 43 bytes



                                                  Output as a BigInt.



                                                  n=>(g=x=>`${x}`.search(n)?g(x*++i):i)(i=1n)


                                                  Try It Online!



                                                  Saved a few bytes by taking Lynn's approach of "building" the factorial rather than calculating it on each iteration so please upvote her solution as well if you're upvoting this one.







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited Apr 26 at 14:31

























                                                  answered Apr 25 at 20:41









                                                  ShaggyShaggy

                                                  19.5k31768




                                                  19.5k31768












                                                  • $begingroup$
                                                    Sadly, _Ês bU}f1 in Japt doesn't work
                                                    $endgroup$
                                                    – Embodiment of Ignorance
                                                    Apr 25 at 21:12










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:13










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:45










                                                  • $begingroup$
                                                    3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
                                                    $endgroup$
                                                    – vrugtehagel
                                                    May 2 at 16:08












                                                  • $begingroup$
                                                    @vrugtehagel, that wouldn't be reusable.
                                                    $endgroup$
                                                    – Shaggy
                                                    May 2 at 20:12


















                                                  • $begingroup$
                                                    Sadly, _Ês bU}f1 in Japt doesn't work
                                                    $endgroup$
                                                    – Embodiment of Ignorance
                                                    Apr 25 at 21:12










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:13










                                                  • $begingroup$
                                                    @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                                                    $endgroup$
                                                    – Shaggy
                                                    Apr 25 at 21:45










                                                  • $begingroup$
                                                    3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
                                                    $endgroup$
                                                    – vrugtehagel
                                                    May 2 at 16:08












                                                  • $begingroup$
                                                    @vrugtehagel, that wouldn't be reusable.
                                                    $endgroup$
                                                    – Shaggy
                                                    May 2 at 20:12
















                                                  $begingroup$
                                                  Sadly, _Ês bU}f1 in Japt doesn't work
                                                  $endgroup$
                                                  – Embodiment of Ignorance
                                                  Apr 25 at 21:12




                                                  $begingroup$
                                                  Sadly, _Ês bU}f1 in Japt doesn't work
                                                  $endgroup$
                                                  – Embodiment of Ignorance
                                                  Apr 25 at 21:12












                                                  $begingroup$
                                                  @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                                                  $endgroup$
                                                  – Shaggy
                                                  Apr 25 at 21:13




                                                  $begingroup$
                                                  @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                                                  $endgroup$
                                                  – Shaggy
                                                  Apr 25 at 21:13












                                                  $begingroup$
                                                  @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                                                  $endgroup$
                                                  – Shaggy
                                                  Apr 25 at 21:45




                                                  $begingroup$
                                                  @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                                                  $endgroup$
                                                  – Shaggy
                                                  Apr 25 at 21:45












                                                  $begingroup$
                                                  3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
                                                  $endgroup$
                                                  – vrugtehagel
                                                  May 2 at 16:08






                                                  $begingroup$
                                                  3 bytes less: x=i=1n;f=n=>`${x*=++i}`.search(n)?f(n):i
                                                  $endgroup$
                                                  – vrugtehagel
                                                  May 2 at 16:08














                                                  $begingroup$
                                                  @vrugtehagel, that wouldn't be reusable.
                                                  $endgroup$
                                                  – Shaggy
                                                  May 2 at 20:12




                                                  $begingroup$
                                                  @vrugtehagel, that wouldn't be reusable.
                                                  $endgroup$
                                                  – Shaggy
                                                  May 2 at 20:12











                                                  2












                                                  $begingroup$


                                                  C# (.NET Core), 69 + 22 = 91 bytes





                                                  a=>{var n=a/a;for(var b=n;!(b+"").StartsWith(a+"");b*=++n);return n;}


                                                  Try it online!



                                                  Uses System.Numerics.BigInteger which requires a using statement.



                                                  -1 byte thanks to @ExpiredData!






                                                  share|improve this answer











                                                  $endgroup$









                                                  • 1




                                                    $begingroup$
                                                    69 + 22
                                                    $endgroup$
                                                    – Expired Data
                                                    Apr 26 at 16:56
















                                                  2












                                                  $begingroup$


                                                  C# (.NET Core), 69 + 22 = 91 bytes





                                                  a=>{var n=a/a;for(var b=n;!(b+"").StartsWith(a+"");b*=++n);return n;}


                                                  Try it online!



                                                  Uses System.Numerics.BigInteger which requires a using statement.



                                                  -1 byte thanks to @ExpiredData!






                                                  share|improve this answer











                                                  $endgroup$









                                                  • 1




                                                    $begingroup$
                                                    69 + 22
                                                    $endgroup$
                                                    – Expired Data
                                                    Apr 26 at 16:56














                                                  2












                                                  2








                                                  2





                                                  $begingroup$


                                                  C# (.NET Core), 69 + 22 = 91 bytes





                                                  a=>{var n=a/a;for(var b=n;!(b+"").StartsWith(a+"");b*=++n);return n;}


                                                  Try it online!



                                                  Uses System.Numerics.BigInteger which requires a using statement.



                                                  -1 byte thanks to @ExpiredData!






                                                  share|improve this answer











                                                  $endgroup$




                                                  C# (.NET Core), 69 + 22 = 91 bytes





                                                  a=>{var n=a/a;for(var b=n;!(b+"").StartsWith(a+"");b*=++n);return n;}


                                                  Try it online!



                                                  Uses System.Numerics.BigInteger which requires a using statement.



                                                  -1 byte thanks to @ExpiredData!







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited Apr 26 at 19:41

























                                                  answered Apr 26 at 4:16









                                                  danadana

                                                  2,261168




                                                  2,261168








                                                  • 1




                                                    $begingroup$
                                                    69 + 22
                                                    $endgroup$
                                                    – Expired Data
                                                    Apr 26 at 16:56














                                                  • 1




                                                    $begingroup$
                                                    69 + 22
                                                    $endgroup$
                                                    – Expired Data
                                                    Apr 26 at 16:56








                                                  1




                                                  1




                                                  $begingroup$
                                                  69 + 22
                                                  $endgroup$
                                                  – Expired Data
                                                  Apr 26 at 16:56




                                                  $begingroup$
                                                  69 + 22
                                                  $endgroup$
                                                  – Expired Data
                                                  Apr 26 at 16:56











                                                  1












                                                  $begingroup$


                                                  Jelly, 16 bytes



                                                  ‘ɼ!³;D®ß⁼Lḣ@¥¥/?


                                                  Try it online!



                                                  Explanation



                                                  ‘ɼ                | Increment the register (initially 0)
                                                  ! | Factorial
                                                  ³; | Prepend the input
                                                  D | Convert to decimal digits
                                                  ⁼ ¥¥/? | If the input diguts are equal to...
                                                  Lḣ@ | The same number of diguts from the head of the factorial
                                                  ® | Return the register
                                                  ß | Otherwise run the link again





                                                  share|improve this answer











                                                  $endgroup$


















                                                    1












                                                    $begingroup$


                                                    Jelly, 16 bytes



                                                    ‘ɼ!³;D®ß⁼Lḣ@¥¥/?


                                                    Try it online!



                                                    Explanation



                                                    ‘ɼ                | Increment the register (initially 0)
                                                    ! | Factorial
                                                    ³; | Prepend the input
                                                    D | Convert to decimal digits
                                                    ⁼ ¥¥/? | If the input diguts are equal to...
                                                    Lḣ@ | The same number of diguts from the head of the factorial
                                                    ® | Return the register
                                                    ß | Otherwise run the link again





                                                    share|improve this answer











                                                    $endgroup$
















                                                      1












                                                      1








                                                      1





                                                      $begingroup$


                                                      Jelly, 16 bytes



                                                      ‘ɼ!³;D®ß⁼Lḣ@¥¥/?


                                                      Try it online!



                                                      Explanation



                                                      ‘ɼ                | Increment the register (initially 0)
                                                      ! | Factorial
                                                      ³; | Prepend the input
                                                      D | Convert to decimal digits
                                                      ⁼ ¥¥/? | If the input diguts are equal to...
                                                      Lḣ@ | The same number of diguts from the head of the factorial
                                                      ® | Return the register
                                                      ß | Otherwise run the link again





                                                      share|improve this answer











                                                      $endgroup$




                                                      Jelly, 16 bytes



                                                      ‘ɼ!³;D®ß⁼Lḣ@¥¥/?


                                                      Try it online!



                                                      Explanation



                                                      ‘ɼ                | Increment the register (initially 0)
                                                      ! | Factorial
                                                      ³; | Prepend the input
                                                      D | Convert to decimal digits
                                                      ⁼ ¥¥/? | If the input diguts are equal to...
                                                      Lḣ@ | The same number of diguts from the head of the factorial
                                                      ® | Return the register
                                                      ß | Otherwise run the link again






                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Apr 25 at 20:38

























                                                      answered Apr 25 at 20:31









                                                      Nick KennedyNick Kennedy

                                                      2,65469




                                                      2,65469























                                                          1












                                                          $begingroup$


                                                          Perl 6, 23 bytes





                                                          {+([*](1..*).../^$_/)}


                                                          Try it online!



                                                          Explanation



                                                          {                     }  # Anonymous code block
                                                          [*](1..*) # From the infinite list of factorials
                                                          ... # Take up to the first element
                                                          /^$_/ # That starts with the input
                                                          +( ) # And return the length of the sequence





                                                          share|improve this answer









                                                          $endgroup$


















                                                            1












                                                            $begingroup$


                                                            Perl 6, 23 bytes





                                                            {+([*](1..*).../^$_/)}


                                                            Try it online!



                                                            Explanation



                                                            {                     }  # Anonymous code block
                                                            [*](1..*) # From the infinite list of factorials
                                                            ... # Take up to the first element
                                                            /^$_/ # That starts with the input
                                                            +( ) # And return the length of the sequence





                                                            share|improve this answer









                                                            $endgroup$
















                                                              1












                                                              1








                                                              1





                                                              $begingroup$


                                                              Perl 6, 23 bytes





                                                              {+([*](1..*).../^$_/)}


                                                              Try it online!



                                                              Explanation



                                                              {                     }  # Anonymous code block
                                                              [*](1..*) # From the infinite list of factorials
                                                              ... # Take up to the first element
                                                              /^$_/ # That starts with the input
                                                              +( ) # And return the length of the sequence





                                                              share|improve this answer









                                                              $endgroup$




                                                              Perl 6, 23 bytes





                                                              {+([*](1..*).../^$_/)}


                                                              Try it online!



                                                              Explanation



                                                              {                     }  # Anonymous code block
                                                              [*](1..*) # From the infinite list of factorials
                                                              ... # Take up to the first element
                                                              /^$_/ # That starts with the input
                                                              +( ) # And return the length of the sequence






                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered Apr 25 at 21:52









                                                              Jo KingJo King

                                                              28.5k367134




                                                              28.5k367134























                                                                  1












                                                                  $begingroup$


                                                                  Charcoal, 16 bytes



                                                                  ⊞υ¹W⌕IΠυθ⊞υLυI⊟υ


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



                                                                  ⊞υ¹


                                                                  Push 1 to the empty list so that it starts off with a defined product.



                                                                  W⌕IΠυθ


                                                                  Repeat while the input cannot be found at the beginning of the product of the list...



                                                                  ⊞υLυ


                                                                  ... push the length of the list to itself.



                                                                  I⊟υ


                                                                  Print the last value pushed to the list.






                                                                  share|improve this answer









                                                                  $endgroup$


















                                                                    1












                                                                    $begingroup$


                                                                    Charcoal, 16 bytes



                                                                    ⊞υ¹W⌕IΠυθ⊞υLυI⊟υ


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



                                                                    ⊞υ¹


                                                                    Push 1 to the empty list so that it starts off with a defined product.



                                                                    W⌕IΠυθ


                                                                    Repeat while the input cannot be found at the beginning of the product of the list...



                                                                    ⊞υLυ


                                                                    ... push the length of the list to itself.



                                                                    I⊟υ


                                                                    Print the last value pushed to the list.






                                                                    share|improve this answer









                                                                    $endgroup$
















                                                                      1












                                                                      1








                                                                      1





                                                                      $begingroup$


                                                                      Charcoal, 16 bytes



                                                                      ⊞υ¹W⌕IΠυθ⊞υLυI⊟υ


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



                                                                      ⊞υ¹


                                                                      Push 1 to the empty list so that it starts off with a defined product.



                                                                      W⌕IΠυθ


                                                                      Repeat while the input cannot be found at the beginning of the product of the list...



                                                                      ⊞υLυ


                                                                      ... push the length of the list to itself.



                                                                      I⊟υ


                                                                      Print the last value pushed to the list.






                                                                      share|improve this answer









                                                                      $endgroup$




                                                                      Charcoal, 16 bytes



                                                                      ⊞υ¹W⌕IΠυθ⊞υLυI⊟υ


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



                                                                      ⊞υ¹


                                                                      Push 1 to the empty list so that it starts off with a defined product.



                                                                      W⌕IΠυθ


                                                                      Repeat while the input cannot be found at the beginning of the product of the list...



                                                                      ⊞υLυ


                                                                      ... push the length of the list to itself.



                                                                      I⊟υ


                                                                      Print the last value pushed to the list.







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Apr 25 at 22:27









                                                                      NeilNeil

                                                                      84.6k845183




                                                                      84.6k845183























                                                                          1












                                                                          $begingroup$


                                                                          Perl 5 -Mbigint -p, 25 bytes





                                                                          1while($.*=++$)!~/^$_/}{


                                                                          Try it online!






                                                                          share|improve this answer









                                                                          $endgroup$


















                                                                            1












                                                                            $begingroup$


                                                                            Perl 5 -Mbigint -p, 25 bytes





                                                                            1while($.*=++$)!~/^$_/}{


                                                                            Try it online!






                                                                            share|improve this answer









                                                                            $endgroup$
















                                                                              1












                                                                              1








                                                                              1





                                                                              $begingroup$


                                                                              Perl 5 -Mbigint -p, 25 bytes





                                                                              1while($.*=++$)!~/^$_/}{


                                                                              Try it online!






                                                                              share|improve this answer









                                                                              $endgroup$




                                                                              Perl 5 -Mbigint -p, 25 bytes





                                                                              1while($.*=++$)!~/^$_/}{


                                                                              Try it online!







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Apr 25 at 23:10









                                                                              XcaliXcali

                                                                              5,890523




                                                                              5,890523























                                                                                  1












                                                                                  $begingroup$


                                                                                  J, 28 22 bytes



                                                                                  -6 bytes thanks to FrownyFrog



                                                                                  (]+1-0{(E.&":!))^:_&1x


                                                                                  Try it online!



                                                                                  original answer J, 28 bytes



                                                                                  >:@]^:(-.@{.@E.&":!)^:_ x:@1


                                                                                  Try it online!





                                                                                  • >:@] ... x:@1 starting with an extended precision 1, keep incrementing it while...


                                                                                  • -.@ its not the case that...


                                                                                  • {.@ the first elm is a starting match of...


                                                                                  • E.&": all the substring matches (after stringfying both arguments &":) of searching for the original input in...


                                                                                  • ! the factorial of the number we're incrementing






                                                                                  share|improve this answer











                                                                                  $endgroup$













                                                                                  • $begingroup$
                                                                                    (]+1-0{(E.&":!))^:_&1x
                                                                                    $endgroup$
                                                                                    – FrownyFrog
                                                                                    Apr 26 at 14:07










                                                                                  • $begingroup$
                                                                                    I love that use of "fixed point" to avoid the traditional while.
                                                                                    $endgroup$
                                                                                    – Jonah
                                                                                    Apr 26 at 14:15
















                                                                                  1












                                                                                  $begingroup$


                                                                                  J, 28 22 bytes



                                                                                  -6 bytes thanks to FrownyFrog



                                                                                  (]+1-0{(E.&":!))^:_&1x


                                                                                  Try it online!



                                                                                  original answer J, 28 bytes



                                                                                  >:@]^:(-.@{.@E.&":!)^:_ x:@1


                                                                                  Try it online!





                                                                                  • >:@] ... x:@1 starting with an extended precision 1, keep incrementing it while...


                                                                                  • -.@ its not the case that...


                                                                                  • {.@ the first elm is a starting match of...


                                                                                  • E.&": all the substring matches (after stringfying both arguments &":) of searching for the original input in...


                                                                                  • ! the factorial of the number we're incrementing






                                                                                  share|improve this answer











                                                                                  $endgroup$













                                                                                  • $begingroup$
                                                                                    (]+1-0{(E.&":!))^:_&1x
                                                                                    $endgroup$
                                                                                    – FrownyFrog
                                                                                    Apr 26 at 14:07










                                                                                  • $begingroup$
                                                                                    I love that use of "fixed point" to avoid the traditional while.
                                                                                    $endgroup$
                                                                                    – Jonah
                                                                                    Apr 26 at 14:15














                                                                                  1












                                                                                  1








                                                                                  1





                                                                                  $begingroup$


                                                                                  J, 28 22 bytes



                                                                                  -6 bytes thanks to FrownyFrog



                                                                                  (]+1-0{(E.&":!))^:_&1x


                                                                                  Try it online!



                                                                                  original answer J, 28 bytes



                                                                                  >:@]^:(-.@{.@E.&":!)^:_ x:@1


                                                                                  Try it online!





                                                                                  • >:@] ... x:@1 starting with an extended precision 1, keep incrementing it while...


                                                                                  • -.@ its not the case that...


                                                                                  • {.@ the first elm is a starting match of...


                                                                                  • E.&": all the substring matches (after stringfying both arguments &":) of searching for the original input in...


                                                                                  • ! the factorial of the number we're incrementing






                                                                                  share|improve this answer











                                                                                  $endgroup$




                                                                                  J, 28 22 bytes



                                                                                  -6 bytes thanks to FrownyFrog



                                                                                  (]+1-0{(E.&":!))^:_&1x


                                                                                  Try it online!



                                                                                  original answer J, 28 bytes



                                                                                  >:@]^:(-.@{.@E.&":!)^:_ x:@1


                                                                                  Try it online!





                                                                                  • >:@] ... x:@1 starting with an extended precision 1, keep incrementing it while...


                                                                                  • -.@ its not the case that...


                                                                                  • {.@ the first elm is a starting match of...


                                                                                  • E.&": all the substring matches (after stringfying both arguments &":) of searching for the original input in...


                                                                                  • ! the factorial of the number we're incrementing







                                                                                  share|improve this answer














                                                                                  share|improve this answer



                                                                                  share|improve this answer








                                                                                  edited Apr 26 at 14:14

























                                                                                  answered Apr 26 at 4:26









                                                                                  JonahJonah

                                                                                  3,3781019




                                                                                  3,3781019












                                                                                  • $begingroup$
                                                                                    (]+1-0{(E.&":!))^:_&1x
                                                                                    $endgroup$
                                                                                    – FrownyFrog
                                                                                    Apr 26 at 14:07










                                                                                  • $begingroup$
                                                                                    I love that use of "fixed point" to avoid the traditional while.
                                                                                    $endgroup$
                                                                                    – Jonah
                                                                                    Apr 26 at 14:15


















                                                                                  • $begingroup$
                                                                                    (]+1-0{(E.&":!))^:_&1x
                                                                                    $endgroup$
                                                                                    – FrownyFrog
                                                                                    Apr 26 at 14:07










                                                                                  • $begingroup$
                                                                                    I love that use of "fixed point" to avoid the traditional while.
                                                                                    $endgroup$
                                                                                    – Jonah
                                                                                    Apr 26 at 14:15
















                                                                                  $begingroup$
                                                                                  (]+1-0{(E.&":!))^:_&1x
                                                                                  $endgroup$
                                                                                  – FrownyFrog
                                                                                  Apr 26 at 14:07




                                                                                  $begingroup$
                                                                                  (]+1-0{(E.&":!))^:_&1x
                                                                                  $endgroup$
                                                                                  – FrownyFrog
                                                                                  Apr 26 at 14:07












                                                                                  $begingroup$
                                                                                  I love that use of "fixed point" to avoid the traditional while.
                                                                                  $endgroup$
                                                                                  – Jonah
                                                                                  Apr 26 at 14:15




                                                                                  $begingroup$
                                                                                  I love that use of "fixed point" to avoid the traditional while.
                                                                                  $endgroup$
                                                                                  – Jonah
                                                                                  Apr 26 at 14:15











                                                                                  1












                                                                                  $begingroup$


                                                                                  C (gcc) -lgmp, 161 bytes





                                                                                  #include"gmp.h"
                                                                                  f(a,n,_,b)char*a,*b;mpz_t n,_;{for(mpz_init_set_si(n,1),mpz_init_set(_,n);b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n));}


                                                                                  Try it online!






                                                                                  share|improve this answer









                                                                                  $endgroup$













                                                                                  • $begingroup$
                                                                                    Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                                                                                    $endgroup$
                                                                                    – ceilingcat
                                                                                    Apr 26 at 22:07
















                                                                                  1












                                                                                  $begingroup$


                                                                                  C (gcc) -lgmp, 161 bytes





                                                                                  #include"gmp.h"
                                                                                  f(a,n,_,b)char*a,*b;mpz_t n,_;{for(mpz_init_set_si(n,1),mpz_init_set(_,n);b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n));}


                                                                                  Try it online!






                                                                                  share|improve this answer









                                                                                  $endgroup$













                                                                                  • $begingroup$
                                                                                    Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                                                                                    $endgroup$
                                                                                    – ceilingcat
                                                                                    Apr 26 at 22:07














                                                                                  1












                                                                                  1








                                                                                  1





                                                                                  $begingroup$


                                                                                  C (gcc) -lgmp, 161 bytes





                                                                                  #include"gmp.h"
                                                                                  f(a,n,_,b)char*a,*b;mpz_t n,_;{for(mpz_init_set_si(n,1),mpz_init_set(_,n);b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n));}


                                                                                  Try it online!






                                                                                  share|improve this answer









                                                                                  $endgroup$




                                                                                  C (gcc) -lgmp, 161 bytes





                                                                                  #include"gmp.h"
                                                                                  f(a,n,_,b)char*a,*b;mpz_t n,_;{for(mpz_init_set_si(n,1),mpz_init_set(_,n);b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n));}


                                                                                  Try it online!







                                                                                  share|improve this answer












                                                                                  share|improve this answer



                                                                                  share|improve this answer










                                                                                  answered Apr 26 at 15:15









                                                                                  LambdaBetaLambdaBeta

                                                                                  2,339419




                                                                                  2,339419












                                                                                  • $begingroup$
                                                                                    Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                                                                                    $endgroup$
                                                                                    – ceilingcat
                                                                                    Apr 26 at 22:07


















                                                                                  • $begingroup$
                                                                                    Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                                                                                    $endgroup$
                                                                                    – ceilingcat
                                                                                    Apr 26 at 22:07
















                                                                                  $begingroup$
                                                                                  Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                                                                                  $endgroup$
                                                                                  – ceilingcat
                                                                                  Apr 26 at 22:07




                                                                                  $begingroup$
                                                                                  Suggest strstr(b=mpz_get_str(0,10,_),a)-b;mpz_mul(_,_,n))mpz_add_ui(n,n,1) instead of b=mpz_get_str(0,10,_),strstr(b,a)-b;mpz_add_ui(n,n,1),mpz_mul(_,_,n))
                                                                                  $endgroup$
                                                                                  – ceilingcat
                                                                                  Apr 26 at 22:07











                                                                                  1












                                                                                  $begingroup$


                                                                                  Python 3, 63 bytes





                                                                                  f=lambda x,a=2,b=1:str(b).find(str(x))==0and a-1or f(x,a+1,b*a)


                                                                                  Try it online!



                                                                                  -24 bytes thanks to Jo King



                                                                                  -3 bytes thanks to Chas Brown






                                                                                  share|improve this answer











                                                                                  $endgroup$













                                                                                  • $begingroup$
                                                                                    @JoKing nice, thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 1:13










                                                                                  • $begingroup$
                                                                                    61 bytes
                                                                                    $endgroup$
                                                                                    – Chas Brown
                                                                                    Apr 26 at 8:17










                                                                                  • $begingroup$
                                                                                    @ChasBrown thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 17:43










                                                                                  • $begingroup$
                                                                                    I think the f= that you've got in the header is supposed to count towards your bit count.
                                                                                    $endgroup$
                                                                                    – mypetlion
                                                                                    May 1 at 22:20










                                                                                  • $begingroup$
                                                                                    @mypetlion You are correct; thanks for catching that.
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    May 1 at 22:33
















                                                                                  1












                                                                                  $begingroup$


                                                                                  Python 3, 63 bytes





                                                                                  f=lambda x,a=2,b=1:str(b).find(str(x))==0and a-1or f(x,a+1,b*a)


                                                                                  Try it online!



                                                                                  -24 bytes thanks to Jo King



                                                                                  -3 bytes thanks to Chas Brown






                                                                                  share|improve this answer











                                                                                  $endgroup$













                                                                                  • $begingroup$
                                                                                    @JoKing nice, thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 1:13










                                                                                  • $begingroup$
                                                                                    61 bytes
                                                                                    $endgroup$
                                                                                    – Chas Brown
                                                                                    Apr 26 at 8:17










                                                                                  • $begingroup$
                                                                                    @ChasBrown thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 17:43










                                                                                  • $begingroup$
                                                                                    I think the f= that you've got in the header is supposed to count towards your bit count.
                                                                                    $endgroup$
                                                                                    – mypetlion
                                                                                    May 1 at 22:20










                                                                                  • $begingroup$
                                                                                    @mypetlion You are correct; thanks for catching that.
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    May 1 at 22:33














                                                                                  1












                                                                                  1








                                                                                  1





                                                                                  $begingroup$


                                                                                  Python 3, 63 bytes





                                                                                  f=lambda x,a=2,b=1:str(b).find(str(x))==0and a-1or f(x,a+1,b*a)


                                                                                  Try it online!



                                                                                  -24 bytes thanks to Jo King



                                                                                  -3 bytes thanks to Chas Brown






                                                                                  share|improve this answer











                                                                                  $endgroup$




                                                                                  Python 3, 63 bytes





                                                                                  f=lambda x,a=2,b=1:str(b).find(str(x))==0and a-1or f(x,a+1,b*a)


                                                                                  Try it online!



                                                                                  -24 bytes thanks to Jo King



                                                                                  -3 bytes thanks to Chas Brown







                                                                                  share|improve this answer














                                                                                  share|improve this answer



                                                                                  share|improve this answer








                                                                                  edited May 1 at 22:33

























                                                                                  answered Apr 25 at 19:56









                                                                                  HyperNeutrinoHyperNeutrino

                                                                                  19.2k438148




                                                                                  19.2k438148












                                                                                  • $begingroup$
                                                                                    @JoKing nice, thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 1:13










                                                                                  • $begingroup$
                                                                                    61 bytes
                                                                                    $endgroup$
                                                                                    – Chas Brown
                                                                                    Apr 26 at 8:17










                                                                                  • $begingroup$
                                                                                    @ChasBrown thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 17:43










                                                                                  • $begingroup$
                                                                                    I think the f= that you've got in the header is supposed to count towards your bit count.
                                                                                    $endgroup$
                                                                                    – mypetlion
                                                                                    May 1 at 22:20










                                                                                  • $begingroup$
                                                                                    @mypetlion You are correct; thanks for catching that.
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    May 1 at 22:33


















                                                                                  • $begingroup$
                                                                                    @JoKing nice, thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 1:13










                                                                                  • $begingroup$
                                                                                    61 bytes
                                                                                    $endgroup$
                                                                                    – Chas Brown
                                                                                    Apr 26 at 8:17










                                                                                  • $begingroup$
                                                                                    @ChasBrown thanks
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    Apr 26 at 17:43










                                                                                  • $begingroup$
                                                                                    I think the f= that you've got in the header is supposed to count towards your bit count.
                                                                                    $endgroup$
                                                                                    – mypetlion
                                                                                    May 1 at 22:20










                                                                                  • $begingroup$
                                                                                    @mypetlion You are correct; thanks for catching that.
                                                                                    $endgroup$
                                                                                    – HyperNeutrino
                                                                                    May 1 at 22:33
















                                                                                  $begingroup$
                                                                                  @JoKing nice, thanks
                                                                                  $endgroup$
                                                                                  – HyperNeutrino
                                                                                  Apr 26 at 1:13




                                                                                  $begingroup$
                                                                                  @JoKing nice, thanks
                                                                                  $endgroup$
                                                                                  – HyperNeutrino
                                                                                  Apr 26 at 1:13












                                                                                  $begingroup$
                                                                                  61 bytes
                                                                                  $endgroup$
                                                                                  – Chas Brown
                                                                                  Apr 26 at 8:17




                                                                                  $begingroup$
                                                                                  61 bytes
                                                                                  $endgroup$
                                                                                  – Chas Brown
                                                                                  Apr 26 at 8:17












                                                                                  $begingroup$
                                                                                  @ChasBrown thanks
                                                                                  $endgroup$
                                                                                  – HyperNeutrino
                                                                                  Apr 26 at 17:43




                                                                                  $begingroup$
                                                                                  @ChasBrown thanks
                                                                                  $endgroup$
                                                                                  – HyperNeutrino
                                                                                  Apr 26 at 17:43












                                                                                  $begingroup$
                                                                                  I think the f= that you've got in the header is supposed to count towards your bit count.
                                                                                  $endgroup$
                                                                                  – mypetlion
                                                                                  May 1 at 22:20




                                                                                  $begingroup$
                                                                                  I think the f= that you've got in the header is supposed to count towards your bit count.
                                                                                  $endgroup$
                                                                                  – mypetlion
                                                                                  May 1 at 22:20












                                                                                  $begingroup$
                                                                                  @mypetlion You are correct; thanks for catching that.
                                                                                  $endgroup$
                                                                                  – HyperNeutrino
                                                                                  May 1 at 22:33




                                                                                  $begingroup$
                                                                                  @mypetlion You are correct; thanks for catching that.
                                                                                  $endgroup$
                                                                                  – HyperNeutrino
                                                                                  May 1 at 22:33











                                                                                  0












                                                                                  $begingroup$


                                                                                  Jelly, 11 bytes



                                                                                  ‘ɼµ®!Dw³’µ¿


                                                                                  Try it online!






                                                                                  share|improve this answer











                                                                                  $endgroup$


















                                                                                    0












                                                                                    $begingroup$


                                                                                    Jelly, 11 bytes



                                                                                    ‘ɼµ®!Dw³’µ¿


                                                                                    Try it online!






                                                                                    share|improve this answer











                                                                                    $endgroup$
















                                                                                      0












                                                                                      0








                                                                                      0





                                                                                      $begingroup$


                                                                                      Jelly, 11 bytes



                                                                                      ‘ɼµ®!Dw³’µ¿


                                                                                      Try it online!






                                                                                      share|improve this answer











                                                                                      $endgroup$




                                                                                      Jelly, 11 bytes



                                                                                      ‘ɼµ®!Dw³’µ¿


                                                                                      Try it online!







                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited Apr 25 at 21:05

























                                                                                      answered Apr 25 at 20:22









                                                                                      HyperNeutrinoHyperNeutrino

                                                                                      19.2k438148




                                                                                      19.2k438148























                                                                                          0












                                                                                          $begingroup$


                                                                                          Clean, 88 bytes



                                                                                          import StdEnv,Data.Integer,Text
                                                                                          $a=hd[n\n<-[a/a..]|startsWith(""<+a)(""<+prod[one..n])]


                                                                                          Try it online!



                                                                                          Defines $ :: Integer -> Integer.



                                                                                          Uses Data.Integer's arbitrary size integers for IO.






                                                                                          share|improve this answer









                                                                                          $endgroup$


















                                                                                            0












                                                                                            $begingroup$


                                                                                            Clean, 88 bytes



                                                                                            import StdEnv,Data.Integer,Text
                                                                                            $a=hd[n\n<-[a/a..]|startsWith(""<+a)(""<+prod[one..n])]


                                                                                            Try it online!



                                                                                            Defines $ :: Integer -> Integer.



                                                                                            Uses Data.Integer's arbitrary size integers for IO.






                                                                                            share|improve this answer









                                                                                            $endgroup$
















                                                                                              0












                                                                                              0








                                                                                              0





                                                                                              $begingroup$


                                                                                              Clean, 88 bytes



                                                                                              import StdEnv,Data.Integer,Text
                                                                                              $a=hd[n\n<-[a/a..]|startsWith(""<+a)(""<+prod[one..n])]


                                                                                              Try it online!



                                                                                              Defines $ :: Integer -> Integer.



                                                                                              Uses Data.Integer's arbitrary size integers for IO.






                                                                                              share|improve this answer









                                                                                              $endgroup$




                                                                                              Clean, 88 bytes



                                                                                              import StdEnv,Data.Integer,Text
                                                                                              $a=hd[n\n<-[a/a..]|startsWith(""<+a)(""<+prod[one..n])]


                                                                                              Try it online!



                                                                                              Defines $ :: Integer -> Integer.



                                                                                              Uses Data.Integer's arbitrary size integers for IO.







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered Apr 25 at 23:39









                                                                                              ΟurousΟurous

                                                                                              7,47611136




                                                                                              7,47611136























                                                                                                  0












                                                                                                  $begingroup$


                                                                                                  Wolfram Language (Mathematica), 62 bytes



                                                                                                  (b=1;While[⌊b!/10^((i=IntegerLength)[b!]-i@#)⌋!=#,b++];b)&


                                                                                                  Try it online!






                                                                                                  share|improve this answer











                                                                                                  $endgroup$


















                                                                                                    0












                                                                                                    $begingroup$


                                                                                                    Wolfram Language (Mathematica), 62 bytes



                                                                                                    (b=1;While[⌊b!/10^((i=IntegerLength)[b!]-i@#)⌋!=#,b++];b)&


                                                                                                    Try it online!






                                                                                                    share|improve this answer











                                                                                                    $endgroup$
















                                                                                                      0












                                                                                                      0








                                                                                                      0





                                                                                                      $begingroup$


                                                                                                      Wolfram Language (Mathematica), 62 bytes



                                                                                                      (b=1;While[⌊b!/10^((i=IntegerLength)[b!]-i@#)⌋!=#,b++];b)&


                                                                                                      Try it online!






                                                                                                      share|improve this answer











                                                                                                      $endgroup$




                                                                                                      Wolfram Language (Mathematica), 62 bytes



                                                                                                      (b=1;While[⌊b!/10^((i=IntegerLength)[b!]-i@#)⌋!=#,b++];b)&


                                                                                                      Try it online!







                                                                                                      share|improve this answer














                                                                                                      share|improve this answer



                                                                                                      share|improve this answer








                                                                                                      edited Apr 26 at 0:42

























                                                                                                      answered Apr 26 at 0:34









                                                                                                      J42161217J42161217

                                                                                                      15.1k21457




                                                                                                      15.1k21457























                                                                                                          0












                                                                                                          $begingroup$


                                                                                                          Ruby, 40 bytes





                                                                                                          ->n{a=b=1;a*=b+=1until"%d"%a=~/^#{n}/;b}


                                                                                                          Try it online!






                                                                                                          share|improve this answer









                                                                                                          $endgroup$


















                                                                                                            0












                                                                                                            $begingroup$


                                                                                                            Ruby, 40 bytes





                                                                                                            ->n{a=b=1;a*=b+=1until"%d"%a=~/^#{n}/;b}


                                                                                                            Try it online!






                                                                                                            share|improve this answer









                                                                                                            $endgroup$
















                                                                                                              0












                                                                                                              0








                                                                                                              0





                                                                                                              $begingroup$


                                                                                                              Ruby, 40 bytes





                                                                                                              ->n{a=b=1;a*=b+=1until"%d"%a=~/^#{n}/;b}


                                                                                                              Try it online!






                                                                                                              share|improve this answer









                                                                                                              $endgroup$




                                                                                                              Ruby, 40 bytes





                                                                                                              ->n{a=b=1;a*=b+=1until"%d"%a=~/^#{n}/;b}


                                                                                                              Try it online!







                                                                                                              share|improve this answer












                                                                                                              share|improve this answer



                                                                                                              share|improve this answer










                                                                                                              answered Apr 26 at 7:25









                                                                                                              G BG B

                                                                                                              8,3061430




                                                                                                              8,3061430























                                                                                                                  0












                                                                                                                  $begingroup$


                                                                                                                  Icon, 65 63 bytes



                                                                                                                  procedure f(a);p:=1;every n:=seq()&1=find(a,p*:=n)&return n;end


                                                                                                                  Try it online!






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$


















                                                                                                                    0












                                                                                                                    $begingroup$


                                                                                                                    Icon, 65 63 bytes



                                                                                                                    procedure f(a);p:=1;every n:=seq()&1=find(a,p*:=n)&return n;end


                                                                                                                    Try it online!






                                                                                                                    share|improve this answer











                                                                                                                    $endgroup$
















                                                                                                                      0












                                                                                                                      0








                                                                                                                      0





                                                                                                                      $begingroup$


                                                                                                                      Icon, 65 63 bytes



                                                                                                                      procedure f(a);p:=1;every n:=seq()&1=find(a,p*:=n)&return n;end


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer











                                                                                                                      $endgroup$




                                                                                                                      Icon, 65 63 bytes



                                                                                                                      procedure f(a);p:=1;every n:=seq()&1=find(a,p*:=n)&return n;end


                                                                                                                      Try it online!







                                                                                                                      share|improve this answer














                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer








                                                                                                                      edited Apr 26 at 18:58

























                                                                                                                      answered Apr 26 at 7:44









                                                                                                                      Galen IvanovGalen Ivanov

                                                                                                                      8,33211237




                                                                                                                      8,33211237























                                                                                                                          0












                                                                                                                          $begingroup$

                                                                                                                          Haskell, 89 bytes



                                                                                                                          import Data.List
                                                                                                                          a x=head$filter(isPrefixOf$show x)$((show.product.(x->[1..x]))<$>[1..])


                                                                                                                          If anyone knows how to bypass the required import, let me know.






                                                                                                                          share|improve this answer









                                                                                                                          $endgroup$













                                                                                                                          • $begingroup$
                                                                                                                            It seems that you output $N!$ and not $N$ as required.
                                                                                                                            $endgroup$
                                                                                                                            – flawr
                                                                                                                            May 3 at 21:49
















                                                                                                                          0












                                                                                                                          $begingroup$

                                                                                                                          Haskell, 89 bytes



                                                                                                                          import Data.List
                                                                                                                          a x=head$filter(isPrefixOf$show x)$((show.product.(x->[1..x]))<$>[1..])


                                                                                                                          If anyone knows how to bypass the required import, let me know.






                                                                                                                          share|improve this answer









                                                                                                                          $endgroup$













                                                                                                                          • $begingroup$
                                                                                                                            It seems that you output $N!$ and not $N$ as required.
                                                                                                                            $endgroup$
                                                                                                                            – flawr
                                                                                                                            May 3 at 21:49














                                                                                                                          0












                                                                                                                          0








                                                                                                                          0





                                                                                                                          $begingroup$

                                                                                                                          Haskell, 89 bytes



                                                                                                                          import Data.List
                                                                                                                          a x=head$filter(isPrefixOf$show x)$((show.product.(x->[1..x]))<$>[1..])


                                                                                                                          If anyone knows how to bypass the required import, let me know.






                                                                                                                          share|improve this answer









                                                                                                                          $endgroup$



                                                                                                                          Haskell, 89 bytes



                                                                                                                          import Data.List
                                                                                                                          a x=head$filter(isPrefixOf$show x)$((show.product.(x->[1..x]))<$>[1..])


                                                                                                                          If anyone knows how to bypass the required import, let me know.







                                                                                                                          share|improve this answer












                                                                                                                          share|improve this answer



                                                                                                                          share|improve this answer










                                                                                                                          answered May 3 at 15:20









                                                                                                                          Mega ManMega Man

                                                                                                                          8141715




                                                                                                                          8141715












                                                                                                                          • $begingroup$
                                                                                                                            It seems that you output $N!$ and not $N$ as required.
                                                                                                                            $endgroup$
                                                                                                                            – flawr
                                                                                                                            May 3 at 21:49


















                                                                                                                          • $begingroup$
                                                                                                                            It seems that you output $N!$ and not $N$ as required.
                                                                                                                            $endgroup$
                                                                                                                            – flawr
                                                                                                                            May 3 at 21:49
















                                                                                                                          $begingroup$
                                                                                                                          It seems that you output $N!$ and not $N$ as required.
                                                                                                                          $endgroup$
                                                                                                                          – flawr
                                                                                                                          May 3 at 21:49




                                                                                                                          $begingroup$
                                                                                                                          It seems that you output $N!$ and not $N$ as required.
                                                                                                                          $endgroup$
                                                                                                                          – flawr
                                                                                                                          May 3 at 21:49


















                                                                                                                          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).





                                                                                                                          draft saved


                                                                                                                          draft discarded














                                                                                                                          StackExchange.ready(
                                                                                                                          function () {
                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f184776%2fa-note-on-n%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

                                                                                                                          Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

                                                                                                                          He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                                                                                                                          Slayer Innehåll Historia | Stil, komposition och lyrik | Bandets betydelse och framgångar | Sidoprojekt och samarbeten | Kontroverser | Medlemmar | Utmärkelser och nomineringar | Turnéer och festivaler | Diskografi | Referenser | Externa länkar | Navigeringsmenywww.slayer.net”Metal Massacre vol. 1””Metal Massacre vol. 3””Metal Massacre Volume III””Show No Mercy””Haunting the Chapel””Live Undead””Hell Awaits””Reign in Blood””Reign in Blood””Gold & Platinum – Reign in Blood””Golden Gods Awards Winners”originalet”Kerrang! Hall Of Fame””Slayer Looks Back On 37-Year Career In New Video Series: Part Two””South of Heaven””Gold & Platinum – South of Heaven””Seasons in the Abyss””Gold & Platinum - Seasons in the Abyss””Divine Intervention””Divine Intervention - Release group by Slayer””Gold & Platinum - Divine Intervention””Live Intrusion””Undisputed Attitude””Abolish Government/Superficial Love””Release “Slatanic Slaughter: A Tribute to Slayer” by Various Artists””Diabolus in Musica””Soundtrack to the Apocalypse””God Hates Us All””Systematic - Relationships””War at the Warfield””Gold & Platinum - War at the Warfield””Soundtrack to the Apocalypse””Gold & Platinum - Still Reigning””Metallica, Slayer, Iron Mauden Among Winners At Metal Hammer Awards””Eternal Pyre””Eternal Pyre - Slayer release group””Eternal Pyre””Metal Storm Awards 2006””Kerrang! Hall Of Fame””Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Bullet-For My Valentine booed at Metal Hammer Golden Gods Awards””Unholy Aliance””The End Of Slayer?””Slayer: We Could Thrash Out Two More Albums If We're Fast Enough...””'The Unholy Alliance: Chapter III' UK Dates Added”originalet”Megadeth And Slayer To Co-Headline 'Canadian Carnage' Trek”originalet”World Painted Blood””Release “World Painted Blood” by Slayer””Metallica Heading To Cinemas””Slayer, Megadeth To Join Forces For 'European Carnage' Tour - Dec. 18, 2010”originalet”Slayer's Hanneman Contracts Acute Infection; Band To Bring In Guest Guitarist””Cannibal Corpse's Pat O'Brien Will Step In As Slayer's Guest Guitarist”originalet”Slayer’s Jeff Hanneman Dead at 49””Dave Lombardo Says He Made Only $67,000 In 2011 While Touring With Slayer””Slayer: We Do Not Agree With Dave Lombardo's Substance Or Timeline Of Events””Slayer Welcomes Drummer Paul Bostaph Back To The Fold””Slayer Hope to Unveil Never-Before-Heard Jeff Hanneman Material on Next Album””Slayer Debut New Song 'Implode' During Surprise Golden Gods Appearance””Release group Repentless by Slayer””Repentless - Slayer - Credits””Slayer””Metal Storm Awards 2015””Slayer - to release comic book "Repentless #1"””Slayer To Release 'Repentless' 6.66" Vinyl Box Set””BREAKING NEWS: Slayer Announce Farewell Tour””Slayer Recruit Lamb of God, Anthrax, Behemoth + Testament for Final Tour””Slayer lägger ner efter 37 år””Slayer Announces Second North American Leg Of 'Final' Tour””Final World Tour””Slayer Announces Final European Tour With Lamb of God, Anthrax And Obituary””Slayer To Tour Europe With Lamb of God, Anthrax And Obituary””Slayer To Play 'Last French Show Ever' At Next Year's Hellfst””Slayer's Final World Tour Will Extend Into 2019””Death Angel's Rob Cavestany On Slayer's 'Farewell' Tour: 'Some Of Us Could See This Coming'””Testament Has No Plans To Retire Anytime Soon, Says Chuck Billy””Anthrax's Scott Ian On Slayer's 'Farewell' Tour Plans: 'I Was Surprised And I Wasn't Surprised'””Slayer””Slayer's Morbid Schlock””Review/Rock; For Slayer, the Mania Is the Message””Slayer - Biography””Slayer - Reign In Blood”originalet”Dave Lombardo””An exclusive oral history of Slayer”originalet”Exclusive! Interview With Slayer Guitarist Jeff Hanneman”originalet”Thinking Out Loud: Slayer's Kerry King on hair metal, Satan and being polite””Slayer Lyrics””Slayer - Biography””Most influential artists for extreme metal music””Slayer - Reign in Blood””Slayer guitarist Jeff Hanneman dies aged 49””Slatanic Slaughter: A Tribute to Slayer””Gateway to Hell: A Tribute to Slayer””Covered In Blood””Slayer: The Origins of Thrash in San Francisco, CA.””Why They Rule - #6 Slayer”originalet”Guitar World's 100 Greatest Heavy Metal Guitarists Of All Time”originalet”The fans have spoken: Slayer comes out on top in readers' polls”originalet”Tribute to Jeff Hanneman (1964-2013)””Lamb Of God Frontman: We Sound Like A Slayer Rip-Off””BEHEMOTH Frontman Pays Tribute To SLAYER's JEFF HANNEMAN””Slayer, Hatebreed Doing Double Duty On This Year's Ozzfest””System of a Down””Lacuna Coil’s Andrea Ferro Talks Influences, Skateboarding, Band Origins + More””Slayer - Reign in Blood””Into The Lungs of Hell””Slayer rules - en utställning om fans””Slayer and Their Fans Slashed Through a No-Holds-Barred Night at Gas Monkey””Home””Slayer””Gold & Platinum - The Big 4 Live from Sofia, Bulgaria””Exclusive! Interview With Slayer Guitarist Kerry King””2008-02-23: Wiltern, Los Angeles, CA, USA””Slayer's Kerry King To Perform With Megadeth Tonight! - Oct. 21, 2010”originalet”Dave Lombardo - Biography”Slayer Case DismissedArkiveradUltimate Classic Rock: Slayer guitarist Jeff Hanneman dead at 49.”Slayer: "We could never do any thing like Some Kind Of Monster..."””Cannibal Corpse'S Pat O'Brien Will Step In As Slayer'S Guest Guitarist | The Official Slayer Site”originalet”Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Kerrang! Awards 2006 Blog: Kerrang! Hall Of Fame””Kerrang! Awards 2013: Kerrang! Legend”originalet”Metallica, Slayer, Iron Maien Among Winners At Metal Hammer Awards””Metal Hammer Golden Gods Awards””Bullet For My Valentine Booed At Metal Hammer Golden Gods Awards””Metal Storm Awards 2006””Metal Storm Awards 2015””Slayer's Concert History””Slayer - Relationships””Slayer - Releases”Slayers officiella webbplatsSlayer på MusicBrainzOfficiell webbplatsSlayerSlayerr1373445760000 0001 1540 47353068615-5086262726cb13906545x(data)6033143kn20030215029