3 Letter Initial Phone Keypad Hash Distribution

58 Views Asked by At

I have written a c++ function that generates a 3 digit number corresponding to each letter in a random 3 letter initial and their location on a phone keypad. For Example, my initials MSG, would return 674. I have to compare the results of how many times different initials return the same hash with the mathematical prediction of this, but i am not sure where to begin. Is this a combinatorial problem? where do I begin?

1

There are 1 best solutions below

0
On BEST ANSWER

My keypad looks like this

  • abc : 2
  • def : 3
  • ghi : 4
  • jkl : 5
  • mno : 6
  • pqrs : 7
  • tuv : 8
  • wxyz : 9

So the number of preimages of $d_1d_2d_3$ equals $3^a4^b$, where $b = |\{i: d_i \in \{7,9\}\}|$, and $a= 3-b$. Every digit not equal to $7$ or $9$ has 3 possible letters leading to it, $7$ and $9$ alone have 4.

As we can choose these pre-images independently,we can use multiplication to find the number.