Jesus Origins
Discovering the original ChristianityWater into Wine: the Thomas Code

The Gospel of Thomas is not a random collection of sayings. It has a mathematical structure unlike anything else from early Christianity, or indeed from the ancient world. That is the conclusion of my book “The Thomas Code”. In this series of posts, I want to reveal two further links between the New Testament gospels and the Thomas Code. These are two miracle stories which are mathematical riddles in disguise.
Both miracles come from the Gospel of John. One is the very first miracle, the turning of water into wine at the wedding at Cana. The other is the very last miracle, in which the resurrected Jesus appears to the fishermen disciples who make a miraculous catch of 153 fish. This second story has close similarities to another famous miracle which appears in all four of the gospels; the feeding of the multitudes with loaves and fishes. The book shows the connections between the loaves and fishes miracle and the Thomas Code—it is another mathematical riddle about multiplication. So there are three separate miracle stories which are all riddles concerning the secret mathematical structure of the Gospel of Thomas. The three miracles all involve a fantastic production of food or drink and are the only three such miracles in the gospels.
Unlike some of the healing miracles, the food and drink miracles have always strained credibility. This would be explained if they started as playful mathematical riddles created by the person who invented the Thomas Code. I believe that the new convert or learner was given the conundrums to ponder until their teacher revealed the hidden mathematical knowledge. But the key to the meaning was lost when the Christian leaders suffered martyrdom in the first century. The stories became viewed naively as miracles performed by Jesus and as such found their way into the gospels
I have split the discussion of the three miracles into three posts; the first and last will deal with the two Gospel of John miracles, and the middle will give a recap of the feeding of the five thousand. A brief explanation of the Thomas Code is included for those who have not read the book.
It should be stressed that the Thomas Code is not some random “Bible code” that has been found by searching a vast number of possibilities by computer. It is very different—a beautiful expression of some simple mathematics of prime numbers. The ancients did not look at mathematics the way we do, but saw it in mystical terms, as revealing religious secrets about the universe. This was as true of pagans as it was Jews and Christians. The Thomas Code is based on the unique properties of the first three prime numbers; two, three and five. The author of Thomas developed a theological interpretation in which two was the number of Jesus, the Son, and three was the number of God, the Father. In The Thomas Code, I suggest that this is how the concept of the trinity originated.
The book offers two main lines of evidence:
- The Thomas Code is alluded to by certain sayings in the gospel. In the case of one saying, we can go as far as to say that it specifies the Thomas Code. These sayings all involve numbers. Some of them have been very puzzling indeed.
- Once the Gospel of Thomas is organised by the Thomas Code, numerous links, symmetries and sub-structures become apparent. The author of the gospel continually poses riddles and plays games with us. Features which have defied explanation now make perfect sense. In one case, it has been possible to quantify probabilities to show that there is no realistic chance that the Thomas Code organization is random.
The miracle stories complement these internal proofs. The link with the feeding of the multitudes shows that the Thomas Code, and hence the Gospel of Thomas, was in existence before the New Testament gospels. This finding is buttressed by the links with the two Gospel of John miracles.
Water into wine
The story of the wedding at Cana, which is found only in the Gospel of John, is Jesus’ first miracle. In this famous story, Jesus turns water into wine:
Now there were six stone water jars there for the Jewish rites of purification, each holding twenty or thirty gallons. Jesus said to the servants, “Fill the jars with water.” And they filled them up to the brim. And he said to them, “Now draw some out and take it to the master of the feast.” So they took it. When the master of the feast tasted the water now become wine, and did not know where it came from (though the servants who had drawn the water knew), the master of the feast called the bridegroom and said to him, “Everyone serves the good wine first, and when people have drunk freely, then the poor wine. But you have kept the good wine until now.” (John 2:6-10 ESV)
According to this translation, Jesus creates a simply enormous quantity of wine – something like 600 litres, equivalent to 800 modern-sized bottles. The guests have already been drinking all day. How many people would be at the wedding? Let us say 50 to 100. If we exclude children, there would be the equivalent of at least ten bottles per person. Is Jesus trying to kill them?

