I am looking for a way to generate the next series of numbers with the version number on the left. For example, given "2", generate [6, 18]. A series of numbers from here .
V2 6 18 V3 6 22 V4 6 26 V5 6 30 V6 6 34 V7 6 22 38 V8 6 24 42 V9 6 26 46 V10 6 28 50 V11 6 30 54 V12 6 32 58 V13 6 34 62 V14 6 26 46 66 V15 6 26 48 70 V16 6 26 50 74 V17 6 30 54 78 V18 6 30 56 82 V19 6 30 58 86 V20 6 34 62 90 V21 6 28 50 72 94 V22 6 26 50 74 98 V23 6 30 54 78 102 V24 6 28 54 80 106 V25 6 32 58 84 110 V26 6 30 58 86 114 V27 6 34 62 90 118 V28 6 26 50 74 98 122 V29 6 30 54 78 102 126 V30 6 26 52 78 104 130 V31 6 30 56 82 108 134 V32 6 34 60 86 112 138 V33 6 30 58 86 114 142 V34 6 34 62 90 118 146 V35 6 30 54 78 102 126 150 V36 6 24 50 76 102 128 154 V37 6 28 54 80 106 132 158 V38 6 32 58 84 110 136 162 V39 6 26 54 82 110 138 166 V40 6 30 58 86 114 142 170
To give context to what these numbers represent, here is a quote from the specification (ISO-18004) from which they were originally drawn:
Alignment patterns are located symmetrically on both sides of the diagonal, going from the upper left corner of the symbol to the lower right corner. They are distributed as evenly as possible between the Temporary pattern and the opposite side of the symbol, any uneven distance is placed between the synchronization pattern and the first alignment of the Pattern in the interior of the symbol.
So, there was an original method / algorithm that generated these numbers.
I came up with the following Python code that generates the correct sequences, but contains an βexceptionalβ condition for V32 expressed in an if .
import math def pattern(ver): w = 21 + ((ver - 1) * 4)
I am looking for an algorithm in which a magic branch and value are not needed. The algorithm may not exist, but I hope.
source share