Lists Samuel Marateck © 2010. The Sieve of Eratosthenes.

Slides:



Advertisements
Similar presentations
Sorting algorithms Sieve of Eratosthenes
Advertisements

Function: Domain and Range
1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
Test practice Multiplication. Multiplication 9x2.
Musical Chairs No more than 2 people at one table who have been at the same table before. I suggest that one person remain at the table you have been at.
Prime Number Sieve
4.2 Factors and Prime Factorization
Finding factors of a number Use the beans to find factors of 24  Count out 24 beans  We know that products can be illustrated using a rectangular model.
+ 5.3a Prime & Composite Kim Norman GES Eratosthene of Cyrene Born: 276 BC in Cyrene, North Africa (now Shahat, Libia) Died: 194 BC in Alexandria,
We can find a multiple by multiplying the numbers together, but to find the Least Common Multiple we have to get rid of any factors that the numbers have.
Welcome Back! Use the manipulatives to make the following numbers (rectangles or two rows): Are you here?
Make a list with your group How can I remember???
0 PROGRAMMING IN HASKELL Chapter 12 – Lazy evaluation and infinite lists Slides not from Hutton.
Musical Chairs No more than 2 people at one table who have been at the same table before. I suggest that one person remain at the table you have been at.
Chapter 4 Number Theory. Terms Factors Divides, divisible, divisibility Multiple.
5-1 Least Common Multiple Learn to find the least common multiple (LCM) of a group of numbers.
Factor Trees. What are Factor Trees for? Ever seen a question that said find the prime factors of a number? Use factor trees to work it out! Contents.
Table of Contents Function: Domain and Range A function is a correspondence between two sets governed by some rule(s) such that each member of the first.
Sieve of Eratosthenes.
Factoring Rainbows Created By Jennifer Conner. First, here is some NEW vocabulary: Prime Number: any number whose only factors are 1 and itself Composite.
SOLUTION Field Trip EXAMPLE 1 Writing Factors of a Number A class of 36 students is on a field trip at the aquarium. The teacher wants to break the class.
Fractions: Simplification, Multiplication & Division Lesson 1e Next.
Prime Numbers Eratosthenes’(ehr-uh-TAHS-thuh-neez) Sieve
5.1 Divisibility. Natural Numbers The set of natural numbers or counting numbers is {1,2,3,4,5,6,…}
Prime Numbers With Mrs Ford. Eratosthenes (ehr-uh-TAHS-thuh-neez) Eratosthenes was the librarian at Alexandria, Egypt in 200 B.C. Note every book was.
An ancient method for finding the prime numbers.  Eratosthenes was a Greek mathematician from Cyrene (modern day Libya!). He was born in 276 BC, and.
Tutorial 5 Arrays Basics (1D, 2D) NUS SCHOOL OF COMPUTING CS1010E PROGRAMMING METHODOLOGY 1 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO.
By: Marlene Reyna and Guadalupe Esquivel
7 is a prime number Factors of 7: 1, 7 Patterns and Algebra 32 Multiplication and Division 28.
Sieve of Eratosthenes. The Sieve of Eratosthenes is a method that.
Factors and Primes by 2July. Definition Product – the answer to a multiplication problem. 5 x 6 = 30 Product.
© T Madas From the numbers in the list below, find: the square numbers.
Course Least Common Multiple. Course Least Common Multiple A multiple of a number is the product of the number and any nonzero whole number.
Loops & List Intro2CS – week 3 1. Loops -- Motivation Sometimes we want to repeat a certain set of instructions more than once. The number of repetitions.
Find the mistake! Here are 10 statements you will have 15 seconds to decide if the statement is right or wrong. List the numbers of the wrong statements.
Least Common Multiple (LCM). Essential Question: How do I find the least common multiple of two or three numbers, and why is this relevant to me? Learning.
Prime and Composite Numbers Factors What is a prime number? Is this number prime?
3:00. 2:59 2:58 2:57 2:56 2:55 2:54 2:53 2:52.
THE SIEVE OF ERATOSTHENES: Prime and Composite Numbers by Jan Harrison
Prime Numbers Lecture L4.4 Sieve of Eratosthenes.
Prime and Composite Numbers. Factors Factors are 2 numbers that are multiplied to get a product. Example: The factors of 10 are 1, 2, 5 and 10 because:
Least Common Multiple Objective: To find the least common multiple
Sieve of Eratosthenes Quiz questions ITCS4145/5145, Parallel Programming Oct 24, 2013.
EVEN NUMBERS EVEN NUMBERS 1 = prime 2 = prime1 3 = prime 4 = 2 x 22 5 = prime 6 = 2 x 33 7 = prime 8 = 2 x 2 x 24 9 = 3 x 3 10 = 2 x 55.
A prime number is a whole number which only has two factors: one and itself. A prime number is a whole number which only has two factors: one and itself.
PRIME FACTORIZATION Pg. 12. ESSENTIAL QUESTION HOW do you use equivalent rates in the real world?
Factors and Multiples.
Number and patterns quiz
Factors and Primes.
Prime Numbers.
Using The Sieve of Eratosthenes
9 x 14 9 x 12 Calculate the value of the following: 1 4 × 5 =
MODIFIED SIEVE OF ERATOSTHENES
Top Fire Protection Services Ottawa available on Dubinskyconstruction
Continuous Slot Well Screens.
Prime Factorisation Factor Trees
AP Java Warm-up Boolean Array.
Determining Factors and Multiples
Concurrent Programming
7.6 Factoring ax2 + bx + c Students will be able to factor ax2 + bx + c. This will be very similar to 7.5. So if you did not get 7.5 you will have.
Activity: Prime Path Coverage CS 4501 / 6501 Software Testing
Sieve of Eratosthenes The Sieve of Eratosthenes uses a bag to find all primes less than or equal to an integer value n. Begin by creating a bag an inserting.
Prime Numbers and Prime Factorization
Skip Counting for Multiplication and Division 2 -12
Common Array Algorithms
TO USE THE SIEVE OF ERATOSTHENES & USE NUMBER PATTERNS
Multiplication Facts 3 x Table.
Presentation transcript:

Lists Samuel Marateck © 2010

The Sieve of Eratosthenes

Place a 0 in all slots X = 26*[0]

Place 0’s in all slots

Start with 2 for j in range(2, √25):

Start with 2 for j in range(2, √25): if x[j] == 0:

Start with 2 for j in range(2, √25): if x[j] == 0: index = 2*j

Start with the 2 slot

for j in range(2, √25): if x[j] == 0: index = 2*j while index < 25: x[index] = 1

Place a 1 in the 4 slot

for j in range(2, √25): if x[j] == 0: index = 2*j while index < 25: x[index] = 1 index = index + j

Then in the 6 slot

Continue

Place 1’s in all multiples of 2 slots

Since there is a 0 in the 3 slot, 3 is prime

There is a 1 already in the 6 slot

Place a 1 in the 9 slot

The 12 slot already has a

Then a 1 in the 15 slot

Then a 1 in the 21 slot

Now there is a 1 in all multiple of 3 slots

Skip the 4 slot since it has a

There is a 0 in the 5 slot, so 5 is prime

Place a 1 in multiple of 5 slots

The only non-zero slot is

Since √25 is 5 we stop here

Starting with 2, all the slots with 0’s are prime numbers