Code: Select all
Label Addr Code Desired jmp
Start 0 882**0^0^*1-1^-00
HashLoop 17 0^<0^0^5^/5^*-5^+1v2*1+1^<0^95*? save
Nonzero 49 -57*? found
Conflict 54 d0^<2^>1v1+1v
Looping 67 1+0^4^-6? HashLoopEnd
ToHashLoop 76 789*-g HashLoop
HashLoopEnd 82 63*g AfterHashLoop
86 !!!
Found 89 1^<p!
Save 94 d1v>358*-g Looping
AfterHashLoop 104 2v+2vd1^-0
ClearLoop 114 01^<0^4^/4^*-4^+>1+0^3^-6? ClearLoopEnd
140 048*-g ClearLoop
BackToHLoop 146 d000754**-g HashLoop
How it works ... storing at (val mod (16384-size)+size) the value 2val+1, of course check there was 0 on the address. If there was nonzero equal to 2val+1 you are done, otherwise store val to the list of conflicted numbers to be processed once again.
Confliceted numbers are processed by the same method, just the size is decreased to the conflict size. To allow that you must ensure there are zeros at the addresses they will use.
... worst case is O(size^2) for the case all hashed to the same address, but as modulo changes, that would require astronomically high numbers. It seems to me the big conflict case is solved better by this method (than by sloving conflicts by standard hash techniques) thanks to the modulus change.
I don't think the size in the 2nd run would be bigger than 5.
I know it's overkill ... to pass tests, it would be probably sufficient to store 1 and report a conflict as a solution ... .
I dont think there is any reason the modulus to be prime number.