Compute hash value according to multiplication method In "Introduction to Algorithms" by C. E. Leiserson, R. L. Rivest and C. Stein (ISBN:  978-0262033848), p. 264 they state this:



I get everything but the last part stating $h(k) = 67$

&gt;&gt;&gt; r = 17612864
&gt;&gt;&gt; bin(r) # r's binary representation
'0b1000011001100000001000000'
&gt;&gt;&gt; int(bin(r)[: 14 + 2], 2) # extract 14 most significant bits and convert to int
8600
You haven't extracted the 14 most significant bits. First, you have to write $r$ as a $w$-bit number:
$$
00000001000011001100000001000000
$$
Now you extract the 14 most significant bits:
$$
00000001000011
$$
Converting to decimal, this is 67.