# Why is Mathematica getting this modular root wrong?

First, note that $4^{96}\equiv 96 \pmod {100}$.

Mathematica claims that PowerMod[96, 1/96, 100] has no integer solutions.

Even more obviously wrong, I get {} for

Solve[4^96 == x^96, Modulus -> 100]


which obviously has at least one solution (4).

Is this a known bug? Can I work around it somehow?

EDIT: I'm on Mathematica 9.0.1, running on OSX 10.10 Yosemite developer beta. Perhaps that could be the cause of this issue for me (also, mathematica crashes whenever I try to paste.).

-
Yes, I think this is a bug in PowerMod, although your second example doesn't give a wrong result for me (version 8.0.4). – Jens Jun 8 '14 at 3:41
I have had that crash before, too. It seems that it can be avoided if you copy from Mathematica as plain text (see the Edit menu under Copy as...). – Jens Jun 8 '14 at 4:41
I removed the version-9 tag because for the current version we don't need a special tag. Let me know if you disagree. – Jens Jun 8 '14 at 4:44
Will investigate. – Daniel Lichtblau Jun 8 '14 at 20:55

Solve[4^96 == x^96, Modulus -> 100]
Solve[x^96 == 96, x, Modulus -> 100]
PowerModList[96, 1/96, 100]

(*
{{x -> 4}, {x -> 22}, {x -> 28}, {x -> 46}, {x -> 54}, {x -> 72}, {x -> 78}, {x -> 96}}
{{x -> 4}, {x -> 22}, {x -> 28}, {x -> 46}, {x -> 54}, {x -> 72}, {x -> 78}, {x -> 96}}
{4,22,28,46,54,72,78,96}
*)

-
Are you on mathematica 9? – Jakob Weisblat Jun 8 '14 at 4:16
@JakobWeisblat: Yes. – ciao Jun 8 '14 at 4:38
Did you try with PowerMod instead of PowerModList? – Jakob Weisblat Jun 8 '14 at 4:59
@JakobWeisblat: No. You asked for a work-around. I gave you one. I have not used PowerMod for years, no reason to, PowerModList is equivalent for non-Nth-root use, and gives complete results for Nth-root, so once it left being experimental (pre V6), I use it. I suspect this may be a bug in PowerMod - that function has existed, unchanged AFAIK, since V1. – ciao Jun 8 '14 at 5:03
I did switch to using PowerModList and have not run into this problem again, so now that you mention it I wonder why I still care about the PowerMid issue. – Jakob Weisblat Jun 8 '14 at 5:05

It works on a Mac with v9.0.1

\$Version


"9.0 for Mac OS X x86 (64-bit) (January 24, 2013)"

pml = PowerModList[96, 1/96, 100]


{4, 22, 28, 46, 54, 72, 78, 96}

And @@ (Mod[#^96, 100] === PowerMod[#, 96, 100] === 96 & /@ pml)


True

pml === (x /. Solve[4^96 == x^96, Modulus -> 100])


True

-
I have the exact same version - it works for me with PowerModList but not PowerMod. – Jakob Weisblat Jun 8 '14 at 4:16