Integers, Division, Primes and Composites

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

In number theory, which concept is utilized for organizing data and facilitating efficient storage within computer science?

  • Encryption
  • Error correcting codes
  • Random number generation
  • Indexing (correct)

Given two integers, p and q, and that p divides q, which statement is true?

  • _p_ is a multiple of _q_
  • _q_ is a multiple of _p_ (correct)
  • _q_ is a factor of _p_
  • _p_ equals _q_

If a divides b and a also divides c, which of the following expressions is a guaranteed to divide?

  • b - c
  • c / b
  • b + c (correct)
  • b * c

If an integer n is divisible by both integers x and y, what can be said about the relationship between x, y, and n?

<p><em>x</em> and <em>y</em> jointly divide <em>n</em>. (B)</p> Signup and view all the answers

Which statement accurately describes a prime number?

<p>A positive integer greater than 1 divisible only by 1 and itself. (B)</p> Signup and view all the answers

According to the Fundamental Theorem of Arithmetic, what is a necessary characteristic of the factors when a positive integer greater than 1 is expressed as a product?

<p>The factors must all be prime numbers. (C)</p> Signup and view all the answers

When testing if a number n is prime by checking for divisors, which set of numbers must you test as potential factors to determine primality?

<p>All prime numbers less than or equal to the square root of <em>n</em>. (D)</p> Signup and view all the answers

If n is a composite number, what does the theorem regarding prime divisors suggest?

<p><em>n</em> has at least one prime divisor less than or equal to √<em>n</em>. (D)</p> Signup and view all the answers

In the context of the division algorithm, given an integer a and a positive integer d, which expression is correct regarding the unique integers q and r?

<p>$a = dq + r$ (B)</p> Signup and view all the answers

According to the division algorithm, what range does the remainder (r) fall into, given an integer a and a positive integer d?

<p>0 ≤ <em>r</em> &lt; <em>d</em> (D)</p> Signup and view all the answers

What is the formal definition of the greatest common divisor (gcd) of integers a and b?

<p>The largest integer <em>d</em> such that <em>d</em> divides both <em>a</em> and <em>b</em>. (D)</p> Signup and view all the answers

How is the greatest common divisor, gcd(a, b), found using factorization?

<p>By multiplying the smallest powers of all common prime factors in the factorization of <em>a</em> and <em>b</em>. (D)</p> Signup and view all the answers

What defines the least common multiple (lcm) of two positive integers a and b?

<p>The smallest positive integer that is divisible by both <em>a</em> and <em>b</em>. (D)</p> Signup and view all the answers

When calculating the least common multiple (lcm) of integers a and b using their prime factorizations, how are the prime factors used?

<p>Multiply the highest powers of all prime factors present in either <em>a</em> or <em>b</em>. (C)</p> Signup and view all the answers

What is the key principle behind the Euclidean Algorithm for finding the greatest common divisor (GCD) of two numbers?

<p>Repeatedly divide the larger number by the smaller number and replace the larger number with the remainder until the remainder is zero. (B)</p> Signup and view all the answers

What does the expression 'a ≡ b (mod m)' signify in modular arithmetic?

<p>m divides (a - b). (B)</p> Signup and view all the answers

What condition must be met for a to be congruent to b modulo m?

<p><em>a</em> mod <em>m</em> should be equal to <em>b</em> mod <em>m</em>. (C)</p> Signup and view all the answers

If a ≡ b (mod m) and c ≡ d (mod m), which congruence is always true?

<p>a + c ≡ b + d (mod m) (B)</p> Signup and view all the answers

In the context of pseudorandom number generators, what is the role of the 'modulus' in the linear congruential method?

<p>It determines the period of the generated sequence. (D)</p> Signup and view all the answers

With regard to pseudorandom number generators using the linear congruential method, what are the constraints on the four chosen numbers (modulus m, multiplier a, increment c, and seed x₀)?

<p>2 ≤ <em>a</em> &lt; <em>m</em>, 0 ≤ <em>c</em>&lt;<em>m</em>, 0 ≤<em>x₀</em>&lt;<em>m</em>. (A)</p> Signup and view all the answers

