Generate some rough numbers











up vote
15
down vote

favorite












Background



A number n can be described as B-rough if all of the prime factors of n strictly exceed B.



The Challenge



Given two positive integers B and k, output the first k B-rough numbers.



Examples



Let f(B, k) be a function which returns the set containing the first k B-rough numbers.



> f(1, 10)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

> f(2, 5)
1, 3, 5, 7, 9

> f(10, 14)
1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59









share|improve this question


















  • 2




    Can you elaborate on the challenge? I don't understand it. Maybe explain the examples?
    – d-b
    Nov 3 at 17:41










  • I don't understand why you include 1 in all your answers when it's never greater than B?
    – kamoroso94
    Nov 3 at 17:56






  • 1




    1 has no prime factors, so every prime factor of 1 is larger than B and 1 should appear in the output independent of B.
    – Hood
    Nov 3 at 19:41










  • @d-b Factorize n into primes. If all of those primes are greater than B, n is B-rough.
    – Addison Crump
    Nov 3 at 20:06










  • @AddisonCrump So for example, since the primes for 35 are 5 and 7, 35 is 4-rough? Is this some recognized common terminology? Never heard of it before. I still don't under the examples, especially not the last one. 14 numbers but what is 10??
    – d-b
    Nov 3 at 20:30















up vote
15
down vote

favorite












Background



A number n can be described as B-rough if all of the prime factors of n strictly exceed B.



The Challenge



Given two positive integers B and k, output the first k B-rough numbers.



Examples



Let f(B, k) be a function which returns the set containing the first k B-rough numbers.



> f(1, 10)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

> f(2, 5)
1, 3, 5, 7, 9

> f(10, 14)
1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59









share|improve this question


















  • 2




    Can you elaborate on the challenge? I don't understand it. Maybe explain the examples?
    – d-b
    Nov 3 at 17:41










  • I don't understand why you include 1 in all your answers when it's never greater than B?
    – kamoroso94
    Nov 3 at 17:56






  • 1




    1 has no prime factors, so every prime factor of 1 is larger than B and 1 should appear in the output independent of B.
    – Hood
    Nov 3 at 19:41










  • @d-b Factorize n into primes. If all of those primes are greater than B, n is B-rough.
    – Addison Crump
    Nov 3 at 20:06










  • @AddisonCrump So for example, since the primes for 35 are 5 and 7, 35 is 4-rough? Is this some recognized common terminology? Never heard of it before. I still don't under the examples, especially not the last one. 14 numbers but what is 10??
    – d-b
    Nov 3 at 20:30













up vote
15
down vote

favorite









up vote
15
down vote

favorite











Background



A number n can be described as B-rough if all of the prime factors of n strictly exceed B.



The Challenge



Given two positive integers B and k, output the first k B-rough numbers.



Examples



Let f(B, k) be a function which returns the set containing the first k B-rough numbers.



> f(1, 10)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

> f(2, 5)
1, 3, 5, 7, 9

> f(10, 14)
1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59









share|improve this question













Background



A number n can be described as B-rough if all of the prime factors of n strictly exceed B.



The Challenge



Given two positive integers B and k, output the first k B-rough numbers.



Examples



Let f(B, k) be a function which returns the set containing the first k B-rough numbers.



> f(1, 10)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

> f(2, 5)
1, 3, 5, 7, 9

> f(10, 14)
1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59






code-golf number-theory primes factoring






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 3 at 6:10









Addison Crump

8,30913282




8,30913282








  • 2




    Can you elaborate on the challenge? I don't understand it. Maybe explain the examples?
    – d-b
    Nov 3 at 17:41










  • I don't understand why you include 1 in all your answers when it's never greater than B?
    – kamoroso94
    Nov 3 at 17:56






  • 1




    1 has no prime factors, so every prime factor of 1 is larger than B and 1 should appear in the output independent of B.
    – Hood
    Nov 3 at 19:41










  • @d-b Factorize n into primes. If all of those primes are greater than B, n is B-rough.
    – Addison Crump
    Nov 3 at 20:06










  • @AddisonCrump So for example, since the primes for 35 are 5 and 7, 35 is 4-rough? Is this some recognized common terminology? Never heard of it before. I still don't under the examples, especially not the last one. 14 numbers but what is 10??
    – d-b
    Nov 3 at 20:30














  • 2




    Can you elaborate on the challenge? I don't understand it. Maybe explain the examples?
    – d-b
    Nov 3 at 17:41










  • I don't understand why you include 1 in all your answers when it's never greater than B?
    – kamoroso94
    Nov 3 at 17:56






  • 1




    1 has no prime factors, so every prime factor of 1 is larger than B and 1 should appear in the output independent of B.
    – Hood
    Nov 3 at 19:41










  • @d-b Factorize n into primes. If all of those primes are greater than B, n is B-rough.
    – Addison Crump
    Nov 3 at 20:06










  • @AddisonCrump So for example, since the primes for 35 are 5 and 7, 35 is 4-rough? Is this some recognized common terminology? Never heard of it before. I still don't under the examples, especially not the last one. 14 numbers but what is 10??
    – d-b
    Nov 3 at 20:30








2




2




Can you elaborate on the challenge? I don't understand it. Maybe explain the examples?
– d-b
Nov 3 at 17:41




Can you elaborate on the challenge? I don't understand it. Maybe explain the examples?
– d-b
Nov 3 at 17:41












I don't understand why you include 1 in all your answers when it's never greater than B?
– kamoroso94
Nov 3 at 17:56




I don't understand why you include 1 in all your answers when it's never greater than B?
– kamoroso94
Nov 3 at 17:56




1




1




1 has no prime factors, so every prime factor of 1 is larger than B and 1 should appear in the output independent of B.
– Hood
Nov 3 at 19:41




1 has no prime factors, so every prime factor of 1 is larger than B and 1 should appear in the output independent of B.
– Hood
Nov 3 at 19:41












@d-b Factorize n into primes. If all of those primes are greater than B, n is B-rough.
– Addison Crump
Nov 3 at 20:06




