VEDIC MATHEMATICS Primes T K Prasad http www
























![(cont’d) Proof: Sum of factors = [2 n - 1] + (2 n - (cont’d) Proof: Sum of factors = [2 n - 1] + (2 n -](https://slidetodoc.com/presentation_image_h2/053ed94e8c2f6dc1b5f792c5fe8e9a46/image-25.jpg)



![Perfection in Python def perfect. Number(n): (factor. List, factor. Sum) = ([], 0) for Perfection in Python def perfect. Number(n): (factor. List, factor. Sum) = ([], 0) for](https://slidetodoc.com/presentation_image_h2/053ed94e8c2f6dc1b5f792c5fe8e9a46/image-29.jpg)
- Slides: 29
VEDIC MATHEMATICS : Primes T. K. Prasad http: //www. cs. wright. edu/~tkprasad Primes 1
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. • • Prasad 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 2
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. Prasad Primes 3
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 193 197 199 211 223 227 229 233 239 241 257 263 269 271 277 281 283 293 307 311 313 317 331 337 349 353 359 367 373 379 383 389 397 401 409 419 421 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 Prasad Primes 6
The Sieve of Eratosthenes • Algorithm to enumerate primes ≤ n : 1. Generate the sequence 2 to n 2. Print the smallest number in the remaining sequence, which is the new prime p. 3. Remove all the multiples of p. 4. Repeat 3 and 4 until the sequence is exhausted.
Hundreds Chart 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
1 – Cross out 1; it is not prime. 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
2 – Leave 2; cross out multiples of 2 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
3– Leave 3; cross out multiples of 3 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
4– Leave 5; cross out multiples of 5 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
5– Leave 7; cross out multiples of 7 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
6–Leave 11; cross out multiples of 11 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
All the numbers left are prime 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100
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). Prasad Primes 17
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). Prasad Primes 18
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 × 3 × 5 981189 = 3 × 11 × 17 × 53 3141879 = 3 × 13 × 6197 Prasad Primes 19
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. Prasad Primes 20
Advanced Material FYI Prasad Primes 21
Perfect Numbers • Euclid (~300 BC) discovered a general formula for even perfect numbers. 2(n - 1) (2 n - 1) is a perfect number whenever (2 n - 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. Prasad Primes 22
Demonstrating perfection! Prove: 2(n - 1) (2 n - 1) is a perfect number, whenever (2 n - 1) is a prime. Proof: Sum of factors = [2(n - 1) + 2(n - 2) + … + 2 + 1] + (2 n - 1) [2(n - 2) + … + 2 + 1] = [2 n - 1] + (2 n - 1) [2(n - 1) - 1] (see next slide) Prasad Primes 23
Auxiliary Result • Show [2(n - 1) + 2(n - 2) + … + 2 + 1] = [2 n - 1] • Let S = [2(n - 1) + 2(n - 2) + … + 2 + 1] 2 * S = [2 n + 2(n - 1) + … + 2*2 + 2] 2 * S - S = 2 n – 1 • S = 2 n - 1 Prasad Primes 24
(cont’d) Proof: Sum of factors = [2 n - 1] + (2 n - 1) [2(n - 1) - 1] = (2 n - 1) [1 + 2(n - 1) - 1] = (2 n - 1) 2(n - 1) (original number) Prasad Primes 25
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 whethere any odd perfect numbers. • Observe: Observe Factoring large primes is a very hard problem so a number of cryptographic systems are based on that fact. Prasad Primes 26
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 perfect. Number(n): (factor. List, factor. Sum) = ([], 0) for i in range(1, 1 + (n / 2)): #help(math) if ( (n % i) == 0 ): factor. List. append(i) factor. Sum += i if n == factor. Sum: return (n, factor. List) else: return False Prasad Primes 29