The Way of 16,777,216




hex digit 
yarrow piles  line number 

3  2  1  
0  0  0  0 0  6 
1  0  0  0 1  7 
2  0  0  1 0  7 
3  0  0  1 1  7 
4  0  1  0 0  7 
5  0  1  0 1  8 
6  0  1  1 0  8 
7  0  1  1 1  8 
8  1  0  0 0  7 
9  1  0  0 1  8 
A  1  0  1 0  8 
B  1  0  1 1  8 
C  1  1  0 0  8 
D  1  1  0 1  9 
E  1  1  1 0  9 
F  1  1  1 1  9 
The yarrow stalk method of generating hexagram lines is the equivalent of choosing one of 16 line possiblities in the ratio 7:3:5:1 for yin, yang, changing yang, and changing yin. Because a hexagram contains six lines, 166, or 16,777,216, possible ways of generating a base and transformed hexagram are required to provide the yarrow stalk ratio.
These possiblities may be represented by a 4096 × 4096 array of sixdigit hexadecimal (base16) numbers from 000000 to FFFFFF. Each digit in the number represents one hexagram line.
The field above contains such an array. Each number from 000000 to FFFFFF is assigned to one of the 4096 × 4096 pixels. Move your mouse over the field; it will scroll by itself as you move the mouse toward the edges. Then click anywhere in the field to choose one pixel out of 16,777,216 and thus generate a base (and transformed, if appropriate) hexagram. The pixel numbers are shuffled ahead of time so that there is no way to predict the outcome; but it is still your choice that determines it.
The lines are represented by hexadecimal digits as illustrated in the table to the right. If the digits are converted to binary, the first two binary digits as a pair represent the first pile of yarrow stalk remainders. If the pair contains a 1, the pile is a small one and is assigned a value of 3; otherwise, it is a large pile and its value is 2. For the other two digits, 1 represents a small pile with a value of 3, and 0 a large pile with a value of 2. The sum of the line values is either 6 for changing yin, 7 for yang, 8 for yin, or 9 for changing yang.
Note that the hexadecimal and binary digits are actual numbers and are thus built from right to left. When representing a hexagram, the line numbers are actually descriptive characters and are written from left to right.
On a side note, the number of colors on a standard computer display is also 16,777,216, or 2563, generated by three colors with 256 possible values, and represented by hexadecimal numbers from 000000 to FFFFFF.