UCT Algorithm Circle: Number Theory

Size: px
Start display at page:

Download "UCT Algorithm Circle: Number Theory"

Transcription

1 UCT Algorithm Circle: 7 April 2011

2 Outline Primes and Prime Factorisation 1 Primes and Prime Factorisation 2 3 4

3 Some revision (hopefully) What is a prime number? An integer greater than 1 whose only factors are itself and 1 2, 3, 5, 7, 11, 13, 17, 19, 23, Non-primes are called composite

4 Some revision (hopefully) What is a prime number? An integer greater than 1 whose only factors are itself and 1 2, 3, 5, 7, 11, 13, 17, 19, 23, Non-primes are called composite

5 Some revision (hopefully) What is a prime number? An integer greater than 1 whose only factors are itself and 1 2, 3, 5, 7, 11, 13, 17, 19, 23, Non-primes are called composite

6 Fundamental Theorem of Arithmetic Any integer greater than 1 can be written as a unique product of prime numbers 6936 = =

7 Fundamental Theorem of Arithmetic Any integer greater than 1 can be written as a unique product of prime numbers 6936 = =

8 Finding primes the slow way Check for factors! def isprime(x): prime = True for factor in range(2, x): if x % factor == 0: prime = False return prime Can be improved by only checking for factors up to square root of number

9 Finding primes the slow way Check for factors! def isprime(x): prime = True for factor in range(2, x): if x % factor == 0: prime = False return prime Can be improved by only checking for factors up to square root of number

10 Sieve of Eratosthenes: a mnemonic Sift the Twos and sift the Threes, The Sieve of Eratosthenes. When the multiples sublime, The numbers that remain are Prime.

11 Sieve of Eratosthenes Invented by Eratosthenes, Greece, c. 200 BC Quickly find all primes up to a limit x Assume 2 to x are prime Take next known prime, and eliminate its multiples from the list Continue for all numbers on the list The remaining numbers are prime!

12 Sieve of Eratosthenes Invented by Eratosthenes, Greece, c. 200 BC Quickly find all primes up to a limit x Assume 2 to x are prime Take next known prime, and eliminate its multiples from the list Continue for all numbers on the list The remaining numbers are prime!

13 Implementation def sieve(x): isprime = [False] * (x + 1) for n in range(2, x + 1): if isprime[n] == True: for multiple in range(2 * n, x + 1, n): isprime[multiple] = False allprimes = [] for n in range(2, x + 1): if isprime[n]: allprimes.append(n) return allprimes

14 Modification to prime factorise Instead of storing False, store a factor To find a prime factors of n, look up n in the list Divide n by this factor, and look up this new value in the list Continue until the resultant value is 1

15 Outline Primes and Prime Factorisation 1 Primes and Prime Factorisation 2 3 4

16 Introduction Common example: a clock Numbers wrap around after some modulus Similar to remainder after division = 13 1 (mod 12) % operator in Python and other languages

17 Introduction Common example: a clock Numbers wrap around after some modulus Similar to remainder after division = 13 1 (mod 12) % operator in Python and other languages

18 Introduction Common example: a clock Numbers wrap around after some modulus Similar to remainder after division = 13 1 (mod 12) % operator in Python and other languages

19 Addition and subtraction Work as expected Just add or subtract remainders, then find new remainder Holds for all real numbers

20 Addition and subtraction Work as expected Just add or subtract remainders, then find new remainder Holds for all real numbers

21 Multiplication Multiply remainders, then find new remainder Holds for all integers Division is possible, but complicated

22 Multiplication Multiply remainders, then find new remainder Holds for all integers Division is possible, but complicated

23 Multiplication Multiply remainders, then find new remainder Holds for all integers Division is possible, but complicated

24 Outline Primes and Prime Factorisation 1 Primes and Prime Factorisation 2 3 4

25 Greatest common divisor The largest factor that will divide two numbers Written GCD(a, b) GCD(9, 12) = 3

26 By prime factorisation Product of all the common prime factors 6936 = = GCD(6936, 1200) = = 24 Prime factorisation is expensive for large numbers Try GCD( , ) by hand!

27 By prime factorisation Product of all the common prime factors 6936 = = GCD(6936, 1200) = = 24 Prime factorisation is expensive for large numbers Try GCD( , ) by hand!

28 Euclidean Algorithm Described by Euclid c. 300 BC, but not invented by him GCD(a, b) = GCD(b, a mod b) GCD(a, 0) = a Efficient Number of steps required for completion is never more than five times the number of digits (base 10) of the smaller number Usually much faster

