[Question]
  [
# Introduction
* Note that I learned it from a [Numberphile Video](https://www.youtube.com/watch?v=KNjPPFyEeLo), where [Neil Sloane](https://www.youtube.com/playlist?list=PLt5AfwLFPxWJXQqPe_llzWmTHMPb9QvV2) explains it better. I recommend you to watch his Video. But for a quick Introduction:
The [Levine Sequence](https://oeis.org/A011784) is made from the Levine's Triangle, which is made as follows:  
First you have \$0\$ ones, and \$1\$ twos.  
Then you read the list backwards (right to left) and you have the same number of ones, as the \$0\$\$th\$ element of the list.  
Then you have the same number of twos, as the \$1\$\$th\$ element of the list. That goes on and on, till the list ends.
These are the first few rows:
```
ln[0]: 2
ln[1]: 11
ln[2]: 12
ln[3]: 112
ln[4]: 1123
ln[5]: 1112234
ln[6]: 11112223344567
```
Really, I don't think I've explained it good, so check out [Neil's Video](https://www.youtube.com/watch?v=KNjPPFyEeLo) to learn more about it.
So, now, the Levine's Sequence. The \$n\$\$th\$ Term of the sequence (starting at \$0\$), is just the sum of the \$n\$\$th\$ row of the Levine's Triangle.
These are the first few terms: 2, 2, 3, 4, 7, 14.  
Then it just blows up.
Disclaimer: In the Numberphile video, also when you follow the steps I told, the \$0\$\$th\$ term is \$2\$. But in [OEIS](https://oeis.org/A011784) the first term is \$1\$. So I will accept both sequences.
# Rules
* The output must be printed to the program's output.
* The output must be in base 10 (outputting them in any other base is not allowed).
* Your program must *can* take input, the nth term.
* Outputting the integers with trailing / leading spaces is allowed.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest (original) code in each language wins!
I'm a bit free about this, so you can output just the \$n\$\$th\$ term, up to the \$n\$\$th\$ term, or even the whole sequence!
# Leaderboard
I liked the leaderboard thingy, so here it is again:
This uses uses [@manatwork's layout](https://codegolf.meta.stackexchange.com/questions/5139/leaderboard-snippet/7742#7742).
```
/* Configuration */
var QUESTION_ID = 222856; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 96037; // This should be the user ID of the challenge author.
/* App */
var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;
function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}
function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}
function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}
function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}
getAnswers();
var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(-?\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;
var OVERRIDE_REG = /^Override\s*header:\s*/i;
function getAuthorName(a) {
  return a.owner.display_name;
}
function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });
  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);
    var lang = a.language;
    if (! /<a/.test(lang)) lang = '<i>' + lang + '</i>';
    lang = jQuery(lang).text().toLowerCase();
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};
  });
  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);
  langs.sort(function (a, b) {
    if (a.uniq > b.uniq) return 1;
    if (a.uniq < b.uniq) return -1;
    return 0;
  });
  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }
}
```
```
body { text-align: left !important}
#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}
#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}
table thead {
  font-weight: bold;
}
table td {
  padding: 5px;
}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=617d0685f6f3">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">
    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">
    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr>
  </tbody>
</table>
```
  
[Answer]
# [J](http://jsoftware.com/), 17 15 bytes
```
1#.0&(]|.##\)&2
```
[Try it online!](https://tio.run/##DcPNCkBAFIDRvaf4milMmOb6p6yUlZU1K5FsvIB3H06d2ysbnQw9ESmO/p9ZxmWevGjrwnh7rdarCXNvgmO/Hk6VIOQUlFTUNLR0iEPEfw "J ‚Äì Try It Online")
-2 thanks to FrownyFrog!
On TIO, handles up to the 11th term `6837625106787` (where term 1 is `2`).
## how
J's ["Copy" verb `#`](https://code.jsoftware.com/wiki/Vocabulary/number#dyadic) is tailor made for this challenge:
```
   1 2 3 # 'abc'
abbccc
```
The rest is just mechanics needed to reverse and iterate:
* `0&(...)&2` Iterate `...` as many times as the input. This occurs as a result of a special rule J has for the bond `&` conjunction. The `&2` on the right hand side also sets the starting value of the iteration.
* `]...` Ignores the left argument of `0` (resulting from `0&`), and returns the result of `...`, which is processed as a single argument verb, because this entire phrase is a dyadic hook.
	+ `|.##\` Reverse current list `|.`, and use it as a mask to duplicate `#` the numbers `1...<length of current list>`.
* `1#.` Sum the result of that iteration.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~91~~ ~~87~~ 85 bytes
```
f=lambda n,l=[2]:n and f(n-1,[n+1for n,e in enumerate(l[::-1])for _ in[0]*e])or l[-1]
```
[Try it online!](https://tio.run/##NU/baoRADH33KwJ90GlHcLzuCvZHplKmbtRldRTNQov47TYjbQjkXAjJmX@on2xyHG01mPHrZsDKodJxXVow9gZtYEMltX1T7bSwh3C3gPY54mIIg0GXZahq4cxPtnRUv2ItmA2a9QO/Z2wIb1BBoCTEZycSUgmFBMUjdZpiKb4kTiqyNIt4Jtciu@YRw5yNPM5UlBeXQgC8AJkHrkDTBMNkOwbQTTCblUBF1AMOOKIlr@mxeeDibvsfz7hIG1/CiVTiC8/9TC7OYmyH7j2lROkB18o7bUDiJMjkP4cmTnWq83K3FLT@RjuE77CtO2x/BzVW1Vrvvjh@AQ "Python 3 ‚Äì Try It Online")
Inputs \$1\$-based index \$n\$ and returns the \$n^{\text{th}}\$ element of the Levine Sequence starting at \$1\$.
### Explanation
Starts at `[2]` and successively computes the next row in Levine's Triangle. The last element in the \$(n+2)^{\text{th}}\$ row is equal to the sum of the \$n^{\text{th}}\$ row or the \$n^{\text{th}}\$ term of the Levine Sequence starting at \$2\$. By using a \$1\$-based index and starting the sequence at \$1\$ we simply return the last element in the \$(n+1)^{\text{th}}\$ row.
[Answer]
# [R](https://www.r-project.org/), ~~49~~ 48 bytes
*Edit: -1 byte thanks to Giuseppe*
```
i=1:0;repeat{i=rep(seq(!i),rev(i));show(sum(i))}
```
[Try it online!](https://tio.run/##K/r/P9PW0MrAuii1IDWxpDrTFsjQKE4t1FDM1NQpSi3TyNTUtC7OyC/XKC7NBXFq//8HAA "R ‚Äì Try It Online")
Prints the infinite sequence (well, until it fails to allocate vector of size 25472.1 Gb at the 12th iteration...)
[Answer]
# [Python 2](https://docs.python.org/2/), 62 bytes
*-3 bytes thanks to @xnor*
Outputs the Levine sequence indefinitely, starting at `1`.
```
a=[2]
while 1:i=len(a);print i;exec'a+=a.pop(i-1)*[i];i-=1;'*i
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9E22iiWqzwjMydVwdAq0zYnNU8jUdO6oCgzr0Qh0zq1IjVZPVHbNlGvIL9AI1PXUFMrOjPWOlPX1tBaXSvz/38A "Python 2 ‚Äì Try It Online")
[Answer]
# [Scratch](https://scratch.mit.edu/), ~~734~~ 715 Bytes
-19 thanks to Lyxal!  
[Try it online!](https://scratch.mit.edu/projects/513149982/)
[Previously discussed](https://codegolf.meta.stackexchange.com/questions/673/golfing-in-scratch/), there doesn't seem to be a consensus on how to score Scratch code. I converted the code to scratchblocks4 and counted the characters:
```
when gf clicked
delete all of[B v
delete all of[E v
delete all of[T v
ask[]and wait
add(2)to[E v
add(1)to[T v
set[D v]to(1
repeat(answer
set[C v]to(0
A
repeat((item(length of [T v])of[T v])-(1
A
if<not<(R)=(item((length of[B v])-(1))of[B v])>>then
change[C v]by(()-(length of(D
change[D v]by(-1
delete(length of[B v])of[B v
A
end
end
set[D v]to(length of[B v
set[S v]to(
set[V v]to(1
set[t v]to(0
repeat(length of[B v
repeat(item(1)of[B v
set[S v]to(join(S)(V
end
change[V v]by(1
change[t v]by(item(1)of[B v
delete(1)of[B v
end
add(S)to[E v
add(t)to[T v
define A
set[R v]to(
repeat(length of(D
set[l v]to(item(length of[E v])of[E v
set[R v]to(join(letter((length of(l))-(C))of(l))(R
change[C v]by(1
end
add(R)to[B v
```
Alternatively, the program is 73 blocks:
[![enter image description here](https://i.stack.imgur.com/HsaGc.png)](https://i.stack.imgur.com/HsaGc.png)
Obviously, Scratch isn't the first choice for any serious program, but I enjoyed making this! Lyxal substituted `(item(length of[E v])of(E v` for a variable, saving 19 bytes.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
2Jx·πö∆ä¬°S
```
[Try it online!](https://tio.run/##y0rNyan8/9/Iq@LhzlnHug4tDP7//78pAA "Jelly ‚Äì Try It Online")
Outputs the \$n\$th term.
## Explanation
```
2Jx·πö∆ä¬°S   Main monadic link
2         Start with 2
     ¬°    Repeat n times
    ∆ä     (
 J          Indices (range [1..length])
  x         Repeat each item a number of times given by the corresponding item in
   ·πö          The list reversed
    ∆ä     )
      S   Sum
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 71 bytes
prints the `n`th 0-indexed term
```
Tr@Nest[Join@@MapThread[Table,{Range@Length[a=#],Reverse@a}]&,{1,0},#]&
```
[Try it online!](https://tio.run/##HcuxCsIwEAbgVxEKnQ7auhduFhUp2UKGU3@SgI2SHl1Kn/2Efvs3iybMovklFkdzle9Y1F@@uTDf5OdShby9k@cHtE1SIviKEjV5GZtAE1bUBSx7aGkbqN@pCa09ai566jh2fBzf03AOZn8 "Wolfram Language (Mathematica) ‚Äì Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 10 bytes
```
mŒ£¬°o`·πòN‚Üî;2
```
[Try it online!](https://tio.run/##yygtzv7/P/fc4kML8xMe7pzh96htirXR//8A "Husk ‚Äì Try It Online")
Prints the infinite sequence. If you let it time out, you can see upto 11 terms.
## Explanation
```
mŒ£¬°o`·πòN‚Üî;2
        ;2 start with [2]
  ¬°o       create the next iteration by
       ‚Üî   reversing it
    `·πò     and replicating each element(flipped arg)
      N    times each element in the natural numbers
mŒ£         map each list to its sum
```
[Answer]
# JavaScript (Node.js), 110 bytes
```
n=6;a=[2];for(;n-->0;a=a.reverse().reduce((v,e,i)=>v.concat(Array(e*1).fill(i+1)),[]));console.log(a.join(""))
```
[Try it online!](https://tio.run/##DcpBCsMgEEDRu2Q10xppuuhGDOQcIYvBTIpBnDKmQk9v3X0e/6RKJWj8XGOWnVvL/uXIr8/NHaLg8jjOjw5klStrYcBe@zcwQDVsIvq52iA50AWLKv2AbxPaI6YE8T4hmnVDdP0oktgmeQPZU2KGYUBs7Q8 "JavaScript (Node.js) ‚Äì Try It Online")
Set `n` at the start to change which element of the sequence is calculated.
Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.
[Answer]
# [Python 2](https://docs.python.org/2/), 82 bytes
```
x=[2]
exec'x=sum([v*[i]for i,v in enumerate(x[::-1],1)],[]);'*input()
print sum(x)
```
Prints the nth, 0-indexed, term.
**[Try it online!](https://tio.run/##FcsxCoAwDADA3Vd0s5U61EVQfEnIIBIxg7HUVuLrK95@8c3HJUOtusCADSltrS53OS08HTDuVzLsH8NiSMpJac1kFaapD@iDQw/o5rZjiSVb18TEks3f1dU6fg "Python 2 ‚Äì Try It Online")**
---
Others at 82:
```
x=[2]
exec'i=1;x=x[::-1];exec"x+=x.pop(0)*[i];i+=1;"*len(x);'*input()
print sum(x)
```
```
x=[2]
exec'i=1;exec"x=x.pop()*[i]+x;i+=1;"*len(x);x=x[::-1];'*input()
print sum(x)
```
```
x=2,
exec'x=sum([v*(i,)for i,v in enumerate(x[::-1],1)],());'*input()
print sum(x)
```
[Answer]
# JavaScript (ES6), 81 bytes
Returns the \$n\$-th term, 0-indexed.
```
f=(n,a=[2])=>a.map(k=>A=n?[...Array(k).fill(++i),...A]:+A+k,i=A=[])&&n?f(n-1,A):A
```
[Try it online!](https://tio.run/##FYtBCoMwEADvfUUOIlkSQ@1Ru0reIYLBmpKabiSWQhHfnuppYJh5ma9Zx@iWT0HhMaVkkZM02N16wMaot1n4jI1GajullI7R/PgMyjrvuRAO5Gn7SmgxS4caux7ynFrLqSilhkonGyInhuxaM2J3Vp4UAth2YWwMtAY/KR@efDA822iHI82244d9gPqypz8 "JavaScript (Node.js) ‚Äì Try It Online")
### Commented
```
f = (               // f is a recursive function taking:
  n,                //   n = input
  a = [2]           //   a[] = Levine sequence
) =>                //
a.map(k =>          // for each value k in a[]:
  A =               //   compute A, which is either the updated Levine sequence
                    //   or the sum of the terms of the last sequence if this is
                    //   the last iteration:
    n ?             //     if n is not equal to 0:
      [ ...Array(k) //       build an array consisting of k entries
        .fill(++i), //       equal to i (which is first incremented)
        ...A        //       followed by the existing entries in A[]
      ]             //
    :               //     else:
      +A + k,       //       coerce A to a number and add k
  i = A = []        //   start with i = A = []
)                   // end of map()
&& n ?              // if n is not equal to 0:
  f(n - 1, A)       //   do a recursive call with n - 1 and a[] = A[]
:                   // else:
  A                 //   we're done: return A
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~57~~ 55 bytes
* -2 bytes thanks to [kops](https://codegolf.stackexchange.com/users/101474/kops).
```
sum<$>iterate(!1)[2]
(x:y)!n=y!(n+1)++(n<$[1..x])
e!_=e
```
[Try it online!](https://tio.run/##BcFBCsMgEADAe16h4EGRBjbHEvuDviANYQmbVqKLRAvJ57ud@WDdKSVJ4SX1m0fziI0ObGQ1uGmYO3veL6c5XNqyB@e95dFM0Pfn7DrSSyDJGDlkLM9FlSNyMw13UgAqyW/dEr6r3NZS/g "Haskell ‚Äì Try It Online")
The whole Levine sequence.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 2Ã∂3Ã∂ 2Ã∂2Ã∂ 21 bytes
-1 thanks to @Razetime
  
-1 thanks to @User
```
+/{√ó‚çµ:/‚àò‚ç≥‚àò‚ç¥‚ç®‚åΩ‚àá‚çµ-1‚ãÑ,2}
+/ ‚çù summation
 √ó‚çµ: ‚çù conditional
   /‚àò‚ç≥‚àò‚ç¥‚ç® ‚çù expand range 0 to length of L(n-1) inclusive
     ‚åΩ‚àá‚çµ-1 ‚çù reverse L(n-1)
       ‚ãÑ ‚çù statement separator (effectively an else clause)
         ,2 ‚çù return value
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wRt/erD0x/1brXSf9Qx41HvZjC55VHvikc9ex91tANldA0fdbfoGNUC1SsYcKUpGAKxERAbA7EJEJsCsRkQmwOxBRBbgtQYAAA "APL (Dyalog Unicode) ‚Äì Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 15 bytes
```
1‚Äö¬∏ŒªRŒµN>y–∏}Àú}ŒµŒ∏
```
[Try it online!](https://tio.run/##ASIA3f9vc2FiaWX//zHigJrCuM67Us61Tj550Lh9y5x9zrXOuP// "05AB1E ‚Äì Try It Online")
prints the whole sequence forever
```
1     pushes 1 to the stack
‚Äö     because there is no input, pairs 1 with itself, pushing [1, 1]
¬∏     listify, pushing [[1,1]]
Œª     recursive environment, with [1, 1] as the base case
 R    reverse the implicit last value
 Œµ    and map each element to
  N>  index + 1
  y   that element
  –∏   repeated, pushes index + 1 repeated the element
 }
 Àú    flatten, to a flat list
}
Œµ     and for each such list
Œ∏     take the last element
```
[Answer]
# [Factor](https://factorcode.org/), 68 bytes
```
[ { 2 } swap [ reverse [ 1 + <array> ] map-index concat ] times Œ£ ]
```
[Try it online!](https://tio.run/##JY0xCsJAEEV7T/F7MaiIhYqt2NiIVUixbEZcNLPr7EQNIafxPl5pXbR7vA/vn41VL@l03B92K1xJmG6IdG@JLUU0Ri8wIqb7c9Gys74mBCHVLohjxXrUY4o5FlhiSCX6zAPi0wSUEHqQRMo0wxibX2uLKtfCxHFNL1jP1mhW6pp8@XmjSnlFkb4 "Factor ‚Äì Try It Online")
## Explanation:
It's a quotation (anonymous function) that takes an integer from the data stack as input and puts an integer (the nth term of the Levine sequence) on the data stack as output. Assuming `4` is on top of the stack when this quotation is called...
* `{ 2 }` Push a sequence to the stack containing one element, `2`.
**Stack:** `4 { 2 }`
* `swap` Swap two objects (because `times` needs access to the `4` later).
**Stack:** `{ 2 } 4`
* `[ reverse [ 1 + <array> ] map-index concat ]` Push a quotation for `times` to use later. This is a quotation that produces the next row of the Levine's Triangle from the previous one.
**Stack:** `{ 2 } 4 [ reverse [ 1 + <array> ] map-index concat ]`
* `times` Call a quotation a certain number of times. Inside the quotation now for the first iteration...
**Stack:** `{ 2 }`
* `reverse` Reverse a sequence.
**Stack:** `{ 2 }`
* `[ 1 + <array> ]` Push a quotation for `map-index` to use later.
**Stack:** `{ 2 } [ 1 + <array> ]`
* `map-index` Take a sequence and a quotation and apply the quotation to each element of the sequence, collecting the results into a new sequence of the same length. However, it also places the index of the element on top of the stack. Inside the quotation now for the first iteration...
**Stack:** `2 0`
* `1` Push `1`.
**Stack:** `2 0 1`
* `+` Add.
**Stack:** `2 1`
* `<array>` Create an array from a count and an element.
**Stack:** `{ 1 1 }`
* Now `map-index` has exhausted its elements. Since we are mapping numbers to arrays, the result will be an array of arrays.
**Stack:** `{ { 1 1 } }`
* `concat` Concatenate a sequence of sequences together into one sequence.
**Stack:** `{ 1 1 }`
* Now we have produced the second row of Levine's Triangle. `times` will run the quotation three more times...
**Stack:** `{ 1 1 2 3 }`
* `Œ£` Sum a sequence.
**Stack:** `7`
[Answer]
# [Python 3](https://docs.python.org/3/), 316 bytes
```
print(*[11,12,112,1123],sep="\n");n="11|2|3";x=2;t="";j=0
while 1:
 for y,z in enumerate(''.join([str(w)[::-1] for w in n.split("|")[1:][::-1]])):
  t+=str(y+1)*int(z)
  if j==0:t+="|"
  j+=1;k=y+2
 n=t+''.join(map(lambda z:'|'+str(z),list(range(k,k+(len(n)-len(n.lstrip('1')))))))
 print(n.replace("|",""));t="";j=0
```
[Try it online!](https://tio.run/##PVDRboQgEHz3KwgvwMGZw3vD8CXWB9pyPRRXgjRW479bPNNustlkZnZ2smFJzxHu@x6ig0QvjZRCVkKefW/FZIPGb4BZDRpLuVXbHdc/uqqTxrju9K2Yn85bJFWBHmNEi1iRA2The7DRJEsJKbvRAW2mFOnMGqWusn1J50MI5RS8SxRvmDVStSffMpb9UOL62Fq4ZJcj3soy6B6o0/qmMpmXMtBxLeteL7wqEOjE/y4OJlBvhvdPg1ZFNsIPr5UJ76ZEo4EvS3vRc@otUGDX1yh9FrlAiSTsrAKdr4Ey2uDNhz2iCowZ@3/Bvv8C "Python 3 ‚Äì Try It Online")
In one word, horrible
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 29 bytes
```
‚äûœÖ¬≤Ôº¶ÔºÆ¬´‚âî‚ü¶‚üßŒ∏Ôº¶Ôº¨œÖÔº¶¬ß‚ÆåœÖŒ∫‚äûŒ∏‚äïŒ∫‚âîŒ∏œÖ¬ªÔº©Œ£œÖ
```
[Try it online!](https://tio.run/##PYw/D4IwEEdn@BQdr0lN1LUTcSIxhOhoHBBOINJD@oeYGD97PTs4/u69e@3Q2HZuphjr4AYISuylzu@zFVDSM/gqmBtakFK886xwbuwJLlclFraypB2Res@frKRd@JI6fMEJV7QOGSjxYJj6ixIltRYNkscO@K7/WWaB5yev7UgeDo3zcA7mV5Y6xt02btbpCw "Charcoal ‚Äì Try It Online") Link is to verbose version of code. 0-indexed, I think? Explanation:
```
‚äûœÖ¬≤
```
Start with `[2]`.
```
Ôº¶ÔºÆ¬´
```
Repeat `n` times.
```
‚âî‚ü¶‚üßŒ∏
```
Start a new list.
```
Ôº¶Ôº¨œÖ
```
Iterate up to the length of the previous list.
```
Ôº¶¬ß‚ÆåœÖŒ∫
```
Repeat according to the value in the reversed list.
```
‚äûŒ∏‚äïŒ∫
```
Push the next integer to the list.
```
‚âîŒ∏œÖ
```
Copy the new list to the previous list.
```
¬ªÔº©Œ£œÖ
```
Print the final sum.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 76 bytes
function that take n and output A[n]
```
f=(n,a=[2],q=a.length)=>n?f(n-1,a.flatMap(n=>Array(a[--q]).fill(++i),i=0)):q
```
[Try it online!](https://tio.run/##Dc1NCoMwEEDhvafIwsUM@UG7rI2lB@gJRHCwxlrCRKMUinj21NXbfPA@9KW1j9O8aQ6vISVngRXZ5tKqxZLxA4/bG23NdwesS0XGedqeNAPb@hEj/YAarZcWjZu8ByknVJMtEK9LciECCyuKSrC4ibI8KyWKPROiD7wGPxgfRugI8p0PPGm@nx88OqyyI/0B "JavaScript (Node.js) ‚Äì Try It Online")
# [JavaScript (Node.js)](https://nodejs.org), 77 bytes
output all A[i]
```
for(a=[2];;a=a.flatMap(n=>Array(a[--q]).fill(i++)))i=!console.log(q=a.length)
```
[Try it online!](https://tio.run/##DctBCsMgEAXQs3Q3Q9BFt2KhB@gJQhYfq4llcIyRQE5v8/bvhxNHaLl2U/Qbx0jaCH5@Ls7BwyZB/6BS8a93a7gIszH7wjZlEcrTxMzZP4KWQyVa0ZX2u0ksa994jD8 "JavaScript (Node.js) ‚Äì Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 28 bytes
```
J[2)W1K_JsK=JYFklK=+J*@Kk[hk
```
[Try it online!](https://tio.run/##K6gsyfj/3yvaSDPc0Dveq9jb1ivSLTvH21bbS8vBOzs6I/v/fwA "Pyth ‚Äì Try It Online")
Prints the infinite sequence.
# Explanation
```
J[2)      # Initialize J to [2]
W1        # While 1...
K_J       # Initialize K to reverse of J
sK        # Print the sum of elements of K
=JY       # Y is an empty list by default. Set J to it.
FklK      # For loop from 0 till length of K, with iterator as k
@Kk       # k'th element of K
[hK       # A list containing only k+1
*         # Repeats the sequence specified number of times.
=+J       # Append that to J.
```
[Answer]
# Scala 3, 84 bytes
```
Seq.iterate(Seq(2),_){s=>s.reverse.zip(1 to s.sum)flatMap(Seq.fill(_)(_))}map(_.sum)
```
[Try it in Scastie!](https://scastie.scala-lang.org/r8kyBmirTRSRIpJN02aYYw)
Outputs the first n items.
## Infinite list + nth element, 85 bytes
```
Stream.iterate(Seq(2)){s=>s.reverse.zip(1 to s.sum)flatMap(Seq.fill(_)(_))}map(_.sum)
```
[Try it in Scastie!](https://scastie.scala-lang.org/LL2mFC06SNi79QmItJiD2w)
Here is an infinite Stream that also acts as a function giving the nth element, but it's a byte longer.
]