Husk, (削除) 11 (削除ここまで) 9(削除) 9 (削除ここまで) 8 bytes
ΘṁṠe→ΘmΣNΘṁṠe→Θ∫N
OutputsSaved a byte thanks to H.PWiz.
Outputs as an infinite list.
Try it online! Try it online!
Explanation
ΘṁṠe→ΘmΣNΘṁṠe→Θ∫N
N ∫N StartCumulative withsum theof natural numbers.
mΣ Get the (triangular numbers).
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Alternatively, we could use ΘṁoṠe→ΣΘN, which avoids the second map but isn't any shorter.
Husk, (削除) 11 (削除ここまで) 9 bytes
ΘṁṠe→ΘmΣN
Outputs as an infinite list.
Try it online!
ΘṁṠe→ΘmΣN
N Start with the natural numbers.
mΣ Get the triangular numbers.
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Alternatively, we could use ΘṁoṠe→ΣΘN, which avoids the second map but isn't any shorter.
Husk, (削除) 11 (削除ここまで) (削除) 9 (削除ここまで) 8 bytes
ΘṁṠe→Θ∫N
Saved a byte thanks to H.PWiz.
Outputs as an infinite list.
Try it online!
Explanation
ΘṁṠe→Θ∫N
∫N Cumulative sum of natural numbers (triangular numbers).
Θ Prepend 0.
ṁṠe→ Concatenate [n + 1, n] for each.
Θ Prepend 0.
Husk, (削除) 11 (削除ここまで) 9 bytes
ΘṁṠe→ΘmΣN
Outputs as an infinite list.
Try it online!
ΘṁṠe→ΘmΣN
N Start with the natural numbers.
mΣ Get the triangular numbers.
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Alternatively, we could use ΘṁoṠe→ΣΘN, which avoids the second map but isn't any shorter.
Husk, (削除) 11 (削除ここまで) 9 bytes
ΘṁṠe→ΘmΣN
Outputs as an infinite list.
Try it online!
ΘṁṠe→ΘmΣN
N Start with the natural numbers.
mΣ Get the triangular numbers.
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Husk, (削除) 11 (削除ここまで) 9 bytes
ΘṁṠe→ΘmΣN
Outputs as an infinite list.
Try it online!
ΘṁṠe→ΘmΣN
N Start with the natural numbers.
mΣ Get the triangular numbers.
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Alternatively, we could use ΘṁoṠe→ΣΘN, which avoids the second map but isn't any shorter.
Husk, 11(削除) 11 (削除ここまで) 9 bytes
ΘṁṠe→ΘmoΣḣNΘṁṠe→ΘmΣN
Outputs as an infinite list.
Try it online! Try it online!
ΘṁṠe→ΘmoΣḣNΘṁṠe→ΘmΣN
N N Start with the natural numbers.
ḣ Get all the prefixes.
mΣ moΣ Get the sum of each (the triangular numbers).
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Husk, 11 bytes
ΘṁṠe→ΘmoΣḣN
Outputs as an infinite list.
Try it online!
ΘṁṠe→ΘmoΣḣN
N Start with the natural numbers.
ḣ Get all the prefixes.
moΣ Get the sum of each (the triangular numbers).
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.
Husk, (削除) 11 (削除ここまで) 9 bytes
ΘṁṠe→ΘmΣN
Outputs as an infinite list.
Try it online!
ΘṁṠe→ΘmΣN
N Start with the natural numbers.
mΣ Get the triangular numbers.
Θ Prepend 0.
ṁṠe→ Concatenate the pairs [n + 1, n] for each element.
Θ Prepend 0.