tailieunhanh - Algorithms for programmers phần 4

Đối với ma sức mạnh của một nguyên tố lẻ p R để tối đa trong Z / MZ (cũng có trong Z / MZ) là R (vn) = φ (vn) Quay trở lại từ bit r / / bên trái (tức là đối với các bit quan trọng nhất) {return (x (BITS_PER_LONG-r));} | CHAPTER 4. NUMBERTHEORETIC TRANSFORMS NTTS 65 function phi_pp p x . . if x 1 then return p - 1 else return p x - p x-1 Pseudo code to compute m for general m Code Compute phi m Return m function phi m n p x factorization m m product i p i x i ph 1 for i 0 to n-1 ph ph phi_pp p i x i Further we need the notion of Z mZ the ring of units in Z mZ. Z mZ contains all invertible elements units of Z mZ . those which are coprime to m. Evidently the total number of units is given by m Z mZ m If m factorizes as m 2q pq1 . p 1 then Z mZ 2q pk . It turns out that the maximal order R of an element can be equal to or less than Z mZ the ring Z mZ is then called cyclic or noncyclic respectively. For m a power of an odd prime p the maximal order R in Z mZ and also in Z mZ is R pq pq while for m a power of two a tiny irregularity enters R 2q 1 2 2q 2 for k 1 for k 2 for k 3 . for powers of two greater than 4 the maximal order deviates from 2q 2q 1 by a factor of 2. For the general modulus m 2q pq1 . pq the maximal order is R m lcm R 2q R pq1 . R pkqq where lcm denotes the least common multiple. Pseudo code to compute R m Code Maximal order modulo m Return R m the maximal order in Z mZ function maxorder m n p k factorization m m product i p i k i R .1 for i 0 to n-1 t phi_pp p i k i if p i 2 AND k i 3 then t t 2 R lcm R t return R CHAPTER 4. NUMBERTHEORETIC TRANSFORMS NTTS 66 Now we can see for which m the ring Z mZ will be cyclic Z mZ cyclic for m 2 4 pk 2 pk where p is an odd prime. If m contains two different odd primes Pa Pb then R m lcm . pa pb is at least by a factor of two smaller than m . pa pb because both pa and pb are even so Z mZ can t be cyclic in that case. The same argument holds for m 2ko pk if k0 1. For m 2k Z mZ is cyclic only for k 1 and k 2 because of the above mentioned irregularity of R 2k . Pseudo code following 14 for a function that returns the order of some element x in Z mZ Code Order of an element in Z .

TỪ KHÓA LIÊN QUAN