A ​Note ​on ​N!Pseudo-cyclic Number EvaluatorFind the remaining side of the tangential quadrilateralSelf Referential PolynomialsClosest Woodall PrimeTriple-balanced numbersprepend,append-SequenceReconstruct an arithmetic sequenceFour Spiraling AxesExact Partial Sum of Harmonic SeriesRyley's Theorem

What's the difference between using dependency injection with a container and using a service locator?

Bayes factor vs P value

How do I produce this symbol: Ϟ in pdfLaTeX?

Which big number is bigger?

"The cow" OR "a cow" OR "cows" in this context

Multiple fireplaces in an apartment building?

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Crossed out red box fitting tightly around image

UK Visa refusal and ban for 10 years ( false Documents) . Can I apply for Australia

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Drawing a german abacus as in the books of Adam Ries

Do I need to watch Ant-Man and the Wasp and Captain Marvel before watching Avengers: Endgame?

Does Mathematica have an implementation of the Poisson binomial distribution?

How bug prioritization works in agile projects vs non agile

A ​Note ​on ​N!

As an international instructor, should I openly talk about my accent?

Is there any pythonic way to find average of specific tuple elements in array?

All ASCII characters with a given bit count

My bank got bought out, am I now going to have to start filing tax returns in a different state?

Double-nominative constructions and “von”

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

Check if a string is entirely made of the same substring

Multiple options vs single option UI

Older movie/show about humans on derelict alien warship which refuels by passing through a star



A ​Note ​on ​N!


Pseudo-cyclic Number EvaluatorFind the remaining side of the tangential quadrilateralSelf Referential PolynomialsClosest Woodall PrimeTriple-balanced numbersprepend,append-SequenceReconstruct an arithmetic sequenceFour Spiraling AxesExact Partial Sum of Harmonic SeriesRyley's Theorem













8












$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 find a corresponding N (in base 10).



Details



  • Your submission should work for arbitrary A 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$







  • 4




    $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
    2 hours ago










  • $begingroup$
    By "any A" do you mean that like using numbers in Python or long longs in C++ is invalid?
    $endgroup$
    – HyperNeutrino
    1 hour ago










  • $begingroup$
    Are programs allowed to throw stackoverflow exceptions if the input is too large?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago






  • 2




    $begingroup$
    Can we return 0 for input 1? Lynn's answer currently does.
    $endgroup$
    – Erik the Outgolfer
    1 hour ago







  • 1




    $begingroup$
    @SolomonUcko My question is whether we're actually required to output a positive integer or not, though, that quote itself isn't really enough to specify that, and nowhere does it say that the test cases include the least possible output for each input.
    $endgroup$
    – Erik the Outgolfer
    1 min ago















8












$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 find a corresponding N (in base 10).



Details



  • Your submission should work for arbitrary A 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$







  • 4




    $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
    2 hours ago










  • $begingroup$
    By "any A" do you mean that like using numbers in Python or long longs in C++ is invalid?
    $endgroup$
    – HyperNeutrino
    1 hour ago










  • $begingroup$
    Are programs allowed to throw stackoverflow exceptions if the input is too large?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago






  • 2




    $begingroup$
    Can we return 0 for input 1? Lynn's answer currently does.
    $endgroup$
    – Erik the Outgolfer
    1 hour ago







  • 1




    $begingroup$
    @SolomonUcko My question is whether we're actually required to output a positive integer or not, though, that quote itself isn't really enough to specify that, and nowhere does it say that the test cases include the least possible output for each input.
    $endgroup$
    – Erik the Outgolfer
    1 min ago













8












8








8





$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 find a corresponding N (in base 10).



Details



  • Your submission should work for arbitrary A 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 find a corresponding N (in base 10).



Details



  • Your submission should work for arbitrary A 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










asked 2 hours ago









flawrflawr

27.5k668193