In computer science, hash functions are used, What is the primary purpose of a hash function?

<p>To map data of arbitrary size to data of a fixed size. (D)</p> Signup and view all the answers

What is a potential problem that can arise when using a hash function?

<p>Two different inputs may produce the same output. (B)</p> Signup and view all the answers

When a collision is detected in a hash table, and 'moving to the next available location' is used, what sequence of equations would try to find a space for k when modulo n?

<p>$h_i(k) = (k + i) \text{ mod } n$ (B)</p> Signup and view all the answers

In the Caesar cipher, if A is shifted to D, what shift is applied?

<p>A shift of 3 to the right (A)</p> Signup and view all the answers

In the Caesar cipher encryption technique, the formula is represented as f(p) = (p + 3) mod 26. Given this, what formula returns the inverse function that would decode the message?

<p>f⁻¹(p) = (p - 3) mod 26 (C)</p> Signup and view all the answers

Which component specifies the set of all possible keys in a cryptosystem?

<p>Keyspace (K) (D)</p> Signup and view all the answers

How does public key cryptography improve upon private key cryptosystems regarding key exchange?

<p>It allows keys to be exchanged publicly without compromising security. (A)</p> Signup and view all the answers

What mathematical property is fundamental to ensuring the security of the RSA cryptosystem?

<p>Difficulty of factoring large numbers (D)</p> Signup and view all the answers

When using the RSA encryption method, what constitutes an individual's encryption key?

<p>A pair of numbers (n, e). (A)</p> Signup and view all the answers

What must Alice and Bob initially agree upon in the Diffie-Hellman key exchange?

<p>A large prime number (<em>p</em>) and a primitive root (<em>a</em>) of <em>p</em> (B)</p> Signup and view all the answers

What is the binary representation of the decimal number 27?

<p>11011 (A)</p> Signup and view all the answers

An integer is expressed in base 8 as (7016)₈. What is its decimal equivalent?

<p>3598 (D)</p> Signup and view all the answers

What is the decimal expansion of the hexadecimal number (2AE0B)₁₆?

<p>175627 (D)</p> Signup and view all the answers

If the octal expansion of (12345)₁₀ is (30071)₈, what quotients gave the correct results, from right to left?

<p>(3, 8, 24, 192, 1543) (D)</p> Signup and view all the answers

In the context of Algorithm 2 (Addition of Integers), what does the variable d represent in each iteration of the loop?

<p>The carry-over value for the current digit position (A)</p> Signup and view all the answers

What represents pseudo code for Binary Exponentiation, calculating $x := (x * power) \text{ mod } m$?

<p><code>for i := 0 to k - 1</code> <code>if aᵢ == 1 then x := (x * power) mod m</code> (A)</p> Signup and view all the answers

Flashcards

Number Theory

A branch of mathematics exploring integers and their properties.

Integers (Z)

Whole numbers including zero, positives, and negatives.

Positive Integers (Z+)

Whole numbers greater than zero.

Divides

An integer 'a' divides 'b' if there is an int. 'c' st. b = ac.

Signup and view all the flashcards

Factor

If 'a' divides 'b', then 'a' is a factor of 'b'.

Signup and view all the flashcards

Multiple

If 'a' divides 'b', then 'b' is a multiple of 'a'.

Signup and view all the flashcards

Divisibility Property 1

If a|b and a|c, then a|(b+c).

Signup and view all the flashcards

Divisibility Property 2

If a|b, then a|bc for all integers c.

Signup and view all the flashcards

Divisibility Property 3

If a|b and b|c, then a|c.

Signup and view all the flashcards

Prime Number

A positive integer greater than 1, divisible only by 1 and itself.

Signup and view all the flashcards

Composite Number

A positive integer greater than 1 that is not prime.

Signup and view all the flashcards

Fundamental Theorem of Arithmetic

Any positive integer greater than 1 can be expressed as a product of prime numbers.

