Unique Number based on 3 variables

Seph

New member
Joined
Feb 19, 2015
Messages
2
Hi All,

My first post so please be gentle if this is the wrong area. My classical math is also very lacking so sorry if wrong terminology used etc.

Anyway - onto my issue.

So essentially Im mapping the alphabet to incrementing numbers,

a=1
b=2
c=3 etc etc

i have 3 random letters, which are taken as input, i then convert the letters to numbers, add them, and total.

for instance,

aaa= 3 (1+1+1)
abc= 6 (1+2+3)

now my issue is this, i want to give a unique number to any combination(3 digits max) of letters that comes in, however

abc = 6
cab = 6
cba = 6

while unique combinations of letters, they do not result in unique combinations of numbers.

I initially took to adding based on position (adding 1 to first letter, 2 to 2nd letter, 3 to 3rd)


abc = (1+1) (2+2) (3+3)
cab = (3+1) (1+2) (2+3)

however this comes undone with combinations such as;

lsj / rmj 13+21+13 / 19 +15 +13 = 47

Is there any thing / any operation i can do, that will result in a unique integer for each set of numbers?
 
Last edited:
Actually thinking about the way i wanted to implement this it wont work at all, there are just not enough digits available in my unique "id" to allow for the number of unique combinations.

Time to think of a different way to implement this.
 
Actually thinking about the way i wanted to implement this it wont work at all, there are just not enough digits available in my unique "id" to allow for the number of unique combinations.

Time to think of a different way to implement this.
Sure there are. There are several ways. First, let x, y, and z be the numbers for the random letters.

One way, use a base 26 arithmetic and let
N = 262 x + 26 y + z
but this would be hard to recognize at first glance for most people, so

Another way
N = 10000 x + 100 y + z
This has the advantage of being able to recognize the number immediately:
abc = 10000 + 200 + 3 = 010203
cab = 30000 + 100 + 2 = 030102
zze = 260000 + 2600 + 5 = 262605
 
Top