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

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

Can I criticise the more senior developers around me for not writing clean code?

Why do games have consumables?

Extracting Dirichlet series coefficients

How exactly does Hawking radiation decrease the mass of black holes?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Where was the County of Thurn und Taxis located?

How important is it that $TERM is correct?

Work requires me to come in early to start computer but wont let me clock in to get paid for it

Mistake in years of experience in resume?

A Paper Record is What I Hamper

What does "function" actually mean in music?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

How much cash can I safely carry into the USA and avoid civil forfeiture?

Multiple options vs single option UI

Could moose/elk survive in the Amazon forest?

Check if a string is entirely made of the same substring

Was Dennis Ritchie being too modest in this quote about C and Pascal?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

How do I check if a string is entirely made of the same substring?

Is Electric Central Heating worth it if using Solar Panels?

Why did C use the -> operator instead of reusing the . operator?

What is the unit of time_lock_delta in LND?

How long after the last departure shall the airport stay open for an emergency return?



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













11












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







  • 5




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










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






  • 2




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







  • 2




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






  • 1




    $begingroup$
    @SolomonUcko Yes, "positive" excludes 0, but, again, nowhere in the challenge does it say that the output must be positive. Well, technically, it does restrict the output, but you really need to see into the details to figure that out (the challenge text also uses the "N" variable), so it's not at all clear if OP actually intended to restrict the output to the positive integers or if we can output 0 for input 1 as well.
    $endgroup$
    – Erik the Outgolfer
    5 hours ago















11












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







  • 5




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










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






  • 2




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







  • 2




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






  • 1




    $begingroup$
    @SolomonUcko Yes, "positive" excludes 0, but, again, nowhere in the challenge does it say that the output must be positive. Well, technically, it does restrict the output, but you really need to see into the details to figure that out (the challenge text also uses the "N" variable), so it's not at all clear if OP actually intended to restrict the output to the positive integers or if we can output 0 for input 1 as well.
    $endgroup$
    – Erik the Outgolfer
    5 hours ago













11












11








11





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









flawrflawr

27.5k668194




27.5k668194







  • 5




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










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






  • 2




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







  • 2




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






  • 1




    $begingroup$
    @SolomonUcko Yes, "positive" excludes 0, but, again, nowhere in the challenge does it say that the output must be positive. Well, technically, it does restrict the output, but you really need to see into the details to figure that out (the challenge text also uses the "N" variable), so it's not at all clear if OP actually intended to restrict the output to the positive integers or if we can output 0 for input 1 as well.
    $endgroup$
    – Erik the Outgolfer
    5 hours ago












  • 5




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










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






  • 2




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







  • 2




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






  • 1




    $begingroup$
    @SolomonUcko Yes, "positive" excludes 0, but, again, nowhere in the challenge does it say that the output must be positive. Well, technically, it does restrict the output, but you really need to see into the details to figure that out (the challenge text also uses the "N" variable), so it's not at all clear if OP actually intended to restrict the output to the positive integers or if we can output 0 for input 1 as well.
    $endgroup$
    – Erik the Outgolfer
    5 hours ago







5




5




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












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




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




2




2




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





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





2




2




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




1




1




$begingroup$
@SolomonUcko Yes, "positive" excludes 0, but, again, nowhere in the challenge does it say that the output must be positive. Well, technically, it does restrict the output, but you really need to see into the details to figure that out (the challenge text also uses the "N" variable), so it's not at all clear if OP actually intended to restrict the output to the positive integers or if we can output 0 for input 1 as well.
$endgroup$
– Erik the Outgolfer
5 hours ago




$begingroup$
@SolomonUcko Yes, "positive" excludes 0, but, again, nowhere in the challenge does it say that the output must be positive. Well, technically, it does restrict the output, but you really need to see into the details to figure that out (the challenge text also uses the "N" variable), so it's not at all clear if OP actually intended to restrict the output to the positive integers or if we can output 0 for input 1 as well.
$endgroup$
– Erik the Outgolfer
5 hours ago










