Incremental Ranges!Analyzing Collatz-like sequencesFinding Collatz-like rules with many loopsGenerate The SUDSI SequenceThe Kimberling SequenceHow many integers contain a number in a specific rangeCompress a maximal discrepancy-2 sequenceA Euro-iginal SequenceThe Ever-Increasing GraphThe Jumping Up SequenceA function to take three integers and return a list of integers and alphabet-letters

Have powerful mythological heroes ever run away or been deeply afraid?

Short story written from alien perspective with this line: "It's too bright to look at, so they don't"

Humans meet a distant alien species. How do they standardize? - Units of Measure

You've spoiled/damaged the card

Will dual-learning in a glider make my airplane learning safer?

How can I grammatically understand "Wir über uns"?

Do adult Russians normally hand-write Cyrillic as cursive or as block letters?

Opposite of "Squeaky wheel gets the grease"

Did Darth Vader wear the same suit for 20+ years?

Applicants clearly not having the skills they advertise

When leasing/renting out an owned property, is there a standard ratio between monthly rent and the mortgage?

Does any lore text explain why the planes of Acheron, Gehenna, and Carceri are the alignment they are?

What's the most polite way to tell a manager "shut up and let me work"?

Unconventional Opposites

Why does a helium balloon rise?

Why use water tanks from a retired Space Shuttle?

If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?

Explain Ant-Man's "not it" scene from Avengers: Endgame

How can I make 20-200 ohm variable resistor look like a 20-240 ohm resistor?

How do I get a cleat that's stuck in a pedal, detached from the shoe, out?

GFCI Outlet in Bathroom, Lights not working

How can I offer a test ride while selling a bike?

Please help me identify this plane

Pros and cons of writing a book review?



Incremental Ranges!


Analyzing Collatz-like sequencesFinding Collatz-like rules with many loopsGenerate The SUDSI SequenceThe Kimberling SequenceHow many integers contain a number in a specific rangeCompress a maximal discrepancy-2 sequenceA Euro-iginal SequenceThe Ever-Increasing GraphThe Jumping Up SequenceA function to take three integers and return a list of integers and alphabet-letters













8












$begingroup$


Your task is to, given two positive integers, $x$ and $n$, return the first $x$ numbers in the incremental ranges sequence.



The incremental range sequence first generates a range from one to $n$ inclusive. For example, if $n$ was $3$, it would generate the list $[1,2,3]$. It then repeatedly appends the last $n$ values incremented by $1$ to the existing list, and continues.



An input of $n=3$ for example:



n=3
1. Get range 1 to n. List: [1,2,3]
2. Get the last n values of the list. List: [1,2,3]. Last n=3 values: [1,2,3].
3. Increment the last n values by 1. List: [1,2,3]. Last n values: [2,3,4].
4. Append the last n values incremented to the list. List: [1,2,3,2,3,4]
5. Repeat steps 2-5. 2nd time repeat shown below.

2nd repeat:
2. Get the last n values of the list. List: [1,2,3,2,3,4]. Last n=3 values: [2,3,4]
3. Increment the last n values by 1. List: [1,2,3,2,3,4]. Last n values: [3,4,5].
4. Append the last n values incremented to the list. List: [1,2,3,2,3,4,3,4,5]


Test cases:



n, x, Output
1, 49, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
2, 100, [1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,48,48,49,49,50,50,51]
3, 13, [1,2,3,2,3,4,3,4,5,4,5,6,5]









share|improve this question











