if n is odd: the first n digits of 36...36if n is even: "3", then n+1 occurrences of "9"

followed by

floor((n-1)/2) occurrences of "59"

followed by

6

The portion of the s.o.d. that's common to the odd and even n is then:

18*floor((n-1)/2) + 6

For even n, we add 9*(n+1) + 3

That makes the total for even n: 18*(n/2 - 1) + 6 + 9*(n+1) + 3, which simplifies to:

18*n

For odd n, it would seem to depend on whether n is congruent to 1 or 3 mod 4. However, a look at the calculated sod's above shows that some of the irregularities cancel each other. The result looks like