Haskell, 46 bytes
g _ 0=[]
g(h:t)n=h:g(t++[sum$h:t])(n-1)
g.g[1]
This is based on xnor's answer but it employs 1 clever trick.
The \$n\$-bonacci sequence always start with \$n\$ 1
s. A more general version of this might start with just any \$n\$ values. And this more general version is what we implement with g
. g
takes a list of \$n\$ integers and a value \$m\$ and gives us a list of the first \$m\$ terms of this generalized \$n\$-bonacci sequence.
The trick is then that g[1]
is a cheap way to generate \$n\$ 1
s. Since the sequence starting with [1]
is just an endless stream of 1
s. So we use g
in two ways, and even though g
might be slightly longer because it implements something a little more general, it saves bytes because it serves two purposes.