Signup and view all the flashcards

Factorization

Process of finding prime factors of a number.

Signup and view all the flashcards

Simple primality test

Test if x < n divides it. If not it is composite.

Signup and view all the flashcards

Prime Divisor Theorem

If n is composite, n has a prime divisor ≤ √n

Signup and view all the flashcards

Infinitude of Primes

There are an infinite number of primes.

Signup and view all the flashcards

Division Algorithm

Unique integers q and r, with 0 <= r < d, such that a = dq + r.

Signup and view all the flashcards

Dividend

In a = dq + r, 'a' is called the dividend.

Signup and view all the flashcards

Divisor

In a = dq + r, 'd' is called the divisor.

Signup and view all the flashcards

Quotient

In a = dq + r, 'q' is called the quotient.

Signup and view all the flashcards

Remainder

In a = dq + r, 'r' is called the remainder.

Signup and view all the flashcards

Greatest Common Divisor (GCD)

Largest integer d such that d|a and d|b.

Signup and view all the flashcards

Least Common Multiple (LCM)

Smallest positive integer divisible by both a and b.

Signup and view all the flashcards

Euclid's Algorithm

Efficient method for computing the GCD.

Signup and view all the flashcards

Euclid algorithm steps

Also Any divisor of 91 and 14 must also be a divisor of 287

Signup and view all the flashcards

Modular Arithmetic

Remainder of an integer when divided by a positive integer.

Signup and view all the flashcards

Congruence Relation

a is congruent to b modulo n if n divides a-b.

Signup and view all the flashcards

Congruence properties

If a=b (mod m) and c=d (mod m) then a+c = b+d (mod m) and ac = bd (mod m).

Signup and view all the flashcards

Hash Function

An algorithm that maps data of arbitrary length to fixed length.

Signup and view all the flashcards

Caesar Cipher

Shifts letters in a message by a fixed amount.

Signup and view all the flashcards

Cryptosystem

Set of plaintext strings, ciphertext strings, keyspace, encryption functions, and decryption functions.

Signup and view all the flashcards

Private key cryptosystem

Shift cipher is an example.

Signup and view all the flashcards

Public key cryptosystem

Alternative to shift cipher.

Signup and view all the flashcards

Public known encryption key

Everyone has encryption, but you can't decrypt to read it.

Signup and view all the flashcards

Secret decryption keys

No one can read plaintext message without the key

Signup and view all the flashcards

RSA Cryptosystem

Algorithm for public key cryptography.

Signup and view all the flashcards

Key Exchange

Exchange a secret key over an insecure communication over shared information

Signup and view all the flashcards

Diffie Hellman

Agree to use prime numbers to share key

Signup and view all the flashcards

RSA Encryption

A message M is translated into sequences of two-digit numbers.

Signup and view all the flashcards

RSA Decryption

quickly recovered when the decryption key d.

Signup and view all the flashcards

Study Notes

Integers and Division

  • Number theory explores integers and their properties
  • Z represents the set of integers {..., -2, -1, 0, 1, 2, ...}
  • Z+ represents the set of positive integers {1, 2, ...}
  • Number theory finds applications in computer science, such as indexing, encryption, error correction, and random number generation

Division

  • For integers a and b (a ≠ 0), a divides b if there exists an integer c such that b = ac
  • If a divides b, then a is a factor of b, and b is a multiple of a
  • The notation a | b signifies that a divides b

Divisibility Properties

  • If a, b, and c are integers, then
    • If a | b and a | c, then a | (b + c)
    • If a | b, then a | bc for all integers c
    • If a | b and b | c, then a | c

Primes and Composites

  • A prime number is a positive integer greater than 1, divisible only by 1 and itself
    • Examples of primes include: 2, 3, 5, 7, 11, 13, etc.
  • A composite number is a positive integer greater than 1 that is not prime.
    • Examples of composite numbers include: 4, 6, 8, 9, etc.

Fundamental Theorem of Arithmetic

  • Any positive integer greater than 1 can be expressed as a product of prime numbers
    • Factorization is the process of finding these prime factors

