Tonelli-Shanks algorithm: Difference between revisions

Content added Content deleted
(added REXX which works for the smaller numbers)
m (→‎{{header|REXX}}: 2 correcions)
Line 1,503: Line 1,503:
{{trans|Python}}
{{trans|Python}}
The large numbers cannot reasonably be handled by the pow function shown here.
The large numbers cannot reasonably be handled by the pow function shown here.
<lang rexx>Numeric Digits 1000000
<lang rexx>/* REXX (required by some interpreters) */
Numeric Digits 1000000

ttest ='[(10, 13), (56, 101), (1030, 10009), (44402, 100049)]'
ttest ='[(10, 13), (56, 101), (1030, 10009), (44402, 100049)]'
Do While pos('(',ttest)>0
Do While pos('(',ttest)>0
Line 1,524: Line 1,524:
Do while q // 2 == 0
Do while q // 2 == 0
q = q % 2
q = q % 2
s += 1
s = s+1
End
End
if s == 1 Then
if s == 1 Then