Exploring Numbers

Exploring Numbers

MATH36032 Problem Solving by Computer Exploring numbers I There are infinitely many prime numbers I (Fermat's Last Theorem:) There is not no non-trivial integer solutions to x n + y n = zn for n ≥ 3 I (Fermat's Little Theorem:) if p is a prime, then for any number a co-prime to p, then ap−1 ≡ 1 (mod p). I Famous (proved) theorems in number theory I Special numbers: Mersenne prime 2p − 1, Fermat number 2n Fn = 2 + 1, ··· I Important applications: Random number generation, cryptography (RSA public-key algorithm) Integers and prime numbers I Many problems are simple to state, yet difficult to prove or refute I Special numbers: Mersenne prime 2p − 1, Fermat number 2n Fn = 2 + 1, ··· I Important applications: Random number generation, cryptography (RSA public-key algorithm) Integers and prime numbers I Many problems are simple to state, yet difficult to prove or refute I Famous (proved) theorems in number theory I There are infinitely many prime numbers I (Fermat's Last Theorem:) There is not no non-trivial integer solutions to x n + y n = zn for n ≥ 3 I (Fermat's Little Theorem:) if p is a prime, then for any number a co-prime to p, then ap−1 ≡ 1 (mod p). I Important applications: Random number generation, cryptography (RSA public-key algorithm) Integers and prime numbers I Many problems are simple to state, yet difficult to prove or refute I Famous (proved) theorems in number theory I There are infinitely many prime numbers I (Fermat's Last Theorem:) There is not no non-trivial integer solutions to x n + y n = zn for n ≥ 3 I (Fermat's Little Theorem:) if p is a prime, then for any number a co-prime to p, then ap−1 ≡ 1 (mod p). I Special numbers: Mersenne prime 2p − 1, Fermat number 2n Fn = 2 + 1, ··· Integers and prime numbers I Many problems are simple to state, yet difficult to prove or refute I Famous (proved) theorems in number theory I There are infinitely many prime numbers I (Fermat's Last Theorem:) There is not no non-trivial integer solutions to x n + y n = zn for n ≥ 3 I (Fermat's Little Theorem:) if p is a prime, then for any number a co-prime to p, then ap−1 ≡ 1 (mod p). I Special numbers: Mersenne prime 2p − 1, Fermat number 2n Fn = 2 + 1, ··· I Important applications: Random number generation, cryptography (RSA public-key algorithm) Unproved conjectures in number theory I Goldbach Conjecture: every even integer greater than two is the sum of two prime numbers (tested by for all integer up to 1020) I Twin Prime Conjecture: are there infinitely many pairs of twin primes like (5; 7); (29; 31); ··· ? Largest twin prime pair known 2996863034895 · 21290000 ± 1 (388; 342 digits) I Collatz Conjectures: For any integer n, the iteration ( 3n + 1; if n is odd; n 7! n=2; if n is even; eventually contains 1. I Riemann Hypothesis: All non-trivial zeroes of the zeta function 1 X ζ(s) = n−s n=1 have real part 1=2 (on the complex plane). Two "simple" questions in the introduction Q1: what is the smallest (in absolute value) integer solutions to x3 + y 3 + z3 = 42? x = −80538738812075974; y = 80435758145817515; z = 12602123297335631: Q2: what is the smallest non-negative integer solutions to x y z + + = 4? y + z z + x x + y x = 154476802108746166441951315019919837485664325669565431700026634898253202035277999; y = 36875131794129999827197811565225474825492979968971970996283137471637224634055579; z = 4373612677928697257861252602371390152816537558161613618621437993378423467772036: Some related built-in functions I primes(N): return all primes up to N I isprime: whether a number is prime I factor: factorize the number I gcd: greatest common divisor I lcm: least common multiplier Each type has its own range, for example: I int8: [−27; 27 − 1] = [−128; 127] I int64: [−263; 263 − 1] = [−9223372036854775808; 9223372036854775807] (19 digits) I uint16: [0; 216 − 1] = [0; 65535] I double: about [−253; 253](≈ 9 × 1015) I Many operations (like sqrt) can not be applied to integers. I Make sure the number stays in the right range (otherwise the number is shrinked to the range) I Use symbolic numbers (though slower), if outside this range, like the factorization of 20!: factor(factorial(sym(20))) Representing numbers in MATLAB I double: the default type for any decimal number, like the output for rand I int8, int16, int32, int64: signed integers I uint8, uint16, uint32, uint64: unsigned integers I Many operations (like sqrt) can not be applied to integers. I Make sure the number stays in the right range (otherwise the number is shrinked to the range) I Use symbolic numbers (though slower), if outside this range, like the factorization of 20!: factor(factorial(sym(20))) Representing numbers in MATLAB I double: the default type for any decimal number, like the output for rand I int8, int16, int32, int64: signed integers I uint8, uint16, uint32, uint64: unsigned integers Each type has its own range, for example: I int8: [−27; 27 − 1] = [−128; 127] I int64: [−263; 263 − 1] = [−9223372036854775808; 9223372036854775807] (19 digits) I uint16: [0; 216 − 1] = [0; 65535] I double: about [−253; 253](≈ 9 × 1015) Representing numbers in MATLAB I double: the default type for any decimal number, like the output for rand I int8, int16, int32, int64: signed integers I uint8, uint16, uint32, uint64: unsigned integers Each type has its own range, for example: I int8: [−27; 27 − 1] = [−128; 127] I int64: [−263; 263 − 1] = [−9223372036854775808; 9223372036854775807] (19 digits) I uint16: [0; 216 − 1] = [0; 65535] I double: about [−253; 253](≈ 9 × 1015) I Many operations (like sqrt) can not be applied to integers. I Make sure the number stays in the right range (otherwise the number is shrinked to the range) I Use symbolic numbers (though slower), if outside this range, like the factorization of 20!: factor(factorial(sym(20))) Prime number theorem Problem: verify that the number of prime up N is about N= log N, when N is large? How do you use the built-in function primes to accomplish this? Related Problem: find the largest twin primes both less than or equal to N Twin prime conjecture: are there infinitely many twin primes? Twin primes Problem: List all twin primes up to N Find all pairs of consecutive primes in the output of primes, with gap exactly two. Twin prime conjecture: are there infinitely many twin primes? Twin primes Problem: List all twin primes up to N Find all pairs of consecutive primes in the output of primes, with gap exactly two. Related Problem: find the largest twin primes both less than or equal to N Twin primes Problem: List all twin primes up to N Find all pairs of consecutive primes in the output of primes, with gap exactly two. Related Problem: find the largest twin primes both less than or equal to N Twin prime conjecture: are there infinitely many twin primes? Largest gap between consecutive primes 1 Problems: what is the largest gap between two consecutive primes that are less than or equal to a given number N 1More on wiki: https://en.wikipedia.org/wiki/Prime_gap Unfortunate, Fn with n ≤ 4 are the only known prime numbers; the conjecture was refuted first by Euler in 1732 by showing that 32 F5 = 2 + 1 = 4294967297 = 641 × 6700417: Current Fn is completely factorized up to n = 11, and incompletely factorized for a few more (only one or more factors of Fn are known). 2n Fermat prime number: Fn = 2 + 1 Observations made by Pierre de Fermat: 1 F0 = 2 + 1 =3 is prime 2 F1 = 2 + 1 =5 is prime 22 F2 = 2 + 1=17 is prime 23 F3 = 2 + 1=257 is prime 24 F4 = 2 + 1=65537 is prime He concluded all such numbers are prime. Current Fn is completely factorized up to n = 11, and incompletely factorized for a few more (only one or more factors of Fn are known). 2n Fermat prime number: Fn = 2 + 1 Observations made by Pierre de Fermat: 1 F0 = 2 + 1 =3 is prime 2 F1 = 2 + 1 =5 is prime 22 F2 = 2 + 1=17 is prime 23 F3 = 2 + 1=257 is prime 24 F4 = 2 + 1=65537 is prime He concluded all such numbers are prime. Unfortunate, Fn with n ≤ 4 are the only known prime numbers; the conjecture was refuted first by Euler in 1732 by showing that 32 F5 = 2 + 1 = 4294967297 = 641 × 6700417: 2n Fermat prime number: Fn = 2 + 1 Observations made by Pierre de Fermat: 1 F0 = 2 + 1 =3 is prime 2 F1 = 2 + 1 =5 is prime 22 F2 = 2 + 1=17 is prime 23 F3 = 2 + 1=257 is prime 24 F4 = 2 + 1=65537 is prime He concluded all such numbers are prime. Unfortunate, Fn with n ≤ 4 are the only known prime numbers; the conjecture was refuted first by Euler in 1732 by showing that 32 F5 = 2 + 1 = 4294967297 = 641 × 6700417: Current Fn is completely factorized up to n = 11, and incompletely factorized for a few more (only one or more factors of Fn are known). Make sure the right operation is applied on the string or vector (convert back into numbers), like the built-in function str2num. Numbers and Digits num2str: conversion of a number like 2020 into string (sequence of characters). You can convert digital string back to numbers, like 1 str2num('2020'); % the output is the number 2020 Equivalently, how to convert a number into a vector of number (from the number 2020 to [2, 0, 2, 0])? 1 function dig = num2dig(n) 2 % convert a number into a vector of digits 3 % for example: num2dig(2020) --> [2 0 2 0] Numbers and Digits num2str: conversion of a number like 2020 into string (sequence of characters).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    41 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us