[Question]
  [
Given a number N, the challenge is to get the sum of the pyramid of N primes. To clarify things, here is an example:
```
Input: 4
```
We will list the first `4` primes, and then compute the sum of them. After that, we will compute the sums of the sums, and so on:
```
  2
    > 5
  3     > 13
    > 8      > 33
  5     > 20
    > 12
  7
```
You can see that the final result is **33**. Here is another example, with N = 8:
```
   2
     >   5
   3       >  13
     >   8       >  33
   5       >  20       >  83
     >  12       >  50       > 205
   7       >  30       > 122       > 495
     >  18       >  72       > 290       > 1169
  11       >  42       > 168       > 674
     >  24       >  96       > 384
  13       >  54       > 216
     >  30       > 120
  17       >  66
     >  36
  19
```
You can see that the final result is **1169**.
Here is another example with an odd N, N = 3:
```
 2
   > 5
 3     > 13
   > 8
 5
```
This gives us **13** as the result
Your task is to write a program or a function, that takes an integer greater than 0, and output the final result.
Here are some test results:
```
1:  2
2:  5
3:  13
4:  33
5:  83
6:  205
7:  495
8:  1169
9:  2707
10: 6169
11: 13889
12: 30993
13: 68701
14: 151469
15: 332349
16: 725837
17: 1577751
18: 3413221
19: 7349029
20: 15751187
21: 33616925
22: 71475193
23: 151466705
24: 320072415
25: 674721797
26: 1419327223
27: 2979993519
28: 6245693407
29: 13068049163
30: 27297614797
31: 56929779663
32: 118543624847
33: 246475746269
34: 511766428817
35: 1061264813321
36: 2198298700845
37: 4548996804811
38: 9405003164065
39: 19429190057417
40: 40107799133677
41: 82736199371081
42: 170553108953473
43: 351333736092089
44: 723224546040181
45: 1487710742395387
46: 3058157261678325
47: 6282142186547177
48: 12896743408107403
49: 26460652594917673
50: 54262186256186881
51: 111224391050741687
52: 227896496141836195
53: 466805185374509003
54: 955904519939662217
55: 1956988697590280537
56: 4005572366722212927
57: 8196803221276230093
58: 16769645303734608963
59: 34300013739423719561
60: 70136585692535099353
61: 143371352962891226373
62: 292978031452308375001
63: 598482012866917021541
64: 1222083126601616763473
65: 2494459637841415902073
66: 5089478703050176444803
67: 10379794709536133386939
68: 21160351440305258275579
69: 43119914481530819445497
70: 87833066190052490228187
71: 178841897161848754603319
72: 364014682565128163812791
73: 740654046243174781813209
74: 1506496270380756958474835
75: 3063280375436290387756263
76: 6227039507615221644290617
77: 12655020557561801933128885
78: 25712267089927372837530869
79: 52230425385198423845305957
80: 106076955379202815098486497
81: 215397386589448754140867649
82: 437308717912632286770415395
83: 887706233370396897803709611
84: 1801721089699452657985592689
85: 3656329898231436156162865559
86: 7418972676822310377574227797
87: 15051599987013574096449515927
88: 30532404546282900804722616529
89: 61926565462373271494414919017
90: 125582269494835615524470915169
91: 254631689768733901573206365479
92: 516210444730946464864091626473
93: 1046330617753410129672316234861
94: 2120493010460433691014704829565
95: 4296639990460140795780826898943
96: 8704509990931940668688755806845
97: 17631229933967301681217551193565
98: 35706243541395815998303171050377
99: 72298621492552303967009812018997
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest amount of bytes wins!
  
[Answer]
# J, 15 bytes
```
p:@i.+/ .*i.!<:
```
Explanation:
Basically the same as [my Mathematica answer](https://codegolf.stackexchange.com/a/65826/9288).
```
p:@i.+/ .*i.!<:
          i.!<:    binomial coefficients
p:@i.              first n primes
     +/ .*         dot product
```
[Answer]
# Mathematica, ~~38~~ ~~36~~ 35 bytes
```
Prime[r=Range@#].Binomial[#-1,r-1]&
```
[Answer]
## [Minkolang 0.14](https://github.com/elendiastarman/Minkolang), 17 bytes
```
n[i3M$i1-i6M*+]N.
```
[Try it here](http://play.starmaninnovations.com/minkolang/?code=n%5Bi3M%24i1-i6M*%2B%5DN%2E&input=8) and [check all test cases here](http://play.starmaninnovations.com/minkolang/?code=%28ndN%5Bi3M%24i1-i6M*%2B%5Dn%3DNlO%24I%29%2E&input=1%3A%20%202%0A2%3A%20%205%0A3%3A%20%2013%0A4%3A%20%2033%0A5%3A%20%2083%0A6%3A%20%20205%0A7%3A%20%20495%0A8%3A%20%201169%0A9%3A%20%202707%0A10%3A%206169%0A11%3A%2013889%0A12%3A%2030993%0A13%3A%2068701%0A14%3A%20151469%0A15%3A%20332349%0A16%3A%20725837%0A17%3A%201577751%0A18%3A%203413221%0A19%3A%207349029%0A20%3A%2015751187%0A21%3A%2033616925%0A22%3A%2071475193%0A23%3A%20151466705%0A24%3A%20320072415%0A25%3A%20674721797%0A26%3A%201419327223%0A27%3A%202979993519%0A28%3A%206245693407%0A29%3A%2013068049163%0A30%3A%2027297614797%0A31%3A%2056929779663%0A32%3A%20118543624847%0A33%3A%20246475746269%0A34%3A%20511766428817%0A35%3A%201061264813321%0A36%3A%202198298700845%0A37%3A%204548996804811%0A38%3A%209405003164065%0A39%3A%2019429190057417%0A40%3A%2040107799133677%0A41%3A%2082736199371081%0A42%3A%20170553108953473%0A43%3A%20351333736092089%0A44%3A%20723224546040181%0A45%3A%201487710742395387%0A46%3A%203058157261678325%0A47%3A%206282142186547177%0A48%3A%2012896743408107403%0A49%3A%2026460652594917673%0A50%3A%2054262186256186881%0A51%3A%20111224391050741687%0A52%3A%20227896496141836195%0A53%3A%20466805185374509003%0A54%3A%20955904519939662217%0A55%3A%201956988697590280537%0A56%3A%204005572366722212927%0A57%3A%208196803221276230093%0A58%3A%2016769645303734608963%0A59%3A%2034300013739423719561%0A60%3A%2070136585692535099353%0A61%3A%20143371352962891226373%0A62%3A%20292978031452308375001%0A63%3A%20598482012866917021541%0A64%3A%201222083126601616763473%0A65%3A%202494459637841415902073%0A66%3A%205089478703050176444803%0A67%3A%2010379794709536133386939%0A68%3A%2021160351440305258275579%0A69%3A%2043119914481530819445497%0A70%3A%2087833066190052490228187%0A71%3A%20178841897161848754603319%0A72%3A%20364014682565128163812791%0A73%3A%20740654046243174781813209%0A74%3A%201506496270380756958474835%0A75%3A%203063280375436290387756263%0A76%3A%206227039507615221644290617%0A77%3A%2012655020557561801933128885%0A78%3A%2025712267089927372837530869%0A79%3A%2052230425385198423845305957%0A80%3A%20106076955379202815098486497%0A81%3A%20215397386589448754140867649%0A82%3A%20437308717912632286770415395%0A83%3A%20887706233370396897803709611%0A84%3A%201801721089699452657985592689%0A85%3A%203656329898231436156162865559%0A86%3A%207418972676822310377574227797%0A87%3A%2015051599987013574096449515927%0A88%3A%2030532404546282900804722616529%0A89%3A%2061926565462373271494414919017%0A90%3A%20125582269494835615524470915169%0A91%3A%20254631689768733901573206365479%0A92%3A%20516210444730946464864091626473%0A93%3A%201046330617753410129672316234861%0A94%3A%202120493010460433691014704829565%0A95%3A%204296639990460140795780826898943%0A96%3A%208704509990931940668688755806845%0A97%3A%2017631229933967301681217551193565%0A98%3A%2035706243541395815998303171050377%0A99%3A%2072298621492552303967009812018997).
### Explanation
```
n                    Take number from input (N)
 [                   Open for loop that repeats N times
  i                  Loop counter (n)
   3M                Pop n and push nth prime (where 2 is the 0th prime)
     $i1-            Max iterations - 1 (which is N-1)
         i           Loop counter (n)
          6M         Pop n,k and push kCn (binomial)
            *+       Multiply and add
              ]      Close for loop
               N.    Output as number and stop.
```
I use basically the same algorithm as several of the earlier answers that use binomial coefficients. Whenever you see such a pyramid of numbers being added, Pascal's triangle should be the first thing to come to mind. I don't see that any of the other answers have *explained* why this works, so I'll do that.
## MORE explanation
```
2
  > [2,3]
3         > [2,3,3,5]
  > [3,5]             > [2,3,3,3,5,5,5,7]
5         > [3,5,5,7]
  > [5,7]
7
```
As you can see, the primes `2,3,5,7` appear `1,3,3,1` times in the final result. Lemme change the layout a bit.
```
_ _ _ 7
_ _ 5
_ 3
2
```
The number of times that the `3` will contribute to the final result is the same as the number of paths from the `3` to the upper-left corner, **moving only up and left**. Here, there are three such paths for the `3`:
```
_    _    _ _
_    _ _    _
_ 3    3    3
```
Note that I can reverse the direction without loss of generality. So I want to know how many paths there are from the upper-left corner to each position along the jagged edge. I can count them like so...
```
1 1 1 1 1 . . .
1 2 3 4
1 3 6
1 4   .
1       .
.         .
.
.
```
For every number in this triangle, if it is X units from the left and Y units from the top, then the number at that position is
[![enter image description here](https://i.stack.imgur.com/seIXi.gif)](https://i.stack.imgur.com/seIXi.gif)
The way I use it, though, `X+Y = N` is constant and `X` ranges from 0 to `N`, which goes along one diagonal. I multiply each coefficient with the corresponding prime number and then add it all up.
See [the Wikipedia article on Pascal's triangle](https://en.wikipedia.org/wiki/Pascal%27s_triangle) for more on this.
[Answer]
# JavaScript ES7 107
Abusing the fixed limit at 27 - how boring is actually finding the primes.
```
n=>eval("t=2;for(p=[for(v of'012242424626424662642646842')t-=-v];--n;)p=p.slice(0,n).map((v,i)=>v+p[i+1])")
```
Test snippet (using array comprehension it will work only in Firefox)
```
F=n=>eval("t=2;for(p=[for(v of'012242424626424662642646842')t-=-v];--n;)p=p.slice(0,n).map((v,i)=>v+p[i+1])")
// Less golfed
Q=n=>{
  t=2;
  // Note: the golfed version will return the last computed value, that is p if the loop is entered, else t=2
  p=[for(v of '012242424626424662642646842') t-=-v] // build the array of first 27 primes in p
  while(--n) p = p.slice(0,n).map((v,i)=>v+p[i+1])  
  return p
}  
//TEST
console.log=x=>O.innerHTML+=x+'\n'
for(i=1;i<28;i++)console.log(i+' : '+F(i))
```
```
<pre id=O></pre>
```
[Answer]
# Pyth, 16 bytes
```
s*V.cLtQQ.f}ZPZQ
```
Very simple actually:
```
s*V          ; Dot product of
  .cLtQQ     ; the binomial coefficients for n
  .f}ZPZQ    ; and the first n prime numbers.
