ZigZag Conversion, math pattern