Lambert cylindrical equal-area projection

From formulasearchengine
Jump to navigation Jump to search

The Tonelli–Shanks algorithm (referred to by Shanks as the RESSOL algorithm) is used within modular arithmetic to solve a congruence of the form

x2n(modp)

where n is a quadratic residue (mod p), and p is an odd prime.

Tonelli–Shanks cannot be used for composite moduli; finding square roots modulo composite numbers is a computational problem equivalent to integer factorization.[1]

An equivalent, but slightly more redundant version of this algorithm was developed by Alberto Tonelli in 1891. The version discussed here was developed independently by Daniel Shanks in 1973, who explained:

"My tardiness in learning of these historical references was because I had lent Volume 1 of Dickson's History to a friend and it was never returned."[2]

The algorithm

(Note: All are taken to mean (modp), unless indicated otherwise).

Inputs: p, an odd prime. n, an integer which is a quadratic residue (mod p), meaning that the Legendre symbol (np)=1.

Outputs: R, an integer satisfying R2n.

  1. Factor out powers of 2 from p − 1, defining Q and S as: p1=Q2S with Q odd. Note that if S=1, i.e. p3(mod4), then solutions are given directly by R±np+14.
  2. Select a z such that the Legendre symbol (zp)=1 (that is, z should be a quadratic non-residue modulo p), and set czQ.
  3. Let RnQ+12,tnQ,M=S.
  4. Loop:
    1. If t1, return R.
    2. Otherwise, find the lowest i, 0<i<M, such that t2i1; e.g. via repeated squaring.
    3. Let bc2Mi1, and set RRb,ttb2,cb2 and M=i.

Once you have solved the congruence with R the second solution is pR.

Example

