Skip to main content
1 of 2
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 19 bytes

[¼¾ENnN+N·¾-1‚ß¾*-,

Port of @alephalpha's Haskell answer.

Outputs indefinitely.

Try it online.

Explanation:

[                # Loop indefinitely:
 ¼               #  Increase variable `c` by 1 (0 by default)
  ¾E             #  Inner loop `N` in the range [1,`c`]:
    NnN+         #   Push N²+N
    N·¾-         #   Push 2N-c
        1‚ß      #   Pop and push min(2N-c,1)
           ¾*    #   Multiply by `c`: min(2N-c,1)*c
             -   #   Subtract: N²+N-min(2N-c,1)*c
              ,  #   Pop and output it with trailing newline
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384