Prime containment numbers (golf edition)











up vote
20
down vote

favorite
2












This is sequence A054261.



The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number which contains the first 3 primes as substrings, making it the 3rd prime containment number.



It is trivial to figure out that the first four prime containment numbers are $2$, $23$, $235$ and $2357$, but then it gets more interesting. Since the next prime is 11, the next prime containment number is not $235711$, but it is $112357$ since it's defined as the smallest number with the property.



However, the real challenge comes when you go beyond 11. The next prime containment number is $113257$. Note that in this number, the substrings 11 and 13 are overlapping. The number 3 is also overlapping with the number 13.



It is easy to prove that this sequence is increasing, since the next number needs to fulfill all criteria of the number before it, and have one more substring. However, the sequence is not strictly increasing, as is shown by the results for n=10 and n=11.



Input



A single integer n>0 (I suppose you could also have it 0-indexed, then making n>=0)



Output



Either the nth prime containment number, or a list containing the first n prime containment numbers.



The numbers I have found so far are:



 1 =>             2
2 => 23
3 => 235
4 => 2357
5 => 112357
6 => 113257
7 => 1131725
8 => 113171925
9 => 1131719235
10 => 113171923295
11 => 113171923295
12 => 1131719237295


Note that n = 10 and n = 11 are the same number, since $113171923295$ is the lowest number which contains all numbers $[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]$, but it also contains $31$.