Solving the congruence x210(mod13). It is clear that 13 is odd, and since 101312=1061(mod13), 10 is a quadratic residue (by Euler's criterion).

Indeed, observe that 72=4910(mod13) and naturally also (7)26210(mod13). So the algorithm yields two solutions to our congruence.

Proof

First write p1=Q2S. Now write rnQ+12(modp) and tnQ(modp), observing that r2nt(modp). This latter congruence will be true after every iteration of the algorithm's main loop. If at any point, t1(modp) then r2n(modp) and the algorithm terminates with R±r(modp).

If t≢1(modp), then consider z, a quadratic non-residue of p. Let czQ(modp). Then c2S(zQ)2Sz2SQzp11(modp) and c2S1zp121(modp), which shows that the order of c is 2S.

Similarly we have t2S1(modp), so the order of t divides 2S. Suppose the order of t is 2S. Since n is a square modulo p, tnQ(modp) is also a square, and hence SS1.

Now we set bc2SS1(modp) and with this rbr(modp), cb2(modp) and tct(modp). As before, r'2nt(modp) holds; however with this construction both t and c have order 2S. This implies that t has order 2S with S<S.

If S=0 then t1(modp), and the algorithm stops, returning R±r(modp). Else, we restart the loop with analogous definitions of b, r, c and t until we arrive at an S(j) that equals 0. Since the sequence of S is strictly decreasing the algorithm terminates.

Speed of the algorithm

The Tonelli–Shanks algorithm requires (on average over all possible input (quadratic residues and quadratic nonresidues))

2m+2k+S(S1)4+12S19

modular multiplications, where m is the number of digits in the binary representation of p and k is the number of ones in the binary representation of p. If the required quadratic nonresidue z is to be found by checking if a randomly taken number y is a quadratic nonresidue, it requires (on average) 2 computations of the Legendre symbol.[3] The average of two computations of the Legendre symbol are explained as follows: y is a quadratic residue with chance p+12p=1+1p2, which is smaller than 1 but 12, so we will on average need to check if a y is a quadratic residue two times.

This shows essentially that the Tonelli–Shanks algorithm works very well if the modulus p is random, that is, if S is not particularly large with respect to the number of digits in the binary representation of p. Cipolla's algorithm works better than Tonelli–Shanks if (and only if) S(S1)>8m+20.

The algorithm requires us to find a quadratic nonresidue z. There is no known deterministic algorithm that runs in polynomial time for finding such a z. However, if the generalized Riemann hypothesis is true, there exists a quadratic nonresidue z<2ln2p,[4] making it possible to check every z up to that limit and find a suitable z within polynomial time. Keep in mind, however, that this is a worst case scenario; in general, z is found in on average 2 trials as stated above.

Uses

The Tonelli–Shanks algorithm can (naturally) be used for any process in which square roots modulo a prime are necessary. For example, it can be used for finding points on elliptic curves. It is also useful for the computations in the Rabin cryptosystem.

Generalizations

Tonelli–Shanks can be generalized to any cyclic group (instead of /p*) and to kth roots for arbitrary integer k, in particular to taking the kth root of an element of a finite field .[5]

If many square-roots must be done in the same cyclic group and S is not too large, a table of square-roots of the elements of 2-power order can be prepared in advance and the algorithm simplified and speeded up as follows.

  1. Factor out powers of 2 from p − 1, defining Q and S as: p1=Q2S with Q odd.
  2. Let RnQ+12,tnQR2/n
  3. Find b from the table such that b2t and set RR/b
  4. return R.

Notes

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

References

  • 20 year-old Real Estate Agent Rusty from Saint-Paul, has hobbies and interests which includes monopoly, property developers in singapore and poker. Will soon undertake a contiki trip that may include going to the Lower Valley of the Omo.

    My blog: http://www.primaboinca.com/view_profile.php?userid=5889534

Pages 110–115 describe the algorithm and explain the group theory behind it.

  • Daniel Shanks. Five Number Theoretic Algorithms. Proceedings of the Second Manitoba Conference on Numerical Mathematics. Pp. 51–70. 1973.
  • Alberto Tonelli, Bemerkung über die Auflösung quadratischer Congruenzen. Nachrichten von der Königlichen Gesellschaft der Wissenschaften und der Georg-Augusts-Universität zu Göttingen. Pp. 344–346. 1891. [1]
  • Gagan Tara Nanda - Mathematics 115: The RESSOL Algorithm [2]

External links

Template:Number theoretic algorithms

ru:Алгоритм Шенкса

  1. Oded Goldreich, Computational complexity: a conceptual perspective, Cambridge University Press, 2008, p. 588.
  2. Daniel Shanks. Five Number-theoretic Algorithms. Proceedings of the Second Manitoba Conference on Numerical Mathematics. Pp. 51–70. 1973.
  3. Gonzalo Tornaria - Square roots modulo p, page 2 http://www.springerlink.com/content/xgxe68edy03la96p/fulltext.pdf
  4. Many property agents need to declare for the PIC grant in Singapore. However, not all of them know find out how to do the correct process for getting this PIC scheme from the IRAS. There are a number of steps that you need to do before your software can be approved.

    Naturally, you will have to pay a safety deposit and that is usually one month rent for annually of the settlement. That is the place your good religion deposit will likely be taken into account and will kind part or all of your security deposit. Anticipate to have a proportionate amount deducted out of your deposit if something is discovered to be damaged if you move out. It's best to you'll want to test the inventory drawn up by the owner, which can detail all objects in the property and their condition. If you happen to fail to notice any harm not already mentioned within the inventory before transferring in, you danger having to pay for it yourself.

    In case you are in search of an actual estate or Singapore property agent on-line, you simply should belief your intuition. It's because you do not know which agent is nice and which agent will not be. Carry out research on several brokers by looking out the internet. As soon as if you end up positive that a selected agent is dependable and reliable, you can choose to utilize his partnerise in finding you a home in Singapore. Most of the time, a property agent is taken into account to be good if he or she locations the contact data on his website. This may mean that the agent does not mind you calling them and asking them any questions relating to new properties in singapore in Singapore. After chatting with them you too can see them in their office after taking an appointment.

    Have handed an trade examination i.e Widespread Examination for House Brokers (CEHA) or Actual Property Agency (REA) examination, or equal; Exclusive brokers are extra keen to share listing information thus making certain the widest doable coverage inside the real estate community via Multiple Listings and Networking. Accepting a severe provide is simpler since your agent is totally conscious of all advertising activity related with your property. This reduces your having to check with a number of agents for some other offers. Price control is easily achieved. Paint work in good restore-discuss with your Property Marketing consultant if main works are still to be done. Softening in residential property prices proceed, led by 2.8 per cent decline within the index for Remainder of Central Region

    Once you place down the one per cent choice price to carry down a non-public property, it's important to accept its situation as it is whenever you move in – faulty air-con, choked rest room and all. Get round this by asking your agent to incorporate a ultimate inspection clause within the possibility-to-buy letter. HDB flat patrons routinely take pleasure in this security net. "There's a ultimate inspection of the property two days before the completion of all HDB transactions. If the air-con is defective, you can request the seller to repair it," says Kelvin.

    15.6.1 As the agent is an intermediary, generally, as soon as the principal and third party are introduced right into a contractual relationship, the agent drops out of the image, subject to any problems with remuneration or indemnification that he could have against the principal, and extra exceptionally, against the third occasion. Generally, agents are entitled to be indemnified for all liabilities reasonably incurred within the execution of the brokers´ authority.

    To achieve the very best outcomes, you must be always updated on market situations, including past transaction information and reliable projections. You could review and examine comparable homes that are currently available in the market, especially these which have been sold or not bought up to now six months. You'll be able to see a pattern of such report by clicking here It's essential to defend yourself in opposition to unscrupulous patrons. They are often very skilled in using highly unethical and manipulative techniques to try and lure you into a lure. That you must also protect your self, your loved ones, and personal belongings as you'll be serving many strangers in your home. Sign a listing itemizing of all of the objects provided by the proprietor, together with their situation. HSR Prime Recruiter 2010
  5. Adleman, L. M., K. Manders, and G. Miller: 1977, `On taking roots in finite fields'. In: 18th IEEE Symposium on Foundations of Computer Science. pp. 175­-177