# [R], 53 bytes <!-- language-all: lang-r --> function(n)rbind(cbind(outer(1:n,1:n,`+`)-1,2*n),2*n) Uses the `outer` "product" to generate all sums of the range `1,...,n` as a matrix, subtracts `1` from each, then `bind`s `2*n` as a column on the right and a row on the bottom, recycling as needed, and returns a matrix as the result. [Try it online!][TIO-j6wp3zaa] [R]: https://www.r-project.org/ [TIO-j6wp3zaa]: https://tio.run/##K/qfZvs/rTQvuSQzP08jT7MoKTMvRSMZTOaXlqQWaRha5emAcIJ2gqauoY6RVp4mmPifpmGk@R8A "R – Try It Online" # [R], 78 bytes More naive implementation. function(n){m=matrix(2*n,n+1,n+1) for(i in seq(n))m[1:n,i]=(0:(2*n))[1:n+i] m} [Try it online!][TIO-j6wola10] [TIO-j6wola10]: https://tio.run/##K/qfZvs/rTQvuSQzP08jT7M61zY3saQos0LDSCtPJ0/bEIQ1udLyizQyFTLzFIpTC4GqNHOjDa3ydDJjbTUMrEAqNTVBAtqZsVy5tf/TNEA6NEw1/wMA "R – Try It Online"