Length of periods in the (infinite) periodic table

A few days ago I wrote about what the periodic table would look like if we extended it, assuming the patterns that hold for known elements continue to hold.

That post reported that the number of elements in nth period works out to

 P_n = \frac{(-1)^n(2n+3) + 2n^2 + 6n + 5}{4}

There’s a simpler expression for Pn:

Here ⌊x⌋ is the largest integer no greater than x.

I posted this yesterday on @AlgebraFact. Surely many people have come up with the same formula, but it doesn’t seem to be well known.