Prime Numbers Lecture L4.4 Sieve of Eratosthenes.

Slides:



Advertisements
Similar presentations
Sorting algorithms Sieve of Eratosthenes
Advertisements

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 Factorization Section 2.5. Objectives Find the prime factorization of a counting number by repeated division Find the prime factorization of a counting.
Special Names for Numbers
1. What number does the following array represent?
Make a list with your group How can I remember???
Lists Samuel Marateck © The Sieve of Eratosthenes.
Sieve of Eratosthenes Lecture L7.2. Sieve of Eratosthenes in Java package com.research.hanna; import com.ajile.drivers.gptc.TimerCounter; /**
Chapter 4 Number Theory. Terms Factors Divides, divisible, divisibility Multiple.
Number Theory Divides: b divides a if there is a whole number q such that a = qb. Factor: b will be a factor of a. Divisor: b is also a divisor of a. Multiple:
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Галактики і квазари.
Характеристика ІНДІЇ.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
(a) (b) (c) (d). What is (1,2,3)  (3,4,2)? (a) (1, 2, 3, 4) (b) (1,2)  (3,4) (c) (1,3,4,2) (d) (3,1)  (4,2)
Chapter Number Theory 4 4 Copyright © 2013, 2010, and 2007, Pearson Education, Inc.
Unit 1 Review. Square Numbers A square number is a number that has the same numbers for its dimensions.
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,…}
Chapter | 2 Copyright © Cengage Learning. All rights reserved. Instructional Goals and Objectives With Number Theory and Integers.
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.
Духовні символи Голосіївського району
Number Theory Yolanda McHenry, Ashley Courtney, Tyler Williams, Jamiya Hagger.
MTH 231 Section 4.1 Divisibility of Natural Numbers.
Whiteboardmaths.com © 2004 All rights reserved
CSCI 383 Object-Oriented Programming & Design Lecture 25 Martin van Bommel.
CSCI-383 Object-Oriented Programming & Design Lecture 30.
© T Madas What comes next and what is the name of these sequences?
Prime Numbers Lecture L6.1 Sieve of Eratosthenes.
 If N= (P₁) ˣ ×(P₂)ʷ ×(P₃) ʸ  Then no. of factors of N=(x+1) ×(w+1) ×(y+1)  For example: N = 50² × 14  Find the total factors, prime factors, composite.
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:
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.
The Sieve of Eratosthenes “Finding Prime Numbers” By: Patt Hawkey, MS.
PowerPointmaths.com © 2004 all rights reserved
Factors and Multiples.
4.OA#5 Sets Missing Elements next Patterns © 2005 Richard A. Medeiros.
Using The Sieve of Eratosthenes
9 x 14 9 x 12 Calculate the value of the following: 1 4 × 5 =
Factors, multiple, primes: Factors from prime factors
Factors, multiple, primes: Prime factors
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
О Б Щ И Н А С И Л И С Т Р А П р о е к т Б ю д ж е т г.
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
Сътрудничество между полицията и другите специалисти в България
Съобщение Ръководството на НУ “Христо Ботев“ – гр. Елин Пелин
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Стратегия за развитие на клъстера 2015
Моето наследствено призвание
Правна кантора “Джингов, Гугински, Кючуков & Величков”
Безопасност на движението
Times.
DISCRETE COMPUTATIONAL STRUCTURES
Sieve of Eratosthenes short demonstration
Factors, multiple, primes: Multiples
Math 0332 Subsets Name ________________________
Presentation transcript:

Prime Numbers Lecture L4.4 Sieve of Eratosthenes

// first create an array of flags, where // each member of the array stands for a odd number // starting with 3. for (j = 0; j < size; j++) { flags[j] = 1; } Find prime numbers using Sieve of Eratosthenes j size = 1024

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b

Find prime numbers using Sieve of Eratosthenes j primeCount = 0; for (j = 0; j < size; j++) { if (flags[j] == 1) { // found a prime, count it primeCount++; // now set all of the multiples of // the current prime number to false // because they couldn't possibly be prime a = 2*j + 3;// odd numbers starting with 3 b = a + j; while(b < size) { flags[b] = 0; b = b + a; } a b