Computational Number Theory and Algebra Lucas Primality Test

Computational Number Theory and Algebra Lucas Primality Test

Computational number theory and algebra Lucas Primality Test Section I: Lucas Sequences Suppose that a; d are non-zero integers with the same parity. p p a + d a − d a2 − d Let α = , β = , b = . Then α + β = a and αβ = b. 2 2 4 n n α − β n n Consider the sequences Un = p and Vn = α + β . d We have: αn − βn = (α + β)(αn−1 − βn−1) − αβ(αn−2 − βn−2); and αn + βn = (α + β)(αn−1 + βn−1) − αβ(αn−2 + βn−2): That is, both Un and Vn satisfy the recurrence Sn = aSn−1 − bSn−2. Further, we can see that U0 = 0, U1 = 1, V0 = 2, V1 = a are all integers; thus both these sequences consist of integers. These sequences are known as Lucas sequences. For clarity, we define them again below. Definition The Lucas sequences Un(a; b) and Vn(a; b) are defined as: U0 = 0;U1 = 1;Un = aUn−1 − bUn−2; and V0 = 2;V1 = a; Vn = aVn−1 − bVn−2: The characteristic polynomial of both recurrences are f(x) = x2 − ax + b. The discriminant of this polynomial is a2 − 4b, which is equal to d, and the roots are α; β. Remarks: Usually d is assumed to be a non-square, but we will make this assumption only when necessary. Also, the Fibonacci sequence Fn is the Lucas sequence Un(−1; 1) with a = −1; b = 1, d = 5. 1 Section II: Arithmetic properties Let a; b; d be as in the previous section, and let p be an odd prime. Since our goal is primality testing, we'll assume that d is constant, so that p > d. d Let r = , i.e. r = 1 if d is a square modulo p and r = −1 otherwise. p Theorem 1 Up−r ≡ 0 (mod p). In particular, for the Fibonacci sequence Fn = Un(−1; 1), we have: Corollary 2 If n is a prime, then njFn−1 if n ≡ ±1 (mod 5) and njFn+1 if n ≡ ±2 (mod 5). The Lucas primality test: Fix a Lucas sequence U(a; b). Given an integer d n, find r = ; this is easier when d is a prime ≡ 1 mod 4. Then find U n n−r mod n; if it is zero, then n passes the test. When the sequence is Fn, the test is called Lucas' Fibonacci test. Computing Un (mod n) efficiently can be done as described in the next section. We now prove the theorem. Proof of Theorem 1: We consider the cases r = 1 and r = −1 separately. Case 1: r = 1 2 We work in Zp. Let c 2 Zp be such that c = d. Thus, both α; β are elements αp−1 − βp−1 of ∗ and we have αp−1 = βp−1 = 1; hence U = = 0. Zp p−1 c Case 2: r = −1 p p Now we work in Zp[ d] = fa + b d : a; b 2 Zpg. This is equivalent to working 2 in Zp[x] modulo (x − d). (p−1)=2 We have xp−1 = (x2) = d(p−1)=2 = −1. Now (a + x)p = ap + xp = a + xp = a − x; hence (a + x)p+1 = a2 − x2 = a2 − d = 4b. Similarly, (a − x)p = a + x and (a − x)p+1 = a2 − x2 = 4b. p+1 p+1 2 Thus, (a + x) = (a − x) (mod (x − d)), i.e. Up+1 = 0. This completes the proof of Theorem 1. Remarks: 1. The calculations for Up−r (or for Vp−r) essentially come from the identity p p p (x + a) = x + a in Zp[x], where we further reduced the term x modulo some quadratic polynomial. Writing F (x) = (x + a)p and G(x) = xp + a, the Lucas test verifies that F (x) = G(x) modulo some quadratic polyno- mial. This identity, which is true only for primes, is the starting point of the AKS algorithm, which checks that F (x) = G(x) modulo h(x) for a bunch of polynomials h(x). 2 2. It appears that we do not know any composite n ≡ ±2 (mod 5), which passes both the Fibonacci test as well as the test 2n−1 ≡ 1 (mod n); thus, performing just these two tests should detect composites effectively for such values. If you find such a composite n which does pass both tests, you win $620 with $500 from Selfridge, and $20 from Pomerance. If you prove that no such composite exists, you stilll win the same amount, with $500 from Pomerance, and $20 from Selfridge. The remaining $100 comes from Wagstaff in both cases. Section III: Computing the Lucas sequence effi- ciently The trivial approach to compute Un and Vn takes O(n) time, whereas we must do it in time poly(log n). This can be done as follows. U U a −b U U We have n n−1 = n−1 n−2 . Un−1 Un−2 1 0 Un−2 Un−3 a −b Un Un−1 Let M = and Mn = . 1 0 Un−1 Un−2 a 1 Then M = and M = MM = M n−2M . 2 1 0 n n−1 2 By repeatedly squaring M, we can compute Mn (mod n) in poly(log n) time. Section IV: Exercises 1. Let p be an odd prime and f(x) a monic quadratic polynomial with no p2 roots in Zp. Show that x ≡ x (mod f(x)) in Zp[x]. Hint: First show this for polynomials of the form x2 −d, and for other cases make a substitution y = r + sx for suitable r; s. d d 2. Show that if = −1, then V ≡ 2b (mod p) and if = 1, then p p+1 p Vp−1 ≡ 2 (mod p). 3. We work in Zp. Let T denote the set of 2 by 2 matrices which are unimod- ular, i.e. with determinant ±1. Find t = jT j. Also show that if M 2 T , t then M = I2, where In is the n by n identity matrix. Hint: Use the method with which we proved Euler's theorem. Remark: Exercises 1 and 3 can both be used for primality testing. 3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us