```
[Answer]
# Pyth - ~~16~~ 15 bytes
Uses reduce and `first_n` filter.
```
u+VGtGtQ.f}ZPZQ
```
[Test Suite](http://pyth.herokuapp.com/?code=u%2BVGtGtQ.f%7DZPZQ&input=8&test_suite=1&test_suite_input=4%0A8%0A26&debug=0).
[Answer]
# Pyth, 18 bytes
```
husM.:G2tQ.f}ZPZQ0
```
Try it online: [Demonstration](http://pyth.herokuapp.com/?input=4&test_suite_input=1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A9%0A10%0A11%0A12%0A13%0A14%0A15%0A16%0A17%0A18%0A19%0A20%0A21%0A22%0A23%0A24%0A25%0A26%0A27%0A28%0A29%0A30%0A31%0A32%0A33%0A34%0A35%0A36%0A37%0A38%0A39%0A40%0A41%0A42%0A43%0A44%0A45%0A46%0A47%0A48%0A49%0A50%0A51%0A52%0A53%0A54%0A55%0A56%0A57%0A58%0A59%0A60%0A61%0A62%0A63%0A64%0A65%0A66%0A67%0A68%0A69%0A70%0A71%0A72%0A73%0A74%0A75%0A76%0A77%0A78%0A79%0A80%0A81%0A82%0A83%0A84%0A85%0A86%0A87%0A88%0A89%0A90%0A91%0A92%0A93%0A94%0A95%0A96%0A97%0A98%0A99&code=husM.%3AG2tQ.f%7DZPZQ0&test_suite=0)
### Explanation:
```
husM.:G2tQ.f}ZPZQ0   implicit: Q = input number
          .f    Q0   find the first Q numbers Z >= 0, which satisfy
            }ZPZ        Z appears in the prime factorization of Z
                     this gives the first Q prime numbers
 u      tQ           assign this list to G and repeat the following Q-1 times:
    .:G2               create all subarrays of length 2
  sM                   sum them up and update G
