It's not about primes, it's about big numbers, with distributions 1, 1000, 10000000, the first char will contribute to the LSBs, the second char to more significant bits and so on. The higher the ratio between those numbers, the more distance between the bit your chars can change. You see collisions when there is an overlap. For example with 26 values and weights of 1, 8, and 64, each char will directly affect a range of 8 bits, and each range will be at a distance of 3 bits from the next, with an overlap of 5. But with weights 1, 32 and 1024, you'll get no overlap in the range of bits each char can affect (so no carry).
Actually the perfect list of weights in your example with chars a..z is 1, 26, 26^2, 26^3 .... But this will not fit into your integers as soon as 26^L > 2^64 with L the maximum length of your string.
The general best distribution (no collisions, ignoring the limitation of 64 bits) is the list of K^N with K the number of possible characters. And I'm pretty sure the list of K^(N/C) should give you an average collision close to C (C strings for each value), but would require an integer with C times less bits.
In reply to Re: An optimal solution to finding weights for a weighted sum signature.
by Eily
in thread An optimal solution to finding weights for a weighted sum signature.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |