Sharedsupport / 2017-06-12-hash.ipynbOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
In [8]:
a = Mod(1,3) b = 4 a == b
True
In [9]:
hash(a), hash(b)
(1, 4)
In [25]:
v = {a:5} v[b]
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-25-a2ac5d31cc70> in <module>() 1 v = {a:Integer(5)} ----> 2 v[b] KeyError: 4
In [34]:
v[2**65-1]
5
In [37]:
a == 4, a == 2**65-1
(True, True)
In [26]:
v.keys()[0] == b
True
In [27]:
set([hash(a), hash(b)])
{1, 4}
In [33]:
hash(2**65-1)
1
In [ ]: