A ​Note ​on ​N!Pseudo-cyclic Number EvaluatorFind the remaining side of the tangential...

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

Conditionally enable edit in lightning:datatable

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

What does "function" actually mean in music?

What is the term for a person whose job is to place products on shelves in stores?

How to find if a column is referenced in a computed column?

Multiple fireplaces in an apartment building?

Where was the County of Thurn und Taxis located?

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

Has a Nobel Peace laureate ever been accused of war crimes?

How important is it that $TERM is correct?

Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?

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

Co-worker works way more than he should

Why do distances seem to matter in the Foundation world?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

How to have a sharp product image?

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

Can a stored procedure reference the database in which it is stored?

What was Apollo 13's "Little Jolt" after MECO?

How much of a wave function must reside inside event horizon for it to be consumed by the black hole?

Why must Chinese maps be obfuscated?

Is there really no use for MD5 anymore?

Apply a different color ramp to subset of categorized symbols in QGIS?



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













5












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








  • 2




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










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










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










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


















5












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








  • 2




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










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










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










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
















5












5








5





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









flawrflawr

27.4k668193




27.4k668193








  • 2




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










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










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










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
















  • 2




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










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










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










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










2




2




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












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




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












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




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












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






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












6 Answers
6






active

oldest

votes


















5












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













  • $begingroup$
    Returns 0 for 1.
    $endgroup$
    – Shaggy
    14 mins ago






  • 1




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





















0












$begingroup$


Python 3, 115 bytes





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


Try it online!



Recursive so it dies quite quickly. 88 bytes if you don't require infinitely large numbers.






share|improve this answer











