Skip to main content
1 of 2
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python, 53 bytes ÷ 2 = 26.5

lambda n:[n-i%-~n%(i//n-~n)for i in range(n*~n//2,0)]

Attempt This Online!

This uses ranges like many other answers here but groups them in pairs (longest,shortest);(2nd longest,2nd shortest) etc. That way we can use a closed form expression inside a flat loop.

loopy walt
  • 16.8k
  • 2
  • 11
  • 69