Appendix: a brief history of numbers God created the natural numbers. Everything else is the work of man. Leopold Kronecker (1823 1891) Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 1
Natural numbers Natural numbers 0, 1, 2, 3, 4,... have two main purposes: they can be used for counting there are 3 apples on the table they can be used for ordering this is the 3rd largest city in the country What s the largest number? Numeral systems A numeral is a symbol or group of symbols that represents a number Unary: numeral means 7 Decimal: numeral 456 means (4 10 2 ) + (5 10 1 ) + (6 10 0 ) numeral 101 means (1 10 2 ) + (0 10 1 ) + (1 10 0 ) Binary: numeral 101 means (1 2 2 ) + (0 2 1 ) + (1 2 0 ),... i.e., decimal 5 Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 2
Basic arithmetic operations Addition (+) + =, 7 + 5 = 12,... Multiplication ( ) =, 7 5 = 35,... Operations + and are defined for all natural numbers: if n and m are natural numbers then n + m and n m are natural numbers as well Subtraction ( ) (inverse of +) 12 7 = 5 What is 7 12? Division (/) (inverse of ) 35/7 = 5 What is 7/35? For any natural numbers a and b 0, there are unique numbers q (quotient) and r (remainder) such that 0 r < b and a = (b q)+r If r = 0 then we say that a is divisible by b For example, 26 = 10 2 + 6, or 26/10 is 2 with remainder 6 Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 3
Prime numbers A prime number (or prime) is a natural number greater than 1 whose only positive divisors are 1 and itself. Or for short: a prime number is a natural number with exactly two natural divisors. The property of being a prime is called primality. The sequence of prime numbers begins 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,... The fundamental theorem of arithmetic: every natural number larger than 1 can be written as a product of primes in a unique way, i.e., unique except for the order. Primes are thus the basic building blocks of the natural numbers. For example, we can write 23244 = 2 2 3 13 149 and any other such factorisation of 23244 will be identical except for the order of the factors. Euclid (325-265 BC): There are infinitely many prime numbers. (Why?) The largest known prime, as of August 2008, is 2 43,112,609 1 (this number is 12, 978, 189 digits long). In 2005, the largest known prime was 2 30402457 1 (9, 152, 052 digits long). Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 4
Two open problems Goldbach s conjecture (1742): every even number a > 2 can be represented as the sum a = b + c of two prime numbers b and c For example, 18 = 11 + 7, 100 = 97 + 3,... Shnirelman (1931) showed that every natural number can be represented as a sum of at most 300, 000 primes. This result was subsequently improved by many authors; currently, the best known result is due to O. Ramaré, who in 1995 showed that every even number n 4 is in fact the sum of at most 6 primes. Twin prime conjecture: there are infinitely many twin primes, pairs of primes with difference 2, such as 5 and 7, or 29 and 31 On May 26, 2004, R. Arenstorf of Vanderbilt University submitted a 38-page proof that there are, in fact, infinitely many twin primes. On June 3, M. Balazard of University Bordeaux reported that Lemma 8 on page 35 is false. As is typical in mathematical proofs, the defect may be correctable or a substitute method may repair the defect. Arenstorf withdrew his proof on June 8, noting A serious error has been found in the paper, specifically, Lemma 8 is incorrect. Largest known twins: 65516468355 2 333333 + 1 and 65516468355 2 333333 1 Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 5
Integer and rational numbers by generalisation By closing the natural numbers under subtraction (inverse of +) we obtain integer numbers..., 3, 2, 1, 0, 1, 2,... By closing the integer numbers under division (inverse of ) we obtain rational numbers of the form m/n, where m, n are integers and n 0 Another reason for introducing rational numbers is to use them for approximate measurements (length, area, weight, time, etc.). For example, 12 hours 35 minutes, that is 12 35 60 hours Decimal representation of rational numbers 833/100 = 8.33 = 8 + 3/10 + 3/100 = 8 10 0 + 3 10 1 + 3 10 2 1/3 = 0.333333... = 0 + 3/10 + 3/100 + 3/1000 + 1/11 = 0.090909... = 0 + 0/10 + 9/100 + 0/1000 + 9/10000 + (with 09 recurring) Any rational number which cannot be expressed as a (finite) decimal fraction has a unique infinite decimal expansion ending with recurring decimals. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 6
Basic arithmetic laws The rationals m/n are still called numbers (remember, originally only natural numbers were numbers ) because basic arithmetic laws extend to rational numbers as well. Namely, for all natural and, moreover, rational numbers, we have a + b = b + a (commutativity of +) a + (b + c) = (a + b) + c (associativity of +) a b = b a (commutativity of ) a (b c) = (a b) c (associativity of ) a (b + c) = (a b) + (a c) (distributivity of over +) Interesting: the rule ( 1) ( 1) = 1 (which is basic for multiplication of negative numbers) is a consequence of our desire to keep distributivity for rational numbers. This rule cannot be proved; it was created or declared artificially without violating the basic arithmetic laws. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 7
Basic arithmetic operations (cont.) Exponentiation: given a rational number a and a natural number n, a n = a a a }{{} n for n > 0, a 0 = 1 Radicals or roots: given a rational a > 0 and a natural n, the nth root or radical of a is the number b, written as n a, such that b n = a a n m = m a n a b = 1 a b Logarithm: the logarithm of a number a relative to a base b is the number c, written as log b a, such that b c = a. For example, log 2 32 = 5 Radicals and logarithms are not defined for all rational numbers... What is 2? What is log 2 3? What is 1? Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 8
Irrational numbers Claim: log 2 3 is irrational (in the sense that there are no integer numbers n and m such that log 2 3 = n/m) Proof by contradiction (or reductio ad absurdum): (1) Assume, hypothetically, that there are integers n and m such that log 2 3 = n/m (2) Then show that this assumption leads us to an absurd, impossible situation, that is, to a contradiction Indeed, log 2 3 = n/m means that 2 n = 3 m. But this is impossible, since 2 n is even and 3 m is odd. Therefore, log 2 3 cannot be rational. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 9
Irrational numbers (cont.) Claim: 2 is irrational Proof: (1) Assume the contrary, that is, 2 = a/b for some integers a and b. (2) By dividing both a and b by all the factors that are common to both, we obtain 2 = m/n, for some integers m and n having no common factors So we have 2 n = m. Squaring both sides we obtain 2n 2 = m 2, and therefore m should be even, that is, m = 2k for some integer k. So we have 2n 2 = (2k) 2, so 2n 2 = 4k 2, and so n 2 = 2k 2. Therefore, n should be even as well. So 2 is a common factor of m and n. But they have no common factor, which is a contradiction Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 10
Sad story :-) The discovery of irrational numbers is usually attributed to Pythagoras, more specifically to the Pythagorean Hippasus of Metapontum, who produced a (most likely geometrical) proof of the irrationality of the square root of 2. The story goes that Hippasus discovered irrational numbers when trying to represent the square root of 2 as a fraction (proof above). However Pythagoras believed in the absoluteness of rational numbers, and could not accept the existence of irrational numbers. He could not disprove their existence through logic, but his beliefs would not accept the existence of irrational numbers and so he sentenced Hippasus to death by drowning. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 11
Real numbers By Pythagoras Theorem, 2 can be regarded as the length of the hypotenuse in the right-angled triangle with legs of length 1 We can approximate this length by means of rational numbers and obtain a sequence 1, 1.4, 1.41, 1.4142, 1.414213562,... The three dots indicate that there would still be more dots to come, no matter how many more might be added to the end. (Why?) We can define 2 as the limit of this sequence. In this respect, 1/3 is represented as 0.3333..., 1 as 0.9999999... (Remember, periodic fractions represent rational numbers.) In general, real numbers can be defined as decimal (or binary, or... ) fractions that have an infinite sequence of digits to the right of the decimal (binary, etc.) point. Real numbers measure continuous quantities like lengthes, weights, etc. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 12
Real numbers and computers A real number is said to be computable if there exists an algorithm that yields its digits. As we shall see later, most real numbers are not computable. Some constructivists accept the existence of only those reals that are computable. The set of definable numbers is broader, but still only countable. Computers can only approximate most real numbers. Most commonly, they can represent a certain subset of the rationals exactly, via either floating point numbers or fixed-point numbers, and these rationals are used as an approximation for other nearby real values. Arbitrary-precision arithmetic is a method to represent arbitrary rational numbers, limited only by available memory, but more commonly one uses a fixed number of bits of precision determined by the size of the processor registers. In addition to these rational values, computer algebra systems are able to treat many irrational numbers exactly by storing an algebraic description (such as 2) rather than their rational approximation. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 13
Graphs of arithmetic functions. 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 exponential order of growth 2 x 0 1 2 3 4 5 6 7. x 2 x quadratic order of growth linear order of growth log 10 x logarithmic order of growth 10 100 seconds 3.168 10 92 years (Age of the universe 1.5 10 9 years) Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 14
Prefixes indicating quantity Prefix Symbol Size Decimal equivalent Comes from Greek nano n 10 9 0.000 000 001 dwarf micro µ 10 6 0.000 001 small milli m 10 3 0.001 Latin thousand centi c 10 2 0.01 Latin hundred deci d 10 1 0.1 Latin tenth deca da, D 10 10 a factor of ten hecto h, H 10 2 100 hundred kilo k, K 10 3 1 000 thousand mega M 10 6 1 000 000 great giga G 10 9 1 000 000 000 giant tera T 10 12 1 000 000 000 000 monster Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 15
However, in Computer Science... Tera can sometimes mean 1099511627776 (2 40 ) instead of 1000000000000, especially in the term terabyte Giga can sometimes mean 1073741824 (2 30 ) for information units, e.g., gigabit or gigabyte, but can also denote 1000000000 of other quantities, e.g., transfer rates: 1 gigabit/s = 1000000000 bit/s Mega can sometimes denote 1048576 (2 20 ) of information units, e.g., a megabyte, but can denote 1000000 (10 6 ) of other quantities, for example, transfer rates: 1 megabit/s = 1000000 bit/s Kilo does not always exactly denote 1000 but is usually equivalent to 1024 (2 10 ), most often when denoting storage. For example, a kilobyte is frequently 1024 bytes, and not 1000 bytes as it should be. A common convention is to use k for 1000 and K for 1024. Fundamentals of Computing 2017 18 (2, appendix) http://www.dcs.bbk.ac.uk/~michael/foc/foc.html 16