We saw previously how a related sequence 1,2,2,3,3,3,4,4,4,4 etc could be expressed as a square root rounded to the nearest integer.
a(n)= round(sqrt(2*n))
Next I’m going to square each term in that sequence:
1,4,4,9,9,9,16,16,16,16,etc.
b(n)= (a(n))^2
Our target sequence 1,3,2,6,5,4,10,9,8,7,etc. Can be expressed in terms of n and b(n):
c(n)= b(n)+1-n
For instance, the fourth term will be 9+1-4=6.
So the full expression will be:
c(n) = (round(sqrt(2*n)))^2 + 1 – n
If you were curious about what, say, the millionth term would be:
C(1000000) = (1414)^2 + 1 – 1000000 = 999397