If you read the Ancient Chronicle, you’re sure to notice some special symbols in the chapter headings. The chapter number and title both include the Nanyan translation. Though it makes sense that the title is indecipherable, it may seem at first that the number is equally incomprehensible. However, I assure you there is a simple (well, simple in concept anyway) meaning to them.
(To make the numbers easy to render in this post, I’m using the symbols | O Θ to stand for the Nanyan symbols you’ll find in the books.)
If you try to work out the pattern yourself, you might find no discernable pattern at first:
But here’s the trick: Each symbol stands for a sequence of numbers and operators in post-fix notation. (If you’re not familiar with post-fix notation, check out the Wikipedia entry.)
|: 1 + *
Θ: 2 *
Simply substitute each symbol with its set from left to right. For example, 15 becomes:
2 1 + * 2 2 * 1 + *
The one special rule is if there are not two operands on the stack, just ignore the operator. Thus the sequence becomes:
2 1 + = 3
3 * (ignore operator without two operands)
3 2 2 * = 3 4
3 4 1
3 4 1 + = 3 5
3 5 * = 15
And there you have it.
To reverse this process and find the Nanyan numeral for a given integer, you need to factor the number recursively until you can represent everything with just the numbers 1 and 2.
For example, 15 factors to 3 * 5. Since we don’t have symbols for 3 and 5, we need to iterate. But 3 and 5 are prime. How do we factor them? Simply subtract 1 and factor again.
3 = 2 + 1
5 = 4 + 1 = 2 * 2 + 1
Then convert it to post-fix notation, using the sequences the from the symbols:
3 = 2 1 + *
5 = 2 2 * 1 + *
Now, if you place all the factors in ascending order, the math works out:
2 1 + * 2 2 * 1 + *
Then all we need to do is replace them with the right symbols:
(2) (1 + *) (2) (2 *) (1 + *)
The * at the end of the 1 + * handles multiplying primes together when there are more than one of them on the stack. If there’s only one on the stack, the * is ignored. When the factors are ordered this way, it just works.
One of the helpful side effects of this is that if you are trying to figure out the factorization of a prime number, you need only at the | (1 + *) to the end of the previous number. For example:
10: OOΘ| = 2 2 2 * 1 + *
11: OOΘ|| = 2 2 2 * 1 + * 1 + *
For 37, you need only add | to the end of 36:
36: OΘO|O| = 2 2 * 2 1 + * 2 1 + *
37: OΘO|O|| = 2 2 * 2 1 + * 2 1 + * 1 + *
Another interesting property of these numbers is that if you know the symbols for all the prime factors of a number, you need only put them together in ascending order:
33 = 3 * 11 = O|OOΘ|| = 2 1 + * 2 2 2 * 1 + * 1 + *
91 = 7 * 13 = OO||OΘO|| = 2 2 1 + * 1 + * 2 2 * 2 1 + * 1 + *
If you take the time to do the math, it works out perfectly. Just to be sure, when I was designing Nanyan numerals, I created a Python program that does these conversions, and with it I checked many, many numbers. The pattern is always the same.
I will detail more about the Python program on my author website, but for now, I’ll say that being a programmer is very helpful when it comes to these sorts of things. (I highly recommend learning how to code.)
And there you have it: a quick explanation of Nanyan Numerals. They are not the most practical way of writing numbers, but their purpose is not really mathematical but ornamental. There is just something elegant out of being able to represent every integer using only three symbols.
I hope you found this interesting. Happy coding!
Postdiluvian is a space fantasy book series about a civilization of people descended from those living off world at the time of the Great Flood. It started as the idea “What would happen if the antediluvian civilization had a space program? Would that not be inconvenient to be in space if some global tragedy destroyed the world?” From that kernel of an idea grew the idea of the Nanyanin and all the bits of culture that went with them.
At the time when I began writing what would become The Ancient Chronicle, fascination with worldbuilding was rising, soon to reach its peak. That is not to say it has waned, but these days it is starting to feel old hat—every book and movie seems to focus heavily on worldbuilding, often to the detriment of the story and characters. Despite that, I believe that Postdiluvian strikes a good balance of all those things.
My goal with Postdiluvian was to write the sort of story I would like to read—one that strikes the proper balance of things I like to see in a story. That is a difficult thing to define succinctly, and I hope to make that known through all the various posts written here.