+Number theory

Notation

[n]: Set of first n natural numbers.

Themes

About Z.

Properties of Numbers

Evenness and odness. Primes and composites. Unique factorization of n as product of primes: n=p1e1...

GCD

gcd(x,y). gcd(x,y)|xy.

Euclid’s algorithm

To find gcd(x, y): if y|x return y else return gcd(x, y-x).

From Euclid’s alg, GCD(x,y)=ax+by. If 1 = ax+by, a multiplicative inverse of x mod y.

Extended Euclid’s alg

Find a,b using Euclid’s alg.

Diophontine equation

Indeterminate polynomial eqn with integer solutions: eg: gcd(x, y) = ax + by in Euclid’s alg.

Conjectures

Goldbach conjecture: xN,x>4, x = sum of 2 primes.

Primes

Special primes

Marsenne prime: writ as 2n1.

Prime number theorem

Num of primes under k = Π(k)=(1+o(1))klnk. \why

(Green, Tao) Number of arithmatic progressions of primes of length k is 1.

Primality testing of n

Don’t try to factor: assumed hard.

Randomized primality test

(Miller Rabin) Pick rand x in \(Z^{+}{n} - \set{0}\). If x|n reject. See if (Fermat’s little th, Lucas-Lehmer) \(\forall x \in Z{n}^{*}: x^{n-1} = 1 \mod n\) holds: do it in polylog time with repeated squaring. Repeat test with many x’s. In failure, reject. Else, check if it is a Carmichael composite number: see if 1 has a non-trivial square root: Write n1=2sd; pick x±1; repeatedly square and check if xmodn=1: if so reject, else if xmodn=1: try starting with another x.

Picking some prime below N

Pick a random number below n, check if it is a prime: if not prime fail. By Prime number th, this alg has (lnn)1 success rate, which can then be amplified.

Special numbers

Square free integers

Aka quadratfrei. Divisible by no perfect square except 1.

Carmichael composite number

Let prime factorization: n=p1e1... Aka Fermat pseudoprimes: They’re Fermat liers: a:an11modn. n is Carmichael iff it is square free; for all pi pi1|n1. \why Eg: 561 = 31117; a:a560=1mod3,mod17,mod11 as 2,10,16|560.

Modulo arithmatic

The remainder fn. 32mod5. abmodn(amodn)(bmodn)modn. So, congruence relation over Z wrt +, *. If abmodnn|ab.

Cancellation law

kakbmodnk(ab)0modpabmodn.

Chinese remainder theorem

Let ni’s coprime, N=jnj. System of simultaneous congruences x=aimodni for i=1k has a unique solution for x in ZN.

Uniqueness

If i,xximodni, and yximodni, xy0modN.

Solving for x

Use Extended Euclid’s alg on 1=rini+siNni to find ri and si, let ei=siNni; then ei1modni but 0modnj; thence find x=i=1kaiei.

Equivalent statements and implications

|ZN||×iZni|. Map x(xmodn1,..) from ZN×iZni is both one to one and onto. Also, Isomorphism by Chinese remainder fn: \(\mathbb{Z}{n} \cong \times{i}\mathbb{Z}{n{i}}\) preserves +, *.

Utility

Useful for manipulating composite numbers. An airthmatic question mod N reduced to arithmatic questions modulo ni, if we know {ni}.

Additive group

\(Z^{+_{p}\) A prime order group. Does not have any subgroups.

Multiplicative group

\(Z_{N^{*}\)

ZN : N’s coprimes in 1,,N1,modN. Proof: GCD with N is 1, so use extended Euclid’s alg to find inverses. If p prime; -1 := p-1; 1±1modp.

Order

N=pq; p, q primes: order = totient function: \(|Z^{*}{N}|=\varphi(N)=(p-1)(q-1)\): we discard multiples of p, q. Also, if \(N= \prod p{i}^{e_{i}}\), φ(N)=(pi1)piei1.

(Euler’s theorem). aφ(N)1modN: Take a,a2ak=e; this is a subgroup of ZN; by Lagrange (see group theory in algebra ref), k|φ(N).

N=piei. |ZN||ZN+|=φ(N)N=i=1tpi1pii=1tii+1=11+t11+log2N.

So, Fermat’s little theorem: p prime: apamodp.

Primitive roots

Aka generator. If \(S = Z_{n}^{}\), g is primitive root of n. \(Z_{p}^{}\) for prime p always has primitive root \why. 7 has primitive roots 3, 5. 1,2,4,pk,2pk have primitive roots for p odd prime and k1.\ \why \tbc

The number of primitive roots, if there are any, is ϕ(ϕ(n)). (See group theory in algebra ref)

Primitive root test

g is primitive root of n iff its multiplicative order is ϕ(n): else it generates a subgroup. Efficiently see if g is a generator: find prime factors of ϕ(n)=ipi, keep seeing if gϕ(n)pi=1.

Quadratic residues

QRn: set of squares mod n. Quadratic non residues. If aQRn,aRn, else a N n.

Finding x same as solving y2=xmodn, or factoring (y2x)modn.

QRp for odd prime p

As structure of \(Z_{p}^{}\) cyclic; writable as {gi} for primitive root g; only even powers {g2i} are squares. So, \(|QR_{p}| = |Z_{p}^{}|/2\).

1 has exactly 2 roots: ±1, and no more: x21modp=(x1)modp(x+1)modp=0 so x-1 = 0 mod p or x+1 = 0 mod p. gp12=1. g2i=±gi by Euler thm.

Jacobi symbol

(ap) = 0 if p|a; +1 if a R p, pa; -1 if a N p.

Legendre: generalization to n=pq; (an) = -1 if a N n; if a R n, (an)=1, but can’t tell if a R n given (an)=1.

QRn for p, q odd primes; n = pq (Blum integer)}

4 1: take x2=1modn; ±1 are obvious roots; Chinese remainder thm solutions s for x=1modp;x=1modq and t for x=1modp;x=+1modq are the other two. As square roots appear in pairs, s = -t. To find the non trivial square roots, must know p, q.

Similarly, for any odd m=m1m2, 1 has 4 roots.

So, any a2QRn has 4 roots: a1. So, 41|Zn||QRn|.