Make me a metasequenceMake a pattern alternateGenerate Loopy puzzlesMake a one sequenceA register calculator...

What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?

How to count occurrences of Friday 13th

As a new poet, where can I find help from a professional to judge my work?

Must a tritone substitution use a dominant seventh chord?

How do ISS astronauts "get their stripes"?

Is there a frame of reference in which I was born before I was conceived?

What is a term for a function that when called repeatedly, has the same effect as calling once?

How can I handle a player who pre-plans arguments about my rulings on RAW?

If nine coins are tossed, what is the probability that the number of heads is even?

Pronunciation of powers

How to count words in a line

What am I? I am in theaters and computer programs

Replacement ford fiesta radiator has extra hose

Compare four integers, return word based on maximum

Reason Why Dimensional Travelling Would be Restricted

What can I substitute for soda pop in a sweet pork recipe?

Equivalent to "source" in OpenBSD?

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

Why is working on the same position for more than 15 years not a red flag?

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

Pure Functions: Does "No Side Effects" Imply "Always Same Output, Given Same Input"?

What is the difference between ashamed and shamed?

Linear regression when Y is bounded and discrete

Is there a low-level alternative to Animate Objects?



Make me a metasequence


Make a pattern alternateGenerate Loopy puzzlesMake a one sequenceA register calculator challengeGenerate E-series of preferred numbersIncrementing Gray CodesDraw the Ingress glyphsExponentiation SequenceMake an n-JugglerIndent your code according to Fibonacci













14












$begingroup$


Background



For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase by an increasing value, etc.



For instance, the tier 3 metasequence would start as:



1 2 4 8 15 26 42 64 93 130 176



because:



    1 2 3  4  5  6  7  8   9       >-|
↓+↑ = 7 | Increases by the amount above each time
1 2 4 7 11 16 22 29 37 46 >-| <-|
| Increases by the amount above each time
1 2 4 8 15 26 42 64 93 130 176 <-|


Challenge



Given a positive integer, output the first twenty items of the metasequence of that tier.



Test cases



Input: 3 Output: [ 1, 2, 4, 8, 15, 26, 42, 64, 93, 130, 176, 232, 299, 378, 470, 576, 697, 834, 988, 1160 ]



Input: 1 Output: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]



Input: 5 Output: [ 1, 2, 4, 8, 16, 32, 63, 120, 219, 382, 638, 1024, 1586, 2380, 3473, 4944, 6885, 9402, 12616, 16664 ]



Input: 13 Output: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16383, 32752, 65399, 130238, 258096, 507624 ]



As you may realise, the first $t+1$ items of each sequence of tier $t$ are the first $t+1$ powers of 2...



Rules




  • Standard loopholes apply

  • This is code-golf, so shortest answer in bytes wins










share|improve this question











$endgroup$








  • 2




    $begingroup$
    I assume you mean 20 terms, not digits?
    $endgroup$
    – Quintec
    9 hours ago










  • $begingroup$
    What do you mean by "tier"?
    $endgroup$
    – DavidC
    9 hours ago






  • 3




    $begingroup$
    By the way, the tier three metasequence is OEIS A000125
    $endgroup$
    – Embodiment of Ignorance
    9 hours ago






  • 3




    $begingroup$
    You may want to clarify if solutions have to work for input 20 or greater.
    $endgroup$
    – FryAmTheEggman
    9 hours ago






  • 3




    $begingroup$
    Can we choose to 0-index (so, output tier 1 for input 0, tier 2 for input 1, etc.)?
    $endgroup$
    – Lynn
    8 hours ago
















14












$begingroup$


Background



For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase by an increasing value, etc.



For instance, the tier 3 metasequence would start as:



1 2 4 8 15 26 42 64 93 130 176



because:



    1 2 3  4  5  6  7  8   9       >-|
↓+↑ = 7 | Increases by the amount above each time
1 2 4 7 11 16 22 29 37 46 >-| <-|
| Increases by the amount above each time
1 2 4 8 15 26 42 64 93 130 176 <-|


Challenge



Given a positive integer, output the first twenty items of the metasequence of that tier.



Test cases



Input: 3 Output: [ 1, 2, 4, 8, 15, 26, 42, 64, 93, 130, 176, 232, 299, 378, 470, 576, 697, 834, 988, 1160 ]



Input: 1 Output: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]



Input: 5 Output: [ 1, 2, 4, 8, 16, 32, 63, 120, 219, 382, 638, 1024, 1586, 2380, 3473, 4944, 6885, 9402, 12616, 16664 ]



Input: 13 Output: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16383, 32752, 65399, 130238, 258096, 507624 ]



As you may realise, the first $t+1$ items of each sequence of tier $t$ are the first $t+1$ powers of 2...



Rules




  • Standard loopholes apply

  • This is code-golf, so shortest answer in bytes wins










share|improve this question











$endgroup$








  • 2




    $begingroup$
    I assume you mean 20 terms, not digits?
    $endgroup$
    – Quintec
    9 hours ago










  • $begingroup$
    What do you mean by "tier"?
    $endgroup$
    – DavidC
    9 hours ago






  • 3




    $begingroup$
    By the way, the tier three metasequence is OEIS A000125
    $endgroup$
    – Embodiment of Ignorance
    9 hours ago






  • 3




    $begingroup$
    You may want to clarify if solutions have to work for input 20 or greater.
    $endgroup$
    – FryAmTheEggman
    9 hours ago






  • 3




    $begingroup$
    Can we choose to 0-index (so, output tier 1 for input 0, tier 2 for input 1, etc.)?
    $endgroup$
    – Lynn
    8 hours ago














14












14








14





$begingroup$


Background



For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase by an increasing value, etc.



For instance, the tier 3 metasequence would start as:



1 2 4 8 15 26 42 64 93 130 176



because:



    1 2 3  4  5  6  7  8   9       >-|
↓+↑ = 7 | Increases by the amount above each time
1 2 4 7 11 16 22 29 37 46 >-| <-|
| Increases by the amount above each time
1 2 4 8 15 26 42 64 93 130 176 <-|


Challenge



Given a positive integer, output the first twenty items of the metasequence of that tier.



Test cases



Input: 3 Output: [ 1, 2, 4, 8, 15, 26, 42, 64, 93, 130, 176, 232, 299, 378, 470, 576, 697, 834, 988, 1160 ]



Input: 1 Output: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]



Input: 5 Output: [ 1, 2, 4, 8, 16, 32, 63, 120, 219, 382, 638, 1024, 1586, 2380, 3473, 4944, 6885, 9402, 12616, 16664 ]



Input: 13 Output: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16383, 32752, 65399, 130238, 258096, 507624 ]



As you may realise, the first $t+1$ items of each sequence of tier $t$ are the first $t+1$ powers of 2...



Rules




  • Standard loopholes apply

  • This is code-golf, so shortest answer in bytes wins










share|improve this question











$endgroup$




Background



For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase by an increasing value, etc.



For instance, the tier 3 metasequence would start as:



1 2 4 8 15 26 42 64 93 130 176



because:



    1 2 3  4  5  6  7  8   9       >-|
↓+↑ = 7 | Increases by the amount above each time
1 2 4 7 11 16 22 29 37 46 >-| <-|
| Increases by the amount above each time
1 2 4 8 15 26 42 64 93 130 176 <-|


Challenge



Given a positive integer, output the first twenty items of the metasequence of that tier.



Test cases



Input: 3 Output: [ 1, 2, 4, 8, 15, 26, 42, 64, 93, 130, 176, 232, 299, 378, 470, 576, 697, 834, 988, 1160 ]



Input: 1 Output: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]



Input: 5 Output: [ 1, 2, 4, 8, 16, 32, 63, 120, 219, 382, 638, 1024, 1586, 2380, 3473, 4944, 6885, 9402, 12616, 16664 ]



Input: 13 Output: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16383, 32752, 65399, 130238, 258096, 507624 ]



As you may realise, the first $t+1$ items of each sequence of tier $t$ are the first $t+1$ powers of 2...



Rules




  • Standard loopholes apply

  • This is code-golf, so shortest answer in bytes wins







code-golf math sequence subsequence






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 9 hours ago







Geza Kerecsenyi

















asked 9 hours ago









Geza KerecsenyiGeza Kerecsenyi

18410




18410








  • 2




    $begingroup$
    I assume you mean 20 terms, not digits?
    $endgroup$
    – Quintec
    9 hours ago










  • $begingroup$
    What do you mean by "tier"?
    $endgroup$
    – DavidC
    9 hours ago






  • 3




    $begingroup$
    By the way, the tier three metasequence is OEIS A000125
    $endgroup$
    – Embodiment of Ignorance
    9 hours ago






  • 3




    $begingroup$
    You may want to clarify if solutions have to work for input 20 or greater.
    $endgroup$
    – FryAmTheEggman
    9 hours ago






  • 3




    $begingroup$
    Can we choose to 0-index (so, output tier 1 for input 0, tier 2 for input 1, etc.)?
    $endgroup$
    – Lynn
    8 hours ago














  • 2




    $begingroup$
    I assume you mean 20 terms, not digits?
    $endgroup$
    – Quintec
    9 hours ago










  • $begingroup$
    What do you mean by "tier"?
    $endgroup$
    – DavidC
    9 hours ago






  • 3




    $begingroup$
    By the way, the tier three metasequence is OEIS A000125
    $endgroup$
    – Embodiment of Ignorance
    9 hours ago






  • 3




    $begingroup$
    You may want to clarify if solutions have to work for input 20 or greater.
    $endgroup$
    – FryAmTheEggman
    9 hours ago






  • 3




    $begingroup$
    Can we choose to 0-index (so, output tier 1 for input 0, tier 2 for input 1, etc.)?
    $endgroup$
    – Lynn
    8 hours ago








2




2




$begingroup$
I assume you mean 20 terms, not digits?
$endgroup$
– Quintec
9 hours ago




$begingroup$
I assume you mean 20 terms, not digits?
$endgroup$
– Quintec
9 hours ago












$begingroup$
What do you mean by "tier"?
$endgroup$
– DavidC
9 hours ago




$begingroup$
What do you mean by "tier"?
$endgroup$
– DavidC
9 hours ago




3




3




$begingroup$
By the way, the tier three metasequence is OEIS A000125
$endgroup$
– Embodiment of Ignorance
9 hours ago




$begingroup$
By the way, the tier three metasequence is OEIS A000125
$endgroup$
– Embodiment of Ignorance
9 hours ago




