Sieve of Eratosthenes | Brilliant Math & Science Wiki Generate all the primes less than 11 First thing to note is that do not mark prime themselves as composite. Create a list of integers from 2 to 10. list = [2, 3, 4, 5, 6, 7, 8, 9, 10] Start with \(p=2\). Since \(2^2 \le 10\), continue. Mark all multiples of 2 as composite by setting their value as 0 in the list. list = [2, 3, 0, 5, 0, 7, 0, 9, 0] Assign the value of \(p\) to the next prime, ie 3. Since \(3^2 \le 10\), continue. Mark all multiples of 3 as composite by setting their value as 0 in the list. list = [2, 3, 0, 5, 0, 7, 0, 0, 0] Assign the value of \(p\) to 5. Since \(5^{ 2 }\nleq 10\), stop.

We are done! The list is [2, 3, 0, 5, 0, 7, 0, 0, 0]. Since all the numbers which are 0 are composite, all the non-zero numbers are prime. Hence the prime numbers less 11 are 2, 3, 5, 7. \( _\square \) Example 2 Generate all the primes less than any integer \(n\) Since \(n\) could be any large number, manually computing the answer would take years. Let's write a code for this.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import math n = 200 # n is any arbitrary integer List = [] for x in xrange(2, n): # add numbers from 2 to n - 1 to List List.append(x) # note the above statement is equivalent to List = range(2, n) p = 2 # p is a prime while not int(math.sqrt(p)) + 1 > n: # continue to mark out primes until square root of p is less than n for x in xrange(p * 2, n, p): # remove all the multiples of p List[x - 2] = 0 p += 1 while p - 2 < len(List) and List[p - 2] == 0: # assign p to the next prime.

Next prime is the next non zero number in the list p += 1 for x in List: # search for non zero or prime numbers in the list and print them if x != 0: print x Here is an optimized java version - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 final int lim = 200; // exclusive int n[] = new int[lim - 2]; //exclude 1 for(int i = 2; i <= lim - 1; i++) //initialize the array with integers from 2 to lim { if((i & 1) == 0) //evens are not primes f & 1 return 0 if f % 2 == 0 { n[i - 2] = 0; } else { n[i - 

2] = i; } } n[0] = 2; int p = 3; //start with a prime.