Factorization of Composites into Primes

  • Examples include:
    • 100 = 2 * 2 * 5 * 5 = 2² * 5²
    • 99 = 3 * 3 * 11 = 3² * 11

Primality Testing

  • Simple Approach 1: Test if any number x < n divides n; if so, n is composite
  • Approach 2: Test if any prime x < n divides n; if so, n is composite.
    • If n is relatively small, this test is good because we can enumerate (memorize) all small primes
    • If n is large there can be larger not obvious primes

Theorem for Primality Testing

  • If n is a composite number, then n has a prime divisor less than or equal to √n
  • Approach 3: to test its primality, test if any prime number x < √n divides it

Number of Primes

  • There are infinitely many primes
  • Proof by Euclid: Assume a finite number of primes, p1, p2, ..., pn; then Q = p1p2...pn + 1 is not divisible by any of these primes, a contradiction

Division with Remainder

  • For an integer a and a positive integer d, there are unique integers q and r with 0 ≤ r < d such that a = dq + r
    • a is the dividend, d the divisor, q the quotient, and r the remainder
    • q = a div d, r = a mod d

Greatest Common Divisor (GCD)

  • For integers a and b, not both 0, the largest integer d such that d | a and d | b is the greatest common divisor, denoted gcd(a, b)
  • Factoring can find the GCD by factoring a and b into their prime factorizations: a=p1^a1 * p2^a2 * p3^a3 ... pk^ak and b = p1^b1 * p2^b2 * p3^b3 ... pk^bk, then: gcd(a,b) = p1^min(a1,b1) * p2^min(a2,b2) * p3^min(a3,b3) ... pk^min(ak,bk)

Least Common Multiple (LCM)

  • For two positive integers a and b, the least common multiple, denoted lcm(a, b), is the smallest positive integer divisible by both a and b
  • Factoring can find the LCM by factoring a and b into their prime factorizations: a=p1^a1 * p2^a2 * p3^a3 ... pk^ak and b = p1^b1 * p2^b2 * p3^b3 ... pk^bk, then: lcm(a,b) = p1^max(a1,b1) * p2^max(a2,b2) * p3^max(a3,b3) ... pk^max(ak,bk)

Euclid's Algorithm

  • Euclid's algorithm provides a more efficient method for computing the GCD, it is based on successively applying the division algorithm
  • To find gcd(287, 91), divide the larger number (287) by the smaller one (91) to get 287 = 3*91 + 14
  • Any divisor of 91 and 287 must also be a divisor of 14 and then gcd(287,91) = gcd(91,14)
  • The same trick can be applied again

Modular Arithmetic

  • Focuses on the remainder of an integer when divided by a positive integer

Congruency

  • Integers a and b are congruent modulo m (a ≡ b (mod m)) if m divides a - b
  • a ≡ b (mod m) if and only if a mod m = b mod m

Congruency Theorems

  • Integers a and b are congruent modulo m if and only if there exists an integer k such that a = b + mk
  • If a ≡ b (mod m) and c ≡ d (mod m), then:
    • a + c ≡ b + d (mod m)
    • ac ≡ bd (mod m)
  • (a + b) mod m = ((a mod m) + (b mod m)) mod m
  • ab mod m = ((a mod m)(b mod m)) mod m

Application of Modular Arithmetic in CS

  • Modular arithmetic and congruencies are used in computer science for:
    • Pseudorandom number generators
    • Hash functions
    • Cryptology

Pseudorandom Number Generators

  • Needed to simulate random choices in programs
  • Linear Congruential Method: Choose 4 numbers: the modulus m, multiplier a, increment c, and seed x0, such that 2 < a <m, 0 < c < m, 0 < x0 < m
  • A sequence is generated by following formula xn+1 = (a*xn + c) mod m

Hash Functions

  • Algorithms that map data of arbitrary length to data of a fixed length
  • Returns hash values or hash codes
  • A common hash function is h(k) = k mod n, where n is the number of available storage locations

