Jump to content

Tonelli-Shanks algorithm: Difference between revisions

m
added wikipedia tag
m (such as --> such that)
m (added wikipedia tag)
Line 1:
{{task}}
{{wikipedia}}
'''Tonelli–Shanks algorithm'''
 
 
In computational number theory, the [[wp:Tonelli–Shanks algorithm|Tonelli–Shanks algorithm]] is a technique for solving for '''x''' in a congruence of the form:
<big>
Line 19 ⟶ 20:
 
 
;Algorithm pseudo-code (copied from Wikipedia):
<big>
All ≡ are taken to mean (mod p) unless stated otherwise.
Line 34 ⟶ 35:
** Let b ≡ c<sup>2<sup>(m - i - 1)</sup></sup>, and set r ≡ rb, t ≡ tb<sup>2</sup>, c ≡ b<sup>2</sup> and m = i .
</big>
 
 
;Numerical Example:
* n=10, p= 13. See [https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm Wikipedia]
 
 
535

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.