29 Euclidean Algorithm Described by Euclid c. 300 BC, but not invented by him GCD(a, b) = GCD(b, a mod b) GCD(a, 0) = a Efficient Number of steps required for completion is never more than five times the number of digits (base 10) of the smaller number Usually much faster

30 Euclidean Algorithm Described by Euclid c. 300 BC, but not invented by him GCD(a, b) = GCD(b, a mod b) GCD(a, 0) = a Efficient Number of steps required for completion is never more than five times the number of digits (base 10) of the smaller number Usually much faster

31 Efficiency of Euclidean Algorithm

32 Recursive implementation def gcd(a, b): if b == 0: return a else: return gcd(b, a % b)

33 Outline Primes and Prime Factorisation 1 Primes and Prime Factorisation 2 3 4

34 Related reading Euler s Sieve More on modular arithmetic Extended Euclidean Algorithm Fermat s Little Theorem

35 In the lab Primes and Prime Factorisation Implement a function to prime factorise any given number Implement a Sieve of Eratosthenes Modify it to return the prime factors of all numbers up to the limit

COMPSCI 230 Discrete Math Prime Numbers January 24, / 15

COMPSCI 230 Discrete Math Prime Numbers January 24, / 15 COMPSCI 230 Discrete Math January 24, 2017 COMPSCI 230 Discrete Math Prime Numbers January 24, 2017 1 / 15 Outline 1 Prime Numbers The Sieve of Eratosthenes Python Implementations GCD and Co-Primes COMPSCI

More information

COP 4516: Math for Programming Contest Notes

COP 4516: Math for Programming Contest Notes COP 4516: Math for Programming Contest Notes Euclid's Algorithm Euclid's Algorithm is the efficient way to determine the greatest common divisor between two integers. Given two positive integers a and

More information

Lecture Notes, CSE 232, Fall 2014 Semester

Lecture Notes, CSE 232, Fall 2014 Semester Lecture Notes, CSE 232, Fall 2014 Semester Dr. Brett Olsen Week 11 - Number Theory Number theory is the study of the integers. The most basic concept in number theory is divisibility. We say that b divides

More information

1 Elementary number theory

1 Elementary number theory Math 215 - Introduction to Advanced Mathematics Spring 2019 1 Elementary number theory We assume the existence of the natural numbers and the integers N = {1, 2, 3,...} Z = {..., 3, 2, 1, 0, 1, 2, 3,...},

More information

Applied Cryptography and Network Security

Applied Cryptography and Network Security Applied Cryptography and Network Security William Garrison bill@cs.pitt.edu 6311 Sennott Square Lecture #8: RSA Didn t we learn about RSA last time? During the last lecture, we saw what RSA does and learned

More information

Euclid's Algorithm. MA/CSSE 473 Day 06. Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm

Euclid's Algorithm. MA/CSSE 473 Day 06. Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm MA/CSSE 473 Day 06 Euclid's Algorithm MA/CSSE 473 Day 06 Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm 1 Quick look at review topics in textbook REVIEW

More information

Math Introduction to Advanced Mathematics

Math Introduction to Advanced Mathematics Math 215 - Introduction to Advanced Mathematics Number Theory Fall 2017 The following introductory guide to number theory is borrowed from Drew Shulman and is used in a couple of other Math 215 classes.

More information

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors

More information

Univ. of Illinois Due Wednesday, Sept 13, 2017 Prof. Allen

Univ. of Illinois Due Wednesday, Sept 13, 2017 Prof. Allen ECE 298JA NS #2 Version.28 April 22, 208 Fall 207 Univ. of Illinois Due Wednesday, Sept 3, 207 Prof. Allen Topic of this homework: Prime numbers, greatest common divisors, the continued fraction algorithm

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.8 Application: Algorithms Copyright Cengage Learning. All rights reserved. Application:

More information

! Addition! Multiplication! Bigger Example - RSA cryptography

