Anagrams are two or more expressions which contain the same letters but which are arranged differently (e.g. “evil” and “vile” or “a gentleman” and “elegant man”). The notion of anagrams can be traced back to the ancient Greeks where it was viewed as a tool in uncovering mystical meanings of said words or expressions. My goal here is to try to explain an algorithm (or method) that checks if two expressions could be anagrams within the Armenian language.

I must first shed some light on the unique factorization theorem, which is the fundamental theorem of arithmetic. It states that every integer greater than one is either a prime number or itself can be a unique product of primes.

Prime numbers are whole numbers which can be divisible by their own self or by one and still give a whole number. For example, {2, 3, 5, 7, 11 et cetera} can only be divided by one or themselves in order to give us a whole number. Meanwhile, {4, 6, 8, 9} are each a unique product of said numbers (the primes) and that product can be rearranged with respect to its order only. For example, 6 will always equal the product of a 2 and a 3 no matter which number of the latter goes first. (2×3=6=3×2)

I offer a small tangent for people curious with arithmetic. The number 1 is not considered a prime because the uniqueness of the theorem would be lost (i.e. 123=1123=2×3=6=3×2 So you get the gist of it)

Why is this necessary for checking anagrams? Because the Armenian alphabet has 38 letters and our aim is to associate each letter of the alphabet with a prime.

“Ա” would be associated to the first prime, which is 2 and “ֆ” which is the last and 38th letter of the Armenian alphabet would be associated to 163 which is the 38th prime number, so now each letter of the alphabet ought to have its “prime” representation. The way to check if two or more expressions are anagrams in Armenian is to calculate the product of the prime representation of each letter of the expression, and if the products of said expressions are equal then they are anagrams.

Let’s take, for example, վրայ and վայր. If we write վրայ in terms of the prime numbers each of its letters represent, we get: 113, 131, 2, 73. We take the product of these primes, we get:113×131×2×73=2,161,238. Let’s do the same for վայր. That yields:113×273131=2,161,238 again!

The product of the prime representation of both words are equal, which shows that both words are in fact anagrams.

Another example:

ծնուել: 43×79×89×139×11×37=17,103,884,809

Լուծեն:37×89×139×43×11×79=17,103,884,809

Ծնելու:43×79×11×37×89×138=17,103,884,809

Special thanks to Garin Angoghinian and Daron Assadourian for providing me with a full database of Armenian anagrams.

I think it’s simpler to see if the words have the same letters. You don’t need math for this! You just made it more complicated.

That’s funny. But you have to love a system that serves as an independent check on your simple method. You can imagine how this might be preferable if all words had a prime-product as a second identifier. Then the list of all words could be arranged by their prime product rather than a list of letters. Anagrams could be identified by a simple sort of increasing value. Still, I appreciate your take on it.

It takes asymptotically longer to check if the words have the same letters than it does to multiply their prime numbers and check the products.

Bravo Alek … I am 76 yrs old and your article generated great interest and woke up my sleeping mind ! Much appreciated for Armenian Weekly publishing articles by young writers and their views , like another great article in this issue by Arianna Mesrobian . It strengthens my belief in our younger Generation for OUR Future !

Azad .

I would love to hear more about how such a prime-product identifier could be used in more complex textural analysis.

To reduce computation the letters could be assigned values based on their typical frequency in text instead of their position in the alphabet. So «ա» would still be 2 (because it’s the most frequent letter) but 3 would be «ն», 5 would be «ր» etc.