12 Answers
12






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
    6 hours 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
    6 hours 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
    6 hours ago










  • $begingroup$
    @Lynn Maybe, I'm a bit tired now. :P
    $endgroup$
    – Erik the Outgolfer
    6 hours 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
    6 hours 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
      6 hours ago










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










    • $begingroup$
      @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
      $endgroup$
      – Shaggy
      5 hours 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$

        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|improve this answer









          $endgroup$




















            0












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




















              0












              $begingroup$


              Perl 5 -Mbigint -p, 25 bytes





              1while($.*=++$)!~/^$_/}improve this answer














              sharef1 in Japt doesn't work
              $endgroup$
              – Embodiment of Ignorance
              6 hours ago










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










            • $begingroup$
              @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
              $endgroup$
              – Shaggy
              5 hours 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
                6 hours ago










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










              • $begingroup$
                @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
                $endgroup$
                – Shaggy
                5 hours 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 5 hours ago

























              answered 6 hours ago









              ShaggyShaggy

              19.2k21768




              19.2k21768











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










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










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
















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










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










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















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




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












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




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












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




              $begingroup$
              @EmbodimentofIgnorance, you could also remove the 1 if 0 can be returned for n=1.
              $endgroup$
              – Shaggy
              5 hours 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 6 hours ago

























                  answered 6 hours 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 6 hours ago

























                          answered 6 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 5 hours 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|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|improve this answer









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









                                          Jo KingJo King

                                          27.6k366133




                                          27.6k366133





















                                              0












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

















                                                0












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















                                                  0












                                                  0








                                                  0





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









                                                  NeilNeil

                                                  83.3k745179




                                                  83.3k745179





















                                                      0












                                                      $begingroup$


                                                      Perl 5 -Mbigint -p, 25 bytes





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











                                                      0












                                                      $begingroup$


                                                      Perl 5 -Mbigint -p, 25 bytes





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


                                                      Try it online!






                                                      share


                                                      Try it online!






                                                      share{


                                                      Try it online!







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered 4 hours ago









                                                      XcaliXcali

                                                      5,585521




                                                      5,585521





















                                                          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 3 hours ago









                                                              ΟurousΟurous

                                                              7,41611136




                                                              7,41611136





















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

























                                                                      answered 2 hours ago









                                                                      J42161217J42161217

                                                                      14.5k21354




                                                                      14.5k21354





















                                                                          0












                                                                          $begingroup$


                                                                          Python 3, 64 bytes





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


                                                                          Try it online!



                                                                          -24 bytes thanks to Jo King






                                                                          share|improve this answer











                                                                          $endgroup$












                                                                          • $begingroup$
                                                                            64 bytes
                                                                            $endgroup$
                                                                            – Jo King
                                                                            5 hours ago










                                                                          • $begingroup$
                                                                            @JoKing nice, thanks
                                                                            $endgroup$
                                                                            – HyperNeutrino
                                                                            2 hours ago















                                                                          0












                                                                          $begingroup$


                                                                          Python 3, 64 bytes





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


                                                                          Try it online!



                                                                          -24 bytes thanks to Jo King






                                                                          share|improve this answer











                                                                          $endgroup$












                                                                          • $begingroup$
                                                                            64 bytes
                                                                            $endgroup$
                                                                            – Jo King
                                                                            5 hours ago










                                                                          • $begingroup$
                                                                            @JoKing nice, thanks
                                                                            $endgroup$
                                                                            – HyperNeutrino
                                                                            2 hours ago













                                                                          0












                                                                          0








                                                                          0





                                                                          $begingroup$


                                                                          Python 3, 64 bytes





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


                                                                          Try it online!



                                                                          -24 bytes thanks to Jo King






                                                                          share|improve this answer











                                                                          $endgroup$




                                                                          Python 3, 64 bytes





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


                                                                          Try it online!



                                                                          -24 bytes thanks to Jo King







                                                                          share|improve this answer














                                                                          share|improve this answer



                                                                          share|improve this answer








                                                                          edited 2 hours ago

























                                                                          answered 7 hours ago









                                                                          HyperNeutrinoHyperNeutrino

                                                                          19.1k437148




                                                                          19.1k437148











                                                                          • $begingroup$
                                                                            64 bytes
                                                                            $endgroup$
                                                                            – Jo King
                                                                            5 hours ago










                                                                          • $begingroup$
                                                                            @JoKing nice, thanks
                                                                            $endgroup$
                                                                            – HyperNeutrino
                                                                            2 hours ago
















                                                                          • $begingroup$
                                                                            64 bytes
                                                                            $endgroup$
                                                                            – Jo King
                                                                            5 hours ago










                                                                          • $begingroup$
                                                                            @JoKing nice, thanks
                                                                            $endgroup$
                                                                            – HyperNeutrino
                                                                            2 hours ago















                                                                          $begingroup$
                                                                          64 bytes
                                                                          $endgroup$
                                                                          – Jo King
                                                                          5 hours ago




                                                                          $begingroup$
                                                                          64 bytes
                                                                          $endgroup$
                                                                          – Jo King
                                                                          5 hours ago












                                                                          $begingroup$
                                                                          @JoKing nice, thanks
                                                                          $endgroup$
                                                                          – HyperNeutrino
                                                                          2 hours ago




                                                                          $begingroup$
                                                                          @JoKing nice, thanks
                                                                          $endgroup$
                                                                          – HyperNeutrino
                                                                          2 hours ago

















                                                                          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

                                                                          Magento 2 - Add success message with knockout Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Success / Error message on ajax request$.widget is not a function when loading a homepage after add custom jQuery on custom themeHow can bind jQuery to current document in Magento 2 When template load by ajaxRedirect page using plugin in Magento 2Magento 2 - Update quantity and totals of cart page without page reload?Magento 2: Quote data not loaded on knockout checkoutMagento 2 : I need to change add to cart success message after adding product into cart through pluginMagento 2.2.5 How to add additional products to cart from new checkout step?Magento 2 Add error/success message with knockoutCan't validate Post Code on checkout page

                                                                          Fil:Tokke komm.svg

                                                                          Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?