! Addition! Multiplication! Bigger Example - RSA cryptography ! Addition! Multiplication! Bigger Example - RSA cryptography Modular Arithmetic Modular Exponentiation Primality Testing (Fermat s little theorem) Probabilistic algorithm Euclid s Algorithm for gcd (greatest

More information

CS/COE 1501 cs.pitt.edu/~bill/1501/ More Math

CS/COE 1501 cs.pitt.edu/~bill/1501/ More Math CS/COE 1501 cs.pitt.edu/~bill/1501/ More Math Exponentiation x y Can easily compute with a simple algorithm: Runtime? ans = 1 i = y while i > 0: ans = ans * x i-- 2 Just like with multiplication, let s

More information

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element. The first exam will be on Wednesday, September 22, 2010. The syllabus will be sections 1.1 and 1.2 in Lax, and the number theory handout found on the class web site, plus the handout on the method of successive

More information

Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD

Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD In this session, we will write another algorithm to solve a mathematical problem. If you

More information

CSCE 110: Programming I

CSCE 110: Programming I CSCE 110: Programming I Sample Questions for Exam #1 February 17, 2013 Below are sample questions to help you prepare for Exam #1. Make sure you can solve all of these problems by hand. For most of the

More information

Lab 1: Cipher Fundamentals

Lab 1: Cipher Fundamentals Lab 1: Cipher Fundamentals Objective: The key objective of this lab is to be introduced to some of the fundamental principles involved in cryptography, including the usage of Base-64, hexadecimal, the

More information

Integers and Mathematical Induction

Integers and Mathematical Induction IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about

More information

Section A Arithmetic ( 5) Exercise A

Section A Arithmetic ( 5) Exercise A Section A Arithmetic In the non-calculator section of the examination there might be times when you need to work with quite awkward numbers quickly and accurately. In particular you must be very familiar

More information

Lecture 7 Number Theory Euiseong Seo

Lecture 7 Number Theory Euiseong Seo Lecture 7 Number Theory Euiseong Seo (euiseong@skku.edu) 1 Number Theory God created the integers. All else is the work of man Leopold Kronecker Study of the property of the integers Specifically, integer

More information

Conditionals !

Conditionals ! Conditionals 02-201! Computing GCD GCD Problem: Compute the greatest common divisor of two integers. Input: Two integers a and b. Output: The greatest common divisor of a and b. Exercise: Design an algorithm

More information

Creating a new data type

Creating a new data type Appendix B Creating a new data type Object-oriented programming languages allow programmers to create new data types that behave much like built-in data types. We will explore this capability by building

More information

Programming Techniques in Computer Algebra

Programming Techniques in Computer Algebra Programming Techniques in Computer Algebra Prof. Dr. Wolfram Koepf Universität Kassel http://www.mathematik.uni-kassel.de/~koepf March 18, 2010 Yaounde, Cameroon Abstract Topics of This Talk In this talk

More information

Ngày 9 tháng 12 năm Discrete Mathematics Lecture-15

Ngày 9 tháng 12 năm Discrete Mathematics Lecture-15 Discrete Mathematics Lecture-15 Ngày 9 tháng 12 năm 2011 ex ex ex a 1 mod b (gcd(a,b) = 1) ex a 1 mod b (gcd(a,b) = 1) Returns an integer c < b such that a c mod b = 1. ex a 1 mod b (gcd(a,b) = 1) Returns

More information

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value 1 Number System Introduction In this chapter, we will study about the number system and number line. We will also learn about the four fundamental operations on whole numbers and their properties. Natural

More information

Lecture 8 Mathematics

Lecture 8 Mathematics CS 491 CAP Intro to Competitive Algorithmic Programming Lecture 8 Mathematics Uttam Thakore University of Illinois at Urbana-Champaign October 14, 2015 Outline Number theory Combinatorics & probability

More information

Lab 1: Cipher Fundamentals

Lab 1: Cipher Fundamentals Lab 1: Cipher Fundamentals Objective: The key objective of this lab is to be introduced to some of the fundamental principles involved in cryptography, including the usage of Base-64, hexadecimal, the

More information

36 Modular Arithmetic

36 Modular Arithmetic 36 Modular Arithmetic Tom Lewis Fall Term 2010 Tom Lewis () 36 Modular Arithmetic Fall Term 2010 1 / 10 Outline 1 The set Z n 2 Addition and multiplication 3 Modular additive inverse 4 Modular multiplicative

More information

1 Elementary number theory

1 Elementary number theory 1 Elementary number theory We assume the existence of the natural numbers and the integers N = {1, 2, 3,...} Z = {..., 3, 2, 1, 0, 1, 2, 3,...}, along with their most basic arithmetical and ordering properties.

More information

Rational numbers as decimals and as integer fractions

Rational numbers as decimals and as integer fractions Rational numbers as decimals and as integer fractions Given a rational number expressed as an integer fraction reduced to the lowest terms, the quotient of that fraction will be: an integer, if the denominator

More information

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

Excerpt from Art of Problem Solving Volume 1: the Basics 2014 AoPS Inc. Chapter 5 Using the Integers In spite of their being a rather restricted class of numbers, the integers have a lot of interesting properties and uses. Math which involves the properties of integers is

More information

Prepared by Sa diyya Hendrickson. Package Summary

Prepared by Sa diyya Hendrickson. Package Summary Introduction Prepared by Sa diyya Hendrickson Name: Date: Package Summary Exponent Form and Basic Properties Order of Operations Using Divisibility Rules Finding Factors and Common Factors Primes, Prime

More information

Chapter 1 An Introduction to Computer Science. INVITATION TO Computer Science 1

Chapter 1 An Introduction to Computer Science. INVITATION TO Computer Science 1 Chapter 1 An Introduction to Computer Science INVITATION TO Computer Science 1 Q8. Under what conditions would the well-known quadratic formula not be effectively computable? (Assume that you are working

More information

Elementary number theory

Elementary number theory Elementary number theory The notion of primes, greatest common divisors, congruences and Euler s phi function. the number theoretic concepts and Sage commands Sage Implementation of the RSA algorithm.

More information

Python lab session 1

Python lab session 1 Python lab session 1 Dr Ben Dudson, Department of Physics, University of York 28th January 2011 Python labs Before we can start using Python, first make sure: ˆ You can log into a computer using your username

More information

r=1 The Binomial Theorem. 4 MA095/98G Revision

r=1 The Binomial Theorem. 4 MA095/98G Revision Revision Read through the whole course once Make summary sheets of important definitions and results, you can use the following pages as a start and fill in more yourself Do all assignments again Do the

More information

CS669 Network Security

CS669 Network Security UNIT II PUBLIC KEY ENCRYPTION Uniqueness Number Theory concepts Primality Modular Arithmetic Fermet & Euler Theorem Euclid Algorithm RSA Elliptic Curve Cryptography Diffie Hellman Key Exchange Uniqueness

More information

Package VeryLargeIntegers

Package VeryLargeIntegers Type Package Package VeryLargeIntegers Title Store and Manage Arbitrarily Large Integers Version 0.1.5 Author December 15, 2017 Maintainer Multi-precission library that allows

More information

Algorithmic number theory Cryptographic hardness assumptions. Table of contents

Algorithmic number theory Cryptographic hardness assumptions. Table of contents Algorithmic number theory Cryptographic hardness assumptions Foundations of Cryptography Computer Science Department Wellesley College Fall 2016 Table of contents Introduction Primes and Divisibility Modular

More information

Davenport University ITS Lunch and Learn February 2, 2012 Sneden Center Meeting Hall Presented by: Scott Radtke

Davenport University ITS Lunch and Learn February 2, 2012 Sneden Center Meeting Hall Presented by: Scott Radtke Davenport University ITS Lunch and Learn February 2, 2012 Sneden Center Meeting Hall Presented by: Scott Radtke A discussion on the mathematics behind coding and decoding using RSA Public-Key Cryptography.

More information

Course Learning Outcomes for Unit I. Reading Assignment. Unit Lesson. UNIT I STUDY GUIDE Number Theory and the Real Number System

Course Learning Outcomes for Unit I. Reading Assignment. Unit Lesson. UNIT I STUDY GUIDE Number Theory and the Real Number System UNIT I STUDY GUIDE Number Theory and the Real Number System Course Learning Outcomes for Unit I Upon completion of this unit, students should be able to: 2. Relate number theory, integer computation, and

More information

15-110: Principles of Computing, Spring Problem Set 3 (PS3) Due: Friday, February 9 by 2:30PM on Gradescope

15-110: Principles of Computing, Spring Problem Set 3 (PS3) Due: Friday, February 9 by 2:30PM on Gradescope 15-110: Principles of Computing, Spring 2018 Problem Set 3 (PS3) Due: Friday, February 9 by 2:30PM on Gradescope HANDIN INSTRUCTIONS Download a copy of this PDF file. You have two ways to fill in your

More information

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus) Math 30 Introduction to Proofs via Number Theory Robert Jewett (with small modifications by B. Ćurgus) March 30, 009 Contents 1 The Integers 3 1.1 Axioms of Z...................................... 3 1.

More information

Chapter 4. Number Theory. 4.1 Factors and multiples

Chapter 4. Number Theory. 4.1 Factors and multiples Chapter 4 Number Theory We ve now covered most of the basic techniques for writing proofs. So we re going to start applying them to specific topics in mathematics, starting with number theory. Number theory

More information

ICT 6541 Applied Cryptography. Hossen Asiful Mustafa

ICT 6541 Applied Cryptography. Hossen Asiful Mustafa ICT 6541 Applied Cryptography Hossen Asiful Mustafa Basic Communication Alice talking to Bob Alice Bob 2 Eavesdropping Eve listening the conversation Alice Bob 3 Secure Communication Eve listening the

More information

Programming Training

Programming Training Programming Training Main Points: - Working with Functions in Python - Problems with Numbers. - Discuss some important algorithms - Primality - Digits - Greatest Common Divisor Python Repetitions. while

More information

Modular Arithmetic. Marizza Bailey. December 14, 2015

Modular Arithmetic. Marizza Bailey. December 14, 2015 Modular Arithmetic Marizza Bailey December 14, 2015 Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find a quicker

More information

Admin ENCRYPTION. Admin. Encryption 10/29/15. Assignment 6. 4 more assignments: Midterm next Thursday. What is it and why do we need it?

Admin ENCRYPTION. Admin. Encryption 10/29/15. Assignment 6. 4 more assignments: Midterm next Thursday. What is it and why do we need it? Admin Assignment 6 4 more assignments:! Assignment 7, due 11/13 5pm! Assignment 8, due 11/20 5pm! Assignments 9 & 10, due 12/9 11:59pm ENCRYPTION David Kauchak CS52 Spring 2015 Admin Midterm next Thursday!

More information

Overview. Public Key Algorithms I

Overview. Public Key Algorithms I Public Key Algorithms I Dr. Arjan Durresi Louisiana State University Baton Rouge, LA 70810 Durresi@csc.lsu.Edu These slides are available at: http://www.csc.lsu.edu/~durresi/csc4601-04/ Louisiana State

More information

CITS3211 FUNCTIONAL PROGRAMMING. 7. Lazy evaluation and infinite lists

CITS3211 FUNCTIONAL PROGRAMMING. 7. Lazy evaluation and infinite lists CITS3211 FUNCTIONAL PROGRAMMING 7. Lazy evaluation and infinite lists Summary: This lecture introduces lazy evaluation and infinite lists in functional languages. cs123 notes: Lecture 19 R.L. While, 1997

More information

HIGH PERFORMANCE ELLIPTIC CURVE CRYPTO-PROCESSOR FOR FPGA PLATFORMS

HIGH PERFORMANCE ELLIPTIC CURVE CRYPTO-PROCESSOR FOR FPGA PLATFORMS HIGH PERFORMANCE ELLIPTIC CURVE CRYPTO-PROCESSOR FOR FPGA PLATFORMS Debdeep Mukhopadhyay Dept. of Computer Science and Engg. IIT Kharagpur 3/6/2010 NTT Labs, Japan 1 Outline Elliptic Curve Cryptography

More information

RSA System setup and test

RSA System setup and test RSA System setup and test Project 1, EITF55 Security, 2018 Ben Smeets Dept. of Electrical and Information Technology, Lund University, Sweden Last revised by Ben Smeets on 2018 01 12 at 01:06 What you

More information

Assertions & Verification & Example Loop Invariants Example Exam Questions

Assertions & Verification & Example Loop Invariants Example Exam Questions 2014 November 27 1. Assertions & Verification & Example Loop Invariants Example Exam Questions 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer

More information

Structured programming

Structured programming Exercises 8 Version 1.0, 1 December, 2016 Table of Contents 1. Recursion................................................................... 1 1.1. Problem 1...............................................................

More information

CS Network Security. Nasir Memon Polytechnic University Module 7 Public Key Cryptography. RSA.

CS Network Security. Nasir Memon Polytechnic University Module 7 Public Key Cryptography. RSA. CS 393 - Network Security Nasir Memon Polytechnic University Module 7 Public Key Cryptography. RSA. Course Logistics Homework 2 revised. Due next Tuesday midnight. 2/26,28/02 Module 7 - Pubic Key Crypto

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 310 Advanced Data Structures and Algorithms Recursion June 27, 2017 Tong Wang UMass Boston CS 310 June 27, 2017 1 / 20 Recursion Recursion means defining something, such as a function, in terms of itself

More information

Definition MATH Benjamin V.C. Collins, James A. Swenson MATH 2730

Definition MATH Benjamin V.C. Collins, James A. Swenson MATH 2730 MATH 2730 Benjamin V.C. Collins James A. Swenson s and undefined terms The importance of definition s matter! may be more important in Discrete Math than in any math course that you have had previously.

More information

Public-Service Announcements

Public-Service Announcements Public-Service Announcements "CSUA has a Welcome BBQ on Wednesday, 2 September at 7PM in the Woz. Open to anyone interested in computer science. Please drop by our office located in 311 Soda Hall" Last

More information

Assertions & Verification Example Exam Questions

Assertions & Verification Example Exam Questions 2009 November 23 Assertions & Verification Example Exam Questions 1. 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer must answer to verify

More information

Secure understanding of multiplication of whole numbers by 10, 100 or 1000.

Secure understanding of multiplication of whole numbers by 10, 100 or 1000. Secure understanding of multiplication of whole numbers by 10, 100 or 1000. Begin to identify common factors. Identify multiples and factors, including finding all factor pairs of a number, and common

More information

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm.

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm. 1 / 43 Today Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm. 2 / 43 Finding an inverse? We showed how to efficiently tell if there is an inverse. Extend euclid to

More information

Exercise 1.1. Page 1 of 22. Website: Mobile:

Exercise 1.1. Page 1 of 22. Website:    Mobile: Question 1: Exercise 1.1 Use Euclid s division algorithm to find the HCF of: (i) 135 and 225 Since 225 > 135, we apply the division lemma to 225 and 135 to obtain 225 = 135 1 + 90 Since remainder 90 0,

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2000.1.1 COMPUTER SCIENCE TRIPOS Part IA Monday 5 June 2000 1.30 to 4.30 Paper 1 Answer two questions from Section A, and one question from each of Sections B, C, D and E. Submit the answers in six

More information

Number Theory Open, Round 1 Test #101

Number Theory Open, Round 1 Test #101 Number Theory Open, Round 1 Test #101 1. Write your 6-digit ID# in the I.D. NUMBER grid, left-justified, and bubble. Check that each column has only one number darkened. 2. In the EXAM NO. grid, write

More information

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane. Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 36 / 76 Spring 208 Instructor: Dr. Sateesh Mane c Sateesh R. Mane 208 Lecture February 25, 208 This is a collection of useful

More information

CS116 - Module 5 - Accumulative Recursion

CS116 - Module 5 - Accumulative Recursion CS116 - Module 5 - Accumulative Recursion Cameron Morland Winter 2018 1 Cameron Morland CS116 - Module 5 - Accumulative Recursion Types of Recursion Structural Recursion Generative Recursion Accumulative

More information

- 0 - CryptoLib: Cryptography in Software John B. Lacy 1 Donald P. Mitchell 2 William M. Schell 3 AT&T Bell Laboratories ABSTRACT

- 0 - CryptoLib: Cryptography in Software John B. Lacy 1 Donald P. Mitchell 2 William M. Schell 3 AT&T Bell Laboratories ABSTRACT - 0 - CryptoLib: Cryptography in Software John B. Lacy 1 Donald P. Mitchell 2 William M. Schell 3 AT&T Bell Laboratories ABSTRACT With the capacity of communications channels increasing at the current

More information

Chapter 3 Public Key Cryptography

Chapter 3 Public Key Cryptography Cryptography and Network Security Chapter 3 Public Key Cryptography Lectured by Nguyễn Đức Thái Outline Number theory overview Public key cryptography RSA algorithm 2 Prime Numbers A prime number is an

More information

Introduction to Modular Arithmetic

Introduction to Modular Arithmetic Randolph High School Math League 2014-2015 Page 1 1 Introduction Introduction to Modular Arithmetic Modular arithmetic is a topic residing under Number Theory, which roughly speaking is the study of integers

More information

Discrete Mathematics SECOND EDITION OXFORD UNIVERSITY PRESS. Norman L. Biggs. Professor of Mathematics London School of Economics University of London

Discrete Mathematics SECOND EDITION OXFORD UNIVERSITY PRESS. Norman L. Biggs. Professor of Mathematics London School of Economics University of London Discrete Mathematics SECOND EDITION Norman L. Biggs Professor of Mathematics London School of Economics University of London OXFORD UNIVERSITY PRESS Contents PART I FOUNDATIONS Statements and proofs. 1

More information

Public Key Algorithms

Public Key Algorithms Public Key Algorithms CS 472 Spring 13 Lecture 6 Mohammad Almalag 2/19/2013 Public Key Algorithms - Introduction Public key algorithms are a motley crew, how? All hash algorithms do the same thing: Take

More information

CS3233 Competitive i Programming

CS3233 Competitive i Programming This course material is now made available for public usage. Special acknowledgement to School of Computing, National University of Singapore for allowing Steven to prepare and distribute these teaching

More information

Addis Ababa University, Amist Kilo July 5, 2011 Algorithms and Programming for High Schoolers. Lab 2

Addis Ababa University, Amist Kilo July 5, 2011 Algorithms and Programming for High Schoolers. Lab 2 Addis Ababa University, Amist Kilo July 5, 2011 Algorithms and Programming for High Schoolers Lab 2 Exercise 1: In my high school, students were given letter grades based on their numerical scores. Here

More information

Lecture 3 Algorithms with numbers (cont.)

Lecture 3 Algorithms with numbers (cont.) Advanced Algorithms Floriano Zini Free University of Bozen-Bolzano Faculty of Computer Science Academic Year 2013-2014 Lecture 3 Algorithms with numbers (cont.) 1 Modular arithmetic For cryptography it

More information

Module 2 Congruence Arithmetic pages 39 54

Module 2 Congruence Arithmetic pages 39 54 Module 2 Congruence Arithmetic pages 9 5 Here are some excellent websites that can help you on this topic: http://mathcentral.uregina.ca/qq/database/qq.09.98/kupper1.html http://nrich.maths.org/public.viewer.php?obj_id=50

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2001.1.1 COMPUTER SCIENCE TRIPOS Part IA Monday 4 June 2001 1.30 to 4.30 Paper 1 Answer two questions from Section A, and one question from each of Sections B, C, D and E. Submit the answers in six

More information

ECE G205 Fundamentals of Computer Engineering Fall Exercises in Preparation to the Midterm

ECE G205 Fundamentals of Computer Engineering Fall Exercises in Preparation to the Midterm ECE G205 Fundamentals of Computer Engineering Fall 2003 Exercises in Preparation to the Midterm The following problems can be solved by either providing the pseudo-codes of the required algorithms or the

More information

3/22/17. Admin. Assignment 6 ENCRYPTION. David Kauchak CS52 Spring Survey: How is the class going? Survey: respondents. 24 total respondents

3/22/17. Admin. Assignment 6 ENCRYPTION. David Kauchak CS52 Spring Survey: How is the class going? Survey: respondents. 24 total respondents Admin Assignment 6 ENCRYPTION David Kauchak CS52 Spring 2016 Survey: respondents Survey: How is the class going? 24 total respondents 1 Survey: How is the difficulty of the class? Survey: time spent per

More information

Congruence Arithmetic

Congruence Arithmetic Module 4 Congruence Arithmetic Popper 4 Introduction to what is like Modulus choices Partitions by modulus Mod 5 Mod 7 Mod 30 Modular Arithmetic Addition Subtraction Multiplication INTEGERS! Mod 12 Cayley

More information

Virtual Lab 5 Solution: Chinese Remainder Theorem and Euler's Theorem

Virtual Lab 5 Solution: Chinese Remainder Theorem and Euler's Theorem Virtual Lab 5 Solution: Chinese Remainder Theorem and Euler's Theorem EECS 70: Discrete Mathematics and Probability Theory, Fall 2014 Due Date: Monday, October 6th, 2014 at 12pm Instructions: Complete

More information

Public-Service Announcements

Public-Service Announcements Public-Service Announcements The Computer Science Undergraduate Association(CSUA) welcomes all students interested in computer science to join them at their Welcome BBQ on Saturday, 8/27 from 12-4pm at

More information

Problem Solving for Intro to Computer Science

Problem Solving for Intro to Computer Science Problem Solving for Intro to Computer Science The purpose of this document is to review some principles for problem solving that are relevant to Intro to Computer Science course. Introduction: A Sample

More information

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple.

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple. Chapter Pythagorean Triples.1 Introduction. The Pythagorean triples have been known since the time of Euclid and can be found in the third century work Arithmetica by Diophantus [9]. An ancient Babylonian

More information

Prime Factorization. Jane Alam Jan. 1 P a g e Document prepared by Jane Alam Jan

Prime Factorization. Jane Alam Jan. 1 P a g e Document prepared by Jane Alam Jan Prime Factorization by Jane Alam Jan 1 P a g e Prime Factorization Introduction Sometimes we need to prime factorize numbers. So, what is prime factorization? Actually prime factorization means finding

More information

Administrivia. Last modified: Fri Aug 25 10:59: CS61B: Lecture #2 1

Administrivia. Last modified: Fri Aug 25 10:59: CS61B: Lecture #2 1 Administrivia Please make sure you have obtained a Unix account. If you are a concurrent enrollment student not yet on our lists, please tell a TA sothatwecanhaveyouaddedtothoseeligibletoreceiveanaccount.

More information

Ch 3.4 The Integers and Division

Ch 3.4 The Integers and Division Integers and Division 1 Ch 3.4 The Integers and Division This area of discrete mathematics belongs to the area of Number Theory. Some applications of the concepts in this section include generating pseudorandom

More information

Names and Functions. Chapter 2

Names and Functions. Chapter 2 Chapter 2 Names and Functions So far we have built only tiny toy programs. To build bigger ones, we need to be able to name things so as to refer to them later. We also need to write expressions whose

More information

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100!

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100! HighPower large integer calculator intended to investigate the properties of large numbers such as large exponentials and factorials. This application is written in Delphi 7 and can be easily ported to

More information

Odd-Numbered Answers to Exercise Set 1.1: Numbers

Odd-Numbered Answers to Exercise Set 1.1: Numbers Odd-Numbered Answers to Exercise Set.: Numbers. (a) Composite;,,, Prime Neither (d) Neither (e) Composite;,,,,,. (a) 0. 0. 0. (d) 0. (e) 0. (f) 0. (g) 0. (h) 0. (i) 0.9 = (j). (since = ) 9 9 (k). (since

More information

Topic 10 Part 2 [474 marks]

Topic 10 Part 2 [474 marks] Topic Part 2 [474 marks] The complete graph H has the following cost adjacency matrix Consider the travelling salesman problem for H a By first finding a minimum spanning tree on the subgraph of H formed

More information

Comp 182 Data Structures Sample Midterm Examination

Comp 182 Data Structures Sample Midterm Examination Comp 182 Data Structures Sample Midterm Examination 5 November 2014 Name: ANSWERS C. R. Putnam 5 November 2014 1. Design an ADT that represents a simple Social Networking Site. It should allow a user to

More information

Least Common Multiple (LCM)

Least Common Multiple (LCM) Least Common Multiple (LCM) Task: Implement an LCM algorithm that is able to handle any combination of 8-bit (sign bit included) numbers. Use two's complement format to represent negative values. Provide

More information

RSA (material drawn from Avi Kak Lecture 12, Lecture Notes on "Computer and Network Security" Used in asymmetric crypto.

RSA (material drawn from Avi Kak Lecture 12, Lecture Notes on Computer and Network Security Used in asymmetric crypto. RSA (material drawn from Avi Kak (kak@purdue.edu) Lecture 12, Lecture Notes on "Computer and Network Security" Used in asymmetric crypto. protocols The RSA algorithm is based on the following property

More information

Understanding Cryptography A Textbook for Students and Practitioners by Christof Paar and Jan Pelzl. Chapter 6 Introduction to Public-Key Cryptography

Understanding Cryptography A Textbook for Students and Practitioners by Christof Paar and Jan Pelzl. Chapter 6 Introduction to Public-Key Cryptography Understanding Cryptography A Textbook for Students and Practitioners by Christof Paar and Jan Pelzl www.crypto-textbook.com Chapter 6 Introduction to Public-Key Cryptography ver. November 18, 2010 These

More information

4 PKI Public Key Infrastructure

4 PKI Public Key Infrastructure 67 PKI 4.1 PKI history 4 PKI Public Key Infrastructure 4.1 PKI history Classical cryptography Example form II WW: Enigma dates back thousands of years symmetric key 68 PKI 4.1 PKI history Symmetric key

More information

Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4. Harper Langston New York University Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

More information

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015 Mathematics Jaehyun Park CS 97SI Stanford University June 29, 2015 Outline Algebra Number Theory Combinatorics Geometry Algebra 2 Sum of Powers n k=1 k 3 k 2 = 1 n(n + 1)(2n + 1) 6 = ( k ) 2 = ( 1 2 n(n

More information

A nice outline of the RSA algorithm and implementation can be found at:

A nice outline of the RSA algorithm and implementation can be found at: Cryptography Lab: RSA Encryption and Decryption Lab Objectives: After this lab, the students should be able to Explain the simple concepts of encryption and decryption to protect information in transmission.

More information

02157 Functional Programming Lecture 2: Functions, Basic Types and Tuples

02157 Functional Programming Lecture 2: Functions, Basic Types and Tuples Lecture 2: Functions, Basic Types and Tuples nsen 1 DTU Informatics, Technical University of Denmark Lecture 2: Functions, Basic Types and Tuples MRH 13/09/2012 Outline A further look at functions, including

More information

Class Book. Anita Straker, Tony Fisher, Rosalyn Hyde, Sue Jennings and Jonathan Longstaffe

Class Book. Anita Straker, Tony Fisher, Rosalyn Hyde, Sue Jennings and Jonathan Longstaffe Class Book Anita Straker, Tony Fisher, Rosalyn Hyde, Sue Jennings and Jonathan Longstaffe 5 Contents Tier 5 N5.1 Powers and roots 1 1 Integer powers of numbers 1 Estimating square roots 3 3 Prime factor

More information

A.1 Numbers, Sets and Arithmetic

A.1 Numbers, Sets and Arithmetic 522 APPENDIX A. MATHEMATICS FOUNDATIONS A.1 Numbers, Sets and Arithmetic Numbers started as a conceptual way to quantify count objects. Later, numbers were used to measure quantities that were extensive,

More information