4
$\begingroup$

Bug introduced in 10.3 or earlier and persisting through 11.3.0 or later
The bug is not present in 10.0.


By definition, PowerMod[a, 1/r, m] finds a modular rth root of a mod m. Here's a pair of examples to illustrate my conundrum in 11.1.1/Win 10.

PowerMod[2488, 1/3, 10^4]
8992
8992^3 
727057727488
Mod[PowerMod[2488, 1/3, 10^4]^3, 10^4] == 2488
False

Maybe pertinent is that the value returned above, 8992, is not contained in the corresponding PowerModList values:

PowerModList[2488, 1/3, 10^4]
{242, 2742, 5242, 7742}
Mod[PowerModList[2488, 1/3, 10^4]^3, 10^4]
{2488, 2488, 2488, 2488}

Similarly (if not identically) for

PowerMod[91175, 1/3, 10^5]  
84375
84375^3
600677490234375
Mod[PowerMod[91175, 1/3, 10^5]^3, 10^5] == 91175
False

And, unlike the first example,

PowerModList[91175, 1/3, 10^5]  
{}

In both cases it appears that PowerModList is correct ( PowerModList[91175, 1/3, 10^5] should not return anything, and it doesn't).

Much obliged for taking a look at this.

$\endgroup$
  • 2
    $\begingroup$ 8992 is wrong. The PowerModList[] is correct. I'm not sure what else to say. I guess it's a bug? -- OK, maybe this: It seems to fail when $a$ and $m$ are not relatively prime. $\endgroup$ – Michael E2 Jan 11 at 21:18
  • 3
    $\begingroup$ @Rabbit i also think that this is a bug. Please report this to Wolfram Support. $\endgroup$ – Henrik Schumacher Jan 11 at 21:21
  • 1
    $\begingroup$ It seems to be calculating the answer as Mod[2488^x,10^4] where x is determined by Solve[3 x == 1, x, Modulus -> EulerPhi[10^4]], which is wrong. $\endgroup$ – Michael E2 Jan 11 at 21:29
  • 1
    $\begingroup$ Thanks @HenrikSchumacher - I let Wolfram support know of this. $\endgroup$ – Rabbit Jan 12 at 1:50
  • $\begingroup$ Thanks @MichaelE2 for explaining the behavior. $\endgroup$ – Rabbit Jan 12 at 1:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.