$endgroup$
















    8












    $begingroup$


    Your task is to, given two positive integers, $x$ and $n$, return the first $x$ numbers in the incremental ranges sequence.



    The incremental range sequence first generates a range from one to $n$ inclusive. For example, if $n$ was $3$, it would generate the list $[1,2,3]$. It then repeatedly appends the last $n$ values incremented by $1$ to the existing list, and continues.



    An input of $n=3$ for example:



    n=3
    1. Get range 1 to n. List: [1,2,3]
    2. Get the last n values of the list. List: [1,2,3]. Last n=3 values: [1,2,3].
    3. Increment the last n values by 1. List: [1,2,3]. Last n values: [2,3,4].
    4. Append the last n values incremented to the list. List: [1,2,3,2,3,4]
    5. Repeat steps 2-5. 2nd time repeat shown below.

    2nd repeat:
    2. Get the last n values of the list. List: [1,2,3,2,3,4]. Last n=3 values: [2,3,4]
    3. Increment the last n values by 1. List: [1,2,3,2,3,4]. Last n values: [3,4,5].
    4. Append the last n values incremented to the list. List: [1,2,3,2,3,4,3,4,5]


    Test cases:



    n, x, Output
    1, 49, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
    2, 100, [1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,48,48,49,49,50,50,51]
    3, 13, [1,2,3,2,3,4,3,4,5,4,5,6,5]









    share|improve this question











    $endgroup$














      8












      8








      8





      $begingroup$


      Your task is to, given two positive integers, $x$ and $n$, return the first $x$ numbers in the incremental ranges sequence.



      The incremental range sequence first generates a range from one to $n$ inclusive. For example, if $n$ was $3$, it would generate the list $[1,2,3]$. It then repeatedly appends the last $n$ values incremented by $1$ to the existing list, and continues.



      An input of $n=3$ for example:



      n=3
      1. Get range 1 to n. List: [1,2,3]
      2. Get the last n values of the list. List: [1,2,3]. Last n=3 values: [1,2,3].
      3. Increment the last n values by 1. List: [1,2,3]. Last n values: [2,3,4].
      4. Append the last n values incremented to the list. List: [1,2,3,2,3,4]
      5. Repeat steps 2-5. 2nd time repeat shown below.

      2nd repeat:
      2. Get the last n values of the list. List: [1,2,3,2,3,4]. Last n=3 values: [2,3,4]
      3. Increment the last n values by 1. List: [1,2,3,2,3,4]. Last n values: [3,4,5].
      4. Append the last n values incremented to the list. List: [1,2,3,2,3,4,3,4,5]


      Test cases:



      n, x, Output
      1, 49, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
      2, 100, [1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,48,48,49,49,50,50,51]
      3, 13, [1,2,3,2,3,4,3,4,5,4,5,6,5]









      share|improve this question











      $endgroup$




      Your task is to, given two positive integers, $x$ and $n$, return the first $x$ numbers in the incremental ranges sequence.



      The incremental range sequence first generates a range from one to $n$ inclusive. For example, if $n$ was $3$, it would generate the list $[1,2,3]$. It then repeatedly appends the last $n$ values incremented by $1$ to the existing list, and continues.



      An input of $n=3$ for example:



      n=3
      1. Get range 1 to n. List: [1,2,3]
      2. Get the last n values of the list. List: [1,2,3]. Last n=3 values: [1,2,3].
      3. Increment the last n values by 1. List: [1,2,3]. Last n values: [2,3,4].
      4. Append the last n values incremented to the list. List: [1,2,3,2,3,4]
      5. Repeat steps 2-5. 2nd time repeat shown below.

      2nd repeat:
      2. Get the last n values of the list. List: [1,2,3,2,3,4]. Last n=3 values: [2,3,4]
      3. Increment the last n values by 1. List: [1,2,3,2,3,4]. Last n values: [3,4,5].
      4. Append the last n values incremented to the list. List: [1,2,3,2,3,4,3,4,5]


      Test cases:



      n, x, Output
      1, 49, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
      2, 100, [1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,48,48,49,49,50,50,51]
      3, 13, [1,2,3,2,3,4,3,4,5,4,5,6,5]






      code-golf number sequence array






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 9 hours ago









      Giuseppe

      18.6k31358




      18.6k31358










      asked 9 hours ago









      Comrade SparklePonyComrade SparklePony

      3,70611756




      3,70611756




















          21 Answers
          21






          active

          oldest

          votes


















          4












          $begingroup$


          Python 2, 39 bytes





          lambda n,x:[v/n+v%n+1for v in range(x)]


          Try it online!






          share|improve this answer









          $endgroup$












          • $begingroup$
            Also works in Python 3 with the replacement of / with //
            $endgroup$
            – Nick Kennedy
            8 hours ago


















          3












          $begingroup$


          Jelly, 4 bytes



          Ḷd§‘


          A dyadic Link accepting two positive integers, x on the left and n on the right, which yields a list of positive integers.



          Try it online!



          How?



          Ḷd§‘ - Link: x, n e.g 13, 3
          Ḷ - lowered range (x) [0,1,2,3,4,5,6,7,8,9,10,11,12]
          d - divmod (n) [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
          § - sums [0,1,2,1,2,3,2,3,4,3,4,5,4]
          ‘ - increment (vectorises) [1,2,3,2,3,4,3,4,5,4,5,6,5]





          share|improve this answer











          $endgroup$








          • 2




            $begingroup$
            Wait... is that divmod? Clever! And I was struggling with p...
            $endgroup$
            – Erik the Outgolfer
            8 hours ago



















          3












          $begingroup$


          R, 33 bytes





          function(n,x,z=1:x-1)z%%n+z%/%n+1


          Try it online!



          Ports Jonathan Allan's Python solution.




          R, 36 bytes





          function(n,x)outer(1:n,0:x,"+")[1:x]


          Try it online!



          My original solution; generates an $ntimes x$ matrix with each column as the increments, i.e., $1 ldots n, 2ldots n+1,ldots$, then takes the first $x$ entries (going down the columns).






          share|improve this answer











          $endgroup$




















            2












            $begingroup$


            05AB1E, 6 bytes



            L<s‰O>


            Port of @JonathanAllan's Jelly answer, so make sure to upvote him!



            First input is $x$, second input is $n$.



            Try it online or verify all test cases.



            Explanation:





            L # Push a list in the range [1, (implicit) input]
            # i.e. 13 → [1,2,3,4,5,6,7,8,9,10,11,12,13]
            < # Decrease each by 1 to the range [0, input)
            # → [0,1,2,3,4,5,6,7,8,9,10,11,12]
            s‰ # Divmod each by the second input
            # i.e. 3 → [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
            O # Sum each pair
            # → [0,1,2,1,2,3,2,3,4,3,4,5,4]
            > # And increase each by 1
            # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
            # (after which the result is output implicitly)





            My own initial approach was 8 bytes:



            LI∍εN¹÷+


            First input is $n$, second input is $x$.



            Try it online or verify all test cases.



            Explanation:





            L # Push a list in the range [1, (implicit) input]
            # i.e. 3 → [1,2,3]
            I∍ # Extend it to the size of the second input
            # i.e. 13 → [1,2,3,1,2,3,1,2,3,1,2,3,1]
            ε # Map each value to:
            N¹÷ # The 0-based index integer-divided by the first input
            # → [0,0,0,1,1,1,2,2,2,3,3,3,4]
            + # Add that to the value
            # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
            # (after which the result is output implicitly)





            share|improve this answer









            $endgroup$




















              2












              $begingroup$


              Brain-Flak, 100 bytes



              (<>)<>([()]<(())(()[()](<>))<>(()<>)(<>)(<>)([()]<(<>[](())[()]<>)>)>)


              With comments and formatting:



              # Push a zero under the other stack
              (<>)<>

              # x times

              # x - 1
              ([()]<

              # Let 'a' be a counter that starts at n
              # Duplicate a and NOT
              (())(()[()](<>))

              # if a == 0

              # Pop truthy

              <>

              # Reset n to a
              (()<>)

              # Push 0 to each
              (<>)(<>)


              # Pop falsy


              # Decrement A, add one to the other stack, and duplicate that number under this stack
              ([()]<
              (<>[](())<>)
              >)
              >)



              Try it online!






              share|improve this answer











              $endgroup$












              • $begingroup$
                Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                $endgroup$
                – Nitrodon
                4 hours ago











              • $begingroup$
                @Nitrodon Whoops, not sure how that happened. Fixed now!
                $endgroup$
                – DJMcMayhem
                4 hours ago


















              1












              $begingroup$


              Jelly, 5 bytes



              +þẎḣ’


              Try it online!






              share|improve this answer









              $endgroup$




















                1












                $begingroup$


                Ruby, 32 bytes





                ->n,x(0...x).mapi


                Try it online!






                share|improve this answer









                $endgroup$




















                  1












                  $begingroup$


                  Japt -m, 12 7 bytes



                  Port of Jonathan's Python solution.



                  Takes x as the first input.



                  %VÄ+UzV


                  Try it






                  share|improve this answer











                  $endgroup$




















                    1












                    $begingroup$


                    Perl 6, 18 bytes





                    (1..*X+ ^*)[^$_]


                    Try it online!



                    Curried function f(x)(n).



                    Explanation



                     # Anonymous block
                    X+ # Cartesian product with addition
                    1..* # of range 1..Inf
                    ^* # and range 0..n
                    ( )[^$_] # First x elements





                    share|improve this answer











                    $endgroup$




















                      1












                      $begingroup$


                      Perl 5 -na, 43 bytes





                      @r=map$_..$_+$F[1]-1,1..$_;say"@r[0..$_-1]"


                      Try it online!






                      share|improve this answer









                      $endgroup$




















                        1












                        $begingroup$


                        Octave, 25 bytes





                        @(n,x)((1:n)'+(0:x))(1:x)


                        Anonymous function that inputs numbers n``andx`, and outputs a row vector.



                        Try it online!






                        share|improve this answer









                        $endgroup$




















                          1












                          $begingroup$


                          MATL, 16 bytes



                          :i:"tQ]v!1e 2G:)


                          Try it online!



                          Explanation:



                          : % Push [1, 2... n]
                          i:" ] % For i in [1, x]:
                          t % Duplicate the first array
                          Q % Increment each number
                          v % Concatenate everything into 1 matrix
                          ! % Transpose
                          1e % Reshape into 1 row
                          2G % Push x again
                          :) % And take the first x elements





                          share|improve this answer









                          $endgroup$








                          • 1




                            $begingroup$
                            10 bytes using broadcasting.
                            $endgroup$
                            – Giuseppe
                            3 hours ago


















                          1












                          $begingroup$


                          J, 13 12 bytes



                          [$[:,1++/&i.


                          Try it online!



                          how



                          We take x as the left arg, n as the right. Let's take x = 8 and n = 3 for this example:




                          • +/&i.: Transform both args by creating integer ranges i., that is, the left arg becomes 0 1 2 3 4 5 6 7 and the right arg becomes 0 1 2. Now we create an "addition table +/ from those two:



                             0 1 2
                            1 2 3
                            2 3 4
                            3 4 5
                            4 5 6
                            5 6 7
                            6 7 8
                            7 8 9



                          • 1 +: Add 1 to every element of this table:



                             1 2 3
                            2 3 4
                            3 4 5
                            4 5 6
                            5 6 7
                            6 7 8
                            7 8 9
                            8 9 10



                          • [: ,: Flatten it ,:



                             1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10



                          • [ $: Shape it $ so it has the same number of elements as the original, untransformed left arg [, ie, x:



                             1 2 3 2 3 4 3 4 






                          share|improve this answer











                          $endgroup$




















                            0












                            $begingroup$


                            Alchemist, 77 bytes



                            _->In_n+In_x
                            x+n+0y+0z->a+Out_a+Out_" "+m+y
                            y+n->n
                            y+0n->z
                            z+m+a->z+n
                            z+0m->a


                            Try it online!



                            Increments and outputs a counter n times, then subtracts n-1 before repeating.






                            share|improve this answer









                            $endgroup$




















                              0












                              $begingroup$


                              Charcoal, 18 bytes



                              NθFN⊞υ⊕⎇‹ιθι§υ±θIυ


                              Try it online! Link is to verbose version of code. I had dreams of seeding the list with a zero-indexed range and then slicing it off again but that was actually 2 bytes longer. Explanation:



                              Nθ Input `n` into variable
                              N Input `x`
                              F Loop over implicit range
                              ι Current index
                              ‹ Less than
                              θ Variable `n`
                              ⎇ ι Then current index else
                              θ Variable `n`
                              ± Negated
                              §υ Cyclically indexed into list
                              ⊕ Incremented
                              ⊞υ Pushed to list
                              Iυ Cast list to string for implicit output





                              share|improve this answer









                              $endgroup$




















                                0












                                $begingroup$

                                APL+WIN, 29 23 bytes



                                x↑,(0,⍳⌊(x←⎕)÷n)∘.+⍳n←⎕


                                Prompts for n and x



                                Try it online! Courtesy of Dyalog Classic






                                share|improve this answer











                                $endgroup$




















                                  0












                                  $begingroup$

                                  JS, 54 bytes



                                  f=(n,x)=>Array.from(Array(x),(_,i)=>i+1-(i/n|0)*(n-1))


                                  Try it online!






                                  share|improve this answer








                                  New contributor



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





                                  $endgroup$




















                                    0












                                    $begingroup$

                                    Haskell, 34 33 bytes



                                    n#x=take x$do j<-[1..];[j..j+n-1]


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$




















                                      0












                                      $begingroup$

                                      JavaScript, 36 bytes



                                      n=>g=x=>x?[...g(--x),1+x%n+x/n|0]:[]


                                      Try It Online!






                                      share|improve this answer











                                      $endgroup$












                                      • $begingroup$
                                        Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                        $endgroup$
                                        – tsh
                                        5 mins ago


















                                      0












                                      $begingroup$


                                      Perl 5, 39 bytes





                                      say 1+int($_/$F[1])+$_%$F[1]for 0..$_-1


                                      Try it online!






                                      share|improve this answer









                                      $endgroup$




















                                        0












                                        $begingroup$


                                        C (gcc), 49 44 bytes



                                        Using recursion to save some bytes.





                                        f(n,x)x&&printf("%d ",x%n+x/n+1,f(n,--x));


                                        Try it online!






                                        share|improve this answer











                                        $endgroup$













                                          Your Answer






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

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

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

                                          else
                                          createEditor();

                                          );

                                          function createEditor()
                                          StackExchange.prepareEditor(
                                          heartbeatType: 'answer',
                                          autoActivateHeartbeat: false,
                                          convertImagesToLinks: false,
                                          noModals: true,
                                          showLowRepImageUploadWarning: true,
                                          reputationToPostImages: null,
                                          bindNavPrevention: true,
                                          postfix: "",
                                          imageUploader:
                                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                                          allowUrls: true
                                          ,
                                          onDemand: true,
                                          discardSelector: ".discard-answer"
                                          ,immediatelyShowMarkdownHelp:true
                                          );



                                          );













                                          draft saved

                                          draft discarded


















                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f186233%2fincremental-ranges%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown

























                                          21 Answers
                                          21






                                          active

                                          oldest

                                          votes








                                          21 Answers
                                          21






                                          active

                                          oldest

                                          votes









                                          active

                                          oldest

                                          votes






                                          active

                                          oldest

                                          votes









                                          4












                                          $begingroup$


                                          Python 2, 39 bytes





                                          lambda n,x:[v/n+v%n+1for v in range(x)]


                                          Try it online!






                                          share|improve this answer









                                          $endgroup$












                                          • $begingroup$
                                            Also works in Python 3 with the replacement of / with //
                                            $endgroup$
                                            – Nick Kennedy
                                            8 hours ago















                                          4












                                          $begingroup$


                                          Python 2, 39 bytes





                                          lambda n,x:[v/n+v%n+1for v in range(x)]


                                          Try it online!






                                          share|improve this answer









                                          $endgroup$












                                          • $begingroup$
                                            Also works in Python 3 with the replacement of / with //
                                            $endgroup$
                                            – Nick Kennedy
                                            8 hours ago













                                          4












                                          4








                                          4





                                          $begingroup$


                                          Python 2, 39 bytes





                                          lambda n,x:[v/n+v%n+1for v in range(x)]


                                          Try it online!






                                          share|improve this answer









                                          $endgroup$




                                          Python 2, 39 bytes





                                          lambda n,x:[v/n+v%n+1for v in range(x)]


                                          Try it online!







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered 8 hours ago









                                          Jonathan AllanJonathan Allan

                                          56k538178




                                          56k538178











                                          • $begingroup$
                                            Also works in Python 3 with the replacement of / with //
                                            $endgroup$
                                            – Nick Kennedy
                                            8 hours ago
















                                          • $begingroup$
                                            Also works in Python 3 with the replacement of / with //
                                            $endgroup$
                                            – Nick Kennedy
                                            8 hours ago















                                          $begingroup$
                                          Also works in Python 3 with the replacement of / with //
                                          $endgroup$
                                          – Nick Kennedy
                                          8 hours ago




                                          $begingroup$
                                          Also works in Python 3 with the replacement of / with //
                                          $endgroup$
                                          – Nick Kennedy
                                          8 hours ago











                                          3












                                          $begingroup$


                                          Jelly, 4 bytes



                                          Ḷd§‘


                                          A dyadic Link accepting two positive integers, x on the left and n on the right, which yields a list of positive integers.



                                          Try it online!



                                          How?



                                          Ḷd§‘ - Link: x, n e.g 13, 3
                                          Ḷ - lowered range (x) [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                          d - divmod (n) [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                          § - sums [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                          ‘ - increment (vectorises) [1,2,3,2,3,4,3,4,5,4,5,6,5]





                                          share|improve this answer











                                          $endgroup$








                                          • 2




                                            $begingroup$
                                            Wait... is that divmod? Clever! And I was struggling with p...
                                            $endgroup$
                                            – Erik the Outgolfer
                                            8 hours ago
















                                          3












                                          $begingroup$


                                          Jelly, 4 bytes



                                          Ḷd§‘


                                          A dyadic Link accepting two positive integers, x on the left and n on the right, which yields a list of positive integers.



                                          Try it online!



                                          How?



                                          Ḷd§‘ - Link: x, n e.g 13, 3
                                          Ḷ - lowered range (x) [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                          d - divmod (n) [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                          § - sums [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                          ‘ - increment (vectorises) [1,2,3,2,3,4,3,4,5,4,5,6,5]





                                          share|improve this answer











                                          $endgroup$








                                          • 2




                                            $begingroup$
                                            Wait... is that divmod? Clever! And I was struggling with p...
                                            $endgroup$
                                            – Erik the Outgolfer
                                            8 hours ago














                                          3












                                          3








                                          3





                                          $begingroup$


                                          Jelly, 4 bytes



                                          Ḷd§‘


                                          A dyadic Link accepting two positive integers, x on the left and n on the right, which yields a list of positive integers.



                                          Try it online!



                                          How?



                                          Ḷd§‘ - Link: x, n e.g 13, 3
                                          Ḷ - lowered range (x) [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                          d - divmod (n) [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                          § - sums [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                          ‘ - increment (vectorises) [1,2,3,2,3,4,3,4,5,4,5,6,5]





                                          share|improve this answer











                                          $endgroup$




                                          Jelly, 4 bytes



                                          Ḷd§‘


                                          A dyadic Link accepting two positive integers, x on the left and n on the right, which yields a list of positive integers.



                                          Try it online!



                                          How?



                                          Ḷd§‘ - Link: x, n e.g 13, 3
                                          Ḷ - lowered range (x) [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                          d - divmod (n) [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                          § - sums [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                          ‘ - increment (vectorises) [1,2,3,2,3,4,3,4,5,4,5,6,5]






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 7 hours ago

























                                          answered 8 hours ago









                                          Jonathan AllanJonathan Allan

                                          56k538178




                                          56k538178







                                          • 2




                                            $begingroup$
                                            Wait... is that divmod? Clever! And I was struggling with p...
                                            $endgroup$
                                            – Erik the Outgolfer
                                            8 hours ago













                                          • 2




                                            $begingroup$
                                            Wait... is that divmod? Clever! And I was struggling with p...
                                            $endgroup$
                                            – Erik the Outgolfer
                                            8 hours ago








                                          2




                                          2




                                          $begingroup$
                                          Wait... is that divmod? Clever! And I was struggling with p...
                                          $endgroup$
                                          – Erik the Outgolfer
                                          8 hours ago





                                          $begingroup$
                                          Wait... is that divmod? Clever! And I was struggling with p...
                                          $endgroup$
                                          – Erik the Outgolfer
                                          8 hours ago












                                          3












                                          $begingroup$


                                          R, 33 bytes





                                          function(n,x,z=1:x-1)z%%n+z%/%n+1


                                          Try it online!



                                          Ports Jonathan Allan's Python solution.




                                          R, 36 bytes





                                          function(n,x)outer(1:n,0:x,"+")[1:x]


                                          Try it online!



                                          My original solution; generates an $ntimes x$ matrix with each column as the increments, i.e., $1 ldots n, 2ldots n+1,ldots$, then takes the first $x$ entries (going down the columns).






                                          share|improve this answer











                                          $endgroup$

















                                            3












                                            $begingroup$


                                            R, 33 bytes





                                            function(n,x,z=1:x-1)z%%n+z%/%n+1


                                            Try it online!



                                            Ports Jonathan Allan's Python solution.




                                            R, 36 bytes





                                            function(n,x)outer(1:n,0:x,"+")[1:x]


                                            Try it online!



                                            My original solution; generates an $ntimes x$ matrix with each column as the increments, i.e., $1 ldots n, 2ldots n+1,ldots$, then takes the first $x$ entries (going down the columns).






                                            share|improve this answer











                                            $endgroup$















                                              3












                                              3








                                              3





                                              $begingroup$


                                              R, 33 bytes





                                              function(n,x,z=1:x-1)z%%n+z%/%n+1


                                              Try it online!



                                              Ports Jonathan Allan's Python solution.




                                              R, 36 bytes





                                              function(n,x)outer(1:n,0:x,"+")[1:x]


                                              Try it online!



                                              My original solution; generates an $ntimes x$ matrix with each column as the increments, i.e., $1 ldots n, 2ldots n+1,ldots$, then takes the first $x$ entries (going down the columns).






                                              share|improve this answer











                                              $endgroup$




                                              R, 33 bytes





                                              function(n,x,z=1:x-1)z%%n+z%/%n+1


                                              Try it online!



                                              Ports Jonathan Allan's Python solution.




                                              R, 36 bytes





                                              function(n,x)outer(1:n,0:x,"+")[1:x]


                                              Try it online!



                                              My original solution; generates an $ntimes x$ matrix with each column as the increments, i.e., $1 ldots n, 2ldots n+1,ldots$, then takes the first $x$ entries (going down the columns).







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited 7 hours ago

























                                              answered 9 hours ago









                                              GiuseppeGiuseppe

                                              18.6k31358




                                              18.6k31358





















                                                  2












                                                  $begingroup$


                                                  05AB1E, 6 bytes



                                                  L<s‰O>


                                                  Port of @JonathanAllan's Jelly answer, so make sure to upvote him!



                                                  First input is $x$, second input is $n$.



                                                  Try it online or verify all test cases.



                                                  Explanation:





                                                  L # Push a list in the range [1, (implicit) input]
                                                  # i.e. 13 → [1,2,3,4,5,6,7,8,9,10,11,12,13]
                                                  < # Decrease each by 1 to the range [0, input)
                                                  # → [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                                  s‰ # Divmod each by the second input
                                                  # i.e. 3 → [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                                  O # Sum each pair
                                                  # → [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                                  > # And increase each by 1
                                                  # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                  # (after which the result is output implicitly)





                                                  My own initial approach was 8 bytes:



                                                  LI∍εN¹÷+


                                                  First input is $n$, second input is $x$.



                                                  Try it online or verify all test cases.



                                                  Explanation:





                                                  L # Push a list in the range [1, (implicit) input]
                                                  # i.e. 3 → [1,2,3]
                                                  I∍ # Extend it to the size of the second input
                                                  # i.e. 13 → [1,2,3,1,2,3,1,2,3,1,2,3,1]
                                                  ε # Map each value to:
                                                  N¹÷ # The 0-based index integer-divided by the first input
                                                  # → [0,0,0,1,1,1,2,2,2,3,3,3,4]
                                                  + # Add that to the value
                                                  # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                  # (after which the result is output implicitly)





                                                  share|improve this answer









                                                  $endgroup$

















                                                    2












                                                    $begingroup$


                                                    05AB1E, 6 bytes



                                                    L<s‰O>


                                                    Port of @JonathanAllan's Jelly answer, so make sure to upvote him!



                                                    First input is $x$, second input is $n$.



                                                    Try it online or verify all test cases.



                                                    Explanation:





                                                    L # Push a list in the range [1, (implicit) input]
                                                    # i.e. 13 → [1,2,3,4,5,6,7,8,9,10,11,12,13]
                                                    < # Decrease each by 1 to the range [0, input)
                                                    # → [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                                    s‰ # Divmod each by the second input
                                                    # i.e. 3 → [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                                    O # Sum each pair
                                                    # → [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                                    > # And increase each by 1
                                                    # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                    # (after which the result is output implicitly)





                                                    My own initial approach was 8 bytes:



                                                    LI∍εN¹÷+


                                                    First input is $n$, second input is $x$.



                                                    Try it online or verify all test cases.



                                                    Explanation:





                                                    L # Push a list in the range [1, (implicit) input]
                                                    # i.e. 3 → [1,2,3]
                                                    I∍ # Extend it to the size of the second input
                                                    # i.e. 13 → [1,2,3,1,2,3,1,2,3,1,2,3,1]
                                                    ε # Map each value to:
                                                    N¹÷ # The 0-based index integer-divided by the first input
                                                    # → [0,0,0,1,1,1,2,2,2,3,3,3,4]
                                                    + # Add that to the value
                                                    # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                    # (after which the result is output implicitly)





                                                    share|improve this answer









                                                    $endgroup$















                                                      2












                                                      2








                                                      2





                                                      $begingroup$


                                                      05AB1E, 6 bytes



                                                      L<s‰O>


                                                      Port of @JonathanAllan's Jelly answer, so make sure to upvote him!



                                                      First input is $x$, second input is $n$.



                                                      Try it online or verify all test cases.



                                                      Explanation:





                                                      L # Push a list in the range [1, (implicit) input]
                                                      # i.e. 13 → [1,2,3,4,5,6,7,8,9,10,11,12,13]
                                                      < # Decrease each by 1 to the range [0, input)
                                                      # → [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                                      s‰ # Divmod each by the second input
                                                      # i.e. 3 → [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                                      O # Sum each pair
                                                      # → [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                                      > # And increase each by 1
                                                      # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                      # (after which the result is output implicitly)





                                                      My own initial approach was 8 bytes:



                                                      LI∍εN¹÷+


                                                      First input is $n$, second input is $x$.



                                                      Try it online or verify all test cases.



                                                      Explanation:





                                                      L # Push a list in the range [1, (implicit) input]
                                                      # i.e. 3 → [1,2,3]
                                                      I∍ # Extend it to the size of the second input
                                                      # i.e. 13 → [1,2,3,1,2,3,1,2,3,1,2,3,1]
                                                      ε # Map each value to:
                                                      N¹÷ # The 0-based index integer-divided by the first input
                                                      # → [0,0,0,1,1,1,2,2,2,3,3,3,4]
                                                      + # Add that to the value
                                                      # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                      # (after which the result is output implicitly)





                                                      share|improve this answer









                                                      $endgroup$




                                                      05AB1E, 6 bytes



                                                      L<s‰O>


                                                      Port of @JonathanAllan's Jelly answer, so make sure to upvote him!



                                                      First input is $x$, second input is $n$.



                                                      Try it online or verify all test cases.



                                                      Explanation:





                                                      L # Push a list in the range [1, (implicit) input]
                                                      # i.e. 13 → [1,2,3,4,5,6,7,8,9,10,11,12,13]
                                                      < # Decrease each by 1 to the range [0, input)
                                                      # → [0,1,2,3,4,5,6,7,8,9,10,11,12]
                                                      s‰ # Divmod each by the second input
                                                      # i.e. 3 → [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
                                                      O # Sum each pair
                                                      # → [0,1,2,1,2,3,2,3,4,3,4,5,4]
                                                      > # And increase each by 1
                                                      # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                      # (after which the result is output implicitly)





                                                      My own initial approach was 8 bytes:



                                                      LI∍εN¹÷+


                                                      First input is $n$, second input is $x$.



                                                      Try it online or verify all test cases.



                                                      Explanation:





                                                      L # Push a list in the range [1, (implicit) input]
                                                      # i.e. 3 → [1,2,3]
                                                      I∍ # Extend it to the size of the second input
                                                      # i.e. 13 → [1,2,3,1,2,3,1,2,3,1,2,3,1]
                                                      ε # Map each value to:
                                                      N¹÷ # The 0-based index integer-divided by the first input
                                                      # → [0,0,0,1,1,1,2,2,2,3,3,3,4]
                                                      + # Add that to the value
                                                      # → [1,2,3,2,3,4,3,4,5,4,5,6,5]
                                                      # (after which the result is output implicitly)






                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered 6 hours ago









                                                      Kevin CruijssenKevin Cruijssen

                                                      45.2k576227




                                                      45.2k576227





















                                                          2












                                                          $begingroup$


                                                          Brain-Flak, 100 bytes



                                                          (<>)<>([()]<(())(()[()](<>))<>(()<>)(<>)(<>)([()]<(<>[](())[()]<>)>)>)


                                                          With comments and formatting:



                                                          # Push a zero under the other stack
                                                          (<>)<>

                                                          # x times

                                                          # x - 1
                                                          ([()]<

                                                          # Let 'a' be a counter that starts at n
                                                          # Duplicate a and NOT
                                                          (())(()[()](<>))

                                                          # if a == 0

                                                          # Pop truthy

                                                          <>

                                                          # Reset n to a
                                                          (()<>)

                                                          # Push 0 to each
                                                          (<>)(<>)


                                                          # Pop falsy


                                                          # Decrement A, add one to the other stack, and duplicate that number under this stack
                                                          ([()]<
                                                          (<>[](())<>)
                                                          >)
                                                          >)



                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$












                                                          • $begingroup$
                                                            Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                                                            $endgroup$
                                                            – Nitrodon
                                                            4 hours ago











                                                          • $begingroup$
                                                            @Nitrodon Whoops, not sure how that happened. Fixed now!
                                                            $endgroup$
                                                            – DJMcMayhem
                                                            4 hours ago















                                                          2












                                                          $begingroup$


                                                          Brain-Flak, 100 bytes



                                                          (<>)<>([()]<(())(()[()](<>))<>(()<>)(<>)(<>)([()]<(<>[](())[()]<>)>)>)


                                                          With comments and formatting:



                                                          # Push a zero under the other stack
                                                          (<>)<>

                                                          # x times

                                                          # x - 1
                                                          ([()]<

                                                          # Let 'a' be a counter that starts at n
                                                          # Duplicate a and NOT
                                                          (())(()[()](<>))

                                                          # if a == 0

                                                          # Pop truthy

                                                          <>

                                                          # Reset n to a
                                                          (()<>)

                                                          # Push 0 to each
                                                          (<>)(<>)


                                                          # Pop falsy


                                                          # Decrement A, add one to the other stack, and duplicate that number under this stack
                                                          ([()]<
                                                          (<>[](())<>)
                                                          >)
                                                          >)



                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$












                                                          • $begingroup$
                                                            Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                                                            $endgroup$
                                                            – Nitrodon
                                                            4 hours ago











                                                          • $begingroup$
                                                            @Nitrodon Whoops, not sure how that happened. Fixed now!
                                                            $endgroup$
                                                            – DJMcMayhem
                                                            4 hours ago













                                                          2












                                                          2








                                                          2





                                                          $begingroup$


                                                          Brain-Flak, 100 bytes



                                                          (<>)<>([()]<(())(()[()](<>))<>(()<>)(<>)(<>)([()]<(<>[](())[()]<>)>)>)


                                                          With comments and formatting:



                                                          # Push a zero under the other stack
                                                          (<>)<>

                                                          # x times

                                                          # x - 1
                                                          ([()]<

                                                          # Let 'a' be a counter that starts at n
                                                          # Duplicate a and NOT
                                                          (())(()[()](<>))

                                                          # if a == 0

                                                          # Pop truthy

                                                          <>

                                                          # Reset n to a
                                                          (()<>)

                                                          # Push 0 to each
                                                          (<>)(<>)


                                                          # Pop falsy


                                                          # Decrement A, add one to the other stack, and duplicate that number under this stack
                                                          ([()]<
                                                          (<>[](())<>)
                                                          >)
                                                          >)



                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$




                                                          Brain-Flak, 100 bytes



                                                          (<>)<>([()]<(())(()[()](<>))<>(()<>)(<>)(<>)([()]<(<>[](())[()]<>)>)>)


                                                          With comments and formatting:



                                                          # Push a zero under the other stack
                                                          (<>)<>

                                                          # x times

                                                          # x - 1
                                                          ([()]<

                                                          # Let 'a' be a counter that starts at n
                                                          # Duplicate a and NOT
                                                          (())(()[()](<>))

                                                          # if a == 0

                                                          # Pop truthy

                                                          <>

                                                          # Reset n to a
                                                          (()<>)

                                                          # Push 0 to each
                                                          (<>)(<>)


                                                          # Pop falsy


                                                          # Decrement A, add one to the other stack, and duplicate that number under this stack
                                                          ([()]<
                                                          (<>[](())<>)
                                                          >)
                                                          >)



                                                          Try it online!







                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited 4 hours ago

























                                                          answered 8 hours ago









                                                          DJMcMayhemDJMcMayhem

                                                          40.8k12150317




                                                          40.8k12150317











                                                          • $begingroup$
                                                            Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                                                            $endgroup$
                                                            – Nitrodon
                                                            4 hours ago











                                                          • $begingroup$
                                                            @Nitrodon Whoops, not sure how that happened. Fixed now!
                                                            $endgroup$
                                                            – DJMcMayhem
                                                            4 hours ago
















                                                          • $begingroup$
                                                            Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                                                            $endgroup$
                                                            – Nitrodon
                                                            4 hours ago











                                                          • $begingroup$
                                                            @Nitrodon Whoops, not sure how that happened. Fixed now!
                                                            $endgroup$
                                                            – DJMcMayhem
                                                            4 hours ago















                                                          $begingroup$
                                                          Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                                                          $endgroup$
                                                          – Nitrodon
                                                          4 hours ago





                                                          $begingroup$
                                                          Your "golfed" version doesn't work (and the formatted/commented version on TIO minifies to 100 bytes).
                                                          $endgroup$
                                                          – Nitrodon
                                                          4 hours ago













                                                          $begingroup$
                                                          @Nitrodon Whoops, not sure how that happened. Fixed now!
                                                          $endgroup$
                                                          – DJMcMayhem
                                                          4 hours ago




                                                          $begingroup$
                                                          @Nitrodon Whoops, not sure how that happened. Fixed now!
                                                          $endgroup$
                                                          – DJMcMayhem
                                                          4 hours ago











                                                          1












                                                          $begingroup$


                                                          Jelly, 5 bytes



                                                          +þẎḣ’


                                                          Try it online!






                                                          share|improve this answer









                                                          $endgroup$

















                                                            1












                                                            $begingroup$


                                                            Jelly, 5 bytes



                                                            +þẎḣ’


                                                            Try it online!






                                                            share|improve this answer









                                                            $endgroup$















                                                              1












                                                              1








                                                              1





                                                              $begingroup$


                                                              Jelly, 5 bytes



                                                              +þẎḣ’


                                                              Try it online!






                                                              share|improve this answer









                                                              $endgroup$




                                                              Jelly, 5 bytes



                                                              +þẎḣ’


                                                              Try it online!







                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered 8 hours ago









                                                              Erik the OutgolferErik the Outgolfer

                                                              33.6k430106




                                                              33.6k430106





















                                                                  1












                                                                  $begingroup$


                                                                  Ruby, 32 bytes





                                                                  ->n,x(0...x).mapi


                                                                  Try it online!






                                                                  share|improve this answer









                                                                  $endgroup$

















                                                                    1












                                                                    $begingroup$


                                                                    Ruby, 32 bytes





                                                                    ->n,x(0...x).mapi


                                                                    Try it online!






                                                                    share|improve this answer









                                                                    $endgroup$















                                                                      1












                                                                      1








                                                                      1





                                                                      $begingroup$


                                                                      Ruby, 32 bytes





                                                                      ->n,x(0...x).mapi


                                                                      Try it online!






                                                                      share|improve this answer









                                                                      $endgroup$




                                                                      Ruby, 32 bytes





                                                                      ->n,x(0...x).mapi


                                                                      Try it online!







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered 7 hours ago









                                                                      Value InkValue Ink

                                                                      8,215731




                                                                      8,215731





















                                                                          1












                                                                          $begingroup$


                                                                          Japt -m, 12 7 bytes



                                                                          Port of Jonathan's Python solution.



                                                                          Takes x as the first input.



                                                                          %VÄ+UzV


                                                                          Try it






                                                                          share|improve this answer











                                                                          $endgroup$

















                                                                            1












                                                                            $begingroup$


                                                                            Japt -m, 12 7 bytes



                                                                            Port of Jonathan's Python solution.



                                                                            Takes x as the first input.



                                                                            %VÄ+UzV


                                                                            Try it






                                                                            share|improve this answer











                                                                            $endgroup$















                                                                              1












                                                                              1








                                                                              1





                                                                              $begingroup$


                                                                              Japt -m, 12 7 bytes



                                                                              Port of Jonathan's Python solution.



                                                                              Takes x as the first input.



                                                                              %VÄ+UzV


                                                                              Try it






                                                                              share|improve this answer











                                                                              $endgroup$




                                                                              Japt -m, 12 7 bytes



                                                                              Port of Jonathan's Python solution.



                                                                              Takes x as the first input.



                                                                              %VÄ+UzV


                                                                              Try it







                                                                              share|improve this answer














                                                                              share|improve this answer



                                                                              share|improve this answer








                                                                              edited 7 hours ago

























                                                                              answered 9 hours ago









                                                                              ShaggyShaggy

                                                                              19.6k31768




                                                                              19.6k31768





















                                                                                  1












                                                                                  $begingroup$


                                                                                  Perl 6, 18 bytes





                                                                                  (1..*X+ ^*)[^$_]


                                                                                  Try it online!



                                                                                  Curried function f(x)(n).



                                                                                  Explanation



                                                                                   # Anonymous block
                                                                                  X+ # Cartesian product with addition
                                                                                  1..* # of range 1..Inf
                                                                                  ^* # and range 0..n
                                                                                  ( )[^$_] # First x elements





                                                                                  share|improve this answer











                                                                                  $endgroup$

















                                                                                    1












                                                                                    $begingroup$


                                                                                    Perl 6, 18 bytes





                                                                                    (1..*X+ ^*)[^$_]


                                                                                    Try it online!



                                                                                    Curried function f(x)(n).



                                                                                    Explanation



                                                                                     # Anonymous block
                                                                                    X+ # Cartesian product with addition
                                                                                    1..* # of range 1..Inf
                                                                                    ^* # and range 0..n
                                                                                    ( )[^$_] # First x elements





                                                                                    share|improve this answer











                                                                                    $endgroup$















                                                                                      1












                                                                                      1








                                                                                      1





                                                                                      $begingroup$


                                                                                      Perl 6, 18 bytes





                                                                                      (1..*X+ ^*)[^$_]


                                                                                      Try it online!



                                                                                      Curried function f(x)(n).



                                                                                      Explanation



                                                                                       # Anonymous block
                                                                                      X+ # Cartesian product with addition
                                                                                      1..* # of range 1..Inf
                                                                                      ^* # and range 0..n
                                                                                      ( )[^$_] # First x elements





                                                                                      share|improve this answer











                                                                                      $endgroup$




                                                                                      Perl 6, 18 bytes





                                                                                      (1..*X+ ^*)[^$_]


                                                                                      Try it online!



                                                                                      Curried function f(x)(n).



                                                                                      Explanation



                                                                                       # Anonymous block
                                                                                      X+ # Cartesian product with addition
                                                                                      1..* # of range 1..Inf
                                                                                      ^* # and range 0..n
                                                                                      ( )[^$_] # First x elements






                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited 6 hours ago

























                                                                                      answered 6 hours ago









                                                                                      nwellnhofnwellnhof

                                                                                      7,70011129




                                                                                      7,70011129





















                                                                                          1












                                                                                          $begingroup$


                                                                                          Perl 5 -na, 43 bytes





                                                                                          @r=map$_..$_+$F[1]-1,1..$_;say"@r[0..$_-1]"


                                                                                          Try it online!






                                                                                          share|improve this answer









                                                                                          $endgroup$

















                                                                                            1












                                                                                            $begingroup$


                                                                                            Perl 5 -na, 43 bytes





                                                                                            @r=map$_..$_+$F[1]-1,1..$_;say"@r[0..$_-1]"


                                                                                            Try it online!






                                                                                            share|improve this answer









                                                                                            $endgroup$















                                                                                              1












                                                                                              1








                                                                                              1





                                                                                              $begingroup$


                                                                                              Perl 5 -na, 43 bytes





                                                                                              @r=map$_..$_+$F[1]-1,1..$_;say"@r[0..$_-1]"


                                                                                              Try it online!






                                                                                              share|improve this answer









                                                                                              $endgroup$




                                                                                              Perl 5 -na, 43 bytes





                                                                                              @r=map$_..$_+$F[1]-1,1..$_;say"@r[0..$_-1]"


                                                                                              Try it online!







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered 6 hours ago









                                                                                              XcaliXcali

                                                                                              5,920523




                                                                                              5,920523





















                                                                                                  1












                                                                                                  $begingroup$


                                                                                                  Octave, 25 bytes





                                                                                                  @(n,x)((1:n)'+(0:x))(1:x)


                                                                                                  Anonymous function that inputs numbers n``andx`, and outputs a row vector.



                                                                                                  Try it online!






                                                                                                  share|improve this answer









                                                                                                  $endgroup$

















                                                                                                    1












                                                                                                    $begingroup$


                                                                                                    Octave, 25 bytes





                                                                                                    @(n,x)((1:n)'+(0:x))(1:x)


                                                                                                    Anonymous function that inputs numbers n``andx`, and outputs a row vector.



                                                                                                    Try it online!






                                                                                                    share|improve this answer









                                                                                                    $endgroup$















                                                                                                      1












                                                                                                      1








                                                                                                      1





                                                                                                      $begingroup$


                                                                                                      Octave, 25 bytes





                                                                                                      @(n,x)((1:n)'+(0:x))(1:x)


                                                                                                      Anonymous function that inputs numbers n``andx`, and outputs a row vector.



                                                                                                      Try it online!






                                                                                                      share|improve this answer









                                                                                                      $endgroup$




                                                                                                      Octave, 25 bytes





                                                                                                      @(n,x)((1:n)'+(0:x))(1:x)


                                                                                                      Anonymous function that inputs numbers n``andx`, and outputs a row vector.



                                                                                                      Try it online!







                                                                                                      share|improve this answer












                                                                                                      share|improve this answer



                                                                                                      share|improve this answer










                                                                                                      answered 5 hours ago









                                                                                                      Luis MendoLuis Mendo

                                                                                                      76k889298




                                                                                                      76k889298





















                                                                                                          1












                                                                                                          $begingroup$


                                                                                                          MATL, 16 bytes



                                                                                                          :i:"tQ]v!1e 2G:)


                                                                                                          Try it online!



                                                                                                          Explanation:



                                                                                                          : % Push [1, 2... n]
                                                                                                          i:" ] % For i in [1, x]:
                                                                                                          t % Duplicate the first array
                                                                                                          Q % Increment each number
                                                                                                          v % Concatenate everything into 1 matrix
                                                                                                          ! % Transpose
                                                                                                          1e % Reshape into 1 row
                                                                                                          2G % Push x again
                                                                                                          :) % And take the first x elements





                                                                                                          share|improve this answer









                                                                                                          $endgroup$








                                                                                                          • 1




                                                                                                            $begingroup$
                                                                                                            10 bytes using broadcasting.
                                                                                                            $endgroup$
                                                                                                            – Giuseppe
                                                                                                            3 hours ago















                                                                                                          1












                                                                                                          $begingroup$


                                                                                                          MATL, 16 bytes



                                                                                                          :i:"tQ]v!1e 2G:)


                                                                                                          Try it online!



                                                                                                          Explanation:



                                                                                                          : % Push [1, 2... n]
                                                                                                          i:" ] % For i in [1, x]:
                                                                                                          t % Duplicate the first array
                                                                                                          Q % Increment each number
                                                                                                          v % Concatenate everything into 1 matrix
                                                                                                          ! % Transpose
                                                                                                          1e % Reshape into 1 row
                                                                                                          2G % Push x again
                                                                                                          :) % And take the first x elements





                                                                                                          share|improve this answer









                                                                                                          $endgroup$








                                                                                                          • 1




                                                                                                            $begingroup$
                                                                                                            10 bytes using broadcasting.
                                                                                                            $endgroup$
                                                                                                            – Giuseppe
                                                                                                            3 hours ago













                                                                                                          1












                                                                                                          1








                                                                                                          1





                                                                                                          $begingroup$


                                                                                                          MATL, 16 bytes



                                                                                                          :i:"tQ]v!1e 2G:)


                                                                                                          Try it online!



                                                                                                          Explanation:



                                                                                                          : % Push [1, 2... n]
                                                                                                          i:" ] % For i in [1, x]:
                                                                                                          t % Duplicate the first array
                                                                                                          Q % Increment each number
                                                                                                          v % Concatenate everything into 1 matrix
                                                                                                          ! % Transpose
                                                                                                          1e % Reshape into 1 row
                                                                                                          2G % Push x again
                                                                                                          :) % And take the first x elements





                                                                                                          share|improve this answer









                                                                                                          $endgroup$




                                                                                                          MATL, 16 bytes



                                                                                                          :i:"tQ]v!1e 2G:)


                                                                                                          Try it online!



                                                                                                          Explanation:



                                                                                                          : % Push [1, 2... n]
                                                                                                          i:" ] % For i in [1, x]:
                                                                                                          t % Duplicate the first array
                                                                                                          Q % Increment each number
                                                                                                          v % Concatenate everything into 1 matrix
                                                                                                          ! % Transpose
                                                                                                          1e % Reshape into 1 row
                                                                                                          2G % Push x again
                                                                                                          :) % And take the first x elements






                                                                                                          share|improve this answer












                                                                                                          share|improve this answer



                                                                                                          share|improve this answer










                                                                                                          answered 4 hours ago









                                                                                                          DJMcMayhemDJMcMayhem

                                                                                                          40.8k12150317




                                                                                                          40.8k12150317







                                                                                                          • 1




                                                                                                            $begingroup$
                                                                                                            10 bytes using broadcasting.
                                                                                                            $endgroup$
                                                                                                            – Giuseppe
                                                                                                            3 hours ago












                                                                                                          • 1




                                                                                                            $begingroup$
                                                                                                            10 bytes using broadcasting.
                                                                                                            $endgroup$
                                                                                                            – Giuseppe
                                                                                                            3 hours ago







                                                                                                          1




                                                                                                          1




                                                                                                          $begingroup$
                                                                                                          10 bytes using broadcasting.
                                                                                                          $endgroup$
                                                                                                          – Giuseppe
                                                                                                          3 hours ago




                                                                                                          $begingroup$
                                                                                                          10 bytes using broadcasting.
                                                                                                          $endgroup$
                                                                                                          – Giuseppe
                                                                                                          3 hours ago











                                                                                                          1












                                                                                                          $begingroup$


                                                                                                          J, 13 12 bytes



                                                                                                          [$[:,1++/&i.


                                                                                                          Try it online!



                                                                                                          how



                                                                                                          We take x as the left arg, n as the right. Let's take x = 8 and n = 3 for this example:




                                                                                                          • +/&i.: Transform both args by creating integer ranges i., that is, the left arg becomes 0 1 2 3 4 5 6 7 and the right arg becomes 0 1 2. Now we create an "addition table +/ from those two:



                                                                                                             0 1 2
                                                                                                            1 2 3
                                                                                                            2 3 4
                                                                                                            3 4 5
                                                                                                            4 5 6
                                                                                                            5 6 7
                                                                                                            6 7 8
                                                                                                            7 8 9



                                                                                                          • 1 +: Add 1 to every element of this table:



                                                                                                             1 2 3
                                                                                                            2 3 4
                                                                                                            3 4 5
                                                                                                            4 5 6
                                                                                                            5 6 7
                                                                                                            6 7 8
                                                                                                            7 8 9
                                                                                                            8 9 10



                                                                                                          • [: ,: Flatten it ,:



                                                                                                             1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10



                                                                                                          • [ $: Shape it $ so it has the same number of elements as the original, untransformed left arg [, ie, x:



                                                                                                             1 2 3 2 3 4 3 4 






                                                                                                          share|improve this answer











                                                                                                          $endgroup$

















                                                                                                            1












                                                                                                            $begingroup$


                                                                                                            J, 13 12 bytes



                                                                                                            [$[:,1++/&i.


                                                                                                            Try it online!



                                                                                                            how



                                                                                                            We take x as the left arg, n as the right. Let's take x = 8 and n = 3 for this example:




                                                                                                            • +/&i.: Transform both args by creating integer ranges i., that is, the left arg becomes 0 1 2 3 4 5 6 7 and the right arg becomes 0 1 2. Now we create an "addition table +/ from those two:



                                                                                                               0 1 2
                                                                                                              1 2 3
                                                                                                              2 3 4
                                                                                                              3 4 5
                                                                                                              4 5 6
                                                                                                              5 6 7
                                                                                                              6 7 8
                                                                                                              7 8 9



                                                                                                            • 1 +: Add 1 to every element of this table:



                                                                                                               1 2 3
                                                                                                              2 3 4
                                                                                                              3 4 5
                                                                                                              4 5 6
                                                                                                              5 6 7
                                                                                                              6 7 8
                                                                                                              7 8 9
                                                                                                              8 9 10



                                                                                                            • [: ,: Flatten it ,:



                                                                                                               1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10



                                                                                                            • [ $: Shape it $ so it has the same number of elements as the original, untransformed left arg [, ie, x:



                                                                                                               1 2 3 2 3 4 3 4 






                                                                                                            share|improve this answer











                                                                                                            $endgroup$















                                                                                                              1












                                                                                                              1








                                                                                                              1





                                                                                                              $begingroup$


                                                                                                              J, 13 12 bytes



                                                                                                              [$[:,1++/&i.


                                                                                                              Try it online!



                                                                                                              how



                                                                                                              We take x as the left arg, n as the right. Let's take x = 8 and n = 3 for this example:




                                                                                                              • +/&i.: Transform both args by creating integer ranges i., that is, the left arg becomes 0 1 2 3 4 5 6 7 and the right arg becomes 0 1 2. Now we create an "addition table +/ from those two:



                                                                                                                 0 1 2
                                                                                                                1 2 3
                                                                                                                2 3 4
                                                                                                                3 4 5
                                                                                                                4 5 6
                                                                                                                5 6 7
                                                                                                                6 7 8
                                                                                                                7 8 9



                                                                                                              • 1 +: Add 1 to every element of this table:



                                                                                                                 1 2 3
                                                                                                                2 3 4
                                                                                                                3 4 5
                                                                                                                4 5 6
                                                                                                                5 6 7
                                                                                                                6 7 8
                                                                                                                7 8 9
                                                                                                                8 9 10



                                                                                                              • [: ,: Flatten it ,:



                                                                                                                 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10



                                                                                                              • [ $: Shape it $ so it has the same number of elements as the original, untransformed left arg [, ie, x:



                                                                                                                 1 2 3 2 3 4 3 4 






                                                                                                              share|improve this answer











                                                                                                              $endgroup$




                                                                                                              J, 13 12 bytes



                                                                                                              [$[:,1++/&i.


                                                                                                              Try it online!



                                                                                                              how



                                                                                                              We take x as the left arg, n as the right. Let's take x = 8 and n = 3 for this example:




                                                                                                              • +/&i.: Transform both args by creating integer ranges i., that is, the left arg becomes 0 1 2 3 4 5 6 7 and the right arg becomes 0 1 2. Now we create an "addition table +/ from those two:



                                                                                                                 0 1 2
                                                                                                                1 2 3
                                                                                                                2 3 4
                                                                                                                3 4 5
                                                                                                                4 5 6
                                                                                                                5 6 7
                                                                                                                6 7 8
                                                                                                                7 8 9



                                                                                                              • 1 +: Add 1 to every element of this table:



                                                                                                                 1 2 3
                                                                                                                2 3 4
                                                                                                                3 4 5
                                                                                                                4 5 6
                                                                                                                5 6 7
                                                                                                                6 7 8
                                                                                                                7 8 9
                                                                                                                8 9 10



                                                                                                              • [: ,: Flatten it ,:



                                                                                                                 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10



                                                                                                              • [ $: Shape it $ so it has the same number of elements as the original, untransformed left arg [, ie, x:



                                                                                                                 1 2 3 2 3 4 3 4 







                                                                                                              share|improve this answer














                                                                                                              share|improve this answer



                                                                                                              share|improve this answer








                                                                                                              edited 43 mins ago

























                                                                                                              answered 7 hours ago









                                                                                                              JonahJonah

                                                                                                              3,3881019




                                                                                                              3,3881019





















                                                                                                                  0












                                                                                                                  $begingroup$


                                                                                                                  Alchemist, 77 bytes



                                                                                                                  _->In_n+In_x
                                                                                                                  x+n+0y+0z->a+Out_a+Out_" "+m+y
                                                                                                                  y+n->n
                                                                                                                  y+0n->z
                                                                                                                  z+m+a->z+n
                                                                                                                  z+0m->a


                                                                                                                  Try it online!



                                                                                                                  Increments and outputs a counter n times, then subtracts n-1 before repeating.






                                                                                                                  share|improve this answer









                                                                                                                  $endgroup$

















                                                                                                                    0












                                                                                                                    $begingroup$


                                                                                                                    Alchemist, 77 bytes



                                                                                                                    _->In_n+In_x
                                                                                                                    x+n+0y+0z->a+Out_a+Out_" "+m+y
                                                                                                                    y+n->n
                                                                                                                    y+0n->z
                                                                                                                    z+m+a->z+n
                                                                                                                    z+0m->a


                                                                                                                    Try it online!



                                                                                                                    Increments and outputs a counter n times, then subtracts n-1 before repeating.






                                                                                                                    share|improve this answer









                                                                                                                    $endgroup$















                                                                                                                      0












                                                                                                                      0








                                                                                                                      0





                                                                                                                      $begingroup$


                                                                                                                      Alchemist, 77 bytes



                                                                                                                      _->In_n+In_x
                                                                                                                      x+n+0y+0z->a+Out_a+Out_" "+m+y
                                                                                                                      y+n->n
                                                                                                                      y+0n->z
                                                                                                                      z+m+a->z+n
                                                                                                                      z+0m->a


                                                                                                                      Try it online!



                                                                                                                      Increments and outputs a counter n times, then subtracts n-1 before repeating.






                                                                                                                      share|improve this answer









                                                                                                                      $endgroup$




                                                                                                                      Alchemist, 77 bytes



                                                                                                                      _->In_n+In_x
                                                                                                                      x+n+0y+0z->a+Out_a+Out_" "+m+y
                                                                                                                      y+n->n
                                                                                                                      y+0n->z
                                                                                                                      z+m+a->z+n
                                                                                                                      z+0m->a


                                                                                                                      Try it online!



                                                                                                                      Increments and outputs a counter n times, then subtracts n-1 before repeating.







                                                                                                                      share|improve this answer












                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer










                                                                                                                      answered 9 hours ago









                                                                                                                      NitrodonNitrodon

                                                                                                                      8,03621024




                                                                                                                      8,03621024





















                                                                                                                          0












                                                                                                                          $begingroup$


                                                                                                                          Charcoal, 18 bytes



                                                                                                                          NθFN⊞υ⊕⎇‹ιθι§υ±θIυ


                                                                                                                          Try it online! Link is to verbose version of code. I had dreams of seeding the list with a zero-indexed range and then slicing it off again but that was actually 2 bytes longer. Explanation:



                                                                                                                          Nθ Input `n` into variable
                                                                                                                          N Input `x`
                                                                                                                          F Loop over implicit range
                                                                                                                          ι Current index
                                                                                                                          ‹ Less than
                                                                                                                          θ Variable `n`
                                                                                                                          ⎇ ι Then current index else
                                                                                                                          θ Variable `n`
                                                                                                                          ± Negated
                                                                                                                          §υ Cyclically indexed into list
                                                                                                                          ⊕ Incremented
                                                                                                                          ⊞υ Pushed to list
                                                                                                                          Iυ Cast list to string for implicit output





                                                                                                                          share|improve this answer









                                                                                                                          $endgroup$

















                                                                                                                            0












                                                                                                                            $begingroup$


                                                                                                                            Charcoal, 18 bytes



                                                                                                                            NθFN⊞υ⊕⎇‹ιθι§υ±θIυ


                                                                                                                            Try it online! Link is to verbose version of code. I had dreams of seeding the list with a zero-indexed range and then slicing it off again but that was actually 2 bytes longer. Explanation:



                                                                                                                            Nθ Input `n` into variable
                                                                                                                            N Input `x`
                                                                                                                            F Loop over implicit range
                                                                                                                            ι Current index
                                                                                                                            ‹ Less than
                                                                                                                            θ Variable `n`
                                                                                                                            ⎇ ι Then current index else
                                                                                                                            θ Variable `n`
                                                                                                                            ± Negated
                                                                                                                            §υ Cyclically indexed into list
                                                                                                                            ⊕ Incremented
                                                                                                                            ⊞υ Pushed to list
                                                                                                                            Iυ Cast list to string for implicit output





                                                                                                                            share|improve this answer









                                                                                                                            $endgroup$















                                                                                                                              0












                                                                                                                              0








                                                                                                                              0





                                                                                                                              $begingroup$


                                                                                                                              Charcoal, 18 bytes



                                                                                                                              NθFN⊞υ⊕⎇‹ιθι§υ±θIυ


                                                                                                                              Try it online! Link is to verbose version of code. I had dreams of seeding the list with a zero-indexed range and then slicing it off again but that was actually 2 bytes longer. Explanation:



                                                                                                                              Nθ Input `n` into variable
                                                                                                                              N Input `x`
                                                                                                                              F Loop over implicit range
                                                                                                                              ι Current index
                                                                                                                              ‹ Less than
                                                                                                                              θ Variable `n`
                                                                                                                              ⎇ ι Then current index else
                                                                                                                              θ Variable `n`
                                                                                                                              ± Negated
                                                                                                                              §υ Cyclically indexed into list
                                                                                                                              ⊕ Incremented
                                                                                                                              ⊞υ Pushed to list
                                                                                                                              Iυ Cast list to string for implicit output





                                                                                                                              share|improve this answer









                                                                                                                              $endgroup$




                                                                                                                              Charcoal, 18 bytes



                                                                                                                              NθFN⊞υ⊕⎇‹ιθι§υ±θIυ


                                                                                                                              Try it online! Link is to verbose version of code. I had dreams of seeding the list with a zero-indexed range and then slicing it off again but that was actually 2 bytes longer. Explanation:



                                                                                                                              Nθ Input `n` into variable
                                                                                                                              N Input `x`
                                                                                                                              F Loop over implicit range
                                                                                                                              ι Current index
                                                                                                                              ‹ Less than
                                                                                                                              θ Variable `n`
                                                                                                                              ⎇ ι Then current index else
                                                                                                                              θ Variable `n`
                                                                                                                              ± Negated
                                                                                                                              §υ Cyclically indexed into list
                                                                                                                              ⊕ Incremented
                                                                                                                              ⊞υ Pushed to list
                                                                                                                              Iυ Cast list to string for implicit output






                                                                                                                              share|improve this answer












                                                                                                                              share|improve this answer



                                                                                                                              share|improve this answer










                                                                                                                              answered 8 hours ago









                                                                                                                              NeilNeil

                                                                                                                              84.6k845183




                                                                                                                              84.6k845183





















                                                                                                                                  0












                                                                                                                                  $begingroup$

                                                                                                                                  APL+WIN, 29 23 bytes



                                                                                                                                  x↑,(0,⍳⌊(x←⎕)÷n)∘.+⍳n←⎕


                                                                                                                                  Prompts for n and x



                                                                                                                                  Try it online! Courtesy of Dyalog Classic






                                                                                                                                  share|improve this answer











                                                                                                                                  $endgroup$

















                                                                                                                                    0












                                                                                                                                    $begingroup$

                                                                                                                                    APL+WIN, 29 23 bytes



                                                                                                                                    x↑,(0,⍳⌊(x←⎕)÷n)∘.+⍳n←⎕


                                                                                                                                    Prompts for n and x



                                                                                                                                    Try it online! Courtesy of Dyalog Classic






                                                                                                                                    share|improve this answer











                                                                                                                                    $endgroup$















                                                                                                                                      0












                                                                                                                                      0








                                                                                                                                      0





                                                                                                                                      $begingroup$

                                                                                                                                      APL+WIN, 29 23 bytes



                                                                                                                                      x↑,(0,⍳⌊(x←⎕)÷n)∘.+⍳n←⎕


                                                                                                                                      Prompts for n and x



                                                                                                                                      Try it online! Courtesy of Dyalog Classic






                                                                                                                                      share|improve this answer











                                                                                                                                      $endgroup$



                                                                                                                                      APL+WIN, 29 23 bytes



                                                                                                                                      x↑,(0,⍳⌊(x←⎕)÷n)∘.+⍳n←⎕


                                                                                                                                      Prompts for n and x



                                                                                                                                      Try it online! Courtesy of Dyalog Classic







                                                                                                                                      share|improve this answer














                                                                                                                                      share|improve this answer



                                                                                                                                      share|improve this answer








                                                                                                                                      edited 6 hours ago

























                                                                                                                                      answered 8 hours ago









                                                                                                                                      GrahamGraham

                                                                                                                                      2,75678




                                                                                                                                      2,75678





















                                                                                                                                          0












                                                                                                                                          $begingroup$

                                                                                                                                          JS, 54 bytes



                                                                                                                                          f=(n,x)=>Array.from(Array(x),(_,i)=>i+1-(i/n|0)*(n-1))


                                                                                                                                          Try it online!






                                                                                                                                          share|improve this answer








                                                                                                                                          New contributor



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





                                                                                                                                          $endgroup$

















                                                                                                                                            0












                                                                                                                                            $begingroup$

                                                                                                                                            JS, 54 bytes



                                                                                                                                            f=(n,x)=>Array.from(Array(x),(_,i)=>i+1-(i/n|0)*(n-1))


                                                                                                                                            Try it online!






                                                                                                                                            share|improve this answer








                                                                                                                                            New contributor



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





                                                                                                                                            $endgroup$















                                                                                                                                              0












                                                                                                                                              0








                                                                                                                                              0





                                                                                                                                              $begingroup$

                                                                                                                                              JS, 54 bytes



                                                                                                                                              f=(n,x)=>Array.from(Array(x),(_,i)=>i+1-(i/n|0)*(n-1))


                                                                                                                                              Try it online!






                                                                                                                                              share|improve this answer








                                                                                                                                              New contributor



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





                                                                                                                                              $endgroup$



                                                                                                                                              JS, 54 bytes



                                                                                                                                              f=(n,x)=>Array.from(Array(x),(_,i)=>i+1-(i/n|0)*(n-1))


                                                                                                                                              Try it online!







                                                                                                                                              share|improve this answer








                                                                                                                                              New contributor



                                                                                                                                              user2657799 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






                                                                                                                                              New contributor



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








                                                                                                                                              answered 6 hours ago









                                                                                                                                              user2657799user2657799

                                                                                                                                              1




                                                                                                                                              1




                                                                                                                                              New contributor



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




                                                                                                                                              New contributor




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























                                                                                                                                                  0












                                                                                                                                                  $begingroup$

                                                                                                                                                  Haskell, 34 33 bytes



                                                                                                                                                  n#x=take x$do j<-[1..];[j..j+n-1]


                                                                                                                                                  Try it online!






                                                                                                                                                  share|improve this answer











                                                                                                                                                  $endgroup$

















                                                                                                                                                    0












                                                                                                                                                    $begingroup$

                                                                                                                                                    Haskell, 34 33 bytes



                                                                                                                                                    n#x=take x$do j<-[1..];[j..j+n-1]


                                                                                                                                                    Try it online!






                                                                                                                                                    share|improve this answer











                                                                                                                                                    $endgroup$















                                                                                                                                                      0












                                                                                                                                                      0








                                                                                                                                                      0





                                                                                                                                                      $begingroup$

                                                                                                                                                      Haskell, 34 33 bytes



                                                                                                                                                      n#x=take x$do j<-[1..];[j..j+n-1]


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer











                                                                                                                                                      $endgroup$



                                                                                                                                                      Haskell, 34 33 bytes



                                                                                                                                                      n#x=take x$do j<-[1..];[j..j+n-1]


                                                                                                                                                      Try it online!







                                                                                                                                                      share|improve this answer














                                                                                                                                                      share|improve this answer



                                                                                                                                                      share|improve this answer








                                                                                                                                                      edited 6 hours ago

























                                                                                                                                                      answered 6 hours ago









                                                                                                                                                      niminimi

                                                                                                                                                      33.2k32491




                                                                                                                                                      33.2k32491





















                                                                                                                                                          0












                                                                                                                                                          $begingroup$

                                                                                                                                                          JavaScript, 36 bytes



                                                                                                                                                          n=>g=x=>x?[...g(--x),1+x%n+x/n|0]:[]


                                                                                                                                                          Try It Online!






                                                                                                                                                          share|improve this answer











                                                                                                                                                          $endgroup$












                                                                                                                                                          • $begingroup$
                                                                                                                                                            Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                                                                                                                                            $endgroup$
                                                                                                                                                            – tsh
                                                                                                                                                            5 mins ago















                                                                                                                                                          0












                                                                                                                                                          $begingroup$

                                                                                                                                                          JavaScript, 36 bytes



                                                                                                                                                          n=>g=x=>x?[...g(--x),1+x%n+x/n|0]:[]


                                                                                                                                                          Try It Online!






                                                                                                                                                          share|improve this answer











                                                                                                                                                          $endgroup$












                                                                                                                                                          • $begingroup$
                                                                                                                                                            Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                                                                                                                                            $endgroup$
                                                                                                                                                            – tsh
                                                                                                                                                            5 mins ago













                                                                                                                                                          0












                                                                                                                                                          0








                                                                                                                                                          0





                                                                                                                                                          $begingroup$

                                                                                                                                                          JavaScript, 36 bytes



                                                                                                                                                          n=>g=x=>x?[...g(--x),1+x%n+x/n|0]:[]


                                                                                                                                                          Try It Online!






                                                                                                                                                          share|improve this answer











                                                                                                                                                          $endgroup$



                                                                                                                                                          JavaScript, 36 bytes



                                                                                                                                                          n=>g=x=>x?[...g(--x),1+x%n+x/n|0]:[]


                                                                                                                                                          Try It Online!







                                                                                                                                                          share|improve this answer














                                                                                                                                                          share|improve this answer



                                                                                                                                                          share|improve this answer








                                                                                                                                                          edited 6 hours ago

























                                                                                                                                                          answered 6 hours ago









                                                                                                                                                          ShaggyShaggy

                                                                                                                                                          19.6k31768




                                                                                                                                                          19.6k31768











                                                                                                                                                          • $begingroup$
                                                                                                                                                            Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                                                                                                                                            $endgroup$
                                                                                                                                                            – tsh
                                                                                                                                                            5 mins ago
















                                                                                                                                                          • $begingroup$
                                                                                                                                                            Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                                                                                                                                            $endgroup$
                                                                                                                                                            – tsh
                                                                                                                                                            5 mins ago















                                                                                                                                                          $begingroup$
                                                                                                                                                          Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                                                                                                                                          $endgroup$
                                                                                                                                                          – tsh
                                                                                                                                                          5 mins ago




                                                                                                                                                          $begingroup$
                                                                                                                                                          Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)
                                                                                                                                                          $endgroup$
                                                                                                                                                          – tsh
                                                                                                                                                          5 mins ago











                                                                                                                                                          0












                                                                                                                                                          $begingroup$


                                                                                                                                                          Perl 5, 39 bytes





                                                                                                                                                          say 1+int($_/$F[1])+$_%$F[1]for 0..$_-1


                                                                                                                                                          Try it online!






                                                                                                                                                          share|improve this answer









                                                                                                                                                          $endgroup$

















                                                                                                                                                            0












                                                                                                                                                            $begingroup$


                                                                                                                                                            Perl 5, 39 bytes





                                                                                                                                                            say 1+int($_/$F[1])+$_%$F[1]for 0..$_-1


                                                                                                                                                            Try it online!






                                                                                                                                                            share|improve this answer









                                                                                                                                                            $endgroup$















                                                                                                                                                              0












                                                                                                                                                              0








                                                                                                                                                              0





                                                                                                                                                              $begingroup$


                                                                                                                                                              Perl 5, 39 bytes





                                                                                                                                                              say 1+int($_/$F[1])+$_%$F[1]for 0..$_-1


                                                                                                                                                              Try it online!






                                                                                                                                                              share|improve this answer









                                                                                                                                                              $endgroup$




                                                                                                                                                              Perl 5, 39 bytes





                                                                                                                                                              say 1+int($_/$F[1])+$_%$F[1]for 0..$_-1


                                                                                                                                                              Try it online!







                                                                                                                                                              share|improve this answer












                                                                                                                                                              share|improve this answer



                                                                                                                                                              share|improve this answer










                                                                                                                                                              answered 1 hour ago









                                                                                                                                                              Kjetil S.Kjetil S.

                                                                                                                                                              66925




                                                                                                                                                              66925





















                                                                                                                                                                  0












                                                                                                                                                                  $begingroup$


                                                                                                                                                                  C (gcc), 49 44 bytes



                                                                                                                                                                  Using recursion to save some bytes.





                                                                                                                                                                  f(n,x)x&&printf("%d ",x%n+x/n+1,f(n,--x));


                                                                                                                                                                  Try it online!






                                                                                                                                                                  share|improve this answer











                                                                                                                                                                  $endgroup$

















                                                                                                                                                                    0












                                                                                                                                                                    $begingroup$


                                                                                                                                                                    C (gcc), 49 44 bytes



                                                                                                                                                                    Using recursion to save some bytes.





                                                                                                                                                                    f(n,x)x&&printf("%d ",x%n+x/n+1,f(n,--x));


                                                                                                                                                                    Try it online!






                                                                                                                                                                    share|improve this answer











                                                                                                                                                                    $endgroup$















                                                                                                                                                                      0












                                                                                                                                                                      0








                                                                                                                                                                      0





                                                                                                                                                                      $begingroup$


                                                                                                                                                                      C (gcc), 49 44 bytes



                                                                                                                                                                      Using recursion to save some bytes.





                                                                                                                                                                      f(n,x)x&&printf("%d ",x%n+x/n+1,f(n,--x));


                                                                                                                                                                      Try it online!






                                                                                                                                                                      share|improve this answer











                                                                                                                                                                      $endgroup$




                                                                                                                                                                      C (gcc), 49 44 bytes



                                                                                                                                                                      Using recursion to save some bytes.





                                                                                                                                                                      f(n,x)x&&printf("%d ",x%n+x/n+1,f(n,--x));


                                                                                                                                                                      Try it online!







                                                                                                                                                                      share|improve this answer














                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer








                                                                                                                                                                      edited 7 mins ago

























                                                                                                                                                                      answered 1 hour ago









                                                                                                                                                                      ErikFErikF

                                                                                                                                                                      1,35927




                                                                                                                                                                      1,35927



























                                                                                                                                                                          draft saved

                                                                                                                                                                          draft discarded
















































                                                                                                                                                                          If this is an answer to a challenge…



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


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


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


                                                                                                                                                                          More generally…



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


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




                                                                                                                                                                          draft saved


                                                                                                                                                                          draft discarded














                                                                                                                                                                          StackExchange.ready(
                                                                                                                                                                          function ()
                                                                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f186233%2fincremental-ranges%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

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

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

                                                                                                                                                                          Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її