Since this is marked code golf, get golfing! Brute force solutions are allowed, but your code has to work for any input in theory (meaning that you can't just concatenate the first n primes). Happy golfing!










share|improve this question




























    up vote
    20
    down vote

    favorite
    2












    This is sequence A054261.



    The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number which contains the first 3 primes as substrings, making it the 3rd prime containment number.



    It is trivial to figure out that the first four prime containment numbers are $2$, $23$, $235$ and $2357$, but then it gets more interesting. Since the next prime is 11, the next prime containment number is not $235711$, but it is $112357$ since it's defined as the smallest number with the property.



    However, the real challenge comes when you go beyond 11. The next prime containment number is $113257$. Note that in this number, the substrings 11 and 13 are overlapping. The number 3 is also overlapping with the number 13.



    It is easy to prove that this sequence is increasing, since the next number needs to fulfill all criteria of the number before it, and have one more substring. However, the sequence is not strictly increasing, as is shown by the results for n=10 and n=11.



    Input



    A single integer n>0 (I suppose you could also have it 0-indexed, then making n>=0)



    Output



    Either the nth prime containment number, or a list containing the first n prime containment numbers.



    The numbers I have found so far are:



     1 =>             2
    2 => 23
    3 => 235
    4 => 2357
    5 => 112357
    6 => 113257
    7 => 1131725
    8 => 113171925
    9 => 1131719235
    10 => 113171923295
    11 => 113171923295
    12 => 1131719237295


    Note that n = 10 and n = 11 are the same number, since $113171923295$ is the lowest number which contains all numbers $[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]$, but it also contains $31$.



    Since this is marked code golf, get golfing! Brute force solutions are allowed, but your code has to work for any input in theory (meaning that you can't just concatenate the first n primes). Happy golfing!










    share|improve this question


























      up vote
      20
      down vote

      favorite
      2









      up vote
      20
      down vote

      favorite
      2






      2





      This is sequence A054261.



      The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number which contains the first 3 primes as substrings, making it the 3rd prime containment number.



      It is trivial to figure out that the first four prime containment numbers are $2$, $23$, $235$ and $2357$, but then it gets more interesting. Since the next prime is 11, the next prime containment number is not $235711$, but it is $112357$ since it's defined as the smallest number with the property.



      However, the real challenge comes when you go beyond 11. The next prime containment number is $113257$. Note that in this number, the substrings 11 and 13 are overlapping. The number 3 is also overlapping with the number 13.



      It is easy to prove that this sequence is increasing, since the next number needs to fulfill all criteria of the number before it, and have one more substring. However, the sequence is not strictly increasing, as is shown by the results for n=10 and n=11.



      Input



      A single integer n>0 (I suppose you could also have it 0-indexed, then making n>=0)



      Output



      Either the nth prime containment number, or a list containing the first n prime containment numbers.



      The numbers I have found so far are:



       1 =>             2
      2 => 23
      3 => 235
      4 => 2357
      5 => 112357
      6 => 113257
      7 => 1131725
      8 => 113171925
      9 => 1131719235
      10 => 113171923295
      11 => 113171923295
      12 => 1131719237295


      Note that n = 10 and n = 11 are the same number, since $113171923295$ is the lowest number which contains all numbers $[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]$, but it also contains $31$.



      Since this is marked code golf, get golfing! Brute force solutions are allowed, but your code has to work for any input in theory (meaning that you can't just concatenate the first n primes). Happy golfing!










      share|improve this question















      This is sequence A054261.



      The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number which contains the first 3 primes as substrings, making it the 3rd prime containment number.



      It is trivial to figure out that the first four prime containment numbers are $2$, $23$, $235$ and $2357$, but then it gets more interesting. Since the next prime is 11, the next prime containment number is not $235711$, but it is $112357$ since it's defined as the smallest number with the property.



      However, the real challenge comes when you go beyond 11. The next prime containment number is $113257$. Note that in this number, the substrings 11 and 13 are overlapping. The number 3 is also overlapping with the number 13.



      It is easy to prove that this sequence is increasing, since the next number needs to fulfill all criteria of the number before it, and have one more substring. However, the sequence is not strictly increasing, as is shown by the results for n=10 and n=11.



      Input



      A single integer n>0 (I suppose you could also have it 0-indexed, then making n>=0)



      Output



      Either the nth prime containment number, or a list containing the first n prime containment numbers.



      The numbers I have found so far are:



       1 =>             2
      2 => 23
      3 => 235
      4 => 2357
      5 => 112357
      6 => 113257
      7 => 1131725
      8 => 113171925
      9 => 1131719235
      10 => 113171923295
      11 => 113171923295
      12 => 1131719237295


      Note that n = 10 and n = 11 are the same number, since $113171923295$ is the lowest number which contains all numbers $[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]$, but it also contains $31$.



      Since this is marked code golf, get golfing! Brute force solutions are allowed, but your code has to work for any input in theory (meaning that you can't just concatenate the first n primes). Happy golfing!







      code-golf math primes integer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 30 at 12:22

























      asked Nov 30 at 7:05









      maxb

      2,3431926




      2,3431926






















          14 Answers
          14






          active

          oldest

          votes

















          up vote
          11
          down vote














          05AB1E, 8 bytes



          ∞.ΔIÅpåP


          Try it online!



          Explanation



                     # from
          ∞ # a list of infinite positive integers
          .Δ # find the first which satisfies the condition:
          P # all
          IÅp # of the first <input> prime numbers
          å # are contained in the number





          share|improve this answer





















          • Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
            – maxb
            Nov 30 at 8:08












          • @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
            – Kevin Cruijssen
            Nov 30 at 8:22










          • @KevinCruijssen I see, thanks for the explanation!
            – maxb
            Nov 30 at 8:38






          • 1




            Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
            – Mr. Xcoder
            Nov 30 at 10:10












          • @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
            – Emigna
            Nov 30 at 12:02


















          up vote
          5
          down vote














          Jelly, 11 bytes



          ³ÆN€ẇ€µẠ$1#


          Try it online!



          Simple brute force. Not completely sure how #'s arity works, so there may be some room for improvement.



          How it works



          ³ÆN€ẇ€µẠ$1#    Main link. Input: Index n.
          1# Find the first natural number N that satisfies:
          ³ÆN€ First n primes...
          ẇ€ ...are substrings of N
          µẠ$ All of them are true





          share|improve this answer





















          • "Fixed under filter with condition" may work instead of "condition true for all".
            – user202729
            Nov 30 at 10:45






          • 2




            wⱮẠ¥1#ÆN€ saves two bytes.
            – Dennis
            Nov 30 at 12:47


















          up vote
          5
          down vote













          Java 8, 143 bytes





          n->{int r=1,f=1,c,i,j,k;for(;f>0;r++)for(i=2,f=c=n;c>0;c-=j>1?1+0*(f-=(r+"").contains(j+"")?1:0):0)for(j=i++,k=2;k<j;)j=j%k++<1?0:j;return~-r;}


          Try it online.

          NOTES:




          1. Times out above n=7.

          2. Given enough time and resources it only works up to a maximum of n=9 due to the size limit of int (maximum of 2,147,483,647).


            • With +4 bytes changing the int to a long, the maximum is increased to an output below 9,223,372,036,854,775,807 (about n=20 I think?)

            • By using java.math.BigInteger the maximum can be increased to any size (in theory), but it will be around +200 bytes at least due to the verbosity of java.math.BigInteger's methods..




          Explanation:



          n->{                   // Method with integer as both parameter and return-type
          int r=1, // Result-integer, starting at 1
          f=1, // Flag-integer, starting at 1 as well
          c, // Counter-integer, starting uninitialized
          i,j,k; // Index integers
          for(;f>0; // Loop as long as the flag is not 0 yet
          r++) // After every iteration, increase the result by 1
          for(i=2, // Reset `i` to 2
          f=c=n; // Reset both `f` and `c` to the input `n`
          c>0; // Inner loop as long as the counter is not 0 yet
          c-= // After every iteration, decrease the counter by:
          j>1? // If `j` is a prime:
          1 // Decrease the counter by 1
          +0*(f-= // And also decrease the flag by:
          (r+"").contains(j+"")?
          // If the result `r` contains the prime `j` as substring
          1 // Decrease the flag by 1
          : // Else:
          0) // Leave the flag the same
          : // Else:
          0) // Leave the counter the same
          for(j=i++, // Set `j` to the current `i`,
          // (and increase `i` by 1 afterwards with `i++`)
          k=2; // Set `k` to 2 (the first prime)
          k<j;) // Inner loop as long as `k` is smaller than `j`
          j=j%k++<1? // If `j` is divisible by `k`
          0 // Set `j` to 0
          : // Else:
          j; // Leave `j` the same
          // (If `j` is unchanged after this inner-most loop,
          // it means `j` is a prime)
          return~-r;} // Return `r-1` as result





          share|improve this answer




























            up vote
            5
            down vote













            JavaScript (ES6),  105 ... 92  91 bytes





            n=>(k=1,g=(s,d=k++)=>n?k%d--?g(s,d):g(d?s:s+`-!/${n--,k}/.test(n)`):eval(s+';)++n'))`for(;`


            Try it online!



            How?



            We recursively build a concatenation of conditions based on the first $n$ primes:



            "-!/2/.test(n)-!/3/.test(n)-!/5/.test(n)-!/7/.test(n)-!/11/.test(n)..."


            We then look for the smallest $n$ such that all conditions evaluate to false:



            eval('for(;' + <conditions> + ';)++n')


            Commented



            n => (                             // main function taking n
            k = 1, // k = current prime candidate, initialized to 1
            g = (s, // g = recursive function taking the code string s
            d = k++) => // and the divisor d
            n ? // if n is not equal to 0:
            k % d-- ? // if d is not a divisor of k:
            g(s, d) // recursive call to test the next divisor
            : // else:
            g( // recursive call with s updated and d undefined:
            d ? // if d is not equal to 0 (i.e. k is composite):
            s // leave s unchanged
            : // else (k is prime):
            s + // decrement n and add to s
            `-!/${n--,k}/.test(n)` // the next condition based on the prime k
            // the lack of 2nd argument triggers 'd = k++'
            ) // end of recursive call
            : // else (n = 0):
            eval(s + ';)++n') // complete and evaluate the code string
            )`for(;` // initial call to g with s = [ "for(;" ]





            share|improve this answer






























              up vote
              4
              down vote














              Ruby, 58 bytes





              ->n,i=1{i+=1until Prime.take(n).all?{|x|/#{x}/=~"#{i}"};i}


              Try it online!



              Brute-force, works up to 7 on TIO.






              share|improve this answer




























                up vote
                4
                down vote














                Pyth, 14 bytes



                Extremely, extremely slow, times out for $n>5$ on TIO.



                f@I`M.fP_ZQ1y`


                Try it online!



                f@I`M.fP_ZQ1y`     Full program. Q is the input.
                f Find the first positive integer that fulfils the condition.
                @I`M.fP_ZQ1y` Filtering condition, uses T to refer to the number being tested.
                .f Q1 Starting at 1, find the first Q positive integers (.f...Q1) that
                P_Z Are prime.
                `M Convert all of those primes to strings.
                I Check whether the result is invariant (i.e. doesn't change) when...
                @ y` Intersecting this list with the powerset of T as a string.





                Pyth, 15 bytes



                Slightly faster but 1 byte longer.



                f.A/L`T`M.fP_ZQ


                Try it online!



                f.A/L`T`M.fP_ZQ     Full program. Q is the input.
                f Find the first positive integer that fulfils the condition.
                .A/L`T`M.fP_ZQ Filtering condition, uses T to refer to the number being tested.
                .f Q Starting at 1, find the first Q positive integers (.f...Q) that
                P_Z Are prime.
                `M Convert all of those primes to strings.
                .A/L And make sure that they all (.A) occur in (/L)...
                `T The string representation of T.





                share|improve this answer






























                  up vote
                  3
                  down vote














                  Jelly, 14 bytes



                  ³RÆNṾ€ẇ€ṾȦ
                  Ç1#


                  Try it online!






                  share|improve this answer




























                    up vote
                    3
                    down vote














                    Charcoal, 42 bytes



                    ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»≔¹ηWΦυ¬№IηIκ≦⊕ηIη


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



                    ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»


                    Build up the first n prime numbers by trial division of all the integers by all of the previously found prime numbers.



                    ≔¹ηWΦυ¬№IηIκ≦⊕η


                    Loop through all integers until we find one which contains all the primes as substrings.



                    Iη


                    Cast the result to string and implicitly print.



                    The program's speed can be doubled at a cost of a byte by replacing the last ≦⊕η with ≦⁺²η but it's still too slow to calculate n>6.






                    share|improve this answer




























                      up vote
                      3
                      down vote














                      Perl 6, 63 bytes





                      {first ->a{!grep {a~~!/$^b/},(grep &is-prime,2..*)[^$_]},2..*}


                      Try it online!



                      A brute force solutions that times out on TIO for numbers above 5, but I'm pretty sure it works correctly. Finds the first positive number that contains the first n primes. Here's a solution that doesn't time out for n=6.



                      Explanation:



                      {                                                             } # Anonymous code block
                      first 2..* # Find the first number
                      ->a{ } # Where:
                      !grep # None of
                      [^$_] # The first n
                      (grep &is-prime,2..*) # primes
                      {a~~!/$^b/}, # Are not in the current number





                      share|improve this answer























                      • Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                        – maxb
                        Nov 30 at 8:16










                      • @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                        – Jo King
                        Nov 30 at 10:59


















                      up vote
                      2
                      down vote














                      Python 2, 131 bytes





                      f=lambda n,x=2:x*all(i in`x`for i in g(n,2))or f(n,x+1)
                      def g(n,x):p=all(x%i for i in range(2,x));return[0]*n and[`x`]*p+g(n-p,x+1)


                      Try it online!



                      f is the function.






                      share|improve this answer




























                        up vote
                        2
                        down vote














                        Python 2, 91 bytes





                        n=input();l=
                        P=k=1
                        while~-all(`x`in`k`for x in(l+[l])[:n]):P*=k*k;k+=1;l+=P%k*[k]
                        print k


                        Try it online!






                        share|improve this answer





















                        • If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                          – maxb
                          Nov 30 at 21:33


















                        up vote
                        2
                        down vote













                        SAS, 149 bytes



                        data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 


                        Input is entered following the cards; statement, like so:



                        data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 
                        1
                        2
                        3
                        4
                        5
                        6
                        7


                        Outputs a dataset p, with the result v, with an output row for each input value. Should technically work for all the given test-cases (the max integer with full precision in SAS is 9,007,199,254,740,992), but I gave up after letting it think for 5 minutes on n=8.



                        Explanation:



                        data p;
                        input n; /* Read a line of input */

                        z: /* Jump label (not proud of this) */
                        i=1; /* i is the current value which we are checking for primality */
                        a=0; /* a is the number of primes we've found so far */
                        v+1; /* v is the final output value which we'll look for substrings in */

                        do while(a<n); /* Loop until we find the Nth prime */
                        i+1;
                        do j=2 to i while(mod(i,j));end; /* Prime sieve: If mod(i,j) != 0 for all j = 2 to i, then i is prime. This could be faster by only looping to sqrt(i), but would take more bytes */
                        if j=i then do; /* If i is prime (ie, we made it to the end of the prime sieve)... */
                        a+1;
                        if find(cat(v),cat(i))=0 then goto z; /* If i does not appear as a substring of v, then start all over again with the next v */
                        end;
                        end;

                        /* Input values, separated by newlines */
                        cards;
                        1
                        2
                        3
                        4
                        5
                        6
                        7





                        share|improve this answer










                        New contributor




                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.

























                          up vote
                          1
                          down vote














                          Haskell, 102 bytes





                          import Data.List
                          f n|x<-[2..n*n]=[a|a<-[2..],all(`isInfixOf`show a).take n$show<$>x\((*)<$>x<*>x)]!!0


                          Try it online!



                          Explanation / Ungolfed



                          Since we already have Data.List imported we might as well use it: Instead of the good old take n[p|p<-[2..],all((>0).mod p)[2..p-1]] we can use another way of generating all primes we need. Namely, we generate a sufficient amount of composites and use these together with (\):



                          [2..n*n] \ ( (*) <$> [2..n*n] <*> [2..n*n] )


                          Using n*n suffices because $pi(n) < frac{n^2}{log(n^2)}$. The rest is just a simple list comprehension:



                          [ a | a <- [2..], all (`isInfixOf` show a) . take n $ enoughPrimes ] !!0





                          share|improve this answer




























                            up vote
                            1
                            down vote













                            Japt, 20 18 bytes



                            Far from my finest work, I was just happy to get it working after the day I've had. I'm sure I'll end up tapping away at it down the boozer later!



                            _õ fj ¯U e!øZs}aUÄ


                            Try it - takes 13 seconds to run for an input of 7, throws a wobbly after that (the updated version craps out at 5 for me, but that might just be my phone).






                            share|improve this answer























                            • @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                              – Shaggy
                              Nov 30 at 21:47










                            • @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                              – Shaggy
                              Nov 30 at 22:36










                            • It's working now! ¯_(ツ)_/¯
                              – Oliver
                              Nov 30 at 23:41










                            • @Oliver, still not working for me. Weirderer and weirderer!
                              – Shaggy
                              Dec 1 at 0:35










                            • It has been working for me since I went from my work computer to my home computer. Weird indeed!
                              – Oliver
                              Dec 1 at 0:37











                            Your Answer





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

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

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

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

                            function createEditor() {
                            StackExchange.prepareEditor({
                            heartbeatType: 'answer',
                            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%2f176823%2fprime-containment-numbers-golf-edition%23new-answer', 'question_page');
                            }
                            );

                            Post as a guest















                            Required, but never shown

























                            14 Answers
                            14






                            active

                            oldest

                            votes








                            14 Answers
                            14






                            active

                            oldest

                            votes









                            active

                            oldest

                            votes






                            active

                            oldest

                            votes








                            up vote
                            11
                            down vote














                            05AB1E, 8 bytes



                            ∞.ΔIÅpåP


                            Try it online!



                            Explanation



                                       # from
                            ∞ # a list of infinite positive integers
                            .Δ # find the first which satisfies the condition:
                            P # all
                            IÅp # of the first <input> prime numbers
                            å # are contained in the number





                            share|improve this answer





















                            • Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
                              – maxb
                              Nov 30 at 8:08












                            • @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
                              – Kevin Cruijssen
                              Nov 30 at 8:22










                            • @KevinCruijssen I see, thanks for the explanation!
                              – maxb
                              Nov 30 at 8:38






                            • 1




                              Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
                              – Mr. Xcoder
                              Nov 30 at 10:10












                            • @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
                              – Emigna
                              Nov 30 at 12:02















                            up vote
                            11
                            down vote














                            05AB1E, 8 bytes



                            ∞.ΔIÅpåP


                            Try it online!



                            Explanation



                                       # from
                            ∞ # a list of infinite positive integers
                            .Δ # find the first which satisfies the condition:
                            P # all
                            IÅp # of the first <input> prime numbers
                            å # are contained in the number





                            share|improve this answer





















                            • Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
                              – maxb
                              Nov 30 at 8:08












                            • @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
                              – Kevin Cruijssen
                              Nov 30 at 8:22










                            • @KevinCruijssen I see, thanks for the explanation!
                              – maxb
                              Nov 30 at 8:38






                            • 1




                              Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
                              – Mr. Xcoder
                              Nov 30 at 10:10












                            • @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
                              – Emigna
                              Nov 30 at 12:02













                            up vote
                            11
                            down vote










                            up vote
                            11
                            down vote










                            05AB1E, 8 bytes



                            ∞.ΔIÅpåP


                            Try it online!



                            Explanation



                                       # from
                            ∞ # a list of infinite positive integers
                            .Δ # find the first which satisfies the condition:
                            P # all
                            IÅp # of the first <input> prime numbers
                            å # are contained in the number





                            share|improve this answer













                            05AB1E, 8 bytes



                            ∞.ΔIÅpåP


                            Try it online!



                            Explanation



                                       # from
                            ∞ # a list of infinite positive integers
                            .Δ # find the first which satisfies the condition:
                            P # all
                            IÅp # of the first <input> prime numbers
                            å # are contained in the number






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 30 at 7:34









                            Emigna

                            45k432137




                            45k432137












                            • Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
                              – maxb
                              Nov 30 at 8:08












                            • @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
                              – Kevin Cruijssen
                              Nov 30 at 8:22










                            • @KevinCruijssen I see, thanks for the explanation!
                              – maxb
                              Nov 30 at 8:38






                            • 1




                              Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
                              – Mr. Xcoder
                              Nov 30 at 10:10












                            • @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
                              – Emigna
                              Nov 30 at 12:02


















                            • Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
                              – maxb
                              Nov 30 at 8:08












                            • @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
                              – Kevin Cruijssen
                              Nov 30 at 8:22










                            • @KevinCruijssen I see, thanks for the explanation!
                              – maxb
                              Nov 30 at 8:38






                            • 1




                              Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
                              – Mr. Xcoder
                              Nov 30 at 10:10












                            • @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
                              – Emigna
                              Nov 30 at 12:02
















                            Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
                            – maxb
                            Nov 30 at 8:08






                            Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.
                            – maxb
                            Nov 30 at 8:08














                            @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
                            – Kevin Cruijssen
                            Nov 30 at 8:22




                            @maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the -loop stops.
                            – Kevin Cruijssen
                            Nov 30 at 8:22












                            @KevinCruijssen I see, thanks for the explanation!
                            – maxb
                            Nov 30 at 8:38




                            @KevinCruijssen I see, thanks for the explanation!
                            – maxb
                            Nov 30 at 8:38




                            1




                            1




                            Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
                            – Mr. Xcoder
                            Nov 30 at 10:10






                            Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first <input> primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.
                            – Mr. Xcoder
                            Nov 30 at 10:10














                            @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
                            – Emigna
                            Nov 30 at 12:02




                            @Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use before :)
                            – Emigna
                            Nov 30 at 12:02










                            up vote
                            5
                            down vote














                            Jelly, 11 bytes



                            ³ÆN€ẇ€µẠ$1#


                            Try it online!



                            Simple brute force. Not completely sure how #'s arity works, so there may be some room for improvement.



                            How it works



                            ³ÆN€ẇ€µẠ$1#    Main link. Input: Index n.
                            1# Find the first natural number N that satisfies:
                            ³ÆN€ First n primes...
                            ẇ€ ...are substrings of N
                            µẠ$ All of them are true





                            share|improve this answer





















                            • "Fixed under filter with condition" may work instead of "condition true for all".
                              – user202729
                              Nov 30 at 10:45






                            • 2




                              wⱮẠ¥1#ÆN€ saves two bytes.
                              – Dennis
                              Nov 30 at 12:47















                            up vote
                            5
                            down vote














                            Jelly, 11 bytes



                            ³ÆN€ẇ€µẠ$1#


                            Try it online!



                            Simple brute force. Not completely sure how #'s arity works, so there may be some room for improvement.



                            How it works



                            ³ÆN€ẇ€µẠ$1#    Main link. Input: Index n.
                            1# Find the first natural number N that satisfies:
                            ³ÆN€ First n primes...
                            ẇ€ ...are substrings of N
                            µẠ$ All of them are true





                            share|improve this answer





















                            • "Fixed under filter with condition" may work instead of "condition true for all".
                              – user202729
                              Nov 30 at 10:45






                            • 2




                              wⱮẠ¥1#ÆN€ saves two bytes.
                              – Dennis
                              Nov 30 at 12:47













                            up vote
                            5
                            down vote










                            up vote
                            5
                            down vote










                            Jelly, 11 bytes



                            ³ÆN€ẇ€µẠ$1#


                            Try it online!



                            Simple brute force. Not completely sure how #'s arity works, so there may be some room for improvement.



                            How it works



                            ³ÆN€ẇ€µẠ$1#    Main link. Input: Index n.
                            1# Find the first natural number N that satisfies:
                            ³ÆN€ First n primes...
                            ẇ€ ...are substrings of N
                            µẠ$ All of them are true





                            share|improve this answer













                            Jelly, 11 bytes



                            ³ÆN€ẇ€µẠ$1#


                            Try it online!



                            Simple brute force. Not completely sure how #'s arity works, so there may be some room for improvement.



                            How it works



                            ³ÆN€ẇ€µẠ$1#    Main link. Input: Index n.
                            1# Find the first natural number N that satisfies:
                            ³ÆN€ First n primes...
                            ẇ€ ...are substrings of N
                            µẠ$ All of them are true






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 30 at 7:29









                            Bubbler

                            6,164759




                            6,164759












                            • "Fixed under filter with condition" may work instead of "condition true for all".
                              – user202729
                              Nov 30 at 10:45






                            • 2




                              wⱮẠ¥1#ÆN€ saves two bytes.
                              – Dennis
                              Nov 30 at 12:47


















                            • "Fixed under filter with condition" may work instead of "condition true for all".
                              – user202729
                              Nov 30 at 10:45






                            • 2




                              wⱮẠ¥1#ÆN€ saves two bytes.
                              – Dennis
                              Nov 30 at 12:47
















                            "Fixed under filter with condition" may work instead of "condition true for all".
                            – user202729
                            Nov 30 at 10:45




                            "Fixed under filter with condition" may work instead of "condition true for all".
                            – user202729
                            Nov 30 at 10:45




                            2




                            2




                            wⱮẠ¥1#ÆN€ saves two bytes.
                            – Dennis
                            Nov 30 at 12:47




                            wⱮẠ¥1#ÆN€ saves two bytes.
                            – Dennis
                            Nov 30 at 12:47










                            up vote
                            5
                            down vote













                            Java 8, 143 bytes





                            n->{int r=1,f=1,c,i,j,k;for(;f>0;r++)for(i=2,f=c=n;c>0;c-=j>1?1+0*(f-=(r+"").contains(j+"")?1:0):0)for(j=i++,k=2;k<j;)j=j%k++<1?0:j;return~-r;}


                            Try it online.

                            NOTES:




                            1. Times out above n=7.

                            2. Given enough time and resources it only works up to a maximum of n=9 due to the size limit of int (maximum of 2,147,483,647).


                              • With +4 bytes changing the int to a long, the maximum is increased to an output below 9,223,372,036,854,775,807 (about n=20 I think?)

                              • By using java.math.BigInteger the maximum can be increased to any size (in theory), but it will be around +200 bytes at least due to the verbosity of java.math.BigInteger's methods..




                            Explanation:



                            n->{                   // Method with integer as both parameter and return-type
                            int r=1, // Result-integer, starting at 1
                            f=1, // Flag-integer, starting at 1 as well
                            c, // Counter-integer, starting uninitialized
                            i,j,k; // Index integers
                            for(;f>0; // Loop as long as the flag is not 0 yet
                            r++) // After every iteration, increase the result by 1
                            for(i=2, // Reset `i` to 2
                            f=c=n; // Reset both `f` and `c` to the input `n`
                            c>0; // Inner loop as long as the counter is not 0 yet
                            c-= // After every iteration, decrease the counter by:
                            j>1? // If `j` is a prime:
                            1 // Decrease the counter by 1
                            +0*(f-= // And also decrease the flag by:
                            (r+"").contains(j+"")?
                            // If the result `r` contains the prime `j` as substring
                            1 // Decrease the flag by 1
                            : // Else:
                            0) // Leave the flag the same
                            : // Else:
                            0) // Leave the counter the same
                            for(j=i++, // Set `j` to the current `i`,
                            // (and increase `i` by 1 afterwards with `i++`)
                            k=2; // Set `k` to 2 (the first prime)
                            k<j;) // Inner loop as long as `k` is smaller than `j`
                            j=j%k++<1? // If `j` is divisible by `k`
                            0 // Set `j` to 0
                            : // Else:
                            j; // Leave `j` the same
                            // (If `j` is unchanged after this inner-most loop,
                            // it means `j` is a prime)
                            return~-r;} // Return `r-1` as result





                            share|improve this answer

























                              up vote
                              5
                              down vote













                              Java 8, 143 bytes





                              n->{int r=1,f=1,c,i,j,k;for(;f>0;r++)for(i=2,f=c=n;c>0;c-=j>1?1+0*(f-=(r+"").contains(j+"")?1:0):0)for(j=i++,k=2;k<j;)j=j%k++<1?0:j;return~-r;}


                              Try it online.

                              NOTES:




                              1. Times out above n=7.

                              2. Given enough time and resources it only works up to a maximum of n=9 due to the size limit of int (maximum of 2,147,483,647).


                                • With +4 bytes changing the int to a long, the maximum is increased to an output below 9,223,372,036,854,775,807 (about n=20 I think?)

                                • By using java.math.BigInteger the maximum can be increased to any size (in theory), but it will be around +200 bytes at least due to the verbosity of java.math.BigInteger's methods..




                              Explanation:



                              n->{                   // Method with integer as both parameter and return-type
                              int r=1, // Result-integer, starting at 1
                              f=1, // Flag-integer, starting at 1 as well
                              c, // Counter-integer, starting uninitialized
                              i,j,k; // Index integers
                              for(;f>0; // Loop as long as the flag is not 0 yet
                              r++) // After every iteration, increase the result by 1
                              for(i=2, // Reset `i` to 2
                              f=c=n; // Reset both `f` and `c` to the input `n`
                              c>0; // Inner loop as long as the counter is not 0 yet
                              c-= // After every iteration, decrease the counter by:
                              j>1? // If `j` is a prime:
                              1 // Decrease the counter by 1
                              +0*(f-= // And also decrease the flag by:
                              (r+"").contains(j+"")?
                              // If the result `r` contains the prime `j` as substring
                              1 // Decrease the flag by 1
                              : // Else:
                              0) // Leave the flag the same
                              : // Else:
                              0) // Leave the counter the same
                              for(j=i++, // Set `j` to the current `i`,
                              // (and increase `i` by 1 afterwards with `i++`)
                              k=2; // Set `k` to 2 (the first prime)
                              k<j;) // Inner loop as long as `k` is smaller than `j`
                              j=j%k++<1? // If `j` is divisible by `k`
                              0 // Set `j` to 0
                              : // Else:
                              j; // Leave `j` the same
                              // (If `j` is unchanged after this inner-most loop,
                              // it means `j` is a prime)
                              return~-r;} // Return `r-1` as result





                              share|improve this answer























                                up vote
                                5
                                down vote










                                up vote
                                5
                                down vote









                                Java 8, 143 bytes





                                n->{int r=1,f=1,c,i,j,k;for(;f>0;r++)for(i=2,f=c=n;c>0;c-=j>1?1+0*(f-=(r+"").contains(j+"")?1:0):0)for(j=i++,k=2;k<j;)j=j%k++<1?0:j;return~-r;}


                                Try it online.

                                NOTES:




                                1. Times out above n=7.

                                2. Given enough time and resources it only works up to a maximum of n=9 due to the size limit of int (maximum of 2,147,483,647).


                                  • With +4 bytes changing the int to a long, the maximum is increased to an output below 9,223,372,036,854,775,807 (about n=20 I think?)

                                  • By using java.math.BigInteger the maximum can be increased to any size (in theory), but it will be around +200 bytes at least due to the verbosity of java.math.BigInteger's methods..




                                Explanation:



                                n->{                   // Method with integer as both parameter and return-type
                                int r=1, // Result-integer, starting at 1
                                f=1, // Flag-integer, starting at 1 as well
                                c, // Counter-integer, starting uninitialized
                                i,j,k; // Index integers
                                for(;f>0; // Loop as long as the flag is not 0 yet
                                r++) // After every iteration, increase the result by 1
                                for(i=2, // Reset `i` to 2
                                f=c=n; // Reset both `f` and `c` to the input `n`
                                c>0; // Inner loop as long as the counter is not 0 yet
                                c-= // After every iteration, decrease the counter by:
                                j>1? // If `j` is a prime:
                                1 // Decrease the counter by 1
                                +0*(f-= // And also decrease the flag by:
                                (r+"").contains(j+"")?
                                // If the result `r` contains the prime `j` as substring
                                1 // Decrease the flag by 1
                                : // Else:
                                0) // Leave the flag the same
                                : // Else:
                                0) // Leave the counter the same
                                for(j=i++, // Set `j` to the current `i`,
                                // (and increase `i` by 1 afterwards with `i++`)
                                k=2; // Set `k` to 2 (the first prime)
                                k<j;) // Inner loop as long as `k` is smaller than `j`
                                j=j%k++<1? // If `j` is divisible by `k`
                                0 // Set `j` to 0
                                : // Else:
                                j; // Leave `j` the same
                                // (If `j` is unchanged after this inner-most loop,
                                // it means `j` is a prime)
                                return~-r;} // Return `r-1` as result





                                share|improve this answer












                                Java 8, 143 bytes





                                n->{int r=1,f=1,c,i,j,k;for(;f>0;r++)for(i=2,f=c=n;c>0;c-=j>1?1+0*(f-=(r+"").contains(j+"")?1:0):0)for(j=i++,k=2;k<j;)j=j%k++<1?0:j;return~-r;}


                                Try it online.

                                NOTES:




                                1. Times out above n=7.

                                2. Given enough time and resources it only works up to a maximum of n=9 due to the size limit of int (maximum of 2,147,483,647).


                                  • With +4 bytes changing the int to a long, the maximum is increased to an output below 9,223,372,036,854,775,807 (about n=20 I think?)

                                  • By using java.math.BigInteger the maximum can be increased to any size (in theory), but it will be around +200 bytes at least due to the verbosity of java.math.BigInteger's methods..




                                Explanation:



                                n->{                   // Method with integer as both parameter and return-type
                                int r=1, // Result-integer, starting at 1
                                f=1, // Flag-integer, starting at 1 as well
                                c, // Counter-integer, starting uninitialized
                                i,j,k; // Index integers
                                for(;f>0; // Loop as long as the flag is not 0 yet
                                r++) // After every iteration, increase the result by 1
                                for(i=2, // Reset `i` to 2
                                f=c=n; // Reset both `f` and `c` to the input `n`
                                c>0; // Inner loop as long as the counter is not 0 yet
                                c-= // After every iteration, decrease the counter by:
                                j>1? // If `j` is a prime:
                                1 // Decrease the counter by 1
                                +0*(f-= // And also decrease the flag by:
                                (r+"").contains(j+"")?
                                // If the result `r` contains the prime `j` as substring
                                1 // Decrease the flag by 1
                                : // Else:
                                0) // Leave the flag the same
                                : // Else:
                                0) // Leave the counter the same
                                for(j=i++, // Set `j` to the current `i`,
                                // (and increase `i` by 1 afterwards with `i++`)
                                k=2; // Set `k` to 2 (the first prime)
                                k<j;) // Inner loop as long as `k` is smaller than `j`
                                j=j%k++<1? // If `j` is divisible by `k`
                                0 // Set `j` to 0
                                : // Else:
                                j; // Leave `j` the same
                                // (If `j` is unchanged after this inner-most loop,
                                // it means `j` is a prime)
                                return~-r;} // Return `r-1` as result






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 30 at 9:25









                                Kevin Cruijssen

                                34.6k554182




                                34.6k554182






















                                    up vote
                                    5
                                    down vote













                                    JavaScript (ES6),  105 ... 92  91 bytes





                                    n=>(k=1,g=(s,d=k++)=>n?k%d--?g(s,d):g(d?s:s+`-!/${n--,k}/.test(n)`):eval(s+';)++n'))`for(;`


                                    Try it online!



                                    How?



                                    We recursively build a concatenation of conditions based on the first $n$ primes:



                                    "-!/2/.test(n)-!/3/.test(n)-!/5/.test(n)-!/7/.test(n)-!/11/.test(n)..."


                                    We then look for the smallest $n$ such that all conditions evaluate to false:



                                    eval('for(;' + <conditions> + ';)++n')


                                    Commented



                                    n => (                             // main function taking n
                                    k = 1, // k = current prime candidate, initialized to 1
                                    g = (s, // g = recursive function taking the code string s
                                    d = k++) => // and the divisor d
                                    n ? // if n is not equal to 0:
                                    k % d-- ? // if d is not a divisor of k:
                                    g(s, d) // recursive call to test the next divisor
                                    : // else:
                                    g( // recursive call with s updated and d undefined:
                                    d ? // if d is not equal to 0 (i.e. k is composite):
                                    s // leave s unchanged
                                    : // else (k is prime):
                                    s + // decrement n and add to s
                                    `-!/${n--,k}/.test(n)` // the next condition based on the prime k
                                    // the lack of 2nd argument triggers 'd = k++'
                                    ) // end of recursive call
                                    : // else (n = 0):
                                    eval(s + ';)++n') // complete and evaluate the code string
                                    )`for(;` // initial call to g with s = [ "for(;" ]





                                    share|improve this answer



























                                      up vote
                                      5
                                      down vote













                                      JavaScript (ES6),  105 ... 92  91 bytes





                                      n=>(k=1,g=(s,d=k++)=>n?k%d--?g(s,d):g(d?s:s+`-!/${n--,k}/.test(n)`):eval(s+';)++n'))`for(;`


                                      Try it online!



                                      How?



                                      We recursively build a concatenation of conditions based on the first $n$ primes:



                                      "-!/2/.test(n)-!/3/.test(n)-!/5/.test(n)-!/7/.test(n)-!/11/.test(n)..."


                                      We then look for the smallest $n$ such that all conditions evaluate to false:



                                      eval('for(;' + <conditions> + ';)++n')


                                      Commented



                                      n => (                             // main function taking n
                                      k = 1, // k = current prime candidate, initialized to 1
                                      g = (s, // g = recursive function taking the code string s
                                      d = k++) => // and the divisor d
                                      n ? // if n is not equal to 0:
                                      k % d-- ? // if d is not a divisor of k:
                                      g(s, d) // recursive call to test the next divisor
                                      : // else:
                                      g( // recursive call with s updated and d undefined:
                                      d ? // if d is not equal to 0 (i.e. k is composite):
                                      s // leave s unchanged
                                      : // else (k is prime):
                                      s + // decrement n and add to s
                                      `-!/${n--,k}/.test(n)` // the next condition based on the prime k
                                      // the lack of 2nd argument triggers 'd = k++'
                                      ) // end of recursive call
                                      : // else (n = 0):
                                      eval(s + ';)++n') // complete and evaluate the code string
                                      )`for(;` // initial call to g with s = [ "for(;" ]





                                      share|improve this answer

























                                        up vote
                                        5
                                        down vote










                                        up vote
                                        5
                                        down vote









                                        JavaScript (ES6),  105 ... 92  91 bytes





                                        n=>(k=1,g=(s,d=k++)=>n?k%d--?g(s,d):g(d?s:s+`-!/${n--,k}/.test(n)`):eval(s+';)++n'))`for(;`


                                        Try it online!



                                        How?



                                        We recursively build a concatenation of conditions based on the first $n$ primes:



                                        "-!/2/.test(n)-!/3/.test(n)-!/5/.test(n)-!/7/.test(n)-!/11/.test(n)..."


                                        We then look for the smallest $n$ such that all conditions evaluate to false:



                                        eval('for(;' + <conditions> + ';)++n')


                                        Commented



                                        n => (                             // main function taking n
                                        k = 1, // k = current prime candidate, initialized to 1
                                        g = (s, // g = recursive function taking the code string s
                                        d = k++) => // and the divisor d
                                        n ? // if n is not equal to 0:
                                        k % d-- ? // if d is not a divisor of k:
                                        g(s, d) // recursive call to test the next divisor
                                        : // else:
                                        g( // recursive call with s updated and d undefined:
                                        d ? // if d is not equal to 0 (i.e. k is composite):
                                        s // leave s unchanged
                                        : // else (k is prime):
                                        s + // decrement n and add to s
                                        `-!/${n--,k}/.test(n)` // the next condition based on the prime k
                                        // the lack of 2nd argument triggers 'd = k++'
                                        ) // end of recursive call
                                        : // else (n = 0):
                                        eval(s + ';)++n') // complete and evaluate the code string
                                        )`for(;` // initial call to g with s = [ "for(;" ]





                                        share|improve this answer














                                        JavaScript (ES6),  105 ... 92  91 bytes





                                        n=>(k=1,g=(s,d=k++)=>n?k%d--?g(s,d):g(d?s:s+`-!/${n--,k}/.test(n)`):eval(s+';)++n'))`for(;`


                                        Try it online!



                                        How?



                                        We recursively build a concatenation of conditions based on the first $n$ primes:



                                        "-!/2/.test(n)-!/3/.test(n)-!/5/.test(n)-!/7/.test(n)-!/11/.test(n)..."


                                        We then look for the smallest $n$ such that all conditions evaluate to false:



                                        eval('for(;' + <conditions> + ';)++n')


                                        Commented



                                        n => (                             // main function taking n
                                        k = 1, // k = current prime candidate, initialized to 1
                                        g = (s, // g = recursive function taking the code string s
                                        d = k++) => // and the divisor d
                                        n ? // if n is not equal to 0:
                                        k % d-- ? // if d is not a divisor of k:
                                        g(s, d) // recursive call to test the next divisor
                                        : // else:
                                        g( // recursive call with s updated and d undefined:
                                        d ? // if d is not equal to 0 (i.e. k is composite):
                                        s // leave s unchanged
                                        : // else (k is prime):
                                        s + // decrement n and add to s
                                        `-!/${n--,k}/.test(n)` // the next condition based on the prime k
                                        // the lack of 2nd argument triggers 'd = k++'
                                        ) // end of recursive call
                                        : // else (n = 0):
                                        eval(s + ';)++n') // complete and evaluate the code string
                                        )`for(;` // initial call to g with s = [ "for(;" ]






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Nov 30 at 17:14

























                                        answered Nov 30 at 8:38









                                        Arnauld

                                        70.3k686296




                                        70.3k686296






















                                            up vote
                                            4
                                            down vote














                                            Ruby, 58 bytes





                                            ->n,i=1{i+=1until Prime.take(n).all?{|x|/#{x}/=~"#{i}"};i}


                                            Try it online!



                                            Brute-force, works up to 7 on TIO.






                                            share|improve this answer

























                                              up vote
                                              4
                                              down vote














                                              Ruby, 58 bytes





                                              ->n,i=1{i+=1until Prime.take(n).all?{|x|/#{x}/=~"#{i}"};i}


                                              Try it online!



                                              Brute-force, works up to 7 on TIO.






                                              share|improve this answer























                                                up vote
                                                4
                                                down vote










                                                up vote
                                                4
                                                down vote










                                                Ruby, 58 bytes





                                                ->n,i=1{i+=1until Prime.take(n).all?{|x|/#{x}/=~"#{i}"};i}


                                                Try it online!



                                                Brute-force, works up to 7 on TIO.






                                                share|improve this answer













                                                Ruby, 58 bytes





                                                ->n,i=1{i+=1until Prime.take(n).all?{|x|/#{x}/=~"#{i}"};i}


                                                Try it online!



                                                Brute-force, works up to 7 on TIO.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Nov 30 at 8:25









                                                Kirill L.

                                                3,3761118




                                                3,3761118






















                                                    up vote
                                                    4
                                                    down vote














                                                    Pyth, 14 bytes



                                                    Extremely, extremely slow, times out for $n>5$ on TIO.



                                                    f@I`M.fP_ZQ1y`


                                                    Try it online!



                                                    f@I`M.fP_ZQ1y`     Full program. Q is the input.
                                                    f Find the first positive integer that fulfils the condition.
                                                    @I`M.fP_ZQ1y` Filtering condition, uses T to refer to the number being tested.
                                                    .f Q1 Starting at 1, find the first Q positive integers (.f...Q1) that
                                                    P_Z Are prime.
                                                    `M Convert all of those primes to strings.
                                                    I Check whether the result is invariant (i.e. doesn't change) when...
                                                    @ y` Intersecting this list with the powerset of T as a string.





                                                    Pyth, 15 bytes



                                                    Slightly faster but 1 byte longer.



                                                    f.A/L`T`M.fP_ZQ


                                                    Try it online!



                                                    f.A/L`T`M.fP_ZQ     Full program. Q is the input.
                                                    f Find the first positive integer that fulfils the condition.
                                                    .A/L`T`M.fP_ZQ Filtering condition, uses T to refer to the number being tested.
                                                    .f Q Starting at 1, find the first Q positive integers (.f...Q) that
                                                    P_Z Are prime.
                                                    `M Convert all of those primes to strings.
                                                    .A/L And make sure that they all (.A) occur in (/L)...
                                                    `T The string representation of T.





                                                    share|improve this answer



























                                                      up vote
                                                      4
                                                      down vote














                                                      Pyth, 14 bytes



                                                      Extremely, extremely slow, times out for $n>5$ on TIO.



                                                      f@I`M.fP_ZQ1y`


                                                      Try it online!



                                                      f@I`M.fP_ZQ1y`     Full program. Q is the input.
                                                      f Find the first positive integer that fulfils the condition.
                                                      @I`M.fP_ZQ1y` Filtering condition, uses T to refer to the number being tested.
                                                      .f Q1 Starting at 1, find the first Q positive integers (.f...Q1) that
                                                      P_Z Are prime.
                                                      `M Convert all of those primes to strings.
                                                      I Check whether the result is invariant (i.e. doesn't change) when...
                                                      @ y` Intersecting this list with the powerset of T as a string.





                                                      Pyth, 15 bytes



                                                      Slightly faster but 1 byte longer.



                                                      f.A/L`T`M.fP_ZQ


                                                      Try it online!



                                                      f.A/L`T`M.fP_ZQ     Full program. Q is the input.
                                                      f Find the first positive integer that fulfils the condition.
                                                      .A/L`T`M.fP_ZQ Filtering condition, uses T to refer to the number being tested.
                                                      .f Q Starting at 1, find the first Q positive integers (.f...Q) that
                                                      P_Z Are prime.
                                                      `M Convert all of those primes to strings.
                                                      .A/L And make sure that they all (.A) occur in (/L)...
                                                      `T The string representation of T.





                                                      share|improve this answer

























                                                        up vote
                                                        4
                                                        down vote










                                                        up vote
                                                        4
                                                        down vote










                                                        Pyth, 14 bytes



                                                        Extremely, extremely slow, times out for $n>5$ on TIO.



                                                        f@I`M.fP_ZQ1y`


                                                        Try it online!



                                                        f@I`M.fP_ZQ1y`     Full program. Q is the input.
                                                        f Find the first positive integer that fulfils the condition.
                                                        @I`M.fP_ZQ1y` Filtering condition, uses T to refer to the number being tested.
                                                        .f Q1 Starting at 1, find the first Q positive integers (.f...Q1) that
                                                        P_Z Are prime.
                                                        `M Convert all of those primes to strings.
                                                        I Check whether the result is invariant (i.e. doesn't change) when...
                                                        @ y` Intersecting this list with the powerset of T as a string.





                                                        Pyth, 15 bytes



                                                        Slightly faster but 1 byte longer.



                                                        f.A/L`T`M.fP_ZQ


                                                        Try it online!



                                                        f.A/L`T`M.fP_ZQ     Full program. Q is the input.
                                                        f Find the first positive integer that fulfils the condition.
                                                        .A/L`T`M.fP_ZQ Filtering condition, uses T to refer to the number being tested.
                                                        .f Q Starting at 1, find the first Q positive integers (.f...Q) that
                                                        P_Z Are prime.
                                                        `M Convert all of those primes to strings.
                                                        .A/L And make sure that they all (.A) occur in (/L)...
                                                        `T The string representation of T.





                                                        share|improve this answer















                                                        Pyth, 14 bytes



                                                        Extremely, extremely slow, times out for $n>5$ on TIO.



                                                        f@I`M.fP_ZQ1y`


                                                        Try it online!



                                                        f@I`M.fP_ZQ1y`     Full program. Q is the input.
                                                        f Find the first positive integer that fulfils the condition.
                                                        @I`M.fP_ZQ1y` Filtering condition, uses T to refer to the number being tested.
                                                        .f Q1 Starting at 1, find the first Q positive integers (.f...Q1) that
                                                        P_Z Are prime.
                                                        `M Convert all of those primes to strings.
                                                        I Check whether the result is invariant (i.e. doesn't change) when...
                                                        @ y` Intersecting this list with the powerset of T as a string.





                                                        Pyth, 15 bytes



                                                        Slightly faster but 1 byte longer.



                                                        f.A/L`T`M.fP_ZQ


                                                        Try it online!



                                                        f.A/L`T`M.fP_ZQ     Full program. Q is the input.
                                                        f Find the first positive integer that fulfils the condition.
                                                        .A/L`T`M.fP_ZQ Filtering condition, uses T to refer to the number being tested.
                                                        .f Q Starting at 1, find the first Q positive integers (.f...Q) that
                                                        P_Z Are prime.
                                                        `M Convert all of those primes to strings.
                                                        .A/L And make sure that they all (.A) occur in (/L)...
                                                        `T The string representation of T.






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited Nov 30 at 9:57

























                                                        answered Nov 30 at 9:26









                                                        Mr. Xcoder

                                                        31.3k759197




                                                        31.3k759197






















                                                            up vote
                                                            3
                                                            down vote














                                                            Jelly, 14 bytes



                                                            ³RÆNṾ€ẇ€ṾȦ
                                                            Ç1#


                                                            Try it online!






                                                            share|improve this answer

























                                                              up vote
                                                              3
                                                              down vote














                                                              Jelly, 14 bytes



                                                              ³RÆNṾ€ẇ€ṾȦ
                                                              Ç1#


                                                              Try it online!






                                                              share|improve this answer























                                                                up vote
                                                                3
                                                                down vote










                                                                up vote
                                                                3
                                                                down vote










                                                                Jelly, 14 bytes



                                                                ³RÆNṾ€ẇ€ṾȦ
                                                                Ç1#


                                                                Try it online!






                                                                share|improve this answer













                                                                Jelly, 14 bytes



                                                                ³RÆNṾ€ẇ€ṾȦ
                                                                Ç1#


                                                                Try it online!







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Nov 30 at 7:24









                                                                lirtosiast

                                                                15.6k436107




                                                                15.6k436107






















                                                                    up vote
                                                                    3
                                                                    down vote














                                                                    Charcoal, 42 bytes



                                                                    ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»≔¹ηWΦυ¬№IηIκ≦⊕ηIη


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



                                                                    ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»


                                                                    Build up the first n prime numbers by trial division of all the integers by all of the previously found prime numbers.



                                                                    ≔¹ηWΦυ¬№IηIκ≦⊕η


                                                                    Loop through all integers until we find one which contains all the primes as substrings.



                                                                    Iη


                                                                    Cast the result to string and implicitly print.



                                                                    The program's speed can be doubled at a cost of a byte by replacing the last ≦⊕η with ≦⁺²η but it's still too slow to calculate n>6.






                                                                    share|improve this answer

























                                                                      up vote
                                                                      3
                                                                      down vote














                                                                      Charcoal, 42 bytes



                                                                      ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»≔¹ηWΦυ¬№IηIκ≦⊕ηIη


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



                                                                      ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»


                                                                      Build up the first n prime numbers by trial division of all the integers by all of the previously found prime numbers.



                                                                      ≔¹ηWΦυ¬№IηIκ≦⊕η


                                                                      Loop through all integers until we find one which contains all the primes as substrings.



                                                                      Iη


                                                                      Cast the result to string and implicitly print.



                                                                      The program's speed can be doubled at a cost of a byte by replacing the last ≦⊕η with ≦⁺²η but it's still too slow to calculate n>6.






                                                                      share|improve this answer























                                                                        up vote
                                                                        3
                                                                        down vote










                                                                        up vote
                                                                        3
                                                                        down vote










                                                                        Charcoal, 42 bytes



                                                                        ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»≔¹ηWΦυ¬№IηIκ≦⊕ηIη


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



                                                                        ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»


                                                                        Build up the first n prime numbers by trial division of all the integers by all of the previously found prime numbers.



                                                                        ≔¹ηWΦυ¬№IηIκ≦⊕η


                                                                        Loop through all integers until we find one which contains all the primes as substrings.



                                                                        Iη


                                                                        Cast the result to string and implicitly print.



                                                                        The program's speed can be doubled at a cost of a byte by replacing the last ≦⊕η with ≦⁺²η but it's still too slow to calculate n>6.






                                                                        share|improve this answer













                                                                        Charcoal, 42 bytes



                                                                        ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»≔¹ηWΦυ¬№IηIκ≦⊕ηIη


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



                                                                        ≔¹ηW‹LυIθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»


                                                                        Build up the first n prime numbers by trial division of all the integers by all of the previously found prime numbers.



                                                                        ≔¹ηWΦυ¬№IηIκ≦⊕η


                                                                        Loop through all integers until we find one which contains all the primes as substrings.



                                                                        Iη


                                                                        Cast the result to string and implicitly print.



                                                                        The program's speed can be doubled at a cost of a byte by replacing the last ≦⊕η with ≦⁺²η but it's still too slow to calculate n>6.







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered Nov 30 at 9:35









                                                                        Neil

                                                                        78.5k744175




                                                                        78.5k744175






















                                                                            up vote
                                                                            3
                                                                            down vote














                                                                            Perl 6, 63 bytes





                                                                            {first ->a{!grep {a~~!/$^b/},(grep &is-prime,2..*)[^$_]},2..*}


                                                                            Try it online!



                                                                            A brute force solutions that times out on TIO for numbers above 5, but I'm pretty sure it works correctly. Finds the first positive number that contains the first n primes. Here's a solution that doesn't time out for n=6.



                                                                            Explanation:



                                                                            {                                                             } # Anonymous code block
                                                                            first 2..* # Find the first number
                                                                            ->a{ } # Where:
                                                                            !grep # None of
                                                                            [^$_] # The first n
                                                                            (grep &is-prime,2..*) # primes
                                                                            {a~~!/$^b/}, # Are not in the current number





                                                                            share|improve this answer























                                                                            • Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                                                                              – maxb
                                                                              Nov 30 at 8:16










                                                                            • @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                                                                              – Jo King
                                                                              Nov 30 at 10:59















                                                                            up vote
                                                                            3
                                                                            down vote














                                                                            Perl 6, 63 bytes





                                                                            {first ->a{!grep {a~~!/$^b/},(grep &is-prime,2..*)[^$_]},2..*}


                                                                            Try it online!



                                                                            A brute force solutions that times out on TIO for numbers above 5, but I'm pretty sure it works correctly. Finds the first positive number that contains the first n primes. Here's a solution that doesn't time out for n=6.



                                                                            Explanation:



                                                                            {                                                             } # Anonymous code block
                                                                            first 2..* # Find the first number
                                                                            ->a{ } # Where:
                                                                            !grep # None of
                                                                            [^$_] # The first n
                                                                            (grep &is-prime,2..*) # primes
                                                                            {a~~!/$^b/}, # Are not in the current number





                                                                            share|improve this answer























                                                                            • Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                                                                              – maxb
                                                                              Nov 30 at 8:16










                                                                            • @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                                                                              – Jo King
                                                                              Nov 30 at 10:59













                                                                            up vote
                                                                            3
                                                                            down vote










                                                                            up vote
                                                                            3
                                                                            down vote










                                                                            Perl 6, 63 bytes





                                                                            {first ->a{!grep {a~~!/$^b/},(grep &is-prime,2..*)[^$_]},2..*}


                                                                            Try it online!



                                                                            A brute force solutions that times out on TIO for numbers above 5, but I'm pretty sure it works correctly. Finds the first positive number that contains the first n primes. Here's a solution that doesn't time out for n=6.



                                                                            Explanation:



                                                                            {                                                             } # Anonymous code block
                                                                            first 2..* # Find the first number
                                                                            ->a{ } # Where:
                                                                            !grep # None of
                                                                            [^$_] # The first n
                                                                            (grep &is-prime,2..*) # primes
                                                                            {a~~!/$^b/}, # Are not in the current number





                                                                            share|improve this answer















                                                                            Perl 6, 63 bytes





                                                                            {first ->a{!grep {a~~!/$^b/},(grep &is-prime,2..*)[^$_]},2..*}


                                                                            Try it online!



                                                                            A brute force solutions that times out on TIO for numbers above 5, but I'm pretty sure it works correctly. Finds the first positive number that contains the first n primes. Here's a solution that doesn't time out for n=6.



                                                                            Explanation:



                                                                            {                                                             } # Anonymous code block
                                                                            first 2..* # Find the first number
                                                                            ->a{ } # Where:
                                                                            !grep # None of
                                                                            [^$_] # The first n
                                                                            (grep &is-prime,2..*) # primes
                                                                            {a~~!/$^b/}, # Are not in the current number






                                                                            share|improve this answer














                                                                            share|improve this answer



                                                                            share|improve this answer








                                                                            edited Nov 30 at 10:57

























                                                                            answered Nov 30 at 7:57









                                                                            Jo King

                                                                            19.9k245105




                                                                            19.9k245105












                                                                            • Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                                                                              – maxb
                                                                              Nov 30 at 8:16










                                                                            • @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                                                                              – Jo King
                                                                              Nov 30 at 10:59


















                                                                            • Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                                                                              – maxb
                                                                              Nov 30 at 8:16










                                                                            • @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                                                                              – Jo King
                                                                              Nov 30 at 10:59
















                                                                            Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                                                                            – maxb
                                                                            Nov 30 at 8:16




                                                                            Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.
                                                                            – maxb
                                                                            Nov 30 at 8:16












                                                                            @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                                                                            – Jo King
                                                                            Nov 30 at 10:59




                                                                            @maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.
                                                                            – Jo King
                                                                            Nov 30 at 10:59










                                                                            up vote
                                                                            2
                                                                            down vote














                                                                            Python 2, 131 bytes





                                                                            f=lambda n,x=2:x*all(i in`x`for i in g(n,2))or f(n,x+1)
                                                                            def g(n,x):p=all(x%i for i in range(2,x));return[0]*n and[`x`]*p+g(n-p,x+1)


                                                                            Try it online!



                                                                            f is the function.






                                                                            share|improve this answer

























                                                                              up vote
                                                                              2
                                                                              down vote














                                                                              Python 2, 131 bytes





                                                                              f=lambda n,x=2:x*all(i in`x`for i in g(n,2))or f(n,x+1)
                                                                              def g(n,x):p=all(x%i for i in range(2,x));return[0]*n and[`x`]*p+g(n-p,x+1)


                                                                              Try it online!



                                                                              f is the function.






                                                                              share|improve this answer























                                                                                up vote
                                                                                2
                                                                                down vote










                                                                                up vote
                                                                                2
                                                                                down vote










                                                                                Python 2, 131 bytes





                                                                                f=lambda n,x=2:x*all(i in`x`for i in g(n,2))or f(n,x+1)
                                                                                def g(n,x):p=all(x%i for i in range(2,x));return[0]*n and[`x`]*p+g(n-p,x+1)


                                                                                Try it online!



                                                                                f is the function.






                                                                                share|improve this answer













                                                                                Python 2, 131 bytes





                                                                                f=lambda n,x=2:x*all(i in`x`for i in g(n,2))or f(n,x+1)
                                                                                def g(n,x):p=all(x%i for i in range(2,x));return[0]*n and[`x`]*p+g(n-p,x+1)


                                                                                Try it online!



                                                                                f is the function.







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Nov 30 at 16:04









                                                                                Erik the Outgolfer

                                                                                30.9k429102




                                                                                30.9k429102






















                                                                                    up vote
                                                                                    2
                                                                                    down vote














                                                                                    Python 2, 91 bytes





                                                                                    n=input();l=
                                                                                    P=k=1
                                                                                    while~-all(`x`in`k`for x in(l+[l])[:n]):P*=k*k;k+=1;l+=P%k*[k]
                                                                                    print k


                                                                                    Try it online!






                                                                                    share|improve this answer





















                                                                                    • If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                                                                                      – maxb
                                                                                      Nov 30 at 21:33















                                                                                    up vote
                                                                                    2
                                                                                    down vote














                                                                                    Python 2, 91 bytes





                                                                                    n=input();l=
                                                                                    P=k=1
                                                                                    while~-all(`x`in`k`for x in(l+[l])[:n]):P*=k*k;k+=1;l+=P%k*[k]
                                                                                    print k


                                                                                    Try it online!






                                                                                    share|improve this answer





















                                                                                    • If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                                                                                      – maxb
                                                                                      Nov 30 at 21:33













                                                                                    up vote
                                                                                    2
                                                                                    down vote










                                                                                    up vote
                                                                                    2
                                                                                    down vote










                                                                                    Python 2, 91 bytes





                                                                                    n=input();l=
                                                                                    P=k=1
                                                                                    while~-all(`x`in`k`for x in(l+[l])[:n]):P*=k*k;k+=1;l+=P%k*[k]
                                                                                    print k


                                                                                    Try it online!






                                                                                    share|improve this answer













                                                                                    Python 2, 91 bytes





                                                                                    n=input();l=
                                                                                    P=k=1
                                                                                    while~-all(`x`in`k`for x in(l+[l])[:n]):P*=k*k;k+=1;l+=P%k*[k]
                                                                                    print k


                                                                                    Try it online!







                                                                                    share|improve this answer












                                                                                    share|improve this answer



                                                                                    share|improve this answer










                                                                                    answered Nov 30 at 17:34









                                                                                    ovs

                                                                                    18.4k21059




                                                                                    18.4k21059












                                                                                    • If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                                                                                      – maxb
                                                                                      Nov 30 at 21:33


















                                                                                    • If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                                                                                      – maxb
                                                                                      Nov 30 at 21:33
















                                                                                    If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                                                                                    – maxb
                                                                                    Nov 30 at 21:33




                                                                                    If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!
                                                                                    – maxb
                                                                                    Nov 30 at 21:33










                                                                                    up vote
                                                                                    2
                                                                                    down vote













                                                                                    SAS, 149 bytes



                                                                                    data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 


                                                                                    Input is entered following the cards; statement, like so:



                                                                                    data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 
                                                                                    1
                                                                                    2
                                                                                    3
                                                                                    4
                                                                                    5
                                                                                    6
                                                                                    7


                                                                                    Outputs a dataset p, with the result v, with an output row for each input value. Should technically work for all the given test-cases (the max integer with full precision in SAS is 9,007,199,254,740,992), but I gave up after letting it think for 5 minutes on n=8.



                                                                                    Explanation:



                                                                                    data p;
                                                                                    input n; /* Read a line of input */

                                                                                    z: /* Jump label (not proud of this) */
                                                                                    i=1; /* i is the current value which we are checking for primality */
                                                                                    a=0; /* a is the number of primes we've found so far */
                                                                                    v+1; /* v is the final output value which we'll look for substrings in */

                                                                                    do while(a<n); /* Loop until we find the Nth prime */
                                                                                    i+1;
                                                                                    do j=2 to i while(mod(i,j));end; /* Prime sieve: If mod(i,j) != 0 for all j = 2 to i, then i is prime. This could be faster by only looping to sqrt(i), but would take more bytes */
                                                                                    if j=i then do; /* If i is prime (ie, we made it to the end of the prime sieve)... */
                                                                                    a+1;
                                                                                    if find(cat(v),cat(i))=0 then goto z; /* If i does not appear as a substring of v, then start all over again with the next v */
                                                                                    end;
                                                                                    end;

                                                                                    /* Input values, separated by newlines */
                                                                                    cards;
                                                                                    1
                                                                                    2
                                                                                    3
                                                                                    4
                                                                                    5
                                                                                    6
                                                                                    7





                                                                                    share|improve this answer










                                                                                    New contributor




                                                                                    Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                    Check out our Code of Conduct.






















                                                                                      up vote
                                                                                      2
                                                                                      down vote













                                                                                      SAS, 149 bytes



                                                                                      data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 


                                                                                      Input is entered following the cards; statement, like so:



                                                                                      data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 
                                                                                      1
                                                                                      2
                                                                                      3
                                                                                      4
                                                                                      5
                                                                                      6
                                                                                      7


                                                                                      Outputs a dataset p, with the result v, with an output row for each input value. Should technically work for all the given test-cases (the max integer with full precision in SAS is 9,007,199,254,740,992), but I gave up after letting it think for 5 minutes on n=8.



                                                                                      Explanation:



                                                                                      data p;
                                                                                      input n; /* Read a line of input */

                                                                                      z: /* Jump label (not proud of this) */
                                                                                      i=1; /* i is the current value which we are checking for primality */
                                                                                      a=0; /* a is the number of primes we've found so far */
                                                                                      v+1; /* v is the final output value which we'll look for substrings in */

                                                                                      do while(a<n); /* Loop until we find the Nth prime */
                                                                                      i+1;
                                                                                      do j=2 to i while(mod(i,j));end; /* Prime sieve: If mod(i,j) != 0 for all j = 2 to i, then i is prime. This could be faster by only looping to sqrt(i), but would take more bytes */
                                                                                      if j=i then do; /* If i is prime (ie, we made it to the end of the prime sieve)... */
                                                                                      a+1;
                                                                                      if find(cat(v),cat(i))=0 then goto z; /* If i does not appear as a substring of v, then start all over again with the next v */
                                                                                      end;
                                                                                      end;

                                                                                      /* Input values, separated by newlines */
                                                                                      cards;
                                                                                      1
                                                                                      2
                                                                                      3
                                                                                      4
                                                                                      5
                                                                                      6
                                                                                      7





                                                                                      share|improve this answer










                                                                                      New contributor




                                                                                      Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                      Check out our Code of Conduct.




















                                                                                        up vote
                                                                                        2
                                                                                        down vote










                                                                                        up vote
                                                                                        2
                                                                                        down vote









                                                                                        SAS, 149 bytes



                                                                                        data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 


                                                                                        Input is entered following the cards; statement, like so:



                                                                                        data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 
                                                                                        1
                                                                                        2
                                                                                        3
                                                                                        4
                                                                                        5
                                                                                        6
                                                                                        7


                                                                                        Outputs a dataset p, with the result v, with an output row for each input value. Should technically work for all the given test-cases (the max integer with full precision in SAS is 9,007,199,254,740,992), but I gave up after letting it think for 5 minutes on n=8.



                                                                                        Explanation:



                                                                                        data p;
                                                                                        input n; /* Read a line of input */

                                                                                        z: /* Jump label (not proud of this) */
                                                                                        i=1; /* i is the current value which we are checking for primality */
                                                                                        a=0; /* a is the number of primes we've found so far */
                                                                                        v+1; /* v is the final output value which we'll look for substrings in */

                                                                                        do while(a<n); /* Loop until we find the Nth prime */
                                                                                        i+1;
                                                                                        do j=2 to i while(mod(i,j));end; /* Prime sieve: If mod(i,j) != 0 for all j = 2 to i, then i is prime. This could be faster by only looping to sqrt(i), but would take more bytes */
                                                                                        if j=i then do; /* If i is prime (ie, we made it to the end of the prime sieve)... */
                                                                                        a+1;
                                                                                        if find(cat(v),cat(i))=0 then goto z; /* If i does not appear as a substring of v, then start all over again with the next v */
                                                                                        end;
                                                                                        end;

                                                                                        /* Input values, separated by newlines */
                                                                                        cards;
                                                                                        1
                                                                                        2
                                                                                        3
                                                                                        4
                                                                                        5
                                                                                        6
                                                                                        7





                                                                                        share|improve this answer










                                                                                        New contributor




                                                                                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                        Check out our Code of Conduct.









                                                                                        SAS, 149 bytes



                                                                                        data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 


                                                                                        Input is entered following the cards; statement, like so:



                                                                                        data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards; 
                                                                                        1
                                                                                        2
                                                                                        3
                                                                                        4
                                                                                        5
                                                                                        6
                                                                                        7


                                                                                        Outputs a dataset p, with the result v, with an output row for each input value. Should technically work for all the given test-cases (the max integer with full precision in SAS is 9,007,199,254,740,992), but I gave up after letting it think for 5 minutes on n=8.



                                                                                        Explanation:



                                                                                        data p;
                                                                                        input n; /* Read a line of input */

                                                                                        z: /* Jump label (not proud of this) */
                                                                                        i=1; /* i is the current value which we are checking for primality */
                                                                                        a=0; /* a is the number of primes we've found so far */
                                                                                        v+1; /* v is the final output value which we'll look for substrings in */

                                                                                        do while(a<n); /* Loop until we find the Nth prime */
                                                                                        i+1;
                                                                                        do j=2 to i while(mod(i,j));end; /* Prime sieve: If mod(i,j) != 0 for all j = 2 to i, then i is prime. This could be faster by only looping to sqrt(i), but would take more bytes */
                                                                                        if j=i then do; /* If i is prime (ie, we made it to the end of the prime sieve)... */
                                                                                        a+1;
                                                                                        if find(cat(v),cat(i))=0 then goto z; /* If i does not appear as a substring of v, then start all over again with the next v */
                                                                                        end;
                                                                                        end;

                                                                                        /* Input values, separated by newlines */
                                                                                        cards;
                                                                                        1
                                                                                        2
                                                                                        3
                                                                                        4
                                                                                        5
                                                                                        6
                                                                                        7






                                                                                        share|improve this answer










                                                                                        New contributor




                                                                                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                        Check out our Code of Conduct.









                                                                                        share|improve this answer



                                                                                        share|improve this answer








                                                                                        edited Nov 30 at 21:51









                                                                                        Shaggy

                                                                                        18.5k21663




                                                                                        18.5k21663






                                                                                        New contributor




                                                                                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                        Check out our Code of Conduct.









                                                                                        answered Nov 30 at 15:26









                                                                                        Josh Eller

                                                                                        1413




                                                                                        1413




                                                                                        New contributor




                                                                                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                        Check out our Code of Conduct.





                                                                                        New contributor





                                                                                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                        Check out our Code of Conduct.






                                                                                        Josh Eller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                                        Check out our Code of Conduct.






















                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            Haskell, 102 bytes





                                                                                            import Data.List
                                                                                            f n|x<-[2..n*n]=[a|a<-[2..],all(`isInfixOf`show a).take n$show<$>x\((*)<$>x<*>x)]!!0


                                                                                            Try it online!



                                                                                            Explanation / Ungolfed



                                                                                            Since we already have Data.List imported we might as well use it: Instead of the good old take n[p|p<-[2..],all((>0).mod p)[2..p-1]] we can use another way of generating all primes we need. Namely, we generate a sufficient amount of composites and use these together with (\):



                                                                                            [2..n*n] \ ( (*) <$> [2..n*n] <*> [2..n*n] )


                                                                                            Using n*n suffices because $pi(n) < frac{n^2}{log(n^2)}$. The rest is just a simple list comprehension:



                                                                                            [ a | a <- [2..], all (`isInfixOf` show a) . take n $ enoughPrimes ] !!0





                                                                                            share|improve this answer

























                                                                                              up vote
                                                                                              1
                                                                                              down vote














                                                                                              Haskell, 102 bytes





                                                                                              import Data.List
                                                                                              f n|x<-[2..n*n]=[a|a<-[2..],all(`isInfixOf`show a).take n$show<$>x\((*)<$>x<*>x)]!!0


                                                                                              Try it online!



                                                                                              Explanation / Ungolfed



                                                                                              Since we already have Data.List imported we might as well use it: Instead of the good old take n[p|p<-[2..],all((>0).mod p)[2..p-1]] we can use another way of generating all primes we need. Namely, we generate a sufficient amount of composites and use these together with (\):



                                                                                              [2..n*n] \ ( (*) <$> [2..n*n] <*> [2..n*n] )


                                                                                              Using n*n suffices because $pi(n) < frac{n^2}{log(n^2)}$. The rest is just a simple list comprehension:



                                                                                              [ a | a <- [2..], all (`isInfixOf` show a) . take n $ enoughPrimes ] !!0





                                                                                              share|improve this answer























                                                                                                up vote
                                                                                                1
                                                                                                down vote










                                                                                                up vote
                                                                                                1
                                                                                                down vote










                                                                                                Haskell, 102 bytes





                                                                                                import Data.List
                                                                                                f n|x<-[2..n*n]=[a|a<-[2..],all(`isInfixOf`show a).take n$show<$>x\((*)<$>x<*>x)]!!0


                                                                                                Try it online!



                                                                                                Explanation / Ungolfed



                                                                                                Since we already have Data.List imported we might as well use it: Instead of the good old take n[p|p<-[2..],all((>0).mod p)[2..p-1]] we can use another way of generating all primes we need. Namely, we generate a sufficient amount of composites and use these together with (\):



                                                                                                [2..n*n] \ ( (*) <$> [2..n*n] <*> [2..n*n] )


                                                                                                Using n*n suffices because $pi(n) < frac{n^2}{log(n^2)}$. The rest is just a simple list comprehension:



                                                                                                [ a | a <- [2..], all (`isInfixOf` show a) . take n $ enoughPrimes ] !!0





                                                                                                share|improve this answer













                                                                                                Haskell, 102 bytes





                                                                                                import Data.List
                                                                                                f n|x<-[2..n*n]=[a|a<-[2..],all(`isInfixOf`show a).take n$show<$>x\((*)<$>x<*>x)]!!0


                                                                                                Try it online!



                                                                                                Explanation / Ungolfed



                                                                                                Since we already have Data.List imported we might as well use it: Instead of the good old take n[p|p<-[2..],all((>0).mod p)[2..p-1]] we can use another way of generating all primes we need. Namely, we generate a sufficient amount of composites and use these together with (\):



                                                                                                [2..n*n] \ ( (*) <$> [2..n*n] <*> [2..n*n] )


                                                                                                Using n*n suffices because $pi(n) < frac{n^2}{log(n^2)}$. The rest is just a simple list comprehension:



                                                                                                [ a | a <- [2..], all (`isInfixOf` show a) . take n $ enoughPrimes ] !!0






                                                                                                share|improve this answer












                                                                                                share|improve this answer



                                                                                                share|improve this answer










                                                                                                answered Dec 1 at 0:42









                                                                                                BMO

                                                                                                10.8k21881




                                                                                                10.8k21881






















                                                                                                    up vote
                                                                                                    1
                                                                                                    down vote













                                                                                                    Japt, 20 18 bytes



                                                                                                    Far from my finest work, I was just happy to get it working after the day I've had. I'm sure I'll end up tapping away at it down the boozer later!



                                                                                                    _õ fj ¯U e!øZs}aUÄ


                                                                                                    Try it - takes 13 seconds to run for an input of 7, throws a wobbly after that (the updated version craps out at 5 for me, but that might just be my phone).






                                                                                                    share|improve this answer























                                                                                                    • @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 21:47










                                                                                                    • @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 22:36










                                                                                                    • It's working now! ¯_(ツ)_/¯
                                                                                                      – Oliver
                                                                                                      Nov 30 at 23:41










                                                                                                    • @Oliver, still not working for me. Weirderer and weirderer!
                                                                                                      – Shaggy
                                                                                                      Dec 1 at 0:35










                                                                                                    • It has been working for me since I went from my work computer to my home computer. Weird indeed!
                                                                                                      – Oliver
                                                                                                      Dec 1 at 0:37















                                                                                                    up vote
                                                                                                    1
                                                                                                    down vote













                                                                                                    Japt, 20 18 bytes



                                                                                                    Far from my finest work, I was just happy to get it working after the day I've had. I'm sure I'll end up tapping away at it down the boozer later!



                                                                                                    _õ fj ¯U e!øZs}aUÄ


                                                                                                    Try it - takes 13 seconds to run for an input of 7, throws a wobbly after that (the updated version craps out at 5 for me, but that might just be my phone).






                                                                                                    share|improve this answer























                                                                                                    • @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 21:47










                                                                                                    • @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 22:36










                                                                                                    • It's working now! ¯_(ツ)_/¯
                                                                                                      – Oliver
                                                                                                      Nov 30 at 23:41










                                                                                                    • @Oliver, still not working for me. Weirderer and weirderer!
                                                                                                      – Shaggy
                                                                                                      Dec 1 at 0:35










                                                                                                    • It has been working for me since I went from my work computer to my home computer. Weird indeed!
                                                                                                      – Oliver
                                                                                                      Dec 1 at 0:37













                                                                                                    up vote
                                                                                                    1
                                                                                                    down vote










                                                                                                    up vote
                                                                                                    1
                                                                                                    down vote









                                                                                                    Japt, 20 18 bytes



                                                                                                    Far from my finest work, I was just happy to get it working after the day I've had. I'm sure I'll end up tapping away at it down the boozer later!



                                                                                                    _õ fj ¯U e!øZs}aUÄ


                                                                                                    Try it - takes 13 seconds to run for an input of 7, throws a wobbly after that (the updated version craps out at 5 for me, but that might just be my phone).






                                                                                                    share|improve this answer














                                                                                                    Japt, 20 18 bytes



                                                                                                    Far from my finest work, I was just happy to get it working after the day I've had. I'm sure I'll end up tapping away at it down the boozer later!



                                                                                                    _õ fj ¯U e!øZs}aUÄ


                                                                                                    Try it - takes 13 seconds to run for an input of 7, throws a wobbly after that (the updated version craps out at 5 for me, but that might just be my phone).







                                                                                                    share|improve this answer














                                                                                                    share|improve this answer



                                                                                                    share|improve this answer








                                                                                                    edited 2 days ago

























                                                                                                    answered Nov 30 at 18:09









                                                                                                    Shaggy

                                                                                                    18.5k21663




                                                                                                    18.5k21663












                                                                                                    • @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 21:47










                                                                                                    • @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 22:36










                                                                                                    • It's working now! ¯_(ツ)_/¯
                                                                                                      – Oliver
                                                                                                      Nov 30 at 23:41










                                                                                                    • @Oliver, still not working for me. Weirderer and weirderer!
                                                                                                      – Shaggy
                                                                                                      Dec 1 at 0:35










                                                                                                    • It has been working for me since I went from my work computer to my home computer. Weird indeed!
                                                                                                      – Oliver
                                                                                                      Dec 1 at 0:37


















                                                                                                    • @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 21:47










                                                                                                    • @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                                                                                                      – Shaggy
                                                                                                      Nov 30 at 22:36










                                                                                                    • It's working now! ¯_(ツ)_/¯
                                                                                                      – Oliver
                                                                                                      Nov 30 at 23:41










                                                                                                    • @Oliver, still not working for me. Weirderer and weirderer!
                                                                                                      – Shaggy
                                                                                                      Dec 1 at 0:35










                                                                                                    • It has been working for me since I went from my work computer to my home computer. Weird indeed!
                                                                                                      – Oliver
                                                                                                      Dec 1 at 0:37
















                                                                                                    @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                                                                                                    – Shaggy
                                                                                                    Nov 30 at 21:47




                                                                                                    @Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.
                                                                                                    – Shaggy
                                                                                                    Nov 30 at 21:47












                                                                                                    @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                                                                                                    – Shaggy
                                                                                                    Nov 30 at 22:36




                                                                                                    @Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!
                                                                                                    – Shaggy
                                                                                                    Nov 30 at 22:36












                                                                                                    It's working now! ¯_(ツ)_/¯
                                                                                                    – Oliver
                                                                                                    Nov 30 at 23:41




                                                                                                    It's working now! ¯_(ツ)_/¯
                                                                                                    – Oliver
                                                                                                    Nov 30 at 23:41












                                                                                                    @Oliver, still not working for me. Weirderer and weirderer!
                                                                                                    – Shaggy
                                                                                                    Dec 1 at 0:35




                                                                                                    @Oliver, still not working for me. Weirderer and weirderer!
                                                                                                    – Shaggy
                                                                                                    Dec 1 at 0:35












                                                                                                    It has been working for me since I went from my work computer to my home computer. Weird indeed!
                                                                                                    – Oliver
                                                                                                    Dec 1 at 0:37




                                                                                                    It has been working for me since I went from my work computer to my home computer. Weird indeed!
                                                                                                    – Oliver
                                                                                                    Dec 1 at 0:37


















                                                                                                    draft saved

                                                                                                    draft discarded




















































                                                                                                    If this is an answer to a challenge…




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


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


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



                                                                                                    More generally…




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


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






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


                                                                                                    Please pay close attention to the following guidance:


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

                                                                                                    But avoid



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

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


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




                                                                                                    draft saved


                                                                                                    draft discarded














                                                                                                    StackExchange.ready(
                                                                                                    function () {
                                                                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176823%2fprime-containment-numbers-golf-edition%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

                                                                                                    AnyDesk - Fatal Program Failure

                                                                                                    How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

                                                                                                    QoS: MAC-Priority for clients behind a repeater