Not comprehending PowerMod

6

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.

Christopher Lamb

Posted 2019-01-11T20:49:36.837

Reputation: 542

28992 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. – Michael E2 – 2019-01-11T21:18:35.743

3@Rabbit i also think that this is a bug. Please report this to Wolfram Support. – Henrik Schumacher – 2019-01-11T21:21:06.863

1It 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. – Michael E2 – 2019-01-11T21:29:53.460

1Thanks @HenrikSchumacher - I let Wolfram support know of this. – Christopher Lamb – 2019-01-12T01:50:51.320

Thanks @MichaelE2 for explaining the behavior. – Christopher Lamb – 2019-01-12T01:51:50.647

1Wolfram case 4211704 – Christopher Lamb – 2019-02-19T23:28:47.567

Email from support@wolfram.com says this is fixed in 12.0, referencing [CASE:4555193]. – Christopher Lamb – 2020-06-11T21:10:58.783

No answers