$endgroup$





















    0












    $begingroup$


    M, 19 bytes



    ®!Dḣ³L¤⁼³µ’
    ®‘$©$Ç¿


    Try it online!



    M is just Jelly but with Sympy. Explanation to come. This program is longer than it should be because M is a very old version of Jelly. I will add the golfed Jelly version later.






    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












        $begingroup$

        JavaScript, 47 bytes



        Port of Lynn's Python solution. If 0 can be output for 1 then the last 3 bytes can be removed.



        Takes input as a BigInt.



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


        Try it online





        share









        $endgroup$





















          0












          $begingroup$


          Jelly, 9 bytes



          1!DḌƤċʋ1#


          Try it online!



          Takes an integer and returns a singleton.





          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

























            6 Answers
            6






            active

            oldest

            votes








            6 Answers
            6






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5












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













            • $begingroup$
              Returns 0 for 1.
              $endgroup$
              – Shaggy
              14 mins ago






            • 1




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


















            5












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













            • $begingroup$
              Returns 0 for 1.
              $endgroup$
              – Shaggy
              14 mins ago






            • 1




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
















            5












            5








            5





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

























            answered 35 mins ago









            LynnLynn

            51.4k899234




            51.4k899234












            • $begingroup$
              Returns 0 for 1.
              $endgroup$
              – Shaggy
              14 mins ago






            • 1




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




















            • $begingroup$
              Returns 0 for 1.
              $endgroup$
              – Shaggy
              14 mins ago






            • 1




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


















            $begingroup$
            Returns 0 for 1.
            $endgroup$
            – Shaggy
            14 mins ago




            $begingroup$
            Returns 0 for 1.
            $endgroup$
            – Shaggy
            14 mins ago




            1




            1




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













            0












            $begingroup$


            Python 3, 115 bytes





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


            Try it online!



            Recursive so it dies quite quickly. 88 bytes if you don't require infinitely large numbers.






            share|improve this answer











            $endgroup$


















              0












              $begingroup$


              Python 3, 115 bytes





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


              Try it online!



              Recursive so it dies quite quickly. 88 bytes if you don't require infinitely large numbers.






              share|improve this answer











              $endgroup$
















                0












                0








                0





                $begingroup$


                Python 3, 115 bytes





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


                Try it online!



                Recursive so it dies quite quickly. 88 bytes if you don't require infinitely large numbers.






                share|improve this answer











                $endgroup$




                Python 3, 115 bytes





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


                Try it online!



                Recursive so it dies quite quickly. 88 bytes if you don't require infinitely large numbers.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 41 mins ago

























                answered 49 mins ago









                HyperNeutrinoHyperNeutrino

                19.1k437148




                19.1k437148























                    0












                    $begingroup$


                    M, 19 bytes



                    ®!Dḣ³L¤⁼³µ’
                    ®‘$©$Ç¿


                    Try it online!



                    M is just Jelly but with Sympy. Explanation to come. This program is longer than it should be because M is a very old version of Jelly. I will add the golfed Jelly version later.






                    share|improve this answer









                    $endgroup$


















                      0












                      $begingroup$


                      M, 19 bytes



                      ®!Dḣ³L¤⁼³µ’
                      ®‘$©$Ç¿


                      Try it online!



                      M is just Jelly but with Sympy. Explanation to come. This program is longer than it should be because M is a very old version of Jelly. I will add the golfed Jelly version later.






                      share|improve this answer









                      $endgroup$
















                        0












                        0








                        0





                        $begingroup$


                        M, 19 bytes



                        ®!Dḣ³L¤⁼³µ’
                        ®‘$©$Ç¿


                        Try it online!



                        M is just Jelly but with Sympy. Explanation to come. This program is longer than it should be because M is a very old version of Jelly. I will add the golfed Jelly version later.






                        share|improve this answer









                        $endgroup$




                        M, 19 bytes



                        ®!Dḣ³L¤⁼³µ’
                        ®‘$©$Ç¿


                        Try it online!



                        M is just Jelly but with Sympy. Explanation to come. This program is longer than it should be because M is a very old version of Jelly. I will add the golfed Jelly version later.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 23 mins ago









                        HyperNeutrinoHyperNeutrino

                        19.1k437148




                        19.1k437148























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

























                                answered 14 mins ago









                                Nick KennedyNick Kennedy

                                1,90149




                                1,90149























                                    0












                                    $begingroup$

                                    JavaScript, 47 bytes



                                    Port of Lynn's Python solution. If 0 can be output for 1 then the last 3 bytes can be removed.



                                    Takes input as a BigInt.



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


                                    Try it online





                                    share









                                    $endgroup$


















                                      0












                                      $begingroup$

                                      JavaScript, 47 bytes



                                      Port of Lynn's Python solution. If 0 can be output for 1 then the last 3 bytes can be removed.



                                      Takes input as a BigInt.



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


                                      Try it online





                                      share









                                      $endgroup$
















                                        0












                                        0








                                        0





                                        $begingroup$

                                        JavaScript, 47 bytes



                                        Port of Lynn's Python solution. If 0 can be output for 1 then the last 3 bytes can be removed.



                                        Takes input as a BigInt.



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


                                        Try it online





                                        share









                                        $endgroup$



                                        JavaScript, 47 bytes



                                        Port of Lynn's Python solution. If 0 can be output for 1 then the last 3 bytes can be removed.



                                        Takes input as a BigInt.



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


                                        Try it online






                                        share











                                        share


                                        share










                                        answered 4 mins ago









                                        ShaggyShaggy

                                        19.2k21768




                                        19.2k21768























                                            0












                                            $begingroup$


                                            Jelly, 9 bytes



                                            1!DḌƤċʋ1#


                                            Try it online!



                                            Takes an integer and returns a singleton.





                                            share









                                            $endgroup$


















                                              0












                                              $begingroup$


                                              Jelly, 9 bytes



                                              1!DḌƤċʋ1#


                                              Try it online!



                                              Takes an integer and returns a singleton.





                                              share









                                              $endgroup$
















                                                0












                                                0








                                                0





                                                $begingroup$


                                                Jelly, 9 bytes



                                                1!DḌƤċʋ1#


                                                Try it online!



                                                Takes an integer and returns a singleton.





                                                share









                                                $endgroup$




                                                Jelly, 9 bytes



                                                1!DḌƤċʋ1#


                                                Try it online!



                                                Takes an integer and returns a singleton.






                                                share











                                                share


                                                share










                                                answered 29 secs ago









                                                Erik the OutgolferErik the Outgolfer

                                                33.2k429106




                                                33.2k429106






























                                                    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

                                                    (145452) 2005 RN43 Классификация | Примечания | Ссылки |...

                                                    Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                                                    Энтрерриос (город) Содержание История | Географическое...