Well that's essentially what I have done, except the unique hash is just a single integer and the hash function is f(x,y) = x + y.
Such a trivial hash function would normally be unacceptable due to the prevalence of hash collisions but avoids them by x and y being (multiples of) prime numbers.
it works anyway
You were lucky. The' x+y is unique if x,y E prime numbers' is a fallacy that is disprovable by the presence of multiple prime pairs. [1]
I just created a simple "x,y" hash myself.
[1] came across this in a PhD thesis once. It was the cornerstone of his algorithm. He failed. [2]
[2] 5+13 == 7+11.
I agree
,
but, is there not a condition you could place on the primes to guarantee it?
My initial 'hunch' was that that condition would be
p1>n AND p2 > n
I have absolutely no idea how to prove that however.
Thinking about it however
would
p1 > p2 x n AND p2 > n
not guarantee it?
Again, no idea how to prove, just a hunch
Can
you disprove it?
so if, say, n = 10, I would choose primes 11 and 113...
i.e. 11 > 10 and 113 > 10* 11.
what moves (values of m1 and m2) would cause a hash collision i.e. such that
m1 * p1 = m2 * p2
where
m1 <= 10
m2 <= 10
p1 = 11
p2 = 113
?
How to prove there are no such values of m1 and m2?
If I place that condition do they even need to be prime?