27.5k668193







  • 4




    $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
    2 hours ago










  • $begingroup$
    By "any A" do you mean that like using numbers in Python or long longs in C++ is invalid?
    $endgroup$
    – HyperNeutrino
    1 hour ago










  • $begingroup$
    Are programs allowed to throw stackoverflow exceptions if the input is too large?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago






  • 2




    $begingroup$
    Can we return 0 for input 1? Lynn's answer currently does.
    $endgroup$
    – Erik the Outgolfer
    1 hour ago







  • 1




    $begingroup$
    @SolomonUcko My question is whether we're actually required to output a positive integer or not, though, that quote itself isn't really enough to specify that, and nowhere does it say that the test cases include the least possible output for each input.
    $endgroup$
    – Erik the Outgolfer
    1 min ago












  • 4




    $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
    2 hours ago










  • $begingroup$
    By "any A" do you mean that like using numbers in Python or long longs in C++ is invalid?
    $endgroup$
    – HyperNeutrino
    1 hour ago










  • $begingroup$
    Are programs allowed to throw stackoverflow exceptions if the input is too large?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago






  • 2




    $begingroup$
    Can we return 0 for input 1? Lynn's answer currently does.
    $endgroup$
    – Erik the Outgolfer
    1 hour ago







  • 1




    $begingroup$
    @SolomonUcko My question is whether we're actually required to output a positive integer or not, though, that quote itself isn't really enough to specify that, and nowhere does it say that the test cases include the least possible output for each input.
    $endgroup$
    – Erik the Outgolfer
    1 min ago







4




4




$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
2 hours ago




$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
2 hours ago












$begingroup$
By "any A" do you mean that like using numbers in Python or long longs in C++ is invalid?
$endgroup$
– HyperNeutrino
1 hour ago




$begingroup$
By "any A" do you mean that like using numbers in Python or long longs in C++ is invalid?
$endgroup$
– HyperNeutrino
1 hour ago












$begingroup$
Are programs allowed to throw stackoverflow exceptions if the input is too large?
$endgroup$
– Embodiment of Ignorance
1 hour ago




$begingroup$
Are programs allowed to throw stackoverflow exceptions if the input is too large?
$endgroup$
– Embodiment of Ignorance
1 hour ago




2




2




$begingroup$
Can we return 0 for input 1? Lynn's answer currently does.
$endgroup$
– Erik the Outgolfer
1 hour ago





$begingroup$
Can we return 0 for input 1? Lynn's answer currently does.
$endgroup$
– Erik the Outgolfer
1 hour ago





1




1




$begingroup$
@SolomonUcko My question is whether we're actually required to output a positive integer or not, though, that quote itself isn't really enough to specify that, and nowhere does it say that the test cases include the least possible output for each input.
$endgroup$
– Erik the Outgolfer
1 min ago




$begingroup$
@SolomonUcko My question is whether we're actually required to output a positive integer or not, though, that quote itself isn't really enough to specify that, and nowhere does it say that the test cases include the least possible output for each input.
$endgroup$
– Erik the Outgolfer
1 min ago










8 Answers
8






active

oldest

votes


















7












$begingroup$


Python 2, 47 bytes





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$








  • 1




    $begingroup$
    Returns 0 for 1.
    $endgroup$
    – Shaggy
    1 hour ago






  • 2




    $begingroup$
    @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
    $endgroup$
    – Erik the Outgolfer
    1 hour ago







  • 1




    $begingroup$
    @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
    $endgroup$
    – Lynn
    1 hour ago










  • $begingroup$
    @Lynn Maybe, I'm a bit tired now. :P
    $endgroup$
    – Erik the Outgolfer
    1 hour ago










  • $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
    1 hour ago


















4












$begingroup$


Jelly, 8 bytes



1!w⁼1ʋ1#


Try it online!



Takes an integer and returns a singleton.






share|improve this answer









$endgroup$




















    2












    $begingroup$

    JavaScript, 47 43 bytes



    I/O as a BigInt.



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


    Try It Online (The 841 test case times out on TIO)



    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
      47 mins ago










    • $begingroup$
      @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
      $endgroup$
      – Shaggy
      46 mins ago










    • $begingroup$
      @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
      $endgroup$
      – Shaggy
      14 mins ago


















    0












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




















      0












      $begingroup$


      Jelly, 11 bytes



      ‘ɼµ®!Dw³’µ¿


      Try it online!






      share|improve this answer











      $endgroup$




















        0












        $begingroup$


        Python 3, 88 bytes





        lambda x,a=0:str(F(a)).startswith(str(x))and a or f(x,a+1)
        F=lambda x:x and x*F(x-1)or 1


        Try it online!



        Recursive so it dies quite quickly.






        share|improve this answer











        $endgroup$




















          0












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




















            0












            $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









            $endgroup$













              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

























              8 Answers
              8






              active

              oldest

              votes








              8 Answers
              8






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              7












              $begingroup$


              Python 2, 47 bytes





              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$








              • 1




                $begingroup$
                Returns 0 for 1.
                $endgroup$
                – Shaggy
                1 hour ago






              • 2




                $begingroup$
                @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
                $endgroup$
                – Erik the Outgolfer
                1 hour ago







              • 1




                $begingroup$
                @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
                $endgroup$
                – Lynn
                1 hour ago










              • $begingroup$
                @Lynn Maybe, I'm a bit tired now. :P
                $endgroup$
                – Erik the Outgolfer
                1 hour ago










              • $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
                1 hour ago















              7












              $begingroup$


              Python 2, 47 bytes





              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$








              • 1




                $begingroup$
                Returns 0 for 1.
                $endgroup$
                – Shaggy
                1 hour ago






              • 2




                $begingroup$
                @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
                $endgroup$
                – Erik the Outgolfer
                1 hour ago







              • 1




                $begingroup$
                @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
                $endgroup$
                – Lynn
                1 hour ago










              • $begingroup$
                @Lynn Maybe, I'm a bit tired now. :P
                $endgroup$
                – Erik the Outgolfer
                1 hour ago










              • $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
                1 hour ago













              7












              7








              7





              $begingroup$


              Python 2, 47 bytes





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





              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 1 hour ago

























              answered 1 hour ago









              LynnLynn

              51.4k899234




              51.4k899234







              • 1




                $begingroup$
                Returns 0 for 1.
                $endgroup$
                – Shaggy
                1 hour ago






              • 2




                $begingroup$
                @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
                $endgroup$
                – Erik the Outgolfer
                1 hour ago







              • 1




                $begingroup$
                @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
                $endgroup$
                – Lynn
                1 hour ago










              • $begingroup$
                @Lynn Maybe, I'm a bit tired now. :P
                $endgroup$
                – Erik the Outgolfer
                1 hour ago










              • $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
                1 hour ago












              • 1




                $begingroup$
                Returns 0 for 1.
                $endgroup$
                – Shaggy
                1 hour ago






              • 2




                $begingroup$
                @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
                $endgroup$
                – Erik the Outgolfer
                1 hour ago







              • 1




                $begingroup$
                @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
                $endgroup$
                – Lynn
                1 hour ago










              • $begingroup$
                @Lynn Maybe, I'm a bit tired now. :P
                $endgroup$
                – Erik the Outgolfer
                1 hour ago










              • $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
                1 hour ago







              1




              1




              $begingroup$
              Returns 0 for 1.
              $endgroup$
              – Shaggy
              1 hour ago




              $begingroup$
              Returns 0 for 1.
              $endgroup$
              – Shaggy
              1 hour ago




              2




              2




              $begingroup$
              @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
              $endgroup$
              – Erik the Outgolfer
              1 hour ago





              $begingroup$
              @Shaggy I've asked about that in the comments, because 0 is a pretty sensible answer if it must just be non-negative (a fix could cost up to 8 bytes).
              $endgroup$
              – Erik the Outgolfer
              1 hour ago





              1




              1




              $begingroup$
              @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
              $endgroup$
              – Lynn
              1 hour ago




              $begingroup$
              @EriktheOutgolfer hmm, I can think of f=lambda a,n=2,p=1:(`p`.find(a)and f(a,n+1,p*n))+1, a +3 byte fix.
              $endgroup$
              – Lynn
              1 hour ago












              $begingroup$
              @Lynn Maybe, I'm a bit tired now. :P
              $endgroup$
              – Erik the Outgolfer
              1 hour ago




              $begingroup$
              @Lynn Maybe, I'm a bit tired now. :P
              $endgroup$
              – Erik the Outgolfer
              1 hour ago












              $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
              1 hour ago




              $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
              1 hour ago











              4












              $begingroup$


              Jelly, 8 bytes



              1!w⁼1ʋ1#


              Try it online!



              Takes an integer and returns a singleton.






              share|improve this answer









              $endgroup$

















                4












                $begingroup$


                Jelly, 8 bytes



                1!w⁼1ʋ1#


                Try it online!



                Takes an integer and returns a singleton.






                share|improve this answer









                $endgroup$















                  4












                  4








                  4





                  $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 1 hour ago









                  Erik the OutgolferErik the Outgolfer

                  33.3k429106




                  33.3k429106





















                      2












                      $begingroup$

                      JavaScript, 47 43 bytes



                      I/O as a BigInt.



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


                      Try It Online (The 841 test case times out on TIO)



                      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
                        47 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                        $endgroup$
                        – Shaggy
                        46 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                        $endgroup$
                        – Shaggy
                        14 mins ago















                      2












                      $begingroup$

                      JavaScript, 47 43 bytes



                      I/O as a BigInt.



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


                      Try It Online (The 841 test case times out on TIO)



                      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
                        47 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                        $endgroup$
                        – Shaggy
                        46 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                        $endgroup$
                        – Shaggy
                        14 mins ago













                      2












                      2








                      2





                      $begingroup$

                      JavaScript, 47 43 bytes



                      I/O as a BigInt.



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


                      Try It Online (The 841 test case times out on TIO)



                      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



                      I/O as a BigInt.



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


                      Try It Online (The 841 test case times out on TIO)



                      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 24 mins ago

























                      answered 1 hour ago









                      ShaggyShaggy

                      19.2k21768




                      19.2k21768











                      • $begingroup$
                        Sadly, _Ês bU}f1 in Japt doesn't work
                        $endgroup$
                        – Embodiment of Ignorance
                        47 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                        $endgroup$
                        – Shaggy
                        46 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                        $endgroup$
                        – Shaggy
                        14 mins ago
















                      • $begingroup$
                        Sadly, _Ês bU}f1 in Japt doesn't work
                        $endgroup$
                        – Embodiment of Ignorance
                        47 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                        $endgroup$
                        – Shaggy
                        46 mins ago










                      • $begingroup$
                        @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                        $endgroup$
                        – Shaggy
                        14 mins ago















                      $begingroup$
                      Sadly, _Ês bU}f1 in Japt doesn't work
                      $endgroup$
                      – Embodiment of Ignorance
                      47 mins ago




                      $begingroup$
                      Sadly, _Ês bU}f1 in Japt doesn't work
                      $endgroup$
                      – Embodiment of Ignorance
                      47 mins ago












                      $begingroup$
                      @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                      $endgroup$
                      – Shaggy
                      46 mins ago




                      $begingroup$
                      @EmbodimentofIgnorance, yeah, I had that too. You could remove the space after s.
                      $endgroup$
                      – Shaggy
                      46 mins ago












                      $begingroup$
                      @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                      $endgroup$
                      – Shaggy
                      14 mins ago




                      $begingroup$
                      @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                      $endgroup$
                      – Shaggy
                      14 mins ago











                      0












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

















                        0












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















                          0












                          0








                          0





                          $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 1 hour ago

























                          answered 1 hour ago









                          Nick KennedyNick Kennedy

                          1,91149




                          1,91149





















                              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 54 mins ago

























                                  answered 1 hour ago









                                  HyperNeutrinoHyperNeutrino

                                  19.1k437148




                                  19.1k437148





















                                      0












                                      $begingroup$


                                      Python 3, 88 bytes





                                      lambda x,a=0:str(F(a)).startswith(str(x))and a or f(x,a+1)
                                      F=lambda x:x and x*F(x-1)or 1


                                      Try it online!



                                      Recursive so it dies quite quickly.






                                      share|improve this answer











                                      $endgroup$

















                                        0












                                        $begingroup$


                                        Python 3, 88 bytes





                                        lambda x,a=0:str(F(a)).startswith(str(x))and a or f(x,a+1)
                                        F=lambda x:x and x*F(x-1)or 1


                                        Try it online!



                                        Recursive so it dies quite quickly.






                                        share|improve this answer











                                        $endgroup$















                                          0












                                          0








                                          0





                                          $begingroup$


                                          Python 3, 88 bytes





                                          lambda x,a=0:str(F(a)).startswith(str(x))and a or f(x,a+1)
                                          F=lambda x:x and x*F(x-1)or 1


                                          Try it online!



                                          Recursive so it dies quite quickly.






                                          share|improve this answer











                                          $endgroup$




                                          Python 3, 88 bytes





                                          lambda x,a=0:str(F(a)).startswith(str(x))and a or f(x,a+1)
                                          F=lambda x:x and x*F(x-1)or 1


                                          Try it online!



                                          Recursive so it dies quite quickly.







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 51 mins ago

























                                          answered 2 hours ago









                                          HyperNeutrinoHyperNeutrino

                                          19.1k437148




                                          19.1k437148





















                                              0












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

















                                                0












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















                                                  0












                                                  0








                                                  0





                                                  $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 16 mins ago









                                                  MaltysenMaltysen

                                                  21.5k445117




                                                  21.5k445117





















                                                      0












                                                      $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









                                                      $endgroup$

















                                                        0












                                                        $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









                                                        $endgroup$















                                                          0












                                                          0








                                                          0





                                                          $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









                                                          $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











                                                          share


                                                          share










                                                          answered 7 mins ago









                                                          Jo KingJo King

                                                          27.6k365133




                                                          27.6k365133



























                                                              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

                                                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                                              199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單