Maybe I missed the multiplication by two for the two possible incrementations, so maybe it should be:
s = (nynx + nxnz + nxnz - 2) 18
The issue is a typo, which is not surprising with those crazy numbers I got. Above is wrong, below is correct and is working in my tests.
s = (nynx + nxnz + nynz - 2) 18
Stephen Skory firstname.lastname@example.org http://stephenskory.com/ 510.621.3687 (google voice)