h                    take the first element (=result) and print
```
[Answer]
## Haskell, 74 bytes
```
import Data.Numbers.Primes
f n=([]:iterate(zipWith(+)=<<tail)primes)!!n!!0
```
Usage example:
```
*Main> map f [1..12]
[2,5,13,33,83,205,495,1169,2707,6169,13889,30993]
```
How it works: repeatedly calculate the neighbor sums of all primes. Take the head of the `n`th iteration.
```
[2,3,5,7,11,13,17,19,23,29,...]             -- plain primes (and 1st iteration)
[5,8,12,18,24,30,36,42,52,60,...]           -- 2nd iteration of neighbor sums
[13,20,30,42,54,66,78,94,112,128,...]       -- 3rd iteration
[33,50,72,96,120,144,172,206,240,274,...]
...
```
As the index operator `!!` is zero based, I'm prepending an empty list to avoid having to use `!!(n-1)`.
[Answer]
# Matlab, 76 bytes
Thanks to David for saving a lot of bytes!
```
n=input('');x=primes(103);
for s=2:n,x=conv(x,[1 1]);end
disp(num2str(x(n)))
```
**Old version, 98 bytes**
```
n=input('');m=1;x=[];while nnz(x)<n
m=m+1;x=primes(m);end
for s=2:n,x=conv(x,[1 1]);end
disp(x(n))
```
[Answer]
# Shell + GNU and BSD utilities, 92
```
echo `primes 1|sed $1q`|sed -r ':
s/(\w+) (\w+)/$((\1+\2)) \2/
t
s/ \w+$//
s/^/echo /e
/ /b'
```
[Answer]
# JavaScript (ES6), 121 bytes
```
n=>eval(`for(p=[],c=0,x=1;c<n;s?p[c++]=x:0)for(s=i=++x;--i>1;)x%i?0:s=0;for(;--c;p=s)for(i=c,s=[];i;)s[c-i]=p[i]+p[--i]`)
```
## Explanation
Most of the size comes from finding the prime numbers.
```
n=>
  eval(`                   // eval used to enable for loops without {} or return
    // Get primes up to n
    for(                   // loop from range 2 to n
      p=[],                // p = primes
      c=0,                 // c = count of primes
      x=1;                 // x = current number to check for primality
      c<n;
      s?p[c++]=x:0         // add the number to the primes if it has no divisors
    )
      for(                 // loop from range 2 to x to check for divisors
        s=                 // s = true if x is a prime
          i=++x;
        --i>1;
      )
        x%i?0:s=0;         // check if x has a divisor
    // Sum primes
    for(;--c;p=s)          // while the new pyramid has pairs to sum
      for(i=c,s=[];i;)     // loop through each pair of the pyramid
        s[c-i]=p[i]+p[--i] // push the sum of the pair to the new pyramid s
  `)                       // implicit: return the final sum
