------ art_30614_1067611.1168534793319 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/11/07, Martin DeMello <martindemello / gmail.com> wrote: > > On 1/11/07, James Edward Gray II <james / grayproductions.net> wrote: > > On Jan 11, 2007, at 7:54 AM, Martin DeMello wrote: > > > I used a different signature method - I mapped each unique letter in > > > the target word to a prime, and then used the product of the primes of > > > all the letters in a word as its signature. That way, a is contained > > > in b if signature(b) % signature(a) 0, and you can generate the > > > signatures via each_byte, array lookup and integer multiplication (no > > > need for split, sort or string deletion). > > > > Very interesting. I've never seen that before. I like it. > > The numbers overflow 32 bits in the general case, I think, but for > this restricted problem it works very nicely. > > martin > > I believe with Ruby they'll get converted to Bignum automatically with no overflow, though I bet the running time suffers. ------ art_30614_1067611.1168534793319--