Two Curves

Two curves can be placed back-to-back, as if starting from a line segment traversed in both directions.

<---------         back-to-back
--------->          lines

For example to N=16,

       11-----10-----9,7-----6------5     k=4       3
        |             |             |
13-----12             8             4------3        2
 |                                         |
14                                         2        1
 |                                         |
15-----16                           0------1   <- Y=0
 1------0                           16----15   <- Y=0
 |                                         |
 2                                        14       -1
 |                                         |
 3------4             8            12-----13       -2
        |             |             |
        5------6-----7,9----10-----11              -3

The boundary and area of this shape are

Btwo[k] = /  2                        if k=0
          |  8*2^h - 8                if k even >= 2
          \ 12*2^h - 8                if k odd
        = 2, 4, 8, 16, 24, 40, 56, 88, 120, 184, 248, 376, 504, 760, 1016, 1528, 2040, ...

Atwo[k] = / 0                         if k=0
          | (7/2)*2^k -  7*2^h + 4    if k even >= 2
          \ (7/2)*2^k - 10*2^h + 4    if k odd
        = 0, 1, 4, 12, 32, 76, 172, 372, 788, 1636, 3364, 6852, 13892, 28036, 56452, 113412, 227588

The straight and zigzag parts are the two middle sides of the right and convex hull shapes shown above. So the boundary

Btwo[k] = 4*S[h] + 4*Z[h-1]                for k even >= 2
        = 4*(2^h) + 4*(2*2^(h-1) - 2)
        = 8*2^h - 8

Btwo[k] = 4*S[h] + 4*Z[h]                  for k odd
        = 4*(2^h) + 4*(2*2^h - 2)
        = 12*2^h - 8

The area can be calculated from the enclosing square S[h]+Z[h-1] from which subtract the four zigzag triangles at the corners.

Atwo[k] = 4*(S[h]+Z[h-1])^2 + 4*Z[h-1]/2*(Z[h-1]/2 + 1)/2
 for k even >= 2

Atwo[k] = 4*(S[h]+Z[h])^2   + 4*Z[h]/2  *(Z[h]/2   + 1)/2
 for k odd

X positive Xpos[8i+0] = e[8i+0] + a[8i+0] + 1 = 2*d[8i-7] + d[8i-3] + 1 Xpos[8i+1] = d[8i+1] Xpos[8i+2] = c[8i+2] = d[8i+1] Xpos[8i+3] = b[8i+3] = d[8i+1] Xpos[8i+4] = a[8i+4] = d[8i+1] Xpos[8i+5] = h[8i+5] = d[8i+1] Xpos[8i+6] = g[8i+6] = d[8i+1] Xpos[8i+7] = f[8i+7] = d[8i+1] 1,1,1,1,1,1,1,1, 7, 17,17,17,17,17,17,17, 103, 273,273

X axis X[4i+0] = 2*a[4i+0] + e[4i+0] = 2*d[4i-3] + 2*d[4i-7] X[4i+1] = d[4i+1] + h[4i+1] = d[4i+1] + d[4i-3] X[4i+2] = c[4i+2] + g[4i+2] = d[4i+1] + d[4i-3] X[4i+3] = b[4i+3] + f[4i+3] = d[4i+1] + d[4i-3] 2,2,2,2, 4, 6,6,6, 12, 22,22,22, 44, 86,86,86, 172, 342,342,342, 684