Since 2 is already eliminated, start with 3 while(p * p < lim) { for(int i = p * p; i < lim; i += p + p) //remvove multiples of prime. Start at p * p { n[i - 2] = 0; } while(n[(p += 2) - 2] == 0) //find next non zero number. This is guaranteed to be a prime. ; } for(int i = 0; i < lim - 2; i++) //print non zero numbers { if(n[i] != 0) { System.out.println(n[i]); } } Proof: To see why Sieve of Eratosthenes generates all the primes To first understand why the sieve works, let's look into the definitions of prime decomposition and composite numbers. Theorem 1 Eratosthenes - Biography, Facts and Pictures Eratosthenes Lived c. 276 BC – c. 194 BC. Eratosthenes was an Ancient Greek scientist born in the town of Cyrene in about 276 BC. Cyrene is now the town of Shahhat in Libya. He was educated in philosophy and mathematics in Athens.

We do not really know what he looked like. This image above is from a painting by Bernardo Strozzi in the year 1635, nineteen centuries after the era of Eratosthenes. It shows Eratosthenes teaching geography, the academic discipline he founded. Advertisements Quick Guide – Eratosthenes’ Greatest Achievements • Eratosthenes produced a reliable, logical method to discover prime numbers: The Sieve of Eratosthenes. In an updated form, this is still important in modern number theory. • Assuming Earth is a sphere, in about 240 BC Eratosthenes calculated its size with good accuracy. This was a moment of triumph for the human intellect: first to realize our planet was a sphere, then to use the powers of observation, deduction and mathematics to calculate its size. • Eratosthenes saw that the heavens rotated once a day around the earth with axis that formed an imaginary line from the North Pole to the South Pole through the center of the earth. He calculated the tilt of Earth’s axis relative to the plane of its equator with good accuracy. • He produced the first map of the world which used meridian lines and parallel lines.

These were similar to our modern lines of latitude and longitude. He marked the equator and its size, considered the size of the polar zones and how far these zones were from the tropics. (Evidently, the Ancient Greeks knew a lot about our planet!) • He invented geography. Today we still use the word he invented for this new discipline. (‘Geo’ was Greek for ‘Earth’ and ‘graphy’ meant ‘field of study.’) • He produced a timeline recording all of the achievements of science since the time the Greeks had laid siege to Troy. • He was the first person to explain why the River Nile flooded every year – i.e. that heavy, seasonal rains fall near the source of the river, resulting in an annual flood in Egypt. • He rejected the commonly held view that people could be divided into ‘Greeks’ and ‘Barbarians.’ He held that people should be judged as individuals on their good and bad qualities. A Rounded Character Not restricting himself to science, Eratosthenes excelled at nearly all things intellectual. He wrote books on philosophy, geography, mathematics, astronomy, history, comedy, and also wrote poetry. This all-round knowledge made him a shoe-in for one very special job.

That job was the most prestigious role an academic could enjoy in Ancient Greece – Director of the Library of Alexandria, the greatest intellectual institution of the ancient world. The Library of Alexandria is said to have contained over half a million books in scroll form. It was the place the greatest scientists, mathematicians, philosophers, poets, and dramatists gathered to talk about their intellectual quests. The Library had lecture halls and meeting rooms. Today, we would call it a great university. Eratosthenes had his fans and his critics. Both seemed to have used the same nicknames for him. Eratosthenes had two nicknames we know about. One of these was ‘Beta’ the second letter of the Greek alphabet. This was because Eratosthenes, although he knew about everything, was not the absolute best at anything. ‘Beta’ could be used as an insult or a compliment. The other nickname he was given was ‘the pentathlete.’ The meaning is similar to Beta, in that a pentathlete has to be very good at five different sports, but will probably not be a champion in any of the individual sports.

Eratosthenes called himself ‘philologos’ – ‘lover of learning.’ The greatest minds of Greece would send their work to Eratosthenes as papyrus scrolls. Ever curious, Eratosthenes would take time to read many of these before his assistants cataloged them. Cataloging of scrolls at the Library of Alexandria, drawn in the 1800s based on the scholarship of the time. His friend, the great Archimedes, entrusted him with an enormously important treatise called The Method. In addition to containing the most advanced mathematics the world had ever seen, The Method gives us some clues about Eratosthenes’ interests. Archimedes writes (loosely translated): “Since I know you care about your work, are an excellent teacher of philosophy, and greatly interested in mathematical investigations, I thought I’d let you know about my special method. The method will enable you to use mechanics to see the answers to mathematical questions…” And so we learn that Eratosthenes is a fantastic teacher, as well as an intellectual. (Not all intellectuals are good teachers!) Of course, Eratosthenes did not only read about great work carried out by other people.

He did some great work himself. We know him best for two important achievements: producing an accurate estimate of how big Earth is; and devising a method to find prime numbers. Unfortunately, other than a few scraps, little remains of Eratosthenes’ original work. We usually have to rely on comments from people who were around at the time and in the following few centuries to get an idea of what Eratosthenes wrote. How Big is Planet Earth? As Director of the Library of Alexandria, Eratosthenes had the closest thing in the ancient world to a modern internet search engine. Everything that had been learned about the world by the Greeks – and that was a lot – was within his reach. Eratosthenes had learned that at midday, on the longest day of the year, walls in the city of Syene cast no shadows, because the sun was directly overhead. He could see with his own eyes in Alexandria that there were small shadows at midday on the longest day. Syene was more-or-less due south of Alexandria, therefore the angle of the shadow must mean something. What did it mean? Eratosthenes reasoned that if: 1.

you make the assumption that planet Earth is a sphere 2. the sun’s rays are parallel to one another when they reach Earth 3. you measure the angle of the shadow in Alexandria when there is no shadow in Syene 4. you know the distance between Alexandria and Syene then, you could calculate how big Earth is. Some Key Parts of Eratosthenes’ Reasoning The Calculation On the diagram above, the angle z is the angle of shadow Eratosthenes found in Alexandria. He found it was one-fiftieth of a whole circle. Using a little simple Euclidean geometry, he knew that by drawing a line downward from each wall to the center of the earth, they would form the same angle z. This meant that the distance from Syene to Alexandria was one-fiftieth of the distance all the way around planet Earth. His maps told Eratosthenes that the distance from Alexandria to Syene was 5000 stades. Eratosthenes multiplied 50 x 5000 to get an answer of 250,000 stades for Earth’s circumference.

He then added a correction of 2000 stades (lacking his original work, we don’t know why he did this) and concluded that: Earth’s circumference is equal to 252,000 stades All we need to do now is convert stades to modern units. (Some things are easier said than done!) How Good Was Eratosthenes’ Estimate of Earth’s Size? We can’t say exactly how good his estimate was, because the ‘stade’ unit of length meant different things to different people. Most likely, Eratosthenes would have said which type of stade he was using when he wrote his book, ‘On the Measurement of the Earth,’ but the book is lost in the mists of time. Whichever stade was used, Eratosthenes overestimated the size of Earth. Depending on which stade he used, we can say that his estimate was, at best, within 1% and, at worst, within about 30% of the value we use now.

(Our current value for Earth’s polar circumference is 40,075.16 km or 24,901.55 miles.) Whichever way you look at it, this was an enormous advance in an era when most people in the world had no idea that our planet is approximately spherical. The Sieve of Eratosthenes Using his ‘sieve’ Eratosthenes solved the problem of how to find prime numbers logically and systematically. Prime numbers are those numbers with no factors except for themselves and 1. Mathematicians look on them in the same way as chemists look on the chemical elements. Prime numbers are the building blocks of all other numbers. The first eight prime numbers are 2, 3, 5, 7, 11, 13, 17 and 19. The prime numbers go on forever. There are an infinite number of them. This had already been proved by the Greeks, and the proof was written in Euclid’s Elements. To use the Sieve of Eratosthenes, first decide the highest number you wish to check. Then, starting at 2, write down all of the numbers up to the highest number.

Say you wanted to check all the numbers up to 110, you would write: You would then remove 1, since it’s not prime, and leaving 2, which is prime, you would remove every second number from 2 onwards, to get: And now, leaving 3 alone, you remove every multiple of 3, to get: The next number to leave is 5. Remove every multiple of 5 to get: The next number to leave is 7. Remove every multiple of 7 to get: Repeat this process until all the primes have been found. In the case of primes up to 110, they are all shown in the final table above. All of the numbers that are not prime have been sieved out using Eratosthenes’ method. The procedure can be used to find primes to as high a limit as you like. The End of Eratosthenes Legend has it that Eratosthenes went blind and died by starving himself when he was 80 to 82 years old. Our Cast of Characters Eratosthenes lived in Ancient Greece. He was born in about 276 BC and died in about 194 BC.

Archimedes lived in Ancient Greece. He was born in about 287 BC and died in 212 BC. Euclid lived in Ancient Greece. He was born in about 325 BC and died in about 265 BC. Advertisements Author of this page: The Doc © All rights reserved. Please use the following MLA compliant citation: "Eratosthenes." Famous Scientists. famousscientists.org. 21 Jun. 2014. Web. < 11 great scientists who were part-timers Advertisements Eratosthenes Peter Alfeld, --- Department of Mathematics, --- College of Science --- University of Utah Eratosthenes of Cyrene A versatile scholar, Eratosthenes of Cyrene lived approximately 275-195 BC. He was the first to estimate accurately the diameter of the earth. For several decades, he served as the director of the famous library in Alexandria. He was highly regarded in the ancient world, but unfortunately only fragments of his writing have survived. Eratosthenes died at an advanced age from voluntary starvation, induced by despair at his blindness.

Here are some links to Eratosthenes related web pages: A worldwide experiment based on Eratosthenes original computation of the Earth's circumference. The library of Alexandria. The Sieve of Eratosthenes Eratosthenes also conceived the "Sieve of Eratosthenes ", a method of identifying prime numbers. If you have a Java compatible browser you can use that sieve right here, from this Applet: However, your browser does not support Java. If it did you would not see this message! Get a java compatible browser such as Netscape, of a sufficiently advanced version. What is the Sieve of Eratosthenes? A prime number is a natural number greater than 1 that can be divided without remainder only by itself and by 1. Natural numbers n that can be divided by a number less than n and greater than 1 are composite numbers. The Sieve of Eratosthenes identifies all prime numbers up to a given number n as follows: Write down the numbers 1, 2, 3, ..., n. We will eliminate composites by marking them. Initially all numbers are unmarked. Mark the number 1 as special (it is neither prime nor composite).

Set k=1. Until k exceeds or equals the square root of n do this: Find the first number in the list greater than k that has not been identified as composite. (The very first number so found is 2.) Call it m. Mark the numbers 2m, 3m, 4m, ... as composite. (Thus in the first run we mark all even numbers greater than 2. In the second run we mark all multiples of 3 greater than 3.) m is a prime number. Put it on your list. Set k=m and repeat. Put the remaining unmarked numbers in the sequence on your list of prime numbers. This is exactly what the applet does. If the natural numbers are arranged in a rectangular array than marking the composites gives rise to interesting patterns. The Figure nearby shows one of these patterns (the prime numbers from 2 through 12,743), but seeing the pattern develop is much more interesting than seeing the static final result. Experiment with various options yourself!

Click here or on the pattern to see a similar pattern made of boxes 2 by 2 pixels large, forming a 529 by 369 rectangle, and showing all primes up to and including 195197. Since this is an educational page I'll give you a home work problem: Explain the vertical streaks that seem to be present in the pattern. Once you are done with that, explain why there are no horizontal streaks! Send me your answer! The remainder of this page is A User's Guide to the Sieve of Eratosthenes Applet A quick tour To see how it works, do the following: Click on the applet. Two windows, called " Sieve of Eratosthenes Controls" and "The Sieve of Eratosthenes" will pop up on your screen. They should look like the images nearby on this page and fit on your screen. Arrange them conveniently so that you can see both windows without obstruction. Let's call them the control panel and the drawing window.

The boxes in the drawing window should form a 10 by 10 array representing the numbers 0 through 99 arranged as we read (i.e., from the top left corner to the bottom right corner). Check you understanding by clicking on some of the black boxes and seeing the corresponding numbers show up in the textfield labeled pick: in the 3rd row of the control panel. The blue box corresponds to 1, which as we saw is different from all other numbers. The number zero is not shown since it isn't a natural number. Move the cursor into the drawing window and hit the key "s" (for "step"). The square corresponding to the number 4 is colored white. That means it is not a prime number (since it is a multiple of 2). Hit "s" again. The number six square is colored white. Do this a few times until you see what's happening. Hit the key "p" (for "prime"). The multiples of 2 will be finished off. Hit "s" again (or "p") to see what happens to the multiples of 3. Hit "a" (for "all") to see the rest of the process.

The prime numbers from 2 to 100 are now marked with black boxes. Click on some of them to see that they do indeed correspond to the prime numbers. In the second row of the control panel, change the number in the textfield labeled "size" to 2. (To do this, highlight the 20 that's in the field, type 2, and hit return.) Then click on " do it all" in the first row of the control panel. You'll see patterns emerge as the Sieve of Eratosthenes proceeds, and the final picture (if you didn't resize the drawing window) should look like the pattern in the image above.. If the process is too slow for your taste, do this: Click on "reset" in the control panel. Change "Delay" in the second row of the control panel to 0. Click on "Do it all". If this is still not fast enough, select " Fast" in the upper right corner of the control panel, click on "reset ", and click on "do it all" again. Now the sieve will run as fast as it can on your machine. Details of the Operation. Starting is very simple. You click on the applet.

To Quit Quitting is also very simple. It can be accomplished in a number of ways: Click in the applet on your web page. Click on the QUIT button in the control panel. Type "x", "X", "Q", or "q" in any window. Quit your browser. Let's run through the rows of the control panel: Row 1. do it all! This button starts the sieve, which will run to completion (unless it is interrupted). do 1 prime will start the sieve and let it run until the multiples of the current prime are all marked. If the button is clicked during a full run (started by do it all! ) the run will stop after the current prime is completed. do 1 step similarly will take 1 step of the sieve and then cause it to stop. It will also stop a run in progress. reset will return the drawing window to its original state. resize is required for one of the methods for resizing the drawing window. To use it, resize the drawing window manually and then click on it. The safe/fast menu will select the safe or fast mode. In the fast mode the program runs a little faster and uses less memory.

In the safe mode you can partially cover and uncover, or even close and reopen, the drawing window and its contents will be restored. Row 2. Size: This is the size (in pixels) of the square corresponding to the numbers 1, 2, ... . Changing the size will also cause the drawing window to be reset. The minimum possible size is 1. If the size is greater than 4 then each square is surrounded by a green outline. Altering the size will increase or decrease the n but not the size of the drawing window. Delay: This is the delay in milliseconds used when marking a number as composite. During the delay the corresponding square is rendered in red. For large investigations the delay should be set to zero, but for demonstrations larger values may be suitable. Row 3 Primes: The text window with the buttons "-" and "+" next to it displays the primes that have been found. By default the largest one is displayed. You can go up and down in the list by clicking on the "-" and "+" buttons, respectively. Overwriting the number in the text field will cause the next largest prime to be displayed (within the range of primes found by the sieve).

pick: Clicking on one of the squares in the drawing window will cause the corresponding number to appear in the text field. This is useful for orienting yourself. Row 4. The text windows give the horizontal and vertical extents extent of the drawing window (in boxes) and the length of the list used in the sieve. You can resize the drawing window by specifying the horizontal and vertical extents in the text windows. Row 5. I increase the version number whenever there is a significant change in the code, by an amount roughly proportional to the change. If you are using an old version then you should probably replace it with the newer version provided here (see the downloading instructions below). The Run # is the total number of runs since November 1, 1996, by all copies of the program, to date. I'm not trying to spy on you, but I am curious how much the program is used, and I'm also fascinated by the technology. The count is obtained by sending an inquiry to my system which returns the current count. This ability to communicate over the net opens a lot possibilities which are as yet not even recognized. If my server daemon is down the program runs fine without indicating a count.

The Drawing Window You can resize the drawing window in several ways: Change the horizontal or vertical extent of the drawing area in the control panel. This will interrupt any drawing in progress. While no drawing is in progress, change the size of the window manually, and then click on "resize ". You can also control the drawing action via the key board as follows: "a" or "A" are the equivalent of do it all! "p" or "P" are the equivalent of do 1prime "s" or "S" are the equivalent of do 1 step "r" or "R" are the equivalent of reset "d" or "D" set the delay equal to zero and accelerate the drawing. "x", "X", "q" or "Q " are the equivalent of quit Getting the most out of your applet. To compute the largest possible range of primes on your machine do the following: Click on "reset" or otherwise make sure the drawing has stopped. Set "size" to 1. Make the drawing window as large as possible, and lower the window, or close it. Click on "resize". Set the delay to zero and click on "do it all!

", or with the cursor in the drawing window type "d" and "a". On my machine this process gives rise to a window that 1254 by 894, with n=1,121,075.. Running Standalone and Downloading You may download the byte code of this software and incorporate it into your own web pages or run it on your system in a standalone mode. You need the following Java classes: Discrete Mathematics/Sieve of Eratosthenes - Wikibooks, open books for an open world Discrete Mathematics/Sieve of Eratosthenes Jump to: navigation , search This page or section is an undeveloped draft or outline. You can help to develop the work , or you can ask for assistance in the project room . The Sieve of Eratosthenes is a method for find prime numbers that is attributed to the ancient Greek mathematician Eratosthenes. The idea is to begin by listing all the natural numbers bigger than 2.

2 … {\displaystyle 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24\ldots } and beginning with 2 we go to the first number that as not been crossed off and cross every multiple of that number that is later on in the list. So in the case of 2, no numbers have been crossed so we start by removing every second number after 2. Our list would then look like 1 24 … {\displaystyle 1,2,3,{\cancel {4}},5,{\cancel {6}},7,{\cancel {8}},9,{\cancel {10}},11,{\cancel {12}},13,{\cancel {14}},15,{\cancel {16}},17,{\cancel {18}},19,{\cancel {20}},21,{\cancel {22}},23,{\cancel {24}}\ldots } And we keep applying our rule.

Here our next number not crossed out will be 3, we cross out every third number after 3. That will be 6, 9, 12,… and our list the becomes 1 24 … {\displaystyle 1,2,3,{\cancel {4}},5,{\cancel {6}},7,{\cancel {8}},{\cancel {9}},{\cancel {10}},11,{\cancel {12}},13,{\cancel {14}},{\cancel {15}},{\cancel {16}},17,{\cancel {18}},19,{\cancel {20}},{\cancel {21}},{\cancel {22}},23,{\cancel {24}}\ldots } And so on. At the end only the prime numbers will be left. In this case we have already found all of the primes less than 25. This is because composite numbers must always have a prime factor less than their square root.

If this were not the case for some integer n Sieve of Eratosthenes view multiples of number and find prime numbers Interactive Sieve of Eratosthenes Named after the Greek Mathematician Erastosthenes, the sieve provides a very efficient method for finding prime numbers. We start with a large grid of whole numbers. If we use the simple definition that a prime number is any number that has exactly 2 factors. Then we can eliminate 1 as not prime. The next number 2 is the first prime number, it also is uniquely the only even prime number. Whenever a prime is found, we choose a color for example red and paint all of its multiples, so for 2 this would be 2,4,6,8 ... Anything other than 2 that is painted red cannot be a prime number as it has more than two factors.(1,2 and the number itself). We now look for the next number that has not be colored, in this case 3. This is are next prime, You can use a different color to mark off its multiples 3,6,9,12 ... The process is continued, look for the next number that has not been colored and paint its multiples.

Eventually you will see only the prime numbers remaining. Grid Sizes Use the slider to change size from 2x2 up to 30x30, the really large squares can show how the method works also for larger numbers. Small grids can be used to examine the factors of a particular number (discussed below). Colors To select a particular color, click on it and to remove colors from the grid click on the white brush The split color control when turned on it allows for a square to show more than one color. Click the trash button to remove all colors from the grid Modes The activity has three different modes. In manual mode choose a color, then click and drag over the number squares to color them. In multiples mode, click a square and all it subsequent multiples will be automatically colored. The final automatic mode will run through the sieve, automatically allocating colors for each prime and its multiples. This can be useful for large numbers of squares, note press the start button to begin the process. Animation Speed Use the animation speed slider to change how fast multiples are highlighted Using the Sieve This activity has many different uses and can help explain many mathematical concepts apart from finding prime numbers.

Finding the Lowest/Least Common Multiple (LCM) This example will work fine with the 100 squares or less, press trash to clear the grid, select multiples mode and make sure split color is on. So an example problem would be find the LCM of 4,6. To do this click the red paint icon, and click number 4 in the grid, all the multiples of 4 are now red. Click the yellow paint and then click the number 6, all the muliples of 6 will be shown as yellow. You should see the common multiples are colored boy red and yellow, these are 12,24,36 ... the LCM the least/lowest of the these is 12. You can do this for more than two numbers, just make sure you use a different color for each one of the multiples you are using. Finding the factors of a number Like the LCM example, the default settings are used, multiples mode and split colors. It is important to understand the relationship between factors and multiples. For example if 12 is one of the multiples of 4 then we know that 4 must be a factor of 12.

So using the grid if I wanted to test if 5 is a factor of 15, then I can click trash to clear the grid and then choose a color and click on 5 to show all its multiples. If one of them is 15 then we know that 5 is indeed a factor of 15. To test if 4 is a factor of 15 you can either clear the grid or select a different color and then click 4, in this case the color does not hit 15 and so we know it is not a factor. If you are only interested in the number upto 16, it is possible to select the 4x4 grid and assign a different color for each number 1-16. In this way the number of colors on each number, gives its number of factors Prime factors class exercise This is a whole class activity, as it can help students understand how each number can be expressed as a product of prime numbers. Start with a 100 square, split colors and automatic mode, click start to run through the sieve. When complete the primes have a single border color, and the composite numbers have one or more solid colors. These colors tell which prime factors the number has.

So for example number 60 has 3 colors: red, yellow and lime. Look at the primes that represent these colors, red is 2, yellow is 3 and lime is 5. In this case 60=2×2×3×5 A question for the class would be what is special about the numbers that are not prime but only have a single color. Hopefully they can work out that these numbers only have one prime factor, so examples would be all the square numbers, all the cube numbers or in fact any number that can be expressed as an where a is a prime number and n is a positive integer. Divisibility Tests These grids can also be a good starting place for a discussion on division tests So for example, any number that is divisibly by 2, must be a multiple of 2. So look at these numbers on the grid and hopefully the students can identify these numbers always end in 0,2,4,6 or 8. Other tests can also be investigated. Related activities The number explorer is also a useful teaching tool for factors, multiples and primes. Set the size of the square Set the mode, manual paint, multiples - show multiples of number, Automatic runs sieve.

Toggle split colors, when turned on more than one color can be shown on a square. Set the animation speed. The Prime Glossary: Sieve of Eratosthenes Sieve of Eratosthenes (another Prime Pages ' Glossary entries) Glossary: Curios The most efficient way to find all of the small primes (say all those less than 10,000,000) is by using a sieve such as the Sieve of Eratosthenes (ca 240 BC): Make a list of all the integers less than or equal to n (and greater than one). Strike out the multiples of all primes less than or equal to the square root of n, then the numbers that are left are the primes. For example, to find all the primes less than or equal to 30, first list the numbers from 2 to 30.

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 The first number 2 is prime, so keep it (we will color it green) and cross out its multiples (we will color them red), so the red numbers are not prime. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 The first number left (still black) is 3, so it is the first odd prime. Keep it and cross out all of its multiples. We know that all multiples less than 9 (i.e.

6) will already have been crossed out, so we can start crossing out at 32=9. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Now the first number left (still black) is 5, the second odd prime. So keep it also and cross out all of its multiples (all multiples less than 52=25 have already been crossed out, and in fact 25 is the only multiple not yet crossed out).

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 The next number left, 7, is larger than the square root of 30, so there are no multiples of 7 to cross off that haven't already been crossed off (14 and 28 by 2, and 21 by 3), and therefore the sieve is complete. Therefore all of the numbers left are primes: {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}. Notice we just found these primes without dividing.

This algorithm can be written in pseudo-code as follows Eratosthenes(n) { a[1] := 0 for i := 2 to n do a[i] := 1 p := 2 while p2 < n do { j := p2 while (j < n) do { a[j] := 0 j := j+p } repeat p := p+1 until a[p] = 1 } return(a) } This method is so fast that there is no reason to store a large list of primes on a computer--an efficient implementation can find them faster than a computer can read from a disk. In fact the problem with the algorithm as presented above is not really speed (it uses O (n( log n)log log n) bit operations), but rather space (it is O(n)). So for large n we usually use a segmented sieve. However, both the time and space theoretically can be improved; for example, Pritchard's "linear segmented wheel sieve" uses O(n log n) bit operations and O(sqrt(n)/log log n) space. Eratosthenes Eratosthenes 276-195 B.C.E.

It can be said that Eratosthenes is most widely known as a famous Greek mathematician. What most people probably do not know is that Eratosthenes is not only a famous mathematician but also a well known geographer, astronomer and historian. Before I get into a few of his accomplishments, let me tell you a little about his personal history. Eratosthenes was born in Cyrene, Greece, which is now known as Libya, in North Africa, in 276 B.C.E.. It is believed that he starved himself to death in 195 B.C.E. due to the fact that he became blind and could no longer work. As a young man, Eratosthenes studied in Athens. Eventually, he made such a name for himself in his many fields that he caught the attention of the ruler of Egypt, Ptolemy III. Ptolemy III invited Eratosthenes to Alexandria, Egypt for two reasons; to tutor his son and to be the librarian for the great Alexandrian University. Eratosthenes jumped at the chance. At the University, he was able to at most interested him and associate with other scholars. Now on to his accomplishments. .

. One of his major accomplishments in mathematics is his creation of a sieve that determines prime numbers up to any given limit. This sieve, which is called, the Sieve of Eratosthenes, is still important today in number research theory. Prime numbers are natural numbers greater than 1 that can be divided without remainder only by itself and by 1. Eratosthenes figured out that if you were to write down all the natural numbers from 2 to infinity and "sieve out" every second number after two (or multiples of two), then move to the next available number (3) and continue to "sieve out" every multiple of 3 and so on, one would end up with a list of prime numbers. Eratosthenes is also known for his achievement in astronomy. Several astronomers and mathematicians before and after Eratosthenes tried to accurately measure the circumference of the Earth, but is was Eratosthenes that came through. He found the circumference of the Earth to be nearly 250,000 stadia (25,000 miles).

Eratosthenes observed that the sun shone directly down a well at high noon on the day of the summer solstice in Syene and that it cast a shadow in Alexandria, directly south of where the well was. To calculate the circumference of the Earth, Eratosthenes measured the angle of the shadow to the Earth. Until he realized this, Eratosthenes believed that the sun was so far away that its rays were parallel. It is also believed that Eratosthenes made a star catalog with approximately 675 stars and created a calendar that included leap years. As a historian, Eratosthenes decided to work on giving a systematic chronography of the known world by figuring out the dates of literary and political events from the siege of Troy up until his time. However, this was only a beginning. Others built on his foundation. There is still more. Eratosthenes also contributed to geographic source of the river. Many scholars that preceded Eratosthenes in the study of the Nile river, tried to figure out the reason why parts of the river flooded while other parts did not. It was not until Eratosthenes that a correct answer was proposed.

He believed that heavy rains near the source of the Nile was the cause of Many of Eratosthenes' peers nicknamed him "Beta" which is the second letter of the Greek alphabet, indicating that he just fell short of first place. Eratosthenes contributed greatly to many different areas of knowledge, more than I could cover in this short paper. Maybe in his time period, his peers did not feel that he contributed enough in one area or maybe they were jealous that he had contributed so much to so many areas. For a man who was nicknamed Beta, it is pretty impressive that so much of his work in these areas is still discussed today, so many years later. Contributed by Courtney Ast

Question: The sieve of Eratosthenes is an ancient method used to find what in mathematics?
Answer: Prime numbers