```
## Test
```
<input type="number" id="input" value="0" oninput="result.textContent=(
n=>eval(`for(p=[],c=0,x=1;c<n;s?p[c++]=x:0)for(s=i=++x;--i>1;)x%i?0:s=0;for(;--c;p=s)for(i=c,s=[];i;)s[c-i]=p[i]+p[--i]`)
)(+this.value)" />
<pre id="result"></pre>
```
[Answer]
## Seriously, 23 bytes
```
,r`P`M;lD`;pX@dXZ'Σ£M`n
```
Outputs the result as a list of length 1: `8 -> [1169]`
[Try it online](http://seriouslylang.herokuapp.com/link/code=2c726050604d3b6c44603b70584064585a27e49c4d606e&input=8)
Explanation:
```
,r`P`M    push the first n primes as a list
;lD       push 1 minus the length of the list (we'll call this k) ([2,3,5,7],3)
`...`n    call the following function k times:
    ;pX      duplicate the list, pop and discard the first element
    @dX      swap, pop and discard the last element
    Z        zip the two lists
    'Σ£      push the string "Σ" and convert to function
    M        map the function over the list
```
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-rprime`, ~~66~~ 62 bytes
-4 bytes thanks to [south](https://codegolf.stackexchange.com/users/110888/south)
```
->n{a=Prime.take n
(eval"a=a.each_cons(2).map &:sum;"*~-n)[0]}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcnW0km5RQVFmbqpS7CI326WlJWm6FjftdO3yqhNtA0DieiWJ2akKeVwaqWWJOUqJtol6qYnJGfHJ-XnFGkaaermJBQpqVsWludZKWnW6eZrRBrG1EFOWFyi4RVtaxkJ4CxZAaAA)
[Answer]
# [Fig](https://github.com/Seggan/Fig), \$18\log\_{256}(96)\approx\$ 14.816 bytes
```
tF@pmC
?!{Lx[xoX+p
```
*-6.585 bytes thanks to @Seggan*
[Try it online!](https://fig.fly.dev/#WyJ0RkBwbUNcbj8he0x4W3hvWCtwIiwiNyJd)
Explanation:
```
tF@pmC  #
t       # Take the first n from
    mC  # all positive integers
 F      # filtered by
  @p    # is prime.
?!{Lx[xoX+p  #
?            # If
 !           # not
   L         # length of
    x        # the list
  {          # decremented,
     [       # return the first item
      x      # from the list
       o     # otherwise call
        X    # the current function
         +   # the list plus
          p  # the list with the first removed
```
[Answer]
# Mathematica 73 bytes
```
NestWhile[Plus@@@Partition[#,2,1]&,Prime@n~Table~{n,#},Length@#>1&][[1]]&
```
---
**How it works**
`Prime@n~Table~{n,#}&` gives a list of the first `#` primes.
`Partition[#,2,1]&` rearranges a list of numbers, `{a, b, c, d ...}` as
`{{a,b}, {b,c}, {c,d}...}}`. 
`Plus@@@` then returns `{a+b, b+c, c+d...}`.
`NestWhile` begins with the list of `#` primes and repeatedly applies `Plus@@@Partition...` as long as there is more than one number in the list.
---
```
NestWhile[Plus@@@Partition[#,2,1]&,Prime@n~Table~{n,#},Length@#>1&][[1]]&[4]
```
> 
> 33
> 
> 
> 
---
```
NestWhile[Plus @@@ Partition[#, 2, 1] &, Prime@n~Table~{n, #}, Length@# > 1 &][[1]] &[5]
```
> 
> 83
> 
> 
> 
---
It takes about 1/5 sec to solve for the first 1000 primes.
```
NestWhile[Plus @@@ Partition[#, 2, 1] &, Prime@n~Table~{n, #}, 
 Length@# > 1 &][[1]] &[10^3] // AbsoluteTiming
```
> 
> {0.185611, 
>  1917231113909474354152581359443368948301825453723617274940459548079399
>  7849439430405641625002631859205971635284844253657654843025188471660669
>  0868945436580032828177831204066809442374364181056590286849530757875874
>  9185665854180901580438781223737728559484382552514103542932932981340942
>  3918431043908415228663677}
> 
> 
> 
[Answer]
# Python 2, 159 bytes
```
m=int(input())
q=[]
x=2
while len(q)<m:
 if not any([x%g<1 for g in q]):q+=[x]
 x+=1
for i in range(m-1):
 for p in q:q+=[q[1]+q[0]];q.pop(0)
 print(q.pop())
print q
```
[Answer]
# [Milky Way 1.4.8](https://github.com/zachgates7/Milky-Way), ~~26~~ 25 bytes
This answer is not competing. Some of the operations were created after this question was posted (but not necessarily for this challenge).
```
'E&{~F§{G}:y1ba?{_^_}};!
```
I was able to remove a byte after reading through the comments. Output is a single-element list.
---
### Explanation
```
'                        #  read input from the command line
 E                       #  push a list of the first N primes
  &{~                }   #  while loop
     F                   #  push the sum of TOS elements i.e. [A, B, C] => [[A,B], [B,C]]
      §{ }               #  mapping
        G                #  sum i.e. [1, 2, 3] => 6
          :              #  duplicate the TOS
           y             #  push the length of the TOS to the stack
            1            #  push 1 to the stack
             b           #  evaluate equality of the TOS and STOS
              a          #  logical not
               ?{_ _}    #  if-else statement
                  ^      #  pop the TOS
                     ;   #  swap the TOS and STOS
                         #  dump the TOS to the stack
                      !  #  output the TOS
```
---
### Usage
```
python3 milkyway.py <path-to-code> -i <input-integer>
```
[Answer]
## Ceylon, 169 bytes
```
alias I=>Integer;I s(I*l)=>l.size<2then(l[0]else 0)else s(*l.paired.map((I[2]i)=>i[0]+i[1]));I p(I n)=>s(*loop(2)(1.plus).filter((c)=>!(2:c-2).any((d)=>c%d<1)).take(n));
```
This defines two functions – `s` calculates the pyramid sum of a sequence of integers, while `p` calls this on the sequence of the first `n` primes.
Looks like about half the size is finding the first `n` primes, other half is calculating the pyramid sum.
Here is a formatted/commented version:
```
// Sum pyramid of primes
//
// Question:  http://codegolf.stackexchange.com/q/65822/2338
// My answer: http://codegolf.stackexchange.com/a/65879/2338
alias I => Integer;
// Calculate the pyramid sum of some sequence.
I s(I* l) =>
        // If less than two elements ...
        l.size < 2
        // then use the first (only element), or 0 if no such.
        then (l[0] else 0)
        // otherwise,
        else s(*
               // take the iterable of pairs of consecutive elements,
               l.paired
               // and add each of them together.
                .map((I[2] i) => i[0] + i[1])
               // then apply s (recursively) on the result.
               );
// Calculate the pyramid sum of the first n primes.
I p(I n) => s(*
              // the infinite sequence of integers, starting with 2.
              loop(2)(1.plus)
              // filter by primality (using trial division)
              .filter((c) => !(2 : c-2)
                              .any((d) => c%d < 1))
              // then take the first n elements
              .take(n)
              // then apply s on the result.
             );
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
ÆN€+ƝƬṀ
```
[Try it online!](https://tio.run/##y0rNyan8//9wm9@jpjXax@YeW/NwZ8N/I/Ogw@1Agf8A "Jelly – Try It Online")
Originally I wrote a Brachylog answer, [`1<|~lṗᵐ≠≜{s₂ᶠ+ᵐ}ⁱ~g`](https://tio.run/##SypKTM6ozMlPN/r/qGXqo6bGR51zqsuVFHTtFJTK7R@1bXjU1PRwV6di7aOupf8NbWrqch7unP5w64RHnQtAKotB0tsWaANFah81bqxL//8fAA), but when it came out to 19 bytes I decided that I should probably try a different language.
```
      Ṁ    The largest value from
     Ƭ     every stage of repeatedly
   +       adding
    Ɲ      adjacent values, starting with
ÆN         nth prime
  €        mapped over the input.
```
Apparently, mapping over a number treats it as a range from 1 to itself inclusive, and integers sort as greater than lists or whatever `''` is.
[Answer]
# APL(NARS), 41 chars, 82 bytes
```
{1=≢⍵:↑⍵⋄∇+/¨¯1↓⍵,¨1⌽⍵}∘{⍵↑v/⍨0πv←⍳1+⍵×⍵}
```
In input if one want to use big number has to enter the type number\_x as 47x.
There could be something not ok: i here write that n primes are in the set 1..n^2
Test:
```
  h←{1=≢⍵:↑⍵⋄∇+/¨¯1↓⍵,¨1⌽⍵}∘{⍵↑v/⍨0πv←⍳1+⍵×⍵}
  h 1
2
  h 2
5
  h 9
2707
  h 24
320072415
  h 47x
6282142186547177 
  h 99x
72298621492552303967009812018997 
  h 200x
433205808657246411262213593770934980590715995899633306941417373
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 52 bytes
```
{grep(&is-prime,1..*)[^$_],{[|$_]Z+.skip}...1& &say}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwvzq9KLVAQy2zWLegKDM3VcdQT09LMzpOJT5Wpzq6BkhFaesVZ2cW1Orp6RmqKagVJ1bW/tcD6k3LL1IAKjYy/w8A "Perl 6 – Try It Online")
Anonymous code block that takes an argument and prints out a one element list containing the result.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
ΩεẊ+↑İp
```
[Try it online!](https://tio.run/##ARgA5/9odXNr///Oqc614bqKK@KGkcSwcP///zQ "Husk – Try It Online")
Pretty straighforward.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-h`](https://codegolf.meta.stackexchange.com/a/14339/), 11 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
_j}jU
Å£=ä+
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWg&code=X2p9alUKxaM95Cs&input=NA)
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `G`, 7 bytes
```
ʁǎ≬2lṠ↔
```
*-1 byte thanks to [Steffan](https://codegolf.stackexchange.com/users/92689/steffan)*
[Try it online](https://vyxal.pythonanywhere.com/#WyJHIiwiIiwiyoHHjuKJrDJs4bmg4oaUIiwiIiwiNCJd), see a [flagless version](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLKgceOP+KAuSgybOG5oCIsIiIsIjQiXQ==), or [verify more test cases](https://vyxal.pythonanywhere.com/#WyJHQSIsIiIsIsqBx47iiawybOG5oOKGlCIsIiIsIjFcbjJcbjNcbjRcbjVcbjZcbjdcbjhcbjkiXQ==).
Explanation:
```
ʁ        # Range from 0 to n
 ǎ       # Nth prime (vectorising)
  ≬      # Three element lambda that:
   2l    #   Gets overlapping groups of 2
     Ṡ   #   And sums each of them
      ↔  # Apply that function until no change and collect intermediate results
         # Get the maximum item of of those results with the G flag
```
[Answer]
# [Pyt](https://github.com/mudkip201/pyt), 10 bytes
```
Đ`ŕʁ+ĐŁ⁻łŕ
```
[Try it online!](https://tio.run/##ASMA3P9weXT//8SQYMWVyoErxJDFgeKBu8WCxZX//1syLDMsNSw3XQ "Pyt – Try It Online")
```
Đ              Implicit input; duplicate list
 `      ł      Do... while top of stack is not 0
  ŕ            Remove top of stack
   ʁ+          Reduce by addition
     ĐŁ⁻       Get the length of the resultant array and subtract 1
         ŕ     Remove the pesky 0; implicit print
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 13 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ä/($◘é∟o¶Vƒm^
```
[Run and debug it](https://staxlang.xyz/#p=842f282408821c6f14569f6d5e&i=3%0A4%0A8%0A27%0A&a=1&m=2)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ÅpIGü+
```
Outputs the result wrapped in a list.
[Try it online](https://tio.run/##yy9OTMpM/f//cGuBp/vhPdr//5sAAA) or [verify all test cases](https://tio.run/##yy9OTMpM/W9p6epnr6TwqG2SgpK93//DrQV@7of3aP@v1fkPAA).
**Explanation:**
```
Åp      # Push a list of the first (implicit) input amount of primes
  IG    # Loop the input-1 amount of times:
    ü   #  For each overlapping pair of integers in the list:
     +  #   Add them together
        # (after which the result is output implicitly)
```
]