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?

  • $\begingroup$ M,N,O returns 6. P,Q,R,S returns 7 and G,H,I returns 4. Thus there are $3\cdot 4\cdot 3=36$ combinations which returns the sequence $674$. $\endgroup$ – callculus Jun 9 '17 at 22:33
  • $\begingroup$ @callculus how would i find the total amount of possible outcomes with 512 random 3 letter initials? I need it to find the probability of different initials producing their own unique number sequences, how many times an initial produce the same sequence as 1 other, 2 other, 3 other, and 4 other initials? $\endgroup$ – EggplantMachina Jun 9 '17 at 23:35

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.