VEDIC MATHEMATICS : Primes

Post on 01-Jan-2016

265 views 43 download

Tags:

description

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 - PowerPoint PPT Presentation

Transcript of VEDIC MATHEMATICS : Primes

Prasad Primes 1

VEDIC MATHEMATICS : Primes

T. K. Prasadhttp://www.cs.wright.edu/~tkprasad

Prasad Primes 2

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.

Prasad Primes 3

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.

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

Prasad Primes 6

The Sieve of Eratosthenes

• Algorithm to enumerate primes ≤ n :

1. Generate the sequence 2 to n2. 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.

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

Hundreds Chart

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

1 – Cross out 1; it is not prime.

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

2 – Leave 2; cross out multiples of 2

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

3– Leave 3; cross out multiples of 3

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

4– Leave 5; cross out multiples of 5

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

5– Leave 7; cross out multiples of 7

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

6–Leave 11; cross out multiples of 11

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

All the numbers left are prime

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

Prasad Primes 17

Perfect Number

• A perfect number is a number which is equal to the sum of its (proper) factors.

• Examples: 6, 28, 496, 8128, etc1 + 2 + 3 = 6

1 + 2 + 4 + 7 + 14 = 28

• These were the only perfect numbers known to early Greek mathematicians (~500 BC).

Prasad Primes 18

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 19

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

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

Prasad Primes 21

Advanced Material

FYI

Prasad Primes 22

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.

Prasad Primes 23

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)

Prasad Primes 24

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

Prasad Primes 25

(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)

Prasad Primes 26

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.

• ObserveObserve: Factoring large primes is a very hard problem so a number of cryptographic systems are based on that fact.

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 Pythondef 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

Prasad Primes 29