Clearly, there is something wrong with the miracle story as it stands in John. Why go out of the way to mention the volume of wine when it results in an absurdity? The author of John must be reflecting something in his source, and that something does not make sense when converted into a literal miracle.
The water/wine is the Gospel of Thomas
The original story was surely not about a group of wedding guests getting hopelessly drunk. The true wedding is spiritual, and the guests have been invited to a spiritual banquet. To find the meaning of the water turned into wine, we must turn to the Gospel of Thomas, and a saying about becoming spiritually drunk:
Jesus said: “I am not your master, because you have drunk, you have become drunk from the bubbling spring that I have measured out.” (Part of Thomas 13; TC 1.12)
In this saying, a bubbling spring (water) has made the disciples drunk (turned into wine). There is also a second saying about drinking:
Jesus said: “Whoever drinks from my mouth shall become like me; I myself will become he [or she], and the hidden thing shall appear to him [or her].” (Thomas 108; TC 6.15)
You drink from the mouth of Jesus by absorbing the sayings. If you do this, you will become like Jesus, and the hidden things will be revealed. It is the sayings in Thomas that are the bubbling stream. The water (the sayings) will turn into wine in the mind of the disciple and make him or her drunk with the spiritual presence of Jesus.
In the Thomas saying, Jesus measures out the stream that will make his disciples drunk. In the John miracle, the water/wine is measured out by being placed into six jugs. To understand the meaning of these six jugs, we need to look at the Thomas Code structure.
The Thomas Code
The starting point for the Thomas Code was a suggestion from Stevan Davies that the Gospel of Thomas originally had 108 sayings. I noticed that the number 108 has a very special prime factorization. Let me explain. A prime number is any number other than 1 that cannot be divided by any other number except itself and 1. Educated people in the first century would have been familiar with prime numbers which were discovered by the Greeks. There are an infinite number of primes, but the series starts simply enough:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, …
Every number has a unique prime factorization – a way of expressing the number as a multiple of primes. For example, the prime factorization of 20 is:
20 = 2 • 2 • 5
where “•” is the symbol for multiplication. The order is not important, but there is no other way of expressing 20 as a product of primes except as two 2s and one 5. Now the prime factorization of 108 is special. It is the first two primes raised to their own powers:
108 = 2² • 3³
This formula uses our modern notation – in the ancient world it would have been thought of as “two twos and three threes”. The total number of factors is five which is the sum of the two prime factors and is also a prime number. But was this unusual mathematical property of 108 relevant?
It could be used to organize a gospel of sayings as a hierarchy. To generate such a hierarchy the five factors must be placed in order. What order would someone living in the first century use? Symmetry was all important – we know that many Jewish and Christian writings employ a chiastic structure which is symmetrical. It also seemed fitting that the factors should alternate, which gave only one possibility:
3 • 2 • 3 • 2 • 3
This is the formula I have called “the Thomas Code”. It is attractive even visually, combining the symmetry of the twos with the triplet of threes in an interlinked whole. I could see how someone in the Roman world would attach a mystical meaning to such a formula. But it is not just visually attractive: it has a number of unique mathematical properties. These come from the very special nature of the three primes, 2,3 and 5:
- 2 and 3 are the only consecutive numbers which are both prime.
- 2 and 3 are the only two successive primes which sum to give another prime, 5. (If we add together any other two successive numbers from the list of primes we will get an even number which is not prime.)
These properties of 2 and 3 contribute to the very special properties of the Thomas Code formula:
- The sum of the two prime factors gives the next highest prime number which also equals the total number of factors (2+3 =5).
- The number of occurrences of each prime factor is equal to the factor (two 2s and three 3s).
- If we add any two successive factors, we always get the next highest prime number (either 3+2=5 or 2+3=5).
The Thomas Code is unique. There is no other sequence for which all these properties are true.
We can apply the formula to organize a collection of 108 sayings as a hierarchy with multiple levels. The sayings are grouped by applying each factor in turn:
3 – group sayings into threes.
2 – combine two threes into sixes.
3 – combine three sixes into eighteens.
2 – combine two eighteens into thirty-sixes.
3 – combine three thirty-sixes to give one-hundred-and eight.
Because the Thomas Code is symmetrical, we can carry this process in reverse by dividing up the gospel. We apply the 3 by dividing 108 into three groups of 36 sayings and so on. Either way, we get the same structure.
108 groups of 1 saying.
36 groups of 3 sayings.
18 groups of 6 sayings.
6 groups of 18 sayings.
3 groups of 36 sayings.
1 group of 108 sayings.
Each individual saying belongs to a group of 3, 6, 18 and 36 as well as to the whole gospel of 108.
To say that such a structure is unexpected would be a complete understatement! As far as I know there is nothing like it in any text from the ancient world. Is it really likely that a person in the first century would have come up with this sophisticated way of organizing a collection of sayings? My own doubts were resolved when I came across a reference to such a hierarchy in a most surprising place; the miracle of the feeding of the five thousand in the Gospel of Mark. It was the first hint of the intimate connection between the Thomas Code and the miracle food and drink stories.
The importance of the eighteens
The levels of the hierarchy are not all equal. The importance of the eighteens jumped out as I placed the gospel into the Thomas Code structure. Essentially, the gospel is organized as six groups of eighteen sayings. The eighteens are put into pairs to give the thirty-sixes. They are subdivided into three sixes and six threes. Because the eighteens were so important, I based the Thomas Code system of numbering around them. In this system, the sayings are numbered first by the eighteen (1 to 6) and then by the position within the eighteen (1 to 18).
This structure is shown in the diagram below, reproduced from the book.

