310 likes | 571 Views
VEDIC MATHEMATICS : Primes. T. K. Prasad http://www.cs.wright.edu/~tkprasad. Divisibility. A number n is divisible by f if there exists another number q such that n = f * q. f is called the factor and q is called the quotient . 25 is divisible by 5
E N D
VEDIC MATHEMATICS : Primes T. K. Prasad http://www.cs.wright.edu/~tkprasad Primes
Divisibility • A number n is divisible by f if there exists another number q such that n = f * q. • f is called the factor and q is called the quotient. • 25 is divisible by 5 • 6 is divisible by 1, 2, and 3. • 28 is divisible by 1, 2, 4, 7, 14, and 28. • 729 is divisible by 3, 9, and 243. Primes
Prime Numbers and Composite Numbers • A prime number is a number that has exactly two factors: 1 and itself. • Smallest prime number is 2. • 1 is not a prime number. • Examples: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, etc. • A composite number is a number that has a factor other than 1 and itself. • 1 is not a composite number. Primes
First 100 primes 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 …
Eratosthenes and the Primes • Eratosthenes of Cyrene (276 B.C. - 194 B.C., Greece) was a Greek mathematician, poet, athlete, geographer and astronomer. • Eratosthenes was the librarian at Alexandria, Egypt. • He made several discoveries and inventions including a system of latitude and longitude. He was the first person to calculate the circumference of the Earth, and the tilt of the earth's axis. • Eratosthenes devised a 'sieve' to discover prime numbers.
Sieve Primes
The Sieve of Eratosthenes • Algorithm to enumerate primes ≤ n : • Generate the sequence 2 to n • Print the smallest number in the remaining sequence, which is the new prime p. • Remove all the multiples of p. • Repeat 3 and 4 until the sequence is exhausted.
The Prime Numbers from 1 to 100 are as follows: 2,3,5,7,11,13,17,19, 23,29,31,37,41,43,47, 53,59,61,67,71,73, 79,83,89,97
Perfect Number • A perfect number is a number which is equal to the sum of its (proper) factors. • Examples: 6, 28, 496, 8128, etc 1 + 2 + 3 = 6 1 + 2 + 4 + 7 + 14 = 28 • These were the only perfect numbers known to early Greek mathematicians (~500 BC). Primes
Amicable Numbers • Amicable numbers are pairs of numbers such that the sum of the proper factors of one is equal to the other. • Example: (220, 284) • Proper factors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, which sum to 284; and • Proper factors of 284 are 1, 2, 4, 71, and 142, which sum to 220. • Amicable and perfect numbers were known to the Pythagoreans (~500 BC). Primes
Prime Decomposition • Every natural number greater than one has a unique prime factorization. That is, it can be uniquely expressed as a product of prime numbers. • E.g., 120 = 2 × 2 × 2 × 3 × 5 981189 = 3 × 3 × 11 × 11 × 17 × 53 3141879 = 3 × 13 × 13 × 6197 Primes
Proof that Primes are infinite : : Proof by Euclid (300 B.C. ) • Let us assume that the set of primes is finite. Primes = {2, 3, …, p} • Consider the number n = (2 * 3 * … * p) + 1. • Claim : n is a prime but is not in Primes. • Reason: Each prime divides the first summand but not 1, so it will not divide n. Hence, n is a new prime not in Primes! • Conclusion: Primes are not finite. Primes
Advanced Material FYI Primes
Perfect Numbers • Euclid (~300 BC) discovered a general formula for even perfect numbers. 2(n- 1) (2n - 1) is a perfect number whenever (2n - 1) is a (Mersenne) prime. • Verify that for n = 2, 3, 5, and 7, you get 6, 28, 496, and 8128, respectively. • Fifth perfect number is 33550336, for n = 13. • (211 - 1) is not a prime because 2047 = 23 * 89. Primes
Demonstrating perfection! Prove: 2(n- 1) (2n - 1) is a perfect number, whenever (2n - 1) is a prime. Proof: Sum of factors = [2(n- 1) + 2(n- 2) + … + 2 + 1] + (2n - 1) [2(n- 2) + … + 2 + 1] = [2n - 1] + (2n - 1) [2(n- 1) - 1] (see next slide) Primes
Auxiliary Result • Show [2(n- 1) + 2(n- 2) + … + 2 + 1] = [2n - 1] • Let S = [2(n- 1) + 2(n- 2) + … + 2+ 1] 2 * S = [2n+ 2(n- 1) + … + 2*2 + 2] 2 * S - S = 2n – 1 • S = 2n - 1 Primes
(cont’d) Proof: Sum of factors = [2n - 1] + (2n - 1) [2(n- 1) - 1] = (2n - 1) [1 + 2(n- 1) - 1] = (2n - 1) 2(n- 1) (original number) Primes
Open problems in Number Theory • Goldbach's conjecture: Every even integer greater than 2 can be written as the sum of two primes. • Odd perfect numbers: It is unknown whether there are any odd perfect numbers. • Observe: Factoring large primes is a very hard problem so a number of cryptographic systems are based on that fact. Primes
Primes Generation in Scheme (define (interval-list m n) (if (> m n) '() (cons m (interval-list (+ 1 m) n)))) (define (primes<= n) (sieve (interval-list 2 n))) (primes<= 300)
(cont’d) (define (sieve l) (define (remove-multiples n l) (if (null? l) '() (if (= (modulo (car l) n) 0) ; division test (remove-multiples n (cdr l)) (cons (car l) (remove-multiples n (cdr l)))))) (if (null? l) '() (cons (car l) (sieve (remove-multiples (car l) (cdr l))))))
Perfection in Python def perfectNumber(n): (factorList, factorSum) = ([],0) for i in range(1, 1 + (n / 2)): #help(math) if ( (n % i) == 0 ): factorList.append(i) factorSum += i if n == factorSum: return (n, factorList) else: return False Primes