### Recent postsView all

 Problem: find exact ratio of are…1 Sep 19 Probability - Complement Approac…1 Jun 19 Worked Solutions - HL Paper 1 Ex…21 May 19 Euler's method on the TI-Ns…17 Mar 19 what is path of midpoint of a fa…24 Nov 18 Effective GDC Use #317 Nov 18 P.o.t.D.- 301 problems30 Sep 18 Effective GDC Use #219 Sep 18 Effective GDC Use #111 Sep 18 P.o.t.D.- 250 Problems6 May 18 Some fun with primes ... and Geo…18 Jan 18 primitive Pythagorean triples30 Dec 17

# counting primes

Tuesday 2 December 2014

Even though they do not need to know it for any exam question, I think any student in IB Math HL or SL should be familiar with Euclid's famous proof of the infinitude of primes. The only formal proof method that a Math HL student is required to know is proof by mathematical induction. A far more elegant (and perhaps better understood by most students) method of proof is a proof by contradiction - and Euclid's proof that there are an infinite number of prime numbers is probably the best known example of this method. Below is a fairly clear explanation of Euclid's proof taken from a site by Peter Alfeld, a professor of mathematics at the University of Utah.

So, what's the point of this blog post? Before I answer that, let me mention two observations of mine from many years in the classroom. Firstly, most students are intrigued by prime numbers - finding them, counting them, finding the website with the largest known prime, etc. And, secondly, the programming capability of graphing calculators - especially the more recent models such as the TI-Nspire CX - is often overlooked as a tool for student exploration (not to mention learning the basics of programming). Combining these two observations, I often show students the fundamentals of how to program on their TI-Nspire and challenge them to write a short program to count the number of primes between two given numbers (inclusively). The program can be quite short especially if students are made aware of the fact that there is a built-in command on the TI-Nspire that determines whether a given number is prime or not.

Here is a program that one of my students recently wrote. Not sure you could make it much shorter. The output (shown below the program listing) is very nice. In another blog post, I'll report on how students have made further investigations on how their results from using this program compares to the prime number counting function - and its many approximations.

9592 primes less than or equal to 100 000 (only took TI-Nspire computer software about 1 second to compute this)