Tonelli-Shanks algorithm: Difference between revisions
Content added Content deleted
(add PicoLisp) |
|||
Line 971: | Line 971: | ||
(de ts (N P) |
(de ts (N P) |
||
(and |
(and |
||
(= |
(=1 (legendre N P)) |
||
(let |
(let |
||
(Q (dec P) |
(Q (dec P) |
||
Line 997: | Line 997: | ||
D (**Mod N Q P) |
D (**Mod N Q P) |
||
M S ) |
M S ) |
||
( |
(until (=1 D) |
||
⚫ | |||
(zero I) |
(zero I) |
||
(for |
(for |
||
Line 1,016: | Line 1,015: | ||
C (% (* B B) P) |
C (% (* B B) P) |
||
D (% (* D C) P) |
D (% (* D C) P) |
||
M I |
M I ) ) |
||
⚫ | |||
(println (ts 10 13)) |
(println (ts 10 13)) |