|P is for Practical|
Using modular numbers with Math::Pariby hv (Parson)
|on Oct 29, 2009 at 12:40 UTC||Need Help??|
hv has asked for the
wisdom of the Perl Monks concerning the following question:
I can get a modular reciprocal with Pari easily enough, eg:
1 / 3 == Mod(6,17)
The result "Mod(6,17)" is a modular value, representing the equivalence class of integers equivalent to 6 (mod 17), and that's great.
However I now want to get the "6" out of there as an integer for further work, i.e. to get the "common residue" of that modular number. I haven't found anything in the Math::Pari or Pari/GP docs that tells how to do that, and everything I've tried gives an error:
I could pull the value out with a regexp, but that would be silly. Surely there is a simple, efficient way to do this?