Security

Cryptology

  • Caesar Cipher: Shift letters in the message by 3, mapping last three letters to the first three
    • If the index of the letter is p represented as: f(p) = (p + 3) mod 26

Cryptosystems

  • A cryptosystem is a five-tuple (P, C, K, E, D), where:
    • P is the set of plaintext strings
    • C is the set of ciphertext strings
    • K is the keyspace (the set of all possible keys)
    • E is the set of encryption functions
    • D is the set of decryption functions

Public Key Cryptography

  • Shift cipher is an example of private key cryptosystems
  • The encryption key can easily find the decryption key, it is necessary to exchange this key safely
  • Public key cryptosystems as an alternative, were Introduced in 1970s
    • Use a publicly known encryption key vs. secret decryption keys
    • An extraordinary amount of work needed to recover the plaintext message without knowing decryption keys

The RSA cryptosystem

  • Developed by Ronald Rivest, Adi Shamir and Leonard Adleman (1976) from the Massachusetts Institute of Technology
  • Every User as an encryption key (n, e) comprised of:
    • n: the product of two large primes p and q, say with 200 digits each.
    • e: relatively prime to (p - 1)(q – 1)

RSA encryption

  • A plaintext message M is first translated into sequences of two-digit numbers
    • A is translated into 00, B into 01,..., and Jinto 09, etc.
    • Concatenate these two-digit numbers into strings of digits
    • Divide this string into equally sized blocks of 2N digits
    • 2N: the largest even number such that the number 2525 ... 25 with 2N digits does not exceed n
    • As a result, M is now translated into a sequence of integers ml,m2, ..., mk for some integer k.
    • Transform each block mi to a ciphertext block ci, following this formala: C = Me mod n

RSA decryption

  • Plaintext message can be quickly recovered when the decryption key d, an inverse of e modulo (p - 1)(q – 1), is known
    • Follows the expression: Cd = (Me)d = Mde = M1+k(p-1)(q-1) (mod n)

RSA as public key system

  • Because RSA cryptosystem is suitable for public key cryptography
    • Possible to rapidly construct a public key by finding two large primes p and q, each with more than 200 digits
    • Possible to find an integer e relatively prime to (p - 1)(q – 1)
    • Quickly find an inverse d of e modulo (p - 1)(q – 1)
  • However, no method is known to decrypt messages that is not based on finding a factorization of n
    • The most efficient factorization methods known (as of 2010) require billions of years to factor 400-digit integers

Key exchange

  • Key exchange occurs when two parties use to exchange a secret key over an insecure communications channel without having shared any information in the past

Diffie-Hellman key agreement protocol

  • It happens when Suppose that Alice and Bob want to share a common key.
    • The protocol follows these steps, where the computations are done in Zp
  • Alice and Bob agree to use a prime p and a primitive root a of p
  • Alice chooses a secret integer k1 and sends ak1 mod p to Bob
  • Bob chooses a secret integer k2 and sends ak2 mod p to Alice
  • Alice computes (ak2)k1 mod p
  • Bob computes (ak1)k2 mod p

Representation of Integers

  • In the modem world, we use decimal, or base 10, notation to represent integers. For example when we write 965, we mean 9 * 10^2 + 6 * 10^1 + 5 * 10^0
  • Numbers can be represented with any positive integer "b" as it base
    • Although base 2, 8 and 16 are important for computing and communications

Modular Exponentiation

  • The expression = bak-12k-1... ba12 . bao means the same as = bak-12k-1 ... ba12 * bao
  • It may be simplified by using the algorithm 5 called "modular exponentiation"

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Number Theory Subtopics Quiz
10 questions
Number Theory Fundamentals
8 questions
Number Theory Basics
8 questions

Number Theory Basics

ZippyWilliamsite3940 avatar
ZippyWilliamsite3940
Divisibility and Prime Numbers
47 questions

Divisibility and Prime Numbers

ProficientRetinalite6568 avatar
ProficientRetinalite6568
Use Quizgecko on...
Browser
Browser