3




3




$begingroup$
You may want to clarify if solutions have to work for input 20 or greater.
$endgroup$
– FryAmTheEggman
9 hours ago




$begingroup$
You may want to clarify if solutions have to work for input 20 or greater.
$endgroup$
– FryAmTheEggman
9 hours ago




3




3




$begingroup$
Can we choose to 0-index (so, output tier 1 for input 0, tier 2 for input 1, etc.)?
$endgroup$
– Lynn
8 hours ago




$begingroup$
Can we choose to 0-index (so, output tier 1 for input 0, tier 2 for input 1, etc.)?
$endgroup$
– Lynn
8 hours ago










17 Answers
17






active

oldest

votes


















9












$begingroup$


Haskell, 34 bytes





f n=iterate(scanl(+)1)[1..20-n]!!n


Try it online!



Uses zero-indexed inputs (f 4 returns tier 5.)




Haskell, 36 bytes





f 1=[1..20]
f n=init$scanl(+)1$f$n-1


Try it online!



Uses 1-indexed inputs (f 5 returns tier 5.)



Explanation



scanl (+) 1 is a function that takes partial sums of a list, starting from (and prepending) 1.




For example: scanl (+) 1 [20,300,4000] equals [1,21,321,4321].




It turns out that tier $n$ is just this function applied $ (n-1) $ times to the list $[1,2,3,dots]$.



(Or equivalently: $n$ times to a list of all ones.)



We use either init or [1..20-n] to account for the list getting longer by $1$ every application.






share|improve this answer











