The Phantom Tollbooth
King Azaz and the Mathemagician
Foils are characters who contrast with each other in order to emphasize their unique characteristics. So, these two rulers are alike in that each worships one kind of knowledge above all else. But one chooses words, the other numbers. They are both so committed to their own kind of knowledge that they won't admit any other and cast out those who disagree.