I suspect it has to do with numerology, which the Babylonians practiced, and during the Babylonian Captivity the Jews picked up a lot of Bablyonian ideas; and the fact that in Hebrew letters represent numbers. (They had no unique characters to represent numbers, but used alphabetic characters instead.)
It could have been a code if the person he was talking about was a powerful, living person. The O.T. writer was afraid to 'spell out' the name. So he gave a clue: the sum of the letters in this devil incarnate's name is 666. Jews would be able to figure it out by taking the names of suspects and seeing if the sum of the numeric values of the characters that spelled his name was 666.
Here's a rather silly example of how that might work today.
If 13 is an unlucky number, and 'a' represents the number 1, and 'n' represents the number 6, then the 'number' of the name 'Ann' is 1+6+6, or 13; so if your name is Ann you should spell it Anne, and change your luck.