$endgroup$





















    7












    $begingroup$


    Wolfram Language (Mathematica), 35 bytes



    Binomial[Range@20-1,i]~Sum~{i,0,#}&


    Try it online!



    The tier $n$ metasequence is the sum of the first $n+1$ elements of each row of the Pascal triangle.






    share|improve this answer











    $endgroup$













    • $begingroup$
      Nice insight! :)
      $endgroup$
      – Lynn
      7 hours ago



















    3












    $begingroup$


    Jelly, 8 bytes



    20ḶcþRS‘


    Try it online!



       cþ       Table of binom(x,y) where:
    20Ḷ x = [0..19]
    R y = [1..n] e.g. n=3 → [[0, 1, 2, 3, 4, 5, …]
    [0, 0, 1, 3, 6, 10, …]
    [0, 0, 0, 1, 4, 10, …]]

    S Columnwise sum. → [0, 1, 3, 7, 14, 25, …]
    ‘ Add one. → [1, 2, 4, 8, 15, 26, …]


    This uses @alephalpha’s insight that $$text{meta-sequence}_n(i) = sum_{k=0}^n binom ik = 1+sum_{k=1}^n binom ik.$$






    share|improve this answer











    $endgroup$





















      3












      $begingroup$


      Perl 6, 34 32 bytes



      -2 bytes thanks to Jo King





      {(@,{[+] 1,|.[^19]}...*)[$_+1]}


      Try it online!



      Explanation



      {                              }  # Anonymous block
      , ...* # Construct infinite sequence of sequences
      @ # Start with empty array
      { } # Compute next element as
      [+] # cumulative sum of
      1, # one followed by
      |.[^19] # first 19 elements of previous sequence
      ( )[$_+1] # Take (n+1)th element





      share|improve this answer











      $endgroup$













      • $begingroup$
        29 bytes (the $^a instead of $_ is necessary)
        $endgroup$
        – Jo King
        4 hours ago





















      3












      $begingroup$


      Python 2, 69 58 55 bytes



      Saved bytes thanks to ovs and Jo King; also, it works in Python 3 now as well.





      m=lambda t:[1+sum(m(t-1)[:n])for n in range(~t and 20)]


      Try it online!



      The math



      Let $a(t,n)$ be the $n^{th}$ term (0-indexed) of the sequence at tier $t$. A little analysis leads to the following recurrence formula:



      $$
      a(t,n) = 1+sum_{i=0}^{n-1}a(t-1,i)
      $$



      Working backwards, we define $a(0,n) = 1$ and $a(-1,n) = 0$ for all $n$. These definitions will simplify our base case.



      The code



      We define a function m(t) that returns the first 20 elements of the sequence at tier t. If t is nonnegative, we use the recursive formula above; if t is -1, we return an empty list. The empty list works as a base case because the result of each recursive call is sliced ([:n]) and then summed. Slicing an empty list gives an empty list, and summing an empty list gives 0. That's exactly the result we want, since tier $-1$ should behave like a constant sequence of all $0$'s.



      m=lambda t:                     # Define a function m(t):
      [ ] # List comprehension
      for n in range( ) # for each n from 0 up to but not including...
      ~n and 20 # 0 if n is -1, else 20:
      1+sum( ) # a(t,n) = 1 + sum of
      [:n] # the first n elements of
      m(t-1) # the previous tier (calculated recursively)





      share|improve this answer











      $endgroup$













      • $begingroup$
        61 bytes as a recursive lambda function (Significantly more inefficient).
        $endgroup$
        – ovs
        4 hours ago












      • $begingroup$
        @ovs Thanks! I found a couple more bytes by using a different base case, too.
        $endgroup$
        – DLosc
        4 hours ago












      • $begingroup$
        :( the nice way is too long
        $endgroup$
        – ASCII-only
        3 hours ago










      • $begingroup$
        or a combinations builtin, yeah
        $endgroup$
        – ASCII-only
        3 hours ago










      • $begingroup$
        closer (with stolen combinations function)
        $endgroup$
        – ASCII-only
        3 hours ago





















      2












      $begingroup$


      Pari/GP, 39 bytes



      n->Vec(sum(i=1,n+1,(1/x-1)^-i)+O(x^21))


      Try it online!






      Pari/GP, 40 bytes



      n->Vec((1-(1/x-1)^-n++)/(1-2*x)+O(x^20))


      Try it online!





      The generating function of the tier $n$ metasequence is:



      $$sum_{i=0}^nfrac{x^i}{(1-x)^{i+1}}=frac{1-left(frac{x}{1-x}right)^{1+n}}{1-2x}$$






      share|improve this answer











      $endgroup$





















        2












        $begingroup$


        dzaima/APL REPL, 14 bytes





        (+1,19↑)⍣⎕⍳20


        Try it online!



        (+1,19↑)⍣⎕⍳20
        ( )⍣⎕ repeat the function below input times:
        + cumulative sum of
        1, 1 prepended to
        19↑ the first 19 items of the previous iteration
        ⍳20 starting with the first 20 integers





        share|improve this answer











        $endgroup$













        • $begingroup$
          -1 byte using dzaima/APL: 1∘,1,
          $endgroup$
          – Adám
          8 hours ago










        • $begingroup$
          @Adám oh duh.. right
          $endgroup$
          – dzaima
          8 hours ago










        • $begingroup$
          Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
          $endgroup$
          – Adám
          8 hours ago










        • $begingroup$
          14 bytes by using the REPL (add the -s flag).
          $endgroup$
          – Erik the Outgolfer
          7 hours ago












        • $begingroup$
          If you use the flag, language becomes -s btw (unless -s is repl flag?)
          $endgroup$
          – ASCII-only
          2 hours ago





















        2












        $begingroup$


        Python 3.8 (pre-release), 62 bytes





        f=lambda n:[t:=1]+[t:=t+n for n in(n and f(n-1)[:-1]or[0]*19)]


        Try it online!





        Explanation



        f=lambda n:     # funtion takes a single argument
        [t:=1] # This evaluates to [1] and assigns 1 to t
        # assignment expressions are a new feature of Python 3.8
        + # concatenated to
        [ .... ] # list comprehension

        # The list comprehesion works together with the
        # assignment expression as a scan function:
        [t := t+n for n in it]
        # This calculates all partial sums of it
        # (plus the initial value of t, which is 1 here)

        # The list comprehension iterates
        # over the first 19 entries of f(n-1)
        # or over a list of zeros for n=0
        for n in (n and f(n-1)[:-1] or [0]*19)





        share|improve this answer











        $endgroup$





















          1












          $begingroup$

          JavaScript (ES6),  68  67 bytes





          f=(n,a=[...f+f])=>n--?f(n,[s=1,...a.map(x=>s-=~--x)]):a.slice(0,20)


          Try it online!





          JavaScript (ES6), 63 bytes



          NB: this version works for $nle20$.





          f=(n,a=[...Array(20-n)])=>n--?f(n,[s=1,...a.map(x=>s+=x||1)]):a


          Try it online!






          share|improve this answer











          $endgroup$





















            1












            $begingroup$

            Ruby, 49 bytes



            f=->n{n<1?[1]*20:[o=1]+f[n-1][0,19].map{|x|o+=x}}


            Recursive definition: Tier 0 is 1,1,1,1... and each subsequent tier is 1 followed by a sequence whose first differences are the previous tier. Annoyingly this would give me 21 values if I didn't explicitly slice out the first 20; seems like there should be a way to shorten this by avoiding that.






            share|improve this answer











            $endgroup$













            • $begingroup$
              tio.run/#ruby pls
              $endgroup$
              – ASCII-only
              3 hours ago










            • $begingroup$
              also 49
              $endgroup$
              – ASCII-only
              3 hours ago










            • $begingroup$
              46
              $endgroup$
              – ASCII-only
              2 hours ago





















            0












            $begingroup$

            Ruby, 74 bytes



            a=->b{c=[1];d=0;b==1?c=(1..20).to_a: 19.times{c<<c[d]+(a[b-1])[d];d+=1};c}



            Ungolfed version:



            def seq num
            ary = [1]
            index = 0
            if num == 1
            ary = (1..20).to_a
            else
            19.times{ary << ary[index]+seq(num-1)[index]; index+=1}
            end
            return ary
            end


            Quite resource-intensive--the online version can't calculate the 13th metasequence.



            Try it online






            share|improve this answer









            $endgroup$





















              0












              $begingroup$


              Jelly, 10 bytes



              20RṖ1;ÄƲ⁸¡


              Try it online!



              0-indexed.






              share|improve this answer









              $endgroup$





















                0












                $begingroup$


                R, 59 bytes





                Reduce(function(x,y)diffinv(x,,,y),!!1:scan(),!!1:19)[1:20]


                Try it online!



                Repeated diffinv with xi=1, and subset out the first 20 terms.






                share|improve this answer









                $endgroup$





















                  0












                  $begingroup$


                  J, 24 bytes



                  <:(1+/@,])^:[(1+i.20)"_


                  Try it online!



                  NOTE: Turns out this is a translation of dzaima's APL answer, though I actually didn't notice it before writing this.



                  explanation



                  <: (1 +/@, ])^:[ (1+i.20)"_
                  <: NB. input minus 1 (left input)
                  (1+i.20)"_ NB. 1..20 (right input)
                  ( )^:[ NB. apply verb in parens
                  NB. "left input" times
                  (1 , ]) NB. prepend 1 to right input
                  ( +/@ ) NB. and take scan sum





                  share|improve this answer











                  $endgroup$





















                    0












                    $begingroup$


                    Wolfram Language (Mathematica), 42 bytes



                    Nest[FoldList[Plus,1,#]&,Range[21-#],#-1]&


                    Try it online!






                    share|improve this answer









                    $endgroup$





















                      0












                      $begingroup$


                      Retina, 59 bytes



                      .+
                      19*$(_,


                      Replace the input with 19 1s (in unary). (The 20th value is 0 because it always gets deleted by the first pass through the loop.)



                      "$+"{`
                      )`


                      Repeat the loop the original input number of times.



                      (.+),_*
                      _,$1


                      Remove the last element and prefix a 1.



                      _+(?<=((_)|,)+)
                      $#2*


                      Calculate the cumulative sum.



                      _+
                      $.&


                      Convert to decimal.



                      Try it online!






                      share|improve this answer









                      $endgroup$





















                        0












                        $begingroup$


                        JavaScript (Node.js), 58 bytes





                        t=>Array(20).fill(t).map(g=(t,i)=>i--*t?g(t,i)+g(t-1,i):1)


                        Try it online!



                        It is trivial to write down following recursive formula based on the description in question
                        $$ g(t,i)=begin{cases}
                        g(t,i-1)+g(t-1,i-1) & text{if} quad icdot t>0 \
                        1 & text{if} quad icdot t=0 \
                        end{cases} $$

                        And you just need to generate an Array of 20 elements with $[g(t,0)dots g(t,19)]$






                        share|improve this answer











                        $endgroup$













                          Your Answer





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

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

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

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

                          function createEditor() {
                          StackExchange.prepareEditor({
                          heartbeatType: 'answer',
                          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%2f180855%2fmake-me-a-metasequence%23new-answer', 'question_page');
                          }
                          );

                          Post as a guest















                          Required, but never shown

























                          17 Answers
                          17






                          active

                          oldest

                          votes








                          17 Answers
                          17






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          9












                          $begingroup$


                          Haskell, 34 bytes





                          f n=iterate(scanl(+)1)[1..20-n]!!n


                          Try it online!



                          Uses zero-indexed inputs (f 4 returns tier 5.)




                          Haskell, 36 bytes





                          f 1=[1..20]
                          f n=init$scanl(+)1$f$n-1


                          Try it online!



                          Uses 1-indexed inputs (f 5 returns tier 5.)



                          Explanation



                          scanl (+) 1 is a function that takes partial sums of a list, starting from (and prepending) 1.




                          For example: scanl (+) 1 [20,300,4000] equals [1,21,321,4321].




                          It turns out that tier $n$ is just this function applied $ (n-1) $ times to the list $[1,2,3,dots]$.



                          (Or equivalently: $n$ times to a list of all ones.)



                          We use either init or [1..20-n] to account for the list getting longer by $1$ every application.






                          share|improve this answer











                          $endgroup$


















                            9












                            $begingroup$


                            Haskell, 34 bytes





                            f n=iterate(scanl(+)1)[1..20-n]!!n


                            Try it online!



                            Uses zero-indexed inputs (f 4 returns tier 5.)




                            Haskell, 36 bytes





                            f 1=[1..20]
                            f n=init$scanl(+)1$f$n-1


                            Try it online!



                            Uses 1-indexed inputs (f 5 returns tier 5.)



                            Explanation



                            scanl (+) 1 is a function that takes partial sums of a list, starting from (and prepending) 1.




                            For example: scanl (+) 1 [20,300,4000] equals [1,21,321,4321].




                            It turns out that tier $n$ is just this function applied $ (n-1) $ times to the list $[1,2,3,dots]$.



                            (Or equivalently: $n$ times to a list of all ones.)



                            We use either init or [1..20-n] to account for the list getting longer by $1$ every application.






                            share|improve this answer











                            $endgroup$
















                              9












                              9








                              9





                              $begingroup$


                              Haskell, 34 bytes





                              f n=iterate(scanl(+)1)[1..20-n]!!n


                              Try it online!



                              Uses zero-indexed inputs (f 4 returns tier 5.)




                              Haskell, 36 bytes





                              f 1=[1..20]
                              f n=init$scanl(+)1$f$n-1


                              Try it online!



                              Uses 1-indexed inputs (f 5 returns tier 5.)



                              Explanation



                              scanl (+) 1 is a function that takes partial sums of a list, starting from (and prepending) 1.




                              For example: scanl (+) 1 [20,300,4000] equals [1,21,321,4321].




                              It turns out that tier $n$ is just this function applied $ (n-1) $ times to the list $[1,2,3,dots]$.



                              (Or equivalently: $n$ times to a list of all ones.)



                              We use either init or [1..20-n] to account for the list getting longer by $1$ every application.






                              share|improve this answer











                              $endgroup$




                              Haskell, 34 bytes





                              f n=iterate(scanl(+)1)[1..20-n]!!n


                              Try it online!



                              Uses zero-indexed inputs (f 4 returns tier 5.)




                              Haskell, 36 bytes





                              f 1=[1..20]
                              f n=init$scanl(+)1$f$n-1


                              Try it online!



                              Uses 1-indexed inputs (f 5 returns tier 5.)



                              Explanation



                              scanl (+) 1 is a function that takes partial sums of a list, starting from (and prepending) 1.




                              For example: scanl (+) 1 [20,300,4000] equals [1,21,321,4321].




                              It turns out that tier $n$ is just this function applied $ (n-1) $ times to the list $[1,2,3,dots]$.



                              (Or equivalently: $n$ times to a list of all ones.)



                              We use either init or [1..20-n] to account for the list getting longer by $1$ every application.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 5 hours ago

























                              answered 9 hours ago









                              LynnLynn

                              50.2k797230




                              50.2k797230























                                  7












                                  $begingroup$


                                  Wolfram Language (Mathematica), 35 bytes



                                  Binomial[Range@20-1,i]~Sum~{i,0,#}&


                                  Try it online!



                                  The tier $n$ metasequence is the sum of the first $n+1$ elements of each row of the Pascal triangle.






                                  share|improve this answer











                                  $endgroup$













                                  • $begingroup$
                                    Nice insight! :)
                                    $endgroup$
                                    – Lynn
                                    7 hours ago
















                                  7












                                  $begingroup$


                                  Wolfram Language (Mathematica), 35 bytes



                                  Binomial[Range@20-1,i]~Sum~{i,0,#}&


                                  Try it online!



                                  The tier $n$ metasequence is the sum of the first $n+1$ elements of each row of the Pascal triangle.






                                  share|improve this answer











                                  $endgroup$













                                  • $begingroup$
                                    Nice insight! :)
                                    $endgroup$
                                    – Lynn
                                    7 hours ago














                                  7












                                  7








                                  7





                                  $begingroup$


                                  Wolfram Language (Mathematica), 35 bytes



                                  Binomial[Range@20-1,i]~Sum~{i,0,#}&


                                  Try it online!



                                  The tier $n$ metasequence is the sum of the first $n+1$ elements of each row of the Pascal triangle.






                                  share|improve this answer











                                  $endgroup$




                                  Wolfram Language (Mathematica), 35 bytes



                                  Binomial[Range@20-1,i]~Sum~{i,0,#}&


                                  Try it online!



                                  The tier $n$ metasequence is the sum of the first $n+1$ elements of each row of the Pascal triangle.







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited 7 hours ago

























                                  answered 9 hours ago









                                  alephalphaalephalpha

                                  21.6k32993




                                  21.6k32993












                                  • $begingroup$
                                    Nice insight! :)
                                    $endgroup$
                                    – Lynn
                                    7 hours ago


















                                  • $begingroup$
                                    Nice insight! :)
                                    $endgroup$
                                    – Lynn
                                    7 hours ago
















                                  $begingroup$
                                  Nice insight! :)
                                  $endgroup$
                                  – Lynn
                                  7 hours ago




                                  $begingroup$
                                  Nice insight! :)
                                  $endgroup$
                                  – Lynn
                                  7 hours ago











                                  3












                                  $begingroup$


                                  Jelly, 8 bytes



                                  20ḶcþRS‘


                                  Try it online!



                                     cþ       Table of binom(x,y) where:
                                  20Ḷ x = [0..19]
                                  R y = [1..n] e.g. n=3 → [[0, 1, 2, 3, 4, 5, …]
                                  [0, 0, 1, 3, 6, 10, …]
                                  [0, 0, 0, 1, 4, 10, …]]

                                  S Columnwise sum. → [0, 1, 3, 7, 14, 25, …]
                                  ‘ Add one. → [1, 2, 4, 8, 15, 26, …]


                                  This uses @alephalpha’s insight that $$text{meta-sequence}_n(i) = sum_{k=0}^n binom ik = 1+sum_{k=1}^n binom ik.$$






                                  share|improve this answer











                                  $endgroup$


















                                    3












                                    $begingroup$


                                    Jelly, 8 bytes



                                    20ḶcþRS‘


                                    Try it online!



                                       cþ       Table of binom(x,y) where:
                                    20Ḷ x = [0..19]
                                    R y = [1..n] e.g. n=3 → [[0, 1, 2, 3, 4, 5, …]
                                    [0, 0, 1, 3, 6, 10, …]
                                    [0, 0, 0, 1, 4, 10, …]]

                                    S Columnwise sum. → [0, 1, 3, 7, 14, 25, …]
                                    ‘ Add one. → [1, 2, 4, 8, 15, 26, …]


                                    This uses @alephalpha’s insight that $$text{meta-sequence}_n(i) = sum_{k=0}^n binom ik = 1+sum_{k=1}^n binom ik.$$






                                    share|improve this answer











                                    $endgroup$
















                                      3












                                      3








                                      3





                                      $begingroup$


                                      Jelly, 8 bytes



                                      20ḶcþRS‘


                                      Try it online!



                                         cþ       Table of binom(x,y) where:
                                      20Ḷ x = [0..19]
                                      R y = [1..n] e.g. n=3 → [[0, 1, 2, 3, 4, 5, …]
                                      [0, 0, 1, 3, 6, 10, …]
                                      [0, 0, 0, 1, 4, 10, …]]

                                      S Columnwise sum. → [0, 1, 3, 7, 14, 25, …]
                                      ‘ Add one. → [1, 2, 4, 8, 15, 26, …]


                                      This uses @alephalpha’s insight that $$text{meta-sequence}_n(i) = sum_{k=0}^n binom ik = 1+sum_{k=1}^n binom ik.$$






                                      share|improve this answer











                                      $endgroup$




                                      Jelly, 8 bytes



                                      20ḶcþRS‘


                                      Try it online!



                                         cþ       Table of binom(x,y) where:
                                      20Ḷ x = [0..19]
                                      R y = [1..n] e.g. n=3 → [[0, 1, 2, 3, 4, 5, …]
                                      [0, 0, 1, 3, 6, 10, …]
                                      [0, 0, 0, 1, 4, 10, …]]

                                      S Columnwise sum. → [0, 1, 3, 7, 14, 25, …]
                                      ‘ Add one. → [1, 2, 4, 8, 15, 26, …]


                                      This uses @alephalpha’s insight that $$text{meta-sequence}_n(i) = sum_{k=0}^n binom ik = 1+sum_{k=1}^n binom ik.$$







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 6 hours ago

























                                      answered 6 hours ago









                                      LynnLynn

                                      50.2k797230




                                      50.2k797230























                                          3












                                          $begingroup$


                                          Perl 6, 34 32 bytes



                                          -2 bytes thanks to Jo King





                                          {(@,{[+] 1,|.[^19]}...*)[$_+1]}


                                          Try it online!



                                          Explanation



                                          {                              }  # Anonymous block
                                          , ...* # Construct infinite sequence of sequences
                                          @ # Start with empty array
                                          { } # Compute next element as
                                          [+] # cumulative sum of
                                          1, # one followed by
                                          |.[^19] # first 19 elements of previous sequence
                                          ( )[$_+1] # Take (n+1)th element





                                          share|improve this answer











                                          $endgroup$













                                          • $begingroup$
                                            29 bytes (the $^a instead of $_ is necessary)
                                            $endgroup$
                                            – Jo King
                                            4 hours ago


















                                          3












                                          $begingroup$


                                          Perl 6, 34 32 bytes



                                          -2 bytes thanks to Jo King





                                          {(@,{[+] 1,|.[^19]}...*)[$_+1]}


                                          Try it online!



                                          Explanation



                                          {                              }  # Anonymous block
                                          , ...* # Construct infinite sequence of sequences
                                          @ # Start with empty array
                                          { } # Compute next element as
                                          [+] # cumulative sum of
                                          1, # one followed by
                                          |.[^19] # first 19 elements of previous sequence
                                          ( )[$_+1] # Take (n+1)th element





                                          share|improve this answer











                                          $endgroup$













                                          • $begingroup$
                                            29 bytes (the $^a instead of $_ is necessary)
                                            $endgroup$
                                            – Jo King
                                            4 hours ago
















                                          3












                                          3








                                          3





                                          $begingroup$


                                          Perl 6, 34 32 bytes



                                          -2 bytes thanks to Jo King





                                          {(@,{[+] 1,|.[^19]}...*)[$_+1]}


                                          Try it online!



                                          Explanation



                                          {                              }  # Anonymous block
                                          , ...* # Construct infinite sequence of sequences
                                          @ # Start with empty array
                                          { } # Compute next element as
                                          [+] # cumulative sum of
                                          1, # one followed by
                                          |.[^19] # first 19 elements of previous sequence
                                          ( )[$_+1] # Take (n+1)th element





                                          share|improve this answer











                                          $endgroup$




                                          Perl 6, 34 32 bytes



                                          -2 bytes thanks to Jo King





                                          {(@,{[+] 1,|.[^19]}...*)[$_+1]}


                                          Try it online!



                                          Explanation



                                          {                              }  # Anonymous block
                                          , ...* # Construct infinite sequence of sequences
                                          @ # Start with empty array
                                          { } # Compute next element as
                                          [+] # cumulative sum of
                                          1, # one followed by
                                          |.[^19] # first 19 elements of previous sequence
                                          ( )[$_+1] # Take (n+1)th element






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 4 hours ago

























                                          answered 6 hours ago









                                          nwellnhofnwellnhof

                                          7,20511128




                                          7,20511128












                                          • $begingroup$
                                            29 bytes (the $^a instead of $_ is necessary)
                                            $endgroup$
                                            – Jo King
                                            4 hours ago




















                                          • $begingroup$
                                            29 bytes (the $^a instead of $_ is necessary)
                                            $endgroup$
                                            – Jo King
                                            4 hours ago


















                                          $begingroup$
                                          29 bytes (the $^a instead of $_ is necessary)
                                          $endgroup$
                                          – Jo King
                                          4 hours ago






                                          $begingroup$
                                          29 bytes (the $^a instead of $_ is necessary)
                                          $endgroup$
                                          – Jo King
                                          4 hours ago













                                          3












                                          $begingroup$


                                          Python 2, 69 58 55 bytes



                                          Saved bytes thanks to ovs and Jo King; also, it works in Python 3 now as well.





                                          m=lambda t:[1+sum(m(t-1)[:n])for n in range(~t and 20)]


                                          Try it online!



                                          The math



                                          Let $a(t,n)$ be the $n^{th}$ term (0-indexed) of the sequence at tier $t$. A little analysis leads to the following recurrence formula:



                                          $$
                                          a(t,n) = 1+sum_{i=0}^{n-1}a(t-1,i)
                                          $$



                                          Working backwards, we define $a(0,n) = 1$ and $a(-1,n) = 0$ for all $n$. These definitions will simplify our base case.



                                          The code



                                          We define a function m(t) that returns the first 20 elements of the sequence at tier t. If t is nonnegative, we use the recursive formula above; if t is -1, we return an empty list. The empty list works as a base case because the result of each recursive call is sliced ([:n]) and then summed. Slicing an empty list gives an empty list, and summing an empty list gives 0. That's exactly the result we want, since tier $-1$ should behave like a constant sequence of all $0$'s.



                                          m=lambda t:                     # Define a function m(t):
                                          [ ] # List comprehension
                                          for n in range( ) # for each n from 0 up to but not including...
                                          ~n and 20 # 0 if n is -1, else 20:
                                          1+sum( ) # a(t,n) = 1 + sum of
                                          [:n] # the first n elements of
                                          m(t-1) # the previous tier (calculated recursively)





                                          share|improve this answer











                                          $endgroup$













                                          • $begingroup$
                                            61 bytes as a recursive lambda function (Significantly more inefficient).
                                            $endgroup$
                                            – ovs
                                            4 hours ago












                                          • $begingroup$
                                            @ovs Thanks! I found a couple more bytes by using a different base case, too.
                                            $endgroup$
                                            – DLosc
                                            4 hours ago












                                          • $begingroup$
                                            :( the nice way is too long
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            or a combinations builtin, yeah
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            closer (with stolen combinations function)
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago


















                                          3












                                          $begingroup$


                                          Python 2, 69 58 55 bytes



                                          Saved bytes thanks to ovs and Jo King; also, it works in Python 3 now as well.





                                          m=lambda t:[1+sum(m(t-1)[:n])for n in range(~t and 20)]


                                          Try it online!



                                          The math



                                          Let $a(t,n)$ be the $n^{th}$ term (0-indexed) of the sequence at tier $t$. A little analysis leads to the following recurrence formula:



                                          $$
                                          a(t,n) = 1+sum_{i=0}^{n-1}a(t-1,i)
                                          $$



                                          Working backwards, we define $a(0,n) = 1$ and $a(-1,n) = 0$ for all $n$. These definitions will simplify our base case.



                                          The code



                                          We define a function m(t) that returns the first 20 elements of the sequence at tier t. If t is nonnegative, we use the recursive formula above; if t is -1, we return an empty list. The empty list works as a base case because the result of each recursive call is sliced ([:n]) and then summed. Slicing an empty list gives an empty list, and summing an empty list gives 0. That's exactly the result we want, since tier $-1$ should behave like a constant sequence of all $0$'s.



                                          m=lambda t:                     # Define a function m(t):
                                          [ ] # List comprehension
                                          for n in range( ) # for each n from 0 up to but not including...
                                          ~n and 20 # 0 if n is -1, else 20:
                                          1+sum( ) # a(t,n) = 1 + sum of
                                          [:n] # the first n elements of
                                          m(t-1) # the previous tier (calculated recursively)





                                          share|improve this answer











                                          $endgroup$













                                          • $begingroup$
                                            61 bytes as a recursive lambda function (Significantly more inefficient).
                                            $endgroup$
                                            – ovs
                                            4 hours ago












                                          • $begingroup$
                                            @ovs Thanks! I found a couple more bytes by using a different base case, too.
                                            $endgroup$
                                            – DLosc
                                            4 hours ago












                                          • $begingroup$
                                            :( the nice way is too long
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            or a combinations builtin, yeah
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            closer (with stolen combinations function)
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago
















                                          3












                                          3








                                          3





                                          $begingroup$


                                          Python 2, 69 58 55 bytes



                                          Saved bytes thanks to ovs and Jo King; also, it works in Python 3 now as well.





                                          m=lambda t:[1+sum(m(t-1)[:n])for n in range(~t and 20)]


                                          Try it online!



                                          The math



                                          Let $a(t,n)$ be the $n^{th}$ term (0-indexed) of the sequence at tier $t$. A little analysis leads to the following recurrence formula:



                                          $$
                                          a(t,n) = 1+sum_{i=0}^{n-1}a(t-1,i)
                                          $$



                                          Working backwards, we define $a(0,n) = 1$ and $a(-1,n) = 0$ for all $n$. These definitions will simplify our base case.



                                          The code



                                          We define a function m(t) that returns the first 20 elements of the sequence at tier t. If t is nonnegative, we use the recursive formula above; if t is -1, we return an empty list. The empty list works as a base case because the result of each recursive call is sliced ([:n]) and then summed. Slicing an empty list gives an empty list, and summing an empty list gives 0. That's exactly the result we want, since tier $-1$ should behave like a constant sequence of all $0$'s.



                                          m=lambda t:                     # Define a function m(t):
                                          [ ] # List comprehension
                                          for n in range( ) # for each n from 0 up to but not including...
                                          ~n and 20 # 0 if n is -1, else 20:
                                          1+sum( ) # a(t,n) = 1 + sum of
                                          [:n] # the first n elements of
                                          m(t-1) # the previous tier (calculated recursively)





                                          share|improve this answer











                                          $endgroup$




                                          Python 2, 69 58 55 bytes



                                          Saved bytes thanks to ovs and Jo King; also, it works in Python 3 now as well.





                                          m=lambda t:[1+sum(m(t-1)[:n])for n in range(~t and 20)]


                                          Try it online!



                                          The math



                                          Let $a(t,n)$ be the $n^{th}$ term (0-indexed) of the sequence at tier $t$. A little analysis leads to the following recurrence formula:



                                          $$
                                          a(t,n) = 1+sum_{i=0}^{n-1}a(t-1,i)
                                          $$



                                          Working backwards, we define $a(0,n) = 1$ and $a(-1,n) = 0$ for all $n$. These definitions will simplify our base case.



                                          The code



                                          We define a function m(t) that returns the first 20 elements of the sequence at tier t. If t is nonnegative, we use the recursive formula above; if t is -1, we return an empty list. The empty list works as a base case because the result of each recursive call is sliced ([:n]) and then summed. Slicing an empty list gives an empty list, and summing an empty list gives 0. That's exactly the result we want, since tier $-1$ should behave like a constant sequence of all $0$'s.



                                          m=lambda t:                     # Define a function m(t):
                                          [ ] # List comprehension
                                          for n in range( ) # for each n from 0 up to but not including...
                                          ~n and 20 # 0 if n is -1, else 20:
                                          1+sum( ) # a(t,n) = 1 + sum of
                                          [:n] # the first n elements of
                                          m(t-1) # the previous tier (calculated recursively)






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 3 hours ago

























                                          answered 4 hours ago









                                          DLoscDLosc

                                          19.3k33889




                                          19.3k33889












                                          • $begingroup$
                                            61 bytes as a recursive lambda function (Significantly more inefficient).
                                            $endgroup$
                                            – ovs
                                            4 hours ago












                                          • $begingroup$
                                            @ovs Thanks! I found a couple more bytes by using a different base case, too.
                                            $endgroup$
                                            – DLosc
                                            4 hours ago












                                          • $begingroup$
                                            :( the nice way is too long
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            or a combinations builtin, yeah
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            closer (with stolen combinations function)
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago




















                                          • $begingroup$
                                            61 bytes as a recursive lambda function (Significantly more inefficient).
                                            $endgroup$
                                            – ovs
                                            4 hours ago












                                          • $begingroup$
                                            @ovs Thanks! I found a couple more bytes by using a different base case, too.
                                            $endgroup$
                                            – DLosc
                                            4 hours ago












                                          • $begingroup$
                                            :( the nice way is too long
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            or a combinations builtin, yeah
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago










                                          • $begingroup$
                                            closer (with stolen combinations function)
                                            $endgroup$
                                            – ASCII-only
                                            3 hours ago


















                                          $begingroup$
                                          61 bytes as a recursive lambda function (Significantly more inefficient).
                                          $endgroup$
                                          – ovs
                                          4 hours ago






                                          $begingroup$
                                          61 bytes as a recursive lambda function (Significantly more inefficient).
                                          $endgroup$
                                          – ovs
                                          4 hours ago














                                          $begingroup$
                                          @ovs Thanks! I found a couple more bytes by using a different base case, too.
                                          $endgroup$
                                          – DLosc
                                          4 hours ago






                                          $begingroup$
                                          @ovs Thanks! I found a couple more bytes by using a different base case, too.
                                          $endgroup$
                                          – DLosc
                                          4 hours ago














                                          $begingroup$
                                          :( the nice way is too long
                                          $endgroup$
                                          – ASCII-only
                                          3 hours ago




                                          $begingroup$
                                          :( the nice way is too long
                                          $endgroup$
                                          – ASCII-only
                                          3 hours ago












                                          $begingroup$
                                          or a combinations builtin, yeah
                                          $endgroup$
                                          – ASCII-only
                                          3 hours ago




                                          $begingroup$
                                          or a combinations builtin, yeah
                                          $endgroup$
                                          – ASCII-only
                                          3 hours ago












                                          $begingroup$
                                          closer (with stolen combinations function)
                                          $endgroup$
                                          – ASCII-only
                                          3 hours ago






                                          $begingroup$
                                          closer (with stolen combinations function)
                                          $endgroup$
                                          – ASCII-only
                                          3 hours ago













                                          2












                                          $begingroup$


                                          Pari/GP, 39 bytes



                                          n->Vec(sum(i=1,n+1,(1/x-1)^-i)+O(x^21))


                                          Try it online!






                                          Pari/GP, 40 bytes



                                          n->Vec((1-(1/x-1)^-n++)/(1-2*x)+O(x^20))


                                          Try it online!





                                          The generating function of the tier $n$ metasequence is:



                                          $$sum_{i=0}^nfrac{x^i}{(1-x)^{i+1}}=frac{1-left(frac{x}{1-x}right)^{1+n}}{1-2x}$$






                                          share|improve this answer











                                          $endgroup$


















                                            2












                                            $begingroup$


                                            Pari/GP, 39 bytes



                                            n->Vec(sum(i=1,n+1,(1/x-1)^-i)+O(x^21))


                                            Try it online!






                                            Pari/GP, 40 bytes



                                            n->Vec((1-(1/x-1)^-n++)/(1-2*x)+O(x^20))


                                            Try it online!





                                            The generating function of the tier $n$ metasequence is:



                                            $$sum_{i=0}^nfrac{x^i}{(1-x)^{i+1}}=frac{1-left(frac{x}{1-x}right)^{1+n}}{1-2x}$$






                                            share|improve this answer











                                            $endgroup$
















                                              2












                                              2








                                              2





                                              $begingroup$


                                              Pari/GP, 39 bytes



                                              n->Vec(sum(i=1,n+1,(1/x-1)^-i)+O(x^21))


                                              Try it online!






                                              Pari/GP, 40 bytes



                                              n->Vec((1-(1/x-1)^-n++)/(1-2*x)+O(x^20))


                                              Try it online!





                                              The generating function of the tier $n$ metasequence is:



                                              $$sum_{i=0}^nfrac{x^i}{(1-x)^{i+1}}=frac{1-left(frac{x}{1-x}right)^{1+n}}{1-2x}$$






                                              share|improve this answer











                                              $endgroup$




                                              Pari/GP, 39 bytes



                                              n->Vec(sum(i=1,n+1,(1/x-1)^-i)+O(x^21))


                                              Try it online!






                                              Pari/GP, 40 bytes



                                              n->Vec((1-(1/x-1)^-n++)/(1-2*x)+O(x^20))


                                              Try it online!





                                              The generating function of the tier $n$ metasequence is:



                                              $$sum_{i=0}^nfrac{x^i}{(1-x)^{i+1}}=frac{1-left(frac{x}{1-x}right)^{1+n}}{1-2x}$$







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited 8 hours ago

























                                              answered 8 hours ago









                                              alephalphaalephalpha

                                              21.6k32993




                                              21.6k32993























                                                  2












                                                  $begingroup$


                                                  dzaima/APL REPL, 14 bytes





                                                  (+1,19↑)⍣⎕⍳20


                                                  Try it online!



                                                  (+1,19↑)⍣⎕⍳20
                                                  ( )⍣⎕ repeat the function below input times:
                                                  + cumulative sum of
                                                  1, 1 prepended to
                                                  19↑ the first 19 items of the previous iteration
                                                  ⍳20 starting with the first 20 integers





                                                  share|improve this answer











                                                  $endgroup$













                                                  • $begingroup$
                                                    -1 byte using dzaima/APL: 1∘,1,
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    @Adám oh duh.. right
                                                    $endgroup$
                                                    – dzaima
                                                    8 hours ago










                                                  • $begingroup$
                                                    Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    14 bytes by using the REPL (add the -s flag).
                                                    $endgroup$
                                                    – Erik the Outgolfer
                                                    7 hours ago












                                                  • $begingroup$
                                                    If you use the flag, language becomes -s btw (unless -s is repl flag?)
                                                    $endgroup$
                                                    – ASCII-only
                                                    2 hours ago


















                                                  2












                                                  $begingroup$


                                                  dzaima/APL REPL, 14 bytes





                                                  (+1,19↑)⍣⎕⍳20


                                                  Try it online!



                                                  (+1,19↑)⍣⎕⍳20
                                                  ( )⍣⎕ repeat the function below input times:
                                                  + cumulative sum of
                                                  1, 1 prepended to
                                                  19↑ the first 19 items of the previous iteration
                                                  ⍳20 starting with the first 20 integers





                                                  share|improve this answer











                                                  $endgroup$













                                                  • $begingroup$
                                                    -1 byte using dzaima/APL: 1∘,1,
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    @Adám oh duh.. right
                                                    $endgroup$
                                                    – dzaima
                                                    8 hours ago










                                                  • $begingroup$
                                                    Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    14 bytes by using the REPL (add the -s flag).
                                                    $endgroup$
                                                    – Erik the Outgolfer
                                                    7 hours ago












                                                  • $begingroup$
                                                    If you use the flag, language becomes -s btw (unless -s is repl flag?)
                                                    $endgroup$
                                                    – ASCII-only
                                                    2 hours ago
















                                                  2












                                                  2








                                                  2





                                                  $begingroup$


                                                  dzaima/APL REPL, 14 bytes





                                                  (+1,19↑)⍣⎕⍳20


                                                  Try it online!



                                                  (+1,19↑)⍣⎕⍳20
                                                  ( )⍣⎕ repeat the function below input times:
                                                  + cumulative sum of
                                                  1, 1 prepended to
                                                  19↑ the first 19 items of the previous iteration
                                                  ⍳20 starting with the first 20 integers





                                                  share|improve this answer











                                                  $endgroup$




                                                  dzaima/APL REPL, 14 bytes





                                                  (+1,19↑)⍣⎕⍳20


                                                  Try it online!



                                                  (+1,19↑)⍣⎕⍳20
                                                  ( )⍣⎕ repeat the function below input times:
                                                  + cumulative sum of
                                                  1, 1 prepended to
                                                  19↑ the first 19 items of the previous iteration
                                                  ⍳20 starting with the first 20 integers






                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited 7 hours ago

























                                                  answered 9 hours ago









                                                  dzaimadzaima

                                                  15.2k21856




                                                  15.2k21856












                                                  • $begingroup$
                                                    -1 byte using dzaima/APL: 1∘,1,
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    @Adám oh duh.. right
                                                    $endgroup$
                                                    – dzaima
                                                    8 hours ago










                                                  • $begingroup$
                                                    Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    14 bytes by using the REPL (add the -s flag).
                                                    $endgroup$
                                                    – Erik the Outgolfer
                                                    7 hours ago












                                                  • $begingroup$
                                                    If you use the flag, language becomes -s btw (unless -s is repl flag?)
                                                    $endgroup$
                                                    – ASCII-only
                                                    2 hours ago




















                                                  • $begingroup$
                                                    -1 byte using dzaima/APL: 1∘,1,
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    @Adám oh duh.. right
                                                    $endgroup$
                                                    – dzaima
                                                    8 hours ago










                                                  • $begingroup$
                                                    Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
                                                    $endgroup$
                                                    – Adám
                                                    8 hours ago










                                                  • $begingroup$
                                                    14 bytes by using the REPL (add the -s flag).
                                                    $endgroup$
                                                    – Erik the Outgolfer
                                                    7 hours ago












                                                  • $begingroup$
                                                    If you use the flag, language becomes -s btw (unless -s is repl flag?)
                                                    $endgroup$
                                                    – ASCII-only
                                                    2 hours ago


















                                                  $begingroup$
                                                  -1 byte using dzaima/APL: 1∘,1,
                                                  $endgroup$
                                                  – Adám
                                                  8 hours ago




                                                  $begingroup$
                                                  -1 byte using dzaima/APL: 1∘,1,
                                                  $endgroup$
                                                  – Adám
                                                  8 hours ago












                                                  $begingroup$
                                                  @Adám oh duh.. right
                                                  $endgroup$
                                                  – dzaima
                                                  8 hours ago




                                                  $begingroup$
                                                  @Adám oh duh.. right
                                                  $endgroup$
                                                  – dzaima
                                                  8 hours ago












                                                  $begingroup$
                                                  Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
                                                  $endgroup$
                                                  – Adám
                                                  8 hours ago




                                                  $begingroup$
                                                  Full program at 17: (≢↑(+1∘,)⍣⎕)20⍴1
                                                  $endgroup$
                                                  – Adám
                                                  8 hours ago












                                                  $begingroup$
                                                  14 bytes by using the REPL (add the -s flag).
                                                  $endgroup$
                                                  – Erik the Outgolfer
                                                  7 hours ago






                                                  $begingroup$
                                                  14 bytes by using the REPL (add the -s flag).
                                                  $endgroup$
                                                  – Erik the Outgolfer
                                                  7 hours ago














                                                  $begingroup$
                                                  If you use the flag, language becomes -s btw (unless -s is repl flag?)
                                                  $endgroup$
                                                  – ASCII-only
                                                  2 hours ago






                                                  $begingroup$
                                                  If you use the flag, language becomes -s btw (unless -s is repl flag?)
                                                  $endgroup$
                                                  – ASCII-only
                                                  2 hours ago













                                                  2












                                                  $begingroup$


                                                  Python 3.8 (pre-release), 62 bytes





                                                  f=lambda n:[t:=1]+[t:=t+n for n in(n and f(n-1)[:-1]or[0]*19)]


                                                  Try it online!





                                                  Explanation



                                                  f=lambda n:     # funtion takes a single argument
                                                  [t:=1] # This evaluates to [1] and assigns 1 to t
                                                  # assignment expressions are a new feature of Python 3.8
                                                  + # concatenated to
                                                  [ .... ] # list comprehension

                                                  # The list comprehesion works together with the
                                                  # assignment expression as a scan function:
                                                  [t := t+n for n in it]
                                                  # This calculates all partial sums of it
                                                  # (plus the initial value of t, which is 1 here)

                                                  # The list comprehension iterates
                                                  # over the first 19 entries of f(n-1)
                                                  # or over a list of zeros for n=0
                                                  for n in (n and f(n-1)[:-1] or [0]*19)





                                                  share|improve this answer











                                                  $endgroup$


















                                                    2












                                                    $begingroup$


                                                    Python 3.8 (pre-release), 62 bytes





                                                    f=lambda n:[t:=1]+[t:=t+n for n in(n and f(n-1)[:-1]or[0]*19)]


                                                    Try it online!





                                                    Explanation



                                                    f=lambda n:     # funtion takes a single argument
                                                    [t:=1] # This evaluates to [1] and assigns 1 to t
                                                    # assignment expressions are a new feature of Python 3.8
                                                    + # concatenated to
                                                    [ .... ] # list comprehension

                                                    # The list comprehesion works together with the
                                                    # assignment expression as a scan function:
                                                    [t := t+n for n in it]
                                                    # This calculates all partial sums of it
                                                    # (plus the initial value of t, which is 1 here)

                                                    # The list comprehension iterates
                                                    # over the first 19 entries of f(n-1)
                                                    # or over a list of zeros for n=0
                                                    for n in (n and f(n-1)[:-1] or [0]*19)





                                                    share|improve this answer











                                                    $endgroup$
















                                                      2












                                                      2








                                                      2





                                                      $begingroup$


                                                      Python 3.8 (pre-release), 62 bytes





                                                      f=lambda n:[t:=1]+[t:=t+n for n in(n and f(n-1)[:-1]or[0]*19)]


                                                      Try it online!





                                                      Explanation



                                                      f=lambda n:     # funtion takes a single argument
                                                      [t:=1] # This evaluates to [1] and assigns 1 to t
                                                      # assignment expressions are a new feature of Python 3.8
                                                      + # concatenated to
                                                      [ .... ] # list comprehension

                                                      # The list comprehesion works together with the
                                                      # assignment expression as a scan function:
                                                      [t := t+n for n in it]
                                                      # This calculates all partial sums of it
                                                      # (plus the initial value of t, which is 1 here)

                                                      # The list comprehension iterates
                                                      # over the first 19 entries of f(n-1)
                                                      # or over a list of zeros for n=0
                                                      for n in (n and f(n-1)[:-1] or [0]*19)





                                                      share|improve this answer











                                                      $endgroup$




                                                      Python 3.8 (pre-release), 62 bytes





                                                      f=lambda n:[t:=1]+[t:=t+n for n in(n and f(n-1)[:-1]or[0]*19)]


                                                      Try it online!





                                                      Explanation



                                                      f=lambda n:     # funtion takes a single argument
                                                      [t:=1] # This evaluates to [1] and assigns 1 to t
                                                      # assignment expressions are a new feature of Python 3.8
                                                      + # concatenated to
                                                      [ .... ] # list comprehension

                                                      # The list comprehesion works together with the
                                                      # assignment expression as a scan function:
                                                      [t := t+n for n in it]
                                                      # This calculates all partial sums of it
                                                      # (plus the initial value of t, which is 1 here)

                                                      # The list comprehension iterates
                                                      # over the first 19 entries of f(n-1)
                                                      # or over a list of zeros for n=0
                                                      for n in (n and f(n-1)[:-1] or [0]*19)






                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited 4 hours ago

























                                                      answered 5 hours ago









                                                      ovsovs

                                                      19.2k21160




                                                      19.2k21160























                                                          1












                                                          $begingroup$

                                                          JavaScript (ES6),  68  67 bytes





                                                          f=(n,a=[...f+f])=>n--?f(n,[s=1,...a.map(x=>s-=~--x)]):a.slice(0,20)


                                                          Try it online!





                                                          JavaScript (ES6), 63 bytes



                                                          NB: this version works for $nle20$.





                                                          f=(n,a=[...Array(20-n)])=>n--?f(n,[s=1,...a.map(x=>s+=x||1)]):a


                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$


















                                                            1












                                                            $begingroup$

                                                            JavaScript (ES6),  68  67 bytes





                                                            f=(n,a=[...f+f])=>n--?f(n,[s=1,...a.map(x=>s-=~--x)]):a.slice(0,20)


                                                            Try it online!





                                                            JavaScript (ES6), 63 bytes



                                                            NB: this version works for $nle20$.





                                                            f=(n,a=[...Array(20-n)])=>n--?f(n,[s=1,...a.map(x=>s+=x||1)]):a


                                                            Try it online!






                                                            share|improve this answer











                                                            $endgroup$
















                                                              1












                                                              1








                                                              1





                                                              $begingroup$

                                                              JavaScript (ES6),  68  67 bytes





                                                              f=(n,a=[...f+f])=>n--?f(n,[s=1,...a.map(x=>s-=~--x)]):a.slice(0,20)


                                                              Try it online!





                                                              JavaScript (ES6), 63 bytes



                                                              NB: this version works for $nle20$.





                                                              f=(n,a=[...Array(20-n)])=>n--?f(n,[s=1,...a.map(x=>s+=x||1)]):a


                                                              Try it online!






                                                              share|improve this answer











                                                              $endgroup$



                                                              JavaScript (ES6),  68  67 bytes





                                                              f=(n,a=[...f+f])=>n--?f(n,[s=1,...a.map(x=>s-=~--x)]):a.slice(0,20)


                                                              Try it online!





                                                              JavaScript (ES6), 63 bytes



                                                              NB: this version works for $nle20$.





                                                              f=(n,a=[...Array(20-n)])=>n--?f(n,[s=1,...a.map(x=>s+=x||1)]):a


                                                              Try it online!







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 6 hours ago

























                                                              answered 9 hours ago









                                                              ArnauldArnauld

                                                              77.6k694325




                                                              77.6k694325























                                                                  1












                                                                  $begingroup$

                                                                  Ruby, 49 bytes



                                                                  f=->n{n<1?[1]*20:[o=1]+f[n-1][0,19].map{|x|o+=x}}


                                                                  Recursive definition: Tier 0 is 1,1,1,1... and each subsequent tier is 1 followed by a sequence whose first differences are the previous tier. Annoyingly this would give me 21 values if I didn't explicitly slice out the first 20; seems like there should be a way to shorten this by avoiding that.






                                                                  share|improve this answer











                                                                  $endgroup$













                                                                  • $begingroup$
                                                                    tio.run/#ruby pls
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    also 49
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    46
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    2 hours ago


















                                                                  1












                                                                  $begingroup$

                                                                  Ruby, 49 bytes



                                                                  f=->n{n<1?[1]*20:[o=1]+f[n-1][0,19].map{|x|o+=x}}


                                                                  Recursive definition: Tier 0 is 1,1,1,1... and each subsequent tier is 1 followed by a sequence whose first differences are the previous tier. Annoyingly this would give me 21 values if I didn't explicitly slice out the first 20; seems like there should be a way to shorten this by avoiding that.






                                                                  share|improve this answer











                                                                  $endgroup$













                                                                  • $begingroup$
                                                                    tio.run/#ruby pls
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    also 49
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    46
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    2 hours ago
















                                                                  1












                                                                  1








                                                                  1





                                                                  $begingroup$

                                                                  Ruby, 49 bytes



                                                                  f=->n{n<1?[1]*20:[o=1]+f[n-1][0,19].map{|x|o+=x}}


                                                                  Recursive definition: Tier 0 is 1,1,1,1... and each subsequent tier is 1 followed by a sequence whose first differences are the previous tier. Annoyingly this would give me 21 values if I didn't explicitly slice out the first 20; seems like there should be a way to shorten this by avoiding that.






                                                                  share|improve this answer











                                                                  $endgroup$



                                                                  Ruby, 49 bytes



                                                                  f=->n{n<1?[1]*20:[o=1]+f[n-1][0,19].map{|x|o+=x}}


                                                                  Recursive definition: Tier 0 is 1,1,1,1... and each subsequent tier is 1 followed by a sequence whose first differences are the previous tier. Annoyingly this would give me 21 values if I didn't explicitly slice out the first 20; seems like there should be a way to shorten this by avoiding that.







                                                                  share|improve this answer














                                                                  share|improve this answer



                                                                  share|improve this answer








                                                                  edited 3 hours ago

























                                                                  answered 6 hours ago









                                                                  histocrathistocrat

                                                                  19k43172




                                                                  19k43172












                                                                  • $begingroup$
                                                                    tio.run/#ruby pls
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    also 49
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    46
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    2 hours ago




















                                                                  • $begingroup$
                                                                    tio.run/#ruby pls
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    also 49
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    3 hours ago










                                                                  • $begingroup$
                                                                    46
                                                                    $endgroup$
                                                                    – ASCII-only
                                                                    2 hours ago


















                                                                  $begingroup$
                                                                  tio.run/#ruby pls
                                                                  $endgroup$
                                                                  – ASCII-only
                                                                  3 hours ago




                                                                  $begingroup$
                                                                  tio.run/#ruby pls
                                                                  $endgroup$
                                                                  – ASCII-only
                                                                  3 hours ago












                                                                  $begingroup$
                                                                  also 49
                                                                  $endgroup$
                                                                  – ASCII-only
                                                                  3 hours ago




                                                                  $begingroup$
                                                                  also 49
                                                                  $endgroup$
                                                                  – ASCII-only
                                                                  3 hours ago












                                                                  $begingroup$
                                                                  46
                                                                  $endgroup$
                                                                  – ASCII-only
                                                                  2 hours ago






                                                                  $begingroup$
                                                                  46
                                                                  $endgroup$
                                                                  – ASCII-only
                                                                  2 hours ago













                                                                  0












                                                                  $begingroup$

                                                                  Ruby, 74 bytes



                                                                  a=->b{c=[1];d=0;b==1?c=(1..20).to_a: 19.times{c<<c[d]+(a[b-1])[d];d+=1};c}



                                                                  Ungolfed version:



                                                                  def seq num
                                                                  ary = [1]
                                                                  index = 0
                                                                  if num == 1
                                                                  ary = (1..20).to_a
                                                                  else
                                                                  19.times{ary << ary[index]+seq(num-1)[index]; index+=1}
                                                                  end
                                                                  return ary
                                                                  end


                                                                  Quite resource-intensive--the online version can't calculate the 13th metasequence.



                                                                  Try it online






                                                                  share|improve this answer









                                                                  $endgroup$


















                                                                    0












                                                                    $begingroup$

                                                                    Ruby, 74 bytes



                                                                    a=->b{c=[1];d=0;b==1?c=(1..20).to_a: 19.times{c<<c[d]+(a[b-1])[d];d+=1};c}



                                                                    Ungolfed version:



                                                                    def seq num
                                                                    ary = [1]
                                                                    index = 0
                                                                    if num == 1
                                                                    ary = (1..20).to_a
                                                                    else
                                                                    19.times{ary << ary[index]+seq(num-1)[index]; index+=1}
                                                                    end
                                                                    return ary
                                                                    end


                                                                    Quite resource-intensive--the online version can't calculate the 13th metasequence.



                                                                    Try it online






                                                                    share|improve this answer









                                                                    $endgroup$
















                                                                      0












                                                                      0








                                                                      0





                                                                      $begingroup$

                                                                      Ruby, 74 bytes



                                                                      a=->b{c=[1];d=0;b==1?c=(1..20).to_a: 19.times{c<<c[d]+(a[b-1])[d];d+=1};c}



                                                                      Ungolfed version:



                                                                      def seq num
                                                                      ary = [1]
                                                                      index = 0
                                                                      if num == 1
                                                                      ary = (1..20).to_a
                                                                      else
                                                                      19.times{ary << ary[index]+seq(num-1)[index]; index+=1}
                                                                      end
                                                                      return ary
                                                                      end


                                                                      Quite resource-intensive--the online version can't calculate the 13th metasequence.



                                                                      Try it online






                                                                      share|improve this answer









                                                                      $endgroup$



                                                                      Ruby, 74 bytes



                                                                      a=->b{c=[1];d=0;b==1?c=(1..20).to_a: 19.times{c<<c[d]+(a[b-1])[d];d+=1};c}



                                                                      Ungolfed version:



                                                                      def seq num
                                                                      ary = [1]
                                                                      index = 0
                                                                      if num == 1
                                                                      ary = (1..20).to_a
                                                                      else
                                                                      19.times{ary << ary[index]+seq(num-1)[index]; index+=1}
                                                                      end
                                                                      return ary
                                                                      end


                                                                      Quite resource-intensive--the online version can't calculate the 13th metasequence.



                                                                      Try it online







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered 9 hours ago









                                                                      CG One HandedCG One Handed

                                                                      614




                                                                      614























                                                                          0












                                                                          $begingroup$


                                                                          Jelly, 10 bytes



                                                                          20RṖ1;ÄƲ⁸¡


                                                                          Try it online!



                                                                          0-indexed.






                                                                          share|improve this answer









                                                                          $endgroup$


















                                                                            0












                                                                            $begingroup$


                                                                            Jelly, 10 bytes



                                                                            20RṖ1;ÄƲ⁸¡


                                                                            Try it online!



                                                                            0-indexed.






                                                                            share|improve this answer









                                                                            $endgroup$
















                                                                              0












                                                                              0








                                                                              0





                                                                              $begingroup$


                                                                              Jelly, 10 bytes



                                                                              20RṖ1;ÄƲ⁸¡


                                                                              Try it online!



                                                                              0-indexed.






                                                                              share|improve this answer









                                                                              $endgroup$




                                                                              Jelly, 10 bytes



                                                                              20RṖ1;ÄƲ⁸¡


                                                                              Try it online!



                                                                              0-indexed.







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered 8 hours ago









                                                                              Erik the OutgolferErik the Outgolfer

                                                                              32.1k429103




                                                                              32.1k429103























                                                                                  0












                                                                                  $begingroup$


                                                                                  R, 59 bytes





                                                                                  Reduce(function(x,y)diffinv(x,,,y),!!1:scan(),!!1:19)[1:20]


                                                                                  Try it online!



                                                                                  Repeated diffinv with xi=1, and subset out the first 20 terms.






                                                                                  share|improve this answer









                                                                                  $endgroup$


















                                                                                    0












                                                                                    $begingroup$


                                                                                    R, 59 bytes





                                                                                    Reduce(function(x,y)diffinv(x,,,y),!!1:scan(),!!1:19)[1:20]


                                                                                    Try it online!



                                                                                    Repeated diffinv with xi=1, and subset out the first 20 terms.






                                                                                    share|improve this answer









                                                                                    $endgroup$
















                                                                                      0












                                                                                      0








                                                                                      0





                                                                                      $begingroup$


                                                                                      R, 59 bytes





                                                                                      Reduce(function(x,y)diffinv(x,,,y),!!1:scan(),!!1:19)[1:20]


                                                                                      Try it online!



                                                                                      Repeated diffinv with xi=1, and subset out the first 20 terms.






                                                                                      share|improve this answer









                                                                                      $endgroup$




                                                                                      R, 59 bytes





                                                                                      Reduce(function(x,y)diffinv(x,,,y),!!1:scan(),!!1:19)[1:20]


                                                                                      Try it online!



                                                                                      Repeated diffinv with xi=1, and subset out the first 20 terms.







                                                                                      share|improve this answer












                                                                                      share|improve this answer



                                                                                      share|improve this answer










                                                                                      answered 4 hours ago









                                                                                      GiuseppeGiuseppe

                                                                                      16.8k31052




                                                                                      16.8k31052























                                                                                          0












                                                                                          $begingroup$


                                                                                          J, 24 bytes



                                                                                          <:(1+/@,])^:[(1+i.20)"_


                                                                                          Try it online!



                                                                                          NOTE: Turns out this is a translation of dzaima's APL answer, though I actually didn't notice it before writing this.



                                                                                          explanation



                                                                                          <: (1 +/@, ])^:[ (1+i.20)"_
                                                                                          <: NB. input minus 1 (left input)
                                                                                          (1+i.20)"_ NB. 1..20 (right input)
                                                                                          ( )^:[ NB. apply verb in parens
                                                                                          NB. "left input" times
                                                                                          (1 , ]) NB. prepend 1 to right input
                                                                                          ( +/@ ) NB. and take scan sum





                                                                                          share|improve this answer











                                                                                          $endgroup$


















                                                                                            0












                                                                                            $begingroup$


                                                                                            J, 24 bytes



                                                                                            <:(1+/@,])^:[(1+i.20)"_


                                                                                            Try it online!



                                                                                            NOTE: Turns out this is a translation of dzaima's APL answer, though I actually didn't notice it before writing this.



                                                                                            explanation



                                                                                            <: (1 +/@, ])^:[ (1+i.20)"_
                                                                                            <: NB. input minus 1 (left input)
                                                                                            (1+i.20)"_ NB. 1..20 (right input)
                                                                                            ( )^:[ NB. apply verb in parens
                                                                                            NB. "left input" times
                                                                                            (1 , ]) NB. prepend 1 to right input
                                                                                            ( +/@ ) NB. and take scan sum





                                                                                            share|improve this answer











                                                                                            $endgroup$
















                                                                                              0












                                                                                              0








                                                                                              0





                                                                                              $begingroup$


                                                                                              J, 24 bytes



                                                                                              <:(1+/@,])^:[(1+i.20)"_


                                                                                              Try it online!



                                                                                              NOTE: Turns out this is a translation of dzaima's APL answer, though I actually didn't notice it before writing this.



                                                                                              explanation



                                                                                              <: (1 +/@, ])^:[ (1+i.20)"_
                                                                                              <: NB. input minus 1 (left input)
                                                                                              (1+i.20)"_ NB. 1..20 (right input)
                                                                                              ( )^:[ NB. apply verb in parens
                                                                                              NB. "left input" times
                                                                                              (1 , ]) NB. prepend 1 to right input
                                                                                              ( +/@ ) NB. and take scan sum





                                                                                              share|improve this answer











                                                                                              $endgroup$




                                                                                              J, 24 bytes



                                                                                              <:(1+/@,])^:[(1+i.20)"_


                                                                                              Try it online!



                                                                                              NOTE: Turns out this is a translation of dzaima's APL answer, though I actually didn't notice it before writing this.



                                                                                              explanation



                                                                                              <: (1 +/@, ])^:[ (1+i.20)"_
                                                                                              <: NB. input minus 1 (left input)
                                                                                              (1+i.20)"_ NB. 1..20 (right input)
                                                                                              ( )^:[ NB. apply verb in parens
                                                                                              NB. "left input" times
                                                                                              (1 , ]) NB. prepend 1 to right input
                                                                                              ( +/@ ) NB. and take scan sum






                                                                                              share|improve this answer














                                                                                              share|improve this answer



                                                                                              share|improve this answer








                                                                                              edited 4 hours ago

























                                                                                              answered 4 hours ago









                                                                                              JonahJonah

                                                                                              2,361916




                                                                                              2,361916























                                                                                                  0












                                                                                                  $begingroup$


                                                                                                  Wolfram Language (Mathematica), 42 bytes



                                                                                                  Nest[FoldList[Plus,1,#]&,Range[21-#],#-1]&


                                                                                                  Try it online!






                                                                                                  share|improve this answer









                                                                                                  $endgroup$


















                                                                                                    0












                                                                                                    $begingroup$


                                                                                                    Wolfram Language (Mathematica), 42 bytes



                                                                                                    Nest[FoldList[Plus,1,#]&,Range[21-#],#-1]&


                                                                                                    Try it online!






                                                                                                    share|improve this answer









                                                                                                    $endgroup$
















                                                                                                      0












                                                                                                      0








                                                                                                      0





                                                                                                      $begingroup$


                                                                                                      Wolfram Language (Mathematica), 42 bytes



                                                                                                      Nest[FoldList[Plus,1,#]&,Range[21-#],#-1]&


                                                                                                      Try it online!






                                                                                                      share|improve this answer









                                                                                                      $endgroup$




                                                                                                      Wolfram Language (Mathematica), 42 bytes



                                                                                                      Nest[FoldList[Plus,1,#]&,Range[21-#],#-1]&


                                                                                                      Try it online!







                                                                                                      share|improve this answer












                                                                                                      share|improve this answer



                                                                                                      share|improve this answer










                                                                                                      answered 3 hours ago









                                                                                                      shrapshrap

                                                                                                      111




                                                                                                      111























                                                                                                          0












                                                                                                          $begingroup$


                                                                                                          Retina, 59 bytes



                                                                                                          .+
                                                                                                          19*$(_,


                                                                                                          Replace the input with 19 1s (in unary). (The 20th value is 0 because it always gets deleted by the first pass through the loop.)



                                                                                                          "$+"{`
                                                                                                          )`


                                                                                                          Repeat the loop the original input number of times.



                                                                                                          (.+),_*
                                                                                                          _,$1


                                                                                                          Remove the last element and prefix a 1.



                                                                                                          _+(?<=((_)|,)+)
                                                                                                          $#2*


                                                                                                          Calculate the cumulative sum.



                                                                                                          _+
                                                                                                          $.&


                                                                                                          Convert to decimal.



                                                                                                          Try it online!






                                                                                                          share|improve this answer









                                                                                                          $endgroup$


















                                                                                                            0












                                                                                                            $begingroup$


                                                                                                            Retina, 59 bytes



                                                                                                            .+
                                                                                                            19*$(_,


                                                                                                            Replace the input with 19 1s (in unary). (The 20th value is 0 because it always gets deleted by the first pass through the loop.)



                                                                                                            "$+"{`
                                                                                                            )`


                                                                                                            Repeat the loop the original input number of times.



                                                                                                            (.+),_*
                                                                                                            _,$1


                                                                                                            Remove the last element and prefix a 1.



                                                                                                            _+(?<=((_)|,)+)
                                                                                                            $#2*


                                                                                                            Calculate the cumulative sum.



                                                                                                            _+
                                                                                                            $.&


                                                                                                            Convert to decimal.



                                                                                                            Try it online!






                                                                                                            share|improve this answer









                                                                                                            $endgroup$
















                                                                                                              0












                                                                                                              0








                                                                                                              0





                                                                                                              $begingroup$


                                                                                                              Retina, 59 bytes



                                                                                                              .+
                                                                                                              19*$(_,


                                                                                                              Replace the input with 19 1s (in unary). (The 20th value is 0 because it always gets deleted by the first pass through the loop.)



                                                                                                              "$+"{`
                                                                                                              )`


                                                                                                              Repeat the loop the original input number of times.



                                                                                                              (.+),_*
                                                                                                              _,$1


                                                                                                              Remove the last element and prefix a 1.



                                                                                                              _+(?<=((_)|,)+)
                                                                                                              $#2*


                                                                                                              Calculate the cumulative sum.



                                                                                                              _+
                                                                                                              $.&


                                                                                                              Convert to decimal.



                                                                                                              Try it online!






                                                                                                              share|improve this answer









                                                                                                              $endgroup$




                                                                                                              Retina, 59 bytes



                                                                                                              .+
                                                                                                              19*$(_,


                                                                                                              Replace the input with 19 1s (in unary). (The 20th value is 0 because it always gets deleted by the first pass through the loop.)



                                                                                                              "$+"{`
                                                                                                              )`


                                                                                                              Repeat the loop the original input number of times.



                                                                                                              (.+),_*
                                                                                                              _,$1


                                                                                                              Remove the last element and prefix a 1.



                                                                                                              _+(?<=((_)|,)+)
                                                                                                              $#2*


                                                                                                              Calculate the cumulative sum.



                                                                                                              _+
                                                                                                              $.&


                                                                                                              Convert to decimal.



                                                                                                              Try it online!







                                                                                                              share|improve this answer












                                                                                                              share|improve this answer



                                                                                                              share|improve this answer










                                                                                                              answered 2 hours ago









                                                                                                              NeilNeil

                                                                                                              81.3k745178




                                                                                                              81.3k745178























                                                                                                                  0












                                                                                                                  $begingroup$


                                                                                                                  JavaScript (Node.js), 58 bytes





                                                                                                                  t=>Array(20).fill(t).map(g=(t,i)=>i--*t?g(t,i)+g(t-1,i):1)


                                                                                                                  Try it online!



                                                                                                                  It is trivial to write down following recursive formula based on the description in question
                                                                                                                  $$ g(t,i)=begin{cases}
                                                                                                                  g(t,i-1)+g(t-1,i-1) & text{if} quad icdot t>0 \
                                                                                                                  1 & text{if} quad icdot t=0 \
                                                                                                                  end{cases} $$

                                                                                                                  And you just need to generate an Array of 20 elements with $[g(t,0)dots g(t,19)]$






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$


















                                                                                                                    0












                                                                                                                    $begingroup$


                                                                                                                    JavaScript (Node.js), 58 bytes





                                                                                                                    t=>Array(20).fill(t).map(g=(t,i)=>i--*t?g(t,i)+g(t-1,i):1)


                                                                                                                    Try it online!



                                                                                                                    It is trivial to write down following recursive formula based on the description in question
                                                                                                                    $$ g(t,i)=begin{cases}
                                                                                                                    g(t,i-1)+g(t-1,i-1) & text{if} quad icdot t>0 \
                                                                                                                    1 & text{if} quad icdot t=0 \
                                                                                                                    end{cases} $$

                                                                                                                    And you just need to generate an Array of 20 elements with $[g(t,0)dots g(t,19)]$






                                                                                                                    share|improve this answer











                                                                                                                    $endgroup$
















                                                                                                                      0












                                                                                                                      0








                                                                                                                      0





                                                                                                                      $begingroup$


                                                                                                                      JavaScript (Node.js), 58 bytes





                                                                                                                      t=>Array(20).fill(t).map(g=(t,i)=>i--*t?g(t,i)+g(t-1,i):1)


                                                                                                                      Try it online!



                                                                                                                      It is trivial to write down following recursive formula based on the description in question
                                                                                                                      $$ g(t,i)=begin{cases}
                                                                                                                      g(t,i-1)+g(t-1,i-1) & text{if} quad icdot t>0 \
                                                                                                                      1 & text{if} quad icdot t=0 \
                                                                                                                      end{cases} $$

                                                                                                                      And you just need to generate an Array of 20 elements with $[g(t,0)dots g(t,19)]$






                                                                                                                      share|improve this answer











                                                                                                                      $endgroup$




                                                                                                                      JavaScript (Node.js), 58 bytes





                                                                                                                      t=>Array(20).fill(t).map(g=(t,i)=>i--*t?g(t,i)+g(t-1,i):1)


                                                                                                                      Try it online!



                                                                                                                      It is trivial to write down following recursive formula based on the description in question
                                                                                                                      $$ g(t,i)=begin{cases}
                                                                                                                      g(t,i-1)+g(t-1,i-1) & text{if} quad icdot t>0 \
                                                                                                                      1 & text{if} quad icdot t=0 \
                                                                                                                      end{cases} $$

                                                                                                                      And you just need to generate an Array of 20 elements with $[g(t,0)dots g(t,19)]$







                                                                                                                      share|improve this answer














                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer








                                                                                                                      edited 2 mins ago

























                                                                                                                      answered 16 mins ago









                                                                                                                      tshtsh

                                                                                                                      9,30511652




                                                                                                                      9,30511652






























                                                                                                                          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%2f180855%2fmake-me-a-metasequence%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

                                                                                                                          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

                                                                                                                          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                                                                                                                          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...