The book explores the many features in the gospel that depend upon this fundamental grouping into eighteens. To give one example: it has long been a mystery why the gospel appears to be signalling an end at Thomas 19, which is saying 1.18 in the above structure. Some people have speculated that the first group of eighteen sayings initially circulated as a separate text. However, the Thomas Code shows that an ending at 1.18 is expected because this is the last saying of the important first eighteen. (If you are wondering why Thomas 19 is the eighteenth saying and not the nineteenth, this is because Thomas 1 is now generally regarded as being part of the incipit and not the first saying.)
The miracle of the wine and the Thomas Code
The importance of the eighteens gives us the solution to the miracle of the water into wine.
- The Gospel of Thomas is the water turned into wine.
- The gospel is placed in six “containers” of eighteen sayings each.
The six jars stand for the eighteens. But what about the “twenty or thirty gallons” that each jar holds? What does this stand for? And why is there an “or”? If the author is writing the story, why is he unsure how much the jars hold?
The twenty or thirty gallons are not actually in the original text but have been written in by the translators. A more literal translation of the Greek is as follows:
Now there were six stone water jars […] holding two or three measures [metrētas].
One “measure” (metrētḗs) of a liquid was equal to about 9 imperial gallons or 10.5 US gallons. The word comes from metreó, to measure. This same word was used in a technical sense in mathematical treatises, particularly in relation to prime numbers. One number is said to “measure” another if it divides that number without a remainder. For example, Euclid’s defines a prime number as being “measured by unity alone” (Euclid Elements 7 Def. 11). We find the same concept of a number being “measured” by its prime factors in Nicomachus’ textbook “Introduction to Arithmetic” written c.100 AD.
Now both 2 and 3 “measure” 18 in this mathematical sense. They are the two prime factors of 18 and the two primes that make up the Thomas Code. But we can go further than this:
- 3 “measures” 18 by dividing it into groups of 6 sayings
- 2 “measures” 6 by dividing it into groups of 3 sayings
So if we measure each jar by 3 and then measure again by 2 we would get the complete Thomas Code structure from the eighteens downwards:

The wording of John is not quite the same as this, but we can recreate what must have been in the author’s source:
“… each jar holding three measures and two measures.”
The author of John would have been understandably confused by what is meant by “three measures and two measures”. He concludes that some jars must have held three measures and others two. So he writes “two or three measures”.
S.P. Laurie