in reply to My first JAPH

I was a little disappointed that it doesn't actually depend much on the properties of Z29.

The main place where Z29 appears is in the a() subroutine where you generate a hash %h whose keys are elements of Z29 and whose values are the discrete logarithms of those elements. But then you immediately turn around and use values on %h, which extracts the logs, but not in any mathematically interesting order. The order is determined by the order in which the Z29 elements happen to appear in the Perl hash, which is dependent on the hashing function that Perl uses.

This is why the program doesn't work except under 5.6.0: The Perl hash function changed in 5.6.0, and the order of the items in the return value of a() depends on this hash function.

Replies are listed 'Best First'.
Re: Re: My first JAPH
by rpc (Monk) on Nov 21, 2000 at 01:58 UTC
    Ah, I see. Thanks for pointing that out.
    I thought that it would return the order in which the elements of Z_29 were found; it seemed to on tests.
    I was interested in the order in which the elements were found, using exponents in ascending order.
    I naively thought this approach would do just that, and eliminate duplicate elements.

    Thanks!
      Says rpc:
      > I thought that it would return the order in which the elements of Z_29 were found
      Nope. Here's what perlfunc has to say about that:
      values HASH
      ...
      The values are returned in an apparently random order. The actual random order is subject to change in future versions of perl...
      so there you go.