@d-b Factorize n into primes. If all of those primes are greater than B, n is B-rough.
– Addison Crump
Nov 3 at 20:06












@AddisonCrump So for example, since the primes for 35 are 5 and 7, 35 is 4-rough? Is this some recognized common terminology? Never heard of it before. I still don't under the examples, especially not the last one. 14 numbers but what is 10??
– d-b
Nov 3 at 20:30




@AddisonCrump So for example, since the primes for 35 are 5 and 7, 35 is 4-rough? Is this some recognized common terminology? Never heard of it before. I still don't under the examples, especially not the last one. 14 numbers but what is 10??
– d-b
Nov 3 at 20:30










11 Answers
11






active

oldest

votes

















up vote
5
down vote














Haskell, 53 44 bytes





b%k=take k[n|n<-[1..],all((>0).mod n)[2..b]]


Try it online!



Thanks to H.PWiz for -9 bytes!



b%k=                       -- given inputs b and k
take k -- take the first k elements from
[n|n<-[1..] -- the infinite list of all n > 0
,all [2..b]] -- where all numbers from 2 to b (inclusive)
((>0).mod n) -- do not divide n.





share|improve this answer























  • This can be simplified somewhat
    – H.PWiz
    Nov 3 at 12:47










  • @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
    – Laikoni
    Nov 3 at 12:57


















up vote
5
down vote














Python 3, 80, 75 bytes





lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k]


Try it online!



Thanks to shooqie for saving 5 bytes.



This assumes that the k'th B-rough number will never exceed $B * k$, which I don't know how to prove, but seems like a fairly safe assumption (and I can't find any counterexamples).



Alternate solution:




Python 2, 78 bytes





B,k=input()
i=1
while k:
if all(i%j for j in range(2,B+1)):print i;k-=1
i+=1


Try it online!



This solution does not make the above solution. And is much more efficient.






share|improve this answer



















  • 3




    Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
    – Addison Crump
    Nov 3 at 7:07






  • 1




    Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
    – shooqie
    Nov 3 at 10:59






  • 1




    @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
    – Anush
    2 days ago










  • @Anush Sadly, my proof didn't work, because I made a mistake
    – Black Owl Kai
    2 days ago


















up vote
3
down vote














Jelly, 7 bytes



1Æf>Ạɗ#


Try it online!






share|improve this answer




























    up vote
    3
    down vote














    Perl 6, 35 32 bytes



    -3 bytes thanks to nwellnof!





    {grep(*%all(2..$^b),1..*)[^$^k]}


    Try it online!



    An anonymous code block that takes two integers and returns a list of integers.



    Explanation



    {                              }  # Anonymous code block
    grep( ,1..*) # Filter from the positive integers
    * # Is the number
    % # Not divisible by
    all( ) # All of the numbers
    2..$^b # From 2 to b
    [^$^k] # And take the first k numbers





    share|improve this answer























    • What does all do?
      – Addison Crump
      Nov 3 at 7:07






    • 1




      @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
      – Jo King
      Nov 3 at 7:10










    • @nwellnhof Wow! So that's what Junctions are useful for!
      – Jo King
      Nov 3 at 10:56










    • Yes, note that you could also use [&] instead of all.
      – nwellnhof
      Nov 3 at 10:57










    • @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
      – Jo King
      Nov 3 at 11:07




















    up vote
    2
    down vote














    Husk, 9 8 bytes



    ↑foΛ>⁰pN


    Try it online!



    Takes $B$ as first and $ k $ as second input.



    ↑         -- take the first k elements 
    N -- from the natural numbers
    f -- filtered by
    o p -- the prime factors
    Λ>⁰ -- are all larger than the first input





    share|improve this answer






























      up vote
      2
      down vote














      Charcoal, 33 bytes



      NθNη≔⁰ζW‹Lυη«≦⊕ζ¿¬Φθ∧κ¬﹪ζ⊕κ⊞υζ»Iυ


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



      NθNη


      Input B and k.



      ≔⁰ζ


      Set z to 0.



      W‹Lυη«


      Repeat until we have k values.



      ≦⊕ζ


      Increment z.



      ¿¬Φθ∧κ¬﹪ζ⊕κ


      Divide z by all the numbers from 2 to B and see if any remainder is zero.



      ⊞υζ»


      If not then push z to the predefined empty list.



      Iυ


      Cast the list to string and implicitly output it.






      share|improve this answer




























        up vote
        2
        down vote













        JavaScript (ES6), 68 bytes



        Takes input as (b)(k).





        b=>k=>(o=,n=1,g=d=>(d<2?o.push(n)==k:n%d&&g(d-1))||g(b,n++))(b)&&o


        Try it online!



        Commented



        b => k => (             // input = b and k
        o = , // o = output array
        n = 1, // n = value to test
        g = d => ( // g = recursive function, taking the divisor d
        d < 2 ? // if d = 1:
        o.push(n) == k // push n into o and test whether o contains k elements
        : // else:
        n % d && g(d - 1) // if d is not a divisor of n, do a recursive call with d - 1
        ) || // if the final result of g() is falsy,
        g(b, n++) // do a recursive call with d = b and n + 1
        )(b) // initial call to g() with d = b
        && o // return o





        share|improve this answer






























          up vote
          1
          down vote














          Jelly, 10 bytes



          1µg³!¤Ịµ⁴#


          Try it online!



          How it works



          1µg³!¤Ịµ⁴#    Dyadic main link. Left = B, right = k
          µ⁴# Take first k numbers satisfying...
          g GCD with
          ³!¤ B factorial
          Ị is insignificant (abs(x) <= 1)?
          1µ ... starting from 1.





          share|improve this answer






























            up vote
            1
            down vote














            JavaScript (Node.js), 68 bytes





            b=>g=(k,i=1,j=b)=>k?j>1?i%j?g(k,i,j-1):g(k,i+1):[i,...g(k-1,i+1)]:


            Try it online!






            share|improve this answer




























              up vote
              1
              down vote













              APL(NARS), 52 chars, 104 bytes



              r←a f w;i
              r←,i←1⋄→3
              i+←1⋄→3×⍳∨/a≥πi⋄r←r,i
              →2×⍳w>↑⍴r


              Above it seems the rows after 'r←a f w;i' have names 1 2 3;test:



                o←⎕fmt
              o 1 h 2
              ┌2───┐
              │ 1 2│
              └~───┘
              o 1 h 1
              ┌1─┐
              │ 1│
              └~─┘
              o 10 h 14
              ┌14───────────────────────────────────────┐
              │ 1 11 13 17 19 23 29 31 37 41 43 47 53 59│
              └~────────────────────────────────────────┘





              share|improve this answer






























                up vote
                1
                down vote














                05AB1E, 9 bytes



                ∞ʒÒ¹›P}²£


                Try it online or verify all test cases.



                Explanation:





                ∞          # Infinite list starting at 1: [1,...]
                ʒ } # Filter it by:
                Ò # Get all prime factors of the current number
                ¹› # Check for each if they are larger than the first input
                P # And check if it's truthy for all of them
                ²£ # Leave only the leading amount of items equal to the second input





                share|improve this answer





















                  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%2f175158%2fgenerate-some-rough-numbers%23new-answer', 'question_page');
                  }
                  );

                  Post as a guest
































                  11 Answers
                  11






                  active

                  oldest

                  votes








                  11 Answers
                  11






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes








                  up vote
                  5
                  down vote














                  Haskell, 53 44 bytes





                  b%k=take k[n|n<-[1..],all((>0).mod n)[2..b]]


                  Try it online!



                  Thanks to H.PWiz for -9 bytes!



                  b%k=                       -- given inputs b and k
                  take k -- take the first k elements from
                  [n|n<-[1..] -- the infinite list of all n > 0
                  ,all [2..b]] -- where all numbers from 2 to b (inclusive)
                  ((>0).mod n) -- do not divide n.





                  share|improve this answer























                  • This can be simplified somewhat
                    – H.PWiz
                    Nov 3 at 12:47










                  • @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
                    – Laikoni
                    Nov 3 at 12:57















                  up vote
                  5
                  down vote














                  Haskell, 53 44 bytes





                  b%k=take k[n|n<-[1..],all((>0).mod n)[2..b]]


                  Try it online!



                  Thanks to H.PWiz for -9 bytes!



                  b%k=                       -- given inputs b and k
                  take k -- take the first k elements from
                  [n|n<-[1..] -- the infinite list of all n > 0
                  ,all [2..b]] -- where all numbers from 2 to b (inclusive)
                  ((>0).mod n) -- do not divide n.





                  share|improve this answer























                  • This can be simplified somewhat
                    – H.PWiz
                    Nov 3 at 12:47










                  • @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
                    – Laikoni
                    Nov 3 at 12:57













                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote










                  Haskell, 53 44 bytes





                  b%k=take k[n|n<-[1..],all((>0).mod n)[2..b]]


                  Try it online!



                  Thanks to H.PWiz for -9 bytes!



                  b%k=                       -- given inputs b and k
                  take k -- take the first k elements from
                  [n|n<-[1..] -- the infinite list of all n > 0
                  ,all [2..b]] -- where all numbers from 2 to b (inclusive)
                  ((>0).mod n) -- do not divide n.





                  share|improve this answer















                  Haskell, 53 44 bytes





                  b%k=take k[n|n<-[1..],all((>0).mod n)[2..b]]


                  Try it online!



                  Thanks to H.PWiz for -9 bytes!



                  b%k=                       -- given inputs b and k
                  take k -- take the first k elements from
                  [n|n<-[1..] -- the infinite list of all n > 0
                  ,all [2..b]] -- where all numbers from 2 to b (inclusive)
                  ((>0).mod n) -- do not divide n.






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 3 at 13:02

























                  answered Nov 3 at 9:55









                  Laikoni

                  19.3k43596




                  19.3k43596












                  • This can be simplified somewhat
                    – H.PWiz
                    Nov 3 at 12:47










                  • @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
                    – Laikoni
                    Nov 3 at 12:57


















                  • This can be simplified somewhat
                    – H.PWiz
                    Nov 3 at 12:47










                  • @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
                    – Laikoni
                    Nov 3 at 12:57
















                  This can be simplified somewhat
                  – H.PWiz
                  Nov 3 at 12:47




                  This can be simplified somewhat
                  – H.PWiz
                  Nov 3 at 12:47












                  @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
                  – Laikoni
                  Nov 3 at 12:57




                  @H.PWiz Right, somehow I only thought about taking the (>b)-part inside the comprehension (which does not work) but not the other way around. Thanks!
                  – Laikoni
                  Nov 3 at 12:57










                  up vote
                  5
                  down vote














                  Python 3, 80, 75 bytes





                  lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k]


                  Try it online!



                  Thanks to shooqie for saving 5 bytes.



                  This assumes that the k'th B-rough number will never exceed $B * k$, which I don't know how to prove, but seems like a fairly safe assumption (and I can't find any counterexamples).



                  Alternate solution:




                  Python 2, 78 bytes





                  B,k=input()
                  i=1
                  while k:
                  if all(i%j for j in range(2,B+1)):print i;k-=1
                  i+=1


                  Try it online!



                  This solution does not make the above solution. And is much more efficient.






                  share|improve this answer



















                  • 3




                    Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
                    – Addison Crump
                    Nov 3 at 7:07






                  • 1




                    Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
                    – shooqie
                    Nov 3 at 10:59






                  • 1




                    @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
                    – Anush
                    2 days ago










                  • @Anush Sadly, my proof didn't work, because I made a mistake
                    – Black Owl Kai
                    2 days ago















                  up vote
                  5
                  down vote














                  Python 3, 80, 75 bytes





                  lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k]


                  Try it online!



                  Thanks to shooqie for saving 5 bytes.



                  This assumes that the k'th B-rough number will never exceed $B * k$, which I don't know how to prove, but seems like a fairly safe assumption (and I can't find any counterexamples).



                  Alternate solution:




                  Python 2, 78 bytes





                  B,k=input()
                  i=1
                  while k:
                  if all(i%j for j in range(2,B+1)):print i;k-=1
                  i+=1


                  Try it online!



                  This solution does not make the above solution. And is much more efficient.






                  share|improve this answer



















                  • 3




                    Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
                    – Addison Crump
                    Nov 3 at 7:07






                  • 1




                    Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
                    – shooqie
                    Nov 3 at 10:59






                  • 1




                    @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
                    – Anush
                    2 days ago










                  • @Anush Sadly, my proof didn't work, because I made a mistake
                    – Black Owl Kai
                    2 days ago













                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote










                  Python 3, 80, 75 bytes





                  lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k]


                  Try it online!



                  Thanks to shooqie for saving 5 bytes.



                  This assumes that the k'th B-rough number will never exceed $B * k$, which I don't know how to prove, but seems like a fairly safe assumption (and I can't find any counterexamples).



                  Alternate solution:




                  Python 2, 78 bytes





                  B,k=input()
                  i=1
                  while k:
                  if all(i%j for j in range(2,B+1)):print i;k-=1
                  i+=1


                  Try it online!



                  This solution does not make the above solution. And is much more efficient.






                  share|improve this answer















                  Python 3, 80, 75 bytes





                  lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k]


                  Try it online!



                  Thanks to shooqie for saving 5 bytes.



                  This assumes that the k'th B-rough number will never exceed $B * k$, which I don't know how to prove, but seems like a fairly safe assumption (and I can't find any counterexamples).



                  Alternate solution:




                  Python 2, 78 bytes





                  B,k=input()
                  i=1
                  while k:
                  if all(i%j for j in range(2,B+1)):print i;k-=1
                  i+=1


                  Try it online!



                  This solution does not make the above solution. And is much more efficient.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 3 at 17:49

























                  answered Nov 3 at 7:00









                  DJMcMayhem

                  40.5k11143307




                  40.5k11143307








                  • 3




                    Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
                    – Addison Crump
                    Nov 3 at 7:07






                  • 1




                    Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
                    – shooqie
                    Nov 3 at 10:59






                  • 1




                    @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
                    – Anush
                    2 days ago










                  • @Anush Sadly, my proof didn't work, because I made a mistake
                    – Black Owl Kai
                    2 days ago














                  • 3




                    Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
                    – Addison Crump
                    Nov 3 at 7:07






                  • 1




                    Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
                    – shooqie
                    Nov 3 at 10:59






                  • 1




                    @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
                    – Anush
                    2 days ago










                  • @Anush Sadly, my proof didn't work, because I made a mistake
                    – Black Owl Kai
                    2 days ago








                  3




                  3




                  Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
                  – Addison Crump
                  Nov 3 at 7:07




                  Hmm, that assumption is probably verifiable, but an interesting problem nonetheless. I'll bounty for a proof.
                  – Addison Crump
                  Nov 3 at 7:07




                  1




                  1




                  Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
                  – shooqie
                  Nov 3 at 10:59




                  Why not lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k] ?
                  – shooqie
                  Nov 3 at 10:59




                  1




                  1




                  @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
                  – Anush
                  2 days ago




                  @BlackOwlKai That sounds cool. See also math.stackexchange.com/questions/2983364/…
                  – Anush
                  2 days ago












                  @Anush Sadly, my proof didn't work, because I made a mistake
                  – Black Owl Kai
                  2 days ago




                  @Anush Sadly, my proof didn't work, because I made a mistake
                  – Black Owl Kai
                  2 days ago










                  up vote
                  3
                  down vote














                  Jelly, 7 bytes



                  1Æf>Ạɗ#


                  Try it online!






                  share|improve this answer

























                    up vote
                    3
                    down vote














                    Jelly, 7 bytes



                    1Æf>Ạɗ#


                    Try it online!






                    share|improve this answer























                      up vote
                      3
                      down vote










                      up vote
                      3
                      down vote










                      Jelly, 7 bytes



                      1Æf>Ạɗ#


                      Try it online!






                      share|improve this answer













                      Jelly, 7 bytes



                      1Æf>Ạɗ#


                      Try it online!







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 3 at 10:04









                      Erik the Outgolfer

                      30.1k428100




                      30.1k428100






















                          up vote
                          3
                          down vote














                          Perl 6, 35 32 bytes



                          -3 bytes thanks to nwellnof!





                          {grep(*%all(2..$^b),1..*)[^$^k]}


                          Try it online!



                          An anonymous code block that takes two integers and returns a list of integers.



                          Explanation



                          {                              }  # Anonymous code block
                          grep( ,1..*) # Filter from the positive integers
                          * # Is the number
                          % # Not divisible by
                          all( ) # All of the numbers
                          2..$^b # From 2 to b
                          [^$^k] # And take the first k numbers





                          share|improve this answer























                          • What does all do?
                            – Addison Crump
                            Nov 3 at 7:07






                          • 1




                            @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
                            – Jo King
                            Nov 3 at 7:10










                          • @nwellnhof Wow! So that's what Junctions are useful for!
                            – Jo King
                            Nov 3 at 10:56










                          • Yes, note that you could also use [&] instead of all.
                            – nwellnhof
                            Nov 3 at 10:57










                          • @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
                            – Jo King
                            Nov 3 at 11:07

















                          up vote
                          3
                          down vote














                          Perl 6, 35 32 bytes



                          -3 bytes thanks to nwellnof!





                          {grep(*%all(2..$^b),1..*)[^$^k]}


                          Try it online!



                          An anonymous code block that takes two integers and returns a list of integers.



                          Explanation



                          {                              }  # Anonymous code block
                          grep( ,1..*) # Filter from the positive integers
                          * # Is the number
                          % # Not divisible by
                          all( ) # All of the numbers
                          2..$^b # From 2 to b
                          [^$^k] # And take the first k numbers





                          share|improve this answer























                          • What does all do?
                            – Addison Crump
                            Nov 3 at 7:07






                          • 1




                            @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
                            – Jo King
                            Nov 3 at 7:10










                          • @nwellnhof Wow! So that's what Junctions are useful for!
                            – Jo King
                            Nov 3 at 10:56










                          • Yes, note that you could also use [&] instead of all.
                            – nwellnhof
                            Nov 3 at 10:57










                          • @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
                            – Jo King
                            Nov 3 at 11:07















                          up vote
                          3
                          down vote










                          up vote
                          3
                          down vote










                          Perl 6, 35 32 bytes



                          -3 bytes thanks to nwellnof!





                          {grep(*%all(2..$^b),1..*)[^$^k]}


                          Try it online!



                          An anonymous code block that takes two integers and returns a list of integers.



                          Explanation



                          {                              }  # Anonymous code block
                          grep( ,1..*) # Filter from the positive integers
                          * # Is the number
                          % # Not divisible by
                          all( ) # All of the numbers
                          2..$^b # From 2 to b
                          [^$^k] # And take the first k numbers





                          share|improve this answer















                          Perl 6, 35 32 bytes



                          -3 bytes thanks to nwellnof!





                          {grep(*%all(2..$^b),1..*)[^$^k]}


                          Try it online!



                          An anonymous code block that takes two integers and returns a list of integers.



                          Explanation



                          {                              }  # Anonymous code block
                          grep( ,1..*) # Filter from the positive integers
                          * # Is the number
                          % # Not divisible by
                          all( ) # All of the numbers
                          2..$^b # From 2 to b
                          [^$^k] # And take the first k numbers






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 3 at 11:01

























                          answered Nov 3 at 6:59









                          Jo King

                          18.6k241100




                          18.6k241100












                          • What does all do?
                            – Addison Crump
                            Nov 3 at 7:07






                          • 1




                            @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
                            – Jo King
                            Nov 3 at 7:10










                          • @nwellnhof Wow! So that's what Junctions are useful for!
                            – Jo King
                            Nov 3 at 10:56










                          • Yes, note that you could also use [&] instead of all.
                            – nwellnhof
                            Nov 3 at 10:57










                          • @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
                            – Jo King
                            Nov 3 at 11:07




















                          • What does all do?
                            – Addison Crump
                            Nov 3 at 7:07






                          • 1




                            @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
                            – Jo King
                            Nov 3 at 7:10










                          • @nwellnhof Wow! So that's what Junctions are useful for!
                            – Jo King
                            Nov 3 at 10:56










                          • Yes, note that you could also use [&] instead of all.
                            – nwellnhof
                            Nov 3 at 10:57










                          • @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
                            – Jo King
                            Nov 3 at 11:07


















                          What does all do?
                          – Addison Crump
                          Nov 3 at 7:07




                          What does all do?
                          – Addison Crump
                          Nov 3 at 7:07




                          1




                          1




                          @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
                          – Jo King
                          Nov 3 at 7:10




                          @AddisonCrump all checks if all the elements in the list are truthy. I will be adding an explanation for the whole thing shortly
                          – Jo King
                          Nov 3 at 7:10












                          @nwellnhof Wow! So that's what Junctions are useful for!
                          – Jo King
                          Nov 3 at 10:56




                          @nwellnhof Wow! So that's what Junctions are useful for!
                          – Jo King
                          Nov 3 at 10:56












                          Yes, note that you could also use [&] instead of all.
                          – nwellnhof
                          Nov 3 at 10:57




                          Yes, note that you could also use [&] instead of all.
                          – nwellnhof
                          Nov 3 at 10:57












                          @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
                          – Jo King
                          Nov 3 at 11:07






                          @AddisonCrump I guess all isn't being used in that way any more, so I should update my answer. all creates a Junction of the values in the range 2..b, and any operations performed on the Junction gets performed on all the values simulataneously. When it is evaluated in Boolean context by the grep, this collapses into whether all the values in the Junction are truthy, ie non-zero
                          – Jo King
                          Nov 3 at 11:07












                          up vote
                          2
                          down vote














                          Husk, 9 8 bytes



                          ↑foΛ>⁰pN


                          Try it online!



                          Takes $B$ as first and $ k $ as second input.



                          ↑         -- take the first k elements 
                          N -- from the natural numbers
                          f -- filtered by
                          o p -- the prime factors
                          Λ>⁰ -- are all larger than the first input





                          share|improve this answer



























                            up vote
                            2
                            down vote














                            Husk, 9 8 bytes



                            ↑foΛ>⁰pN


                            Try it online!



                            Takes $B$ as first and $ k $ as second input.



                            ↑         -- take the first k elements 
                            N -- from the natural numbers
                            f -- filtered by
                            o p -- the prime factors
                            Λ>⁰ -- are all larger than the first input





                            share|improve this answer

























                              up vote
                              2
                              down vote










                              up vote
                              2
                              down vote










                              Husk, 9 8 bytes



                              ↑foΛ>⁰pN


                              Try it online!



                              Takes $B$ as first and $ k $ as second input.



                              ↑         -- take the first k elements 
                              N -- from the natural numbers
                              f -- filtered by
                              o p -- the prime factors
                              Λ>⁰ -- are all larger than the first input





                              share|improve this answer















                              Husk, 9 8 bytes



                              ↑foΛ>⁰pN


                              Try it online!



                              Takes $B$ as first and $ k $ as second input.



                              ↑         -- take the first k elements 
                              N -- from the natural numbers
                              f -- filtered by
                              o p -- the prime factors
                              Λ>⁰ -- are all larger than the first input






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Nov 3 at 11:11

























                              answered Nov 3 at 10:59









                              Laikoni

                              19.3k43596




                              19.3k43596






















                                  up vote
                                  2
                                  down vote














                                  Charcoal, 33 bytes



                                  NθNη≔⁰ζW‹Lυη«≦⊕ζ¿¬Φθ∧κ¬﹪ζ⊕κ⊞υζ»Iυ


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



                                  NθNη


                                  Input B and k.



                                  ≔⁰ζ


                                  Set z to 0.



                                  W‹Lυη«


                                  Repeat until we have k values.



                                  ≦⊕ζ


                                  Increment z.



                                  ¿¬Φθ∧κ¬﹪ζ⊕κ


                                  Divide z by all the numbers from 2 to B and see if any remainder is zero.



                                  ⊞υζ»


                                  If not then push z to the predefined empty list.



                                  Iυ


                                  Cast the list to string and implicitly output it.






                                  share|improve this answer

























                                    up vote
                                    2
                                    down vote














                                    Charcoal, 33 bytes



                                    NθNη≔⁰ζW‹Lυη«≦⊕ζ¿¬Φθ∧κ¬﹪ζ⊕κ⊞υζ»Iυ


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



                                    NθNη


                                    Input B and k.



                                    ≔⁰ζ


                                    Set z to 0.



                                    W‹Lυη«


                                    Repeat until we have k values.



                                    ≦⊕ζ


                                    Increment z.



                                    ¿¬Φθ∧κ¬﹪ζ⊕κ


                                    Divide z by all the numbers from 2 to B and see if any remainder is zero.



                                    ⊞υζ»


                                    If not then push z to the predefined empty list.



                                    Iυ


                                    Cast the list to string and implicitly output it.






                                    share|improve this answer























                                      up vote
                                      2
                                      down vote










                                      up vote
                                      2
                                      down vote










                                      Charcoal, 33 bytes



                                      NθNη≔⁰ζW‹Lυη«≦⊕ζ¿¬Φθ∧κ¬﹪ζ⊕κ⊞υζ»Iυ


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



                                      NθNη


                                      Input B and k.



                                      ≔⁰ζ


                                      Set z to 0.



                                      W‹Lυη«


                                      Repeat until we have k values.



                                      ≦⊕ζ


                                      Increment z.



                                      ¿¬Φθ∧κ¬﹪ζ⊕κ


                                      Divide z by all the numbers from 2 to B and see if any remainder is zero.



                                      ⊞υζ»


                                      If not then push z to the predefined empty list.



                                      Iυ


                                      Cast the list to string and implicitly output it.






                                      share|improve this answer













                                      Charcoal, 33 bytes



                                      NθNη≔⁰ζW‹Lυη«≦⊕ζ¿¬Φθ∧κ¬﹪ζ⊕κ⊞υζ»Iυ


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



                                      NθNη


                                      Input B and k.



                                      ≔⁰ζ


                                      Set z to 0.



                                      W‹Lυη«


                                      Repeat until we have k values.



                                      ≦⊕ζ


                                      Increment z.



                                      ¿¬Φθ∧κ¬﹪ζ⊕κ


                                      Divide z by all the numbers from 2 to B and see if any remainder is zero.



                                      ⊞υζ»


                                      If not then push z to the predefined empty list.



                                      Iυ


                                      Cast the list to string and implicitly output it.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 3 at 11:19









                                      Neil

                                      77.4k744174




                                      77.4k744174






















                                          up vote
                                          2
                                          down vote













                                          JavaScript (ES6), 68 bytes



                                          Takes input as (b)(k).





                                          b=>k=>(o=,n=1,g=d=>(d<2?o.push(n)==k:n%d&&g(d-1))||g(b,n++))(b)&&o


                                          Try it online!



                                          Commented



                                          b => k => (             // input = b and k
                                          o = , // o = output array
                                          n = 1, // n = value to test
                                          g = d => ( // g = recursive function, taking the divisor d
                                          d < 2 ? // if d = 1:
                                          o.push(n) == k // push n into o and test whether o contains k elements
                                          : // else:
                                          n % d && g(d - 1) // if d is not a divisor of n, do a recursive call with d - 1
                                          ) || // if the final result of g() is falsy,
                                          g(b, n++) // do a recursive call with d = b and n + 1
                                          )(b) // initial call to g() with d = b
                                          && o // return o





                                          share|improve this answer



























                                            up vote
                                            2
                                            down vote













                                            JavaScript (ES6), 68 bytes



                                            Takes input as (b)(k).





                                            b=>k=>(o=,n=1,g=d=>(d<2?o.push(n)==k:n%d&&g(d-1))||g(b,n++))(b)&&o


                                            Try it online!



                                            Commented



                                            b => k => (             // input = b and k
                                            o = , // o = output array
                                            n = 1, // n = value to test
                                            g = d => ( // g = recursive function, taking the divisor d
                                            d < 2 ? // if d = 1:
                                            o.push(n) == k // push n into o and test whether o contains k elements
                                            : // else:
                                            n % d && g(d - 1) // if d is not a divisor of n, do a recursive call with d - 1
                                            ) || // if the final result of g() is falsy,
                                            g(b, n++) // do a recursive call with d = b and n + 1
                                            )(b) // initial call to g() with d = b
                                            && o // return o





                                            share|improve this answer

























                                              up vote
                                              2
                                              down vote










                                              up vote
                                              2
                                              down vote









                                              JavaScript (ES6), 68 bytes



                                              Takes input as (b)(k).





                                              b=>k=>(o=,n=1,g=d=>(d<2?o.push(n)==k:n%d&&g(d-1))||g(b,n++))(b)&&o


                                              Try it online!



                                              Commented



                                              b => k => (             // input = b and k
                                              o = , // o = output array
                                              n = 1, // n = value to test
                                              g = d => ( // g = recursive function, taking the divisor d
                                              d < 2 ? // if d = 1:
                                              o.push(n) == k // push n into o and test whether o contains k elements
                                              : // else:
                                              n % d && g(d - 1) // if d is not a divisor of n, do a recursive call with d - 1
                                              ) || // if the final result of g() is falsy,
                                              g(b, n++) // do a recursive call with d = b and n + 1
                                              )(b) // initial call to g() with d = b
                                              && o // return o





                                              share|improve this answer














                                              JavaScript (ES6), 68 bytes



                                              Takes input as (b)(k).





                                              b=>k=>(o=,n=1,g=d=>(d<2?o.push(n)==k:n%d&&g(d-1))||g(b,n++))(b)&&o


                                              Try it online!



                                              Commented



                                              b => k => (             // input = b and k
                                              o = , // o = output array
                                              n = 1, // n = value to test
                                              g = d => ( // g = recursive function, taking the divisor d
                                              d < 2 ? // if d = 1:
                                              o.push(n) == k // push n into o and test whether o contains k elements
                                              : // else:
                                              n % d && g(d - 1) // if d is not a divisor of n, do a recursive call with d - 1
                                              ) || // if the final result of g() is falsy,
                                              g(b, n++) // do a recursive call with d = b and n + 1
                                              )(b) // initial call to g() with d = b
                                              && o // return o






                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Nov 3 at 14:35

























                                              answered Nov 3 at 9:28









                                              Arnauld

                                              67.7k584288




                                              67.7k584288






















                                                  up vote
                                                  1
                                                  down vote














                                                  Jelly, 10 bytes



                                                  1µg³!¤Ịµ⁴#


                                                  Try it online!



                                                  How it works



                                                  1µg³!¤Ịµ⁴#    Dyadic main link. Left = B, right = k
                                                  µ⁴# Take first k numbers satisfying...
                                                  g GCD with
                                                  ³!¤ B factorial
                                                  Ị is insignificant (abs(x) <= 1)?
                                                  1µ ... starting from 1.





                                                  share|improve this answer



























                                                    up vote
                                                    1
                                                    down vote














                                                    Jelly, 10 bytes



                                                    1µg³!¤Ịµ⁴#


                                                    Try it online!



                                                    How it works



                                                    1µg³!¤Ịµ⁴#    Dyadic main link. Left = B, right = k
                                                    µ⁴# Take first k numbers satisfying...
                                                    g GCD with
                                                    ³!¤ B factorial
                                                    Ị is insignificant (abs(x) <= 1)?
                                                    1µ ... starting from 1.





                                                    share|improve this answer

























                                                      up vote
                                                      1
                                                      down vote










                                                      up vote
                                                      1
                                                      down vote










                                                      Jelly, 10 bytes



                                                      1µg³!¤Ịµ⁴#


                                                      Try it online!



                                                      How it works



                                                      1µg³!¤Ịµ⁴#    Dyadic main link. Left = B, right = k
                                                      µ⁴# Take first k numbers satisfying...
                                                      g GCD with
                                                      ³!¤ B factorial
                                                      Ị is insignificant (abs(x) <= 1)?
                                                      1µ ... starting from 1.





                                                      share|improve this answer















                                                      Jelly, 10 bytes



                                                      1µg³!¤Ịµ⁴#


                                                      Try it online!



                                                      How it works



                                                      1µg³!¤Ịµ⁴#    Dyadic main link. Left = B, right = k
                                                      µ⁴# Take first k numbers satisfying...
                                                      g GCD with
                                                      ³!¤ B factorial
                                                      Ị is insignificant (abs(x) <= 1)?
                                                      1µ ... starting from 1.






                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Nov 3 at 7:58

























                                                      answered Nov 3 at 7:46









                                                      Bubbler

                                                      4,649749




                                                      4,649749






















                                                          up vote
                                                          1
                                                          down vote














                                                          JavaScript (Node.js), 68 bytes





                                                          b=>g=(k,i=1,j=b)=>k?j>1?i%j?g(k,i,j-1):g(k,i+1):[i,...g(k-1,i+1)]:


                                                          Try it online!






                                                          share|improve this answer

























                                                            up vote
                                                            1
                                                            down vote














                                                            JavaScript (Node.js), 68 bytes





                                                            b=>g=(k,i=1,j=b)=>k?j>1?i%j?g(k,i,j-1):g(k,i+1):[i,...g(k-1,i+1)]:


                                                            Try it online!






                                                            share|improve this answer























                                                              up vote
                                                              1
                                                              down vote










                                                              up vote
                                                              1
                                                              down vote










                                                              JavaScript (Node.js), 68 bytes





                                                              b=>g=(k,i=1,j=b)=>k?j>1?i%j?g(k,i,j-1):g(k,i+1):[i,...g(k-1,i+1)]:


                                                              Try it online!






                                                              share|improve this answer













                                                              JavaScript (Node.js), 68 bytes





                                                              b=>g=(k,i=1,j=b)=>k?j>1?i%j?g(k,i,j-1):g(k,i+1):[i,...g(k-1,i+1)]:


                                                              Try it online!







                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered Nov 3 at 11:00









                                                              tsh

                                                              8,03511346




                                                              8,03511346






















                                                                  up vote
                                                                  1
                                                                  down vote













                                                                  APL(NARS), 52 chars, 104 bytes



                                                                  r←a f w;i
                                                                  r←,i←1⋄→3
                                                                  i+←1⋄→3×⍳∨/a≥πi⋄r←r,i
                                                                  →2×⍳w>↑⍴r


                                                                  Above it seems the rows after 'r←a f w;i' have names 1 2 3;test:



                                                                    o←⎕fmt
                                                                  o 1 h 2
                                                                  ┌2───┐
                                                                  │ 1 2│
                                                                  └~───┘
                                                                  o 1 h 1
                                                                  ┌1─┐
                                                                  │ 1│
                                                                  └~─┘
                                                                  o 10 h 14
                                                                  ┌14───────────────────────────────────────┐
                                                                  │ 1 11 13 17 19 23 29 31 37 41 43 47 53 59│
                                                                  └~────────────────────────────────────────┘





                                                                  share|improve this answer



























                                                                    up vote
                                                                    1
                                                                    down vote













                                                                    APL(NARS), 52 chars, 104 bytes



                                                                    r←a f w;i
                                                                    r←,i←1⋄→3
                                                                    i+←1⋄→3×⍳∨/a≥πi⋄r←r,i
                                                                    →2×⍳w>↑⍴r


                                                                    Above it seems the rows after 'r←a f w;i' have names 1 2 3;test:



                                                                      o←⎕fmt
                                                                    o 1 h 2
                                                                    ┌2───┐
                                                                    │ 1 2│
                                                                    └~───┘
                                                                    o 1 h 1
                                                                    ┌1─┐
                                                                    │ 1│
                                                                    └~─┘
                                                                    o 10 h 14
                                                                    ┌14───────────────────────────────────────┐
                                                                    │ 1 11 13 17 19 23 29 31 37 41 43 47 53 59│
                                                                    └~────────────────────────────────────────┘





                                                                    share|improve this answer

























                                                                      up vote
                                                                      1
                                                                      down vote










                                                                      up vote
                                                                      1
                                                                      down vote









                                                                      APL(NARS), 52 chars, 104 bytes



                                                                      r←a f w;i
                                                                      r←,i←1⋄→3
                                                                      i+←1⋄→3×⍳∨/a≥πi⋄r←r,i
                                                                      →2×⍳w>↑⍴r


                                                                      Above it seems the rows after 'r←a f w;i' have names 1 2 3;test:



                                                                        o←⎕fmt
                                                                      o 1 h 2
                                                                      ┌2───┐
                                                                      │ 1 2│
                                                                      └~───┘
                                                                      o 1 h 1
                                                                      ┌1─┐
                                                                      │ 1│
                                                                      └~─┘
                                                                      o 10 h 14
                                                                      ┌14───────────────────────────────────────┐
                                                                      │ 1 11 13 17 19 23 29 31 37 41 43 47 53 59│
                                                                      └~────────────────────────────────────────┘





                                                                      share|improve this answer














                                                                      APL(NARS), 52 chars, 104 bytes



                                                                      r←a f w;i
                                                                      r←,i←1⋄→3
                                                                      i+←1⋄→3×⍳∨/a≥πi⋄r←r,i
                                                                      →2×⍳w>↑⍴r


                                                                      Above it seems the rows after 'r←a f w;i' have names 1 2 3;test:



                                                                        o←⎕fmt
                                                                      o 1 h 2
                                                                      ┌2───┐
                                                                      │ 1 2│
                                                                      └~───┘
                                                                      o 1 h 1
                                                                      ┌1─┐
                                                                      │ 1│
                                                                      └~─┘
                                                                      o 10 h 14
                                                                      ┌14───────────────────────────────────────┐
                                                                      │ 1 11 13 17 19 23 29 31 37 41 43 47 53 59│
                                                                      └~────────────────────────────────────────┘






                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited Nov 3 at 19:45

























                                                                      answered Nov 3 at 17:17









                                                                      RosLuP

                                                                      1,710514




                                                                      1,710514






















                                                                          up vote
                                                                          1
                                                                          down vote














                                                                          05AB1E, 9 bytes



                                                                          ∞ʒÒ¹›P}²£


                                                                          Try it online or verify all test cases.



                                                                          Explanation:





                                                                          ∞          # Infinite list starting at 1: [1,...]
                                                                          ʒ } # Filter it by:
                                                                          Ò # Get all prime factors of the current number
                                                                          ¹› # Check for each if they are larger than the first input
                                                                          P # And check if it's truthy for all of them
                                                                          ²£ # Leave only the leading amount of items equal to the second input





                                                                          share|improve this answer

























                                                                            up vote
                                                                            1
                                                                            down vote














                                                                            05AB1E, 9 bytes



                                                                            ∞ʒÒ¹›P}²£


                                                                            Try it online or verify all test cases.



                                                                            Explanation:





                                                                            ∞          # Infinite list starting at 1: [1,...]
                                                                            ʒ } # Filter it by:
                                                                            Ò # Get all prime factors of the current number
                                                                            ¹› # Check for each if they are larger than the first input
                                                                            P # And check if it's truthy for all of them
                                                                            ²£ # Leave only the leading amount of items equal to the second input





                                                                            share|improve this answer























                                                                              up vote
                                                                              1
                                                                              down vote










                                                                              up vote
                                                                              1
                                                                              down vote










                                                                              05AB1E, 9 bytes



                                                                              ∞ʒÒ¹›P}²£


                                                                              Try it online or verify all test cases.



                                                                              Explanation:





                                                                              ∞          # Infinite list starting at 1: [1,...]
                                                                              ʒ } # Filter it by:
                                                                              Ò # Get all prime factors of the current number
                                                                              ¹› # Check for each if they are larger than the first input
                                                                              P # And check if it's truthy for all of them
                                                                              ²£ # Leave only the leading amount of items equal to the second input





                                                                              share|improve this answer













                                                                              05AB1E, 9 bytes



                                                                              ∞ʒÒ¹›P}²£


                                                                              Try it online or verify all test cases.



                                                                              Explanation:





                                                                              ∞          # Infinite list starting at 1: [1,...]
                                                                              ʒ } # Filter it by:
                                                                              Ò # Get all prime factors of the current number
                                                                              ¹› # Check for each if they are larger than the first input
                                                                              P # And check if it's truthy for all of them
                                                                              ²£ # Leave only the leading amount of items equal to the second input






                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered 2 days ago









                                                                              Kevin Cruijssen

                                                                              33k554176




                                                                              33k554176






























                                                                                   

                                                                                  draft saved


                                                                                  draft discarded



















































                                                                                   


                                                                                  draft saved


                                                                                  draft discarded














                                                                                  StackExchange.ready(
                                                                                  function () {
                                                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175158%2fgenerate-some-rough-numbers%23new-answer', 'question_page');
                                                                                  }
                                                                                  );

                                                                                  Post as a guest




















































































                                                                                  這個網誌中的熱門文章

                                                                                  Xamarin.form Move up view when keyboard appear

                                                                                  Post-Redirect-Get with Spring WebFlux and Thymeleaf

                                                                                  Anylogic : not able to use stopDelay()