hermann on Tue, 28 Apr 2026 08:46:05 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

modular sqrt does not always detect and error on non-prime modulus


Seems to be a little bug.
I found another factor than 3 that worked but not able to reproduce now.
Not all primes of the form 1+k^2 behave wrong as k=6 shows:

? version
[2, 17, 3]
? sqrt(Mod(-1-2^2,3*5))
Mod(5, 15)
? sqrt(Mod(-1-2^4,3*17))
Mod(17, 51)
? sqrt(Mod(-1-10^2,3*101))
Mod(101, 303)
? sqrt(Mod(-1-2^6,3*37))
  ***   at top-level: sqrt(Mod(-1-2^6,3*37))
  ***                 ^----------------------
  *** sqrt: not a prime number in sqrt [modulus]: 111.
  ***   Break loop: type 'break' to go back to GP prompt
break>


Regards,

Hermann.