12.12 Implement a hash function for chess

#1

Question about the “straightforward hash function” that the book presents that treats the board as a sequence of 64 base 13 digits:

Does the sum use a different prime number for each of the 64 locations? I’m trying to understand why p^i.

Also, does this forum support LaTex?

Thanks!

0 Likes

#2

No, we use same prime number, and you will know that we use different prime number by the notation of p_i.

0 Likes

#3

Thanks @tsunghsienlee.

If it’s the same number, perhaps the book needs to be updated to just p instead of p superscript(i)?

Also, any chance of adding LaTeX to the forums?

0 Likes

#4

No, the book is correct because p_i means prime for different i, and p^i means prime with i’s power.

0 Likes

#5

Ok, so are you saying it’s not the same prime number for all i? You’re saying each i has a different p in the solution?

(Btw, I used p^i in my post because I didn’t know how to represent p superscript(i). I didn’t actually mean “power”. Sorry for the mixup. Perhaps the book should say p subscript(i) then, instead of p superscript(i)).

0 Likes

#6

No, I was saying it is the same prime number, and I was saying if we were using different prime numbers then the notation will be p_i.

0 Likes

#7

Ok, got it. So then the book should say p instead of pⁱ, right?

0 Likes

#8

No, because p^i is the one we want as it represents the unique encoding for each position on the chessboard.

0 Likes

#9

I’m confused. You said earlier

So, is the prime number the same, or unique?

0 Likes

#10

Only one prime number p is chosen, and we did mention that in the book as you can see from the formula. I mentioned there is that if I use different primes (which is not the case), we would use different notation (like p_i).

0 Likes

#11

I see this in the book. Does it mean different p for each i, or p to the power i?

F9B59B53-B8C4-4E57-A11C-4628FC72F206L0001

0 Likes

#12

It is p to the power i.

0 Likes

#13

:slight_smile: Ah, now I understand. Thank you. And thanks for being patient with me.

0 Likes

#14

It is my pleasure to help you guys, no problem!

1 Like