\(\left( {{2^{77,232,917}} - 1} \right)\) led to some interesting discussions in a couple of my classes the past couple of weeks...."/>

Some fun with primes ... and Geogebra

Thursday 18 January 2018

Prime numbers are fascinating, mysterious and useful.  The topic of prime numbers can pop up in a maths lesson at many different ages and ability levels.  The announcement two weeks ago of a ‘new’ largest known prime number \(\left( {{2^{77,232,917}} - 1} \right)\) led to some interesting discussions in a couple of my classes the past couple of weeks.  I have a poster in my classroom that lists all the prime numbers between 1 and 10,000 (there are 1229 of them) – and it gives some impression about the distribution of prime numbers. The 'density' of primes certainly seems to decrease as we move to ever larger positive integers. Students are intrigued by this. It might be an opportunity to mention the Prime Number Theorem (good Numberphile video here on it), but I think it might be a bit too much for most students. If time allows, I find it fun to give students some way to actively explore something about prime numbers, and how they are - or how they are not - distributed is very accessible given some easy-to-use maths software such as Geogebra.

The important thing to me is the active exploring - rather than just passively reading something about prime numbers on a website. So, the task that we set ourselves in one of my classes this week was to use Geogebra to produce some kind of frequency distribution plot for all 1229 prime numbers between 1 and 10,000. When I can carve a bit of time out of a Maths HL or SL class (especially 1st year), I like doing activities with suitable maths software because it shows students what kind of tools that might be useful to them when they are writing their Exploration (IA). So, activities like this can act as a type of mini-tutorial on using some technology - Geogebra in this case.

Note: I wrote a blog post three years ago this month about how a classroom discussion lead to some students writing a computer program - and me writing a program on the TI-Nspire - that counted the number of primes that occur for certain intervals. But using Geogebra is significantly easier and more accessible to students than writing a calculator or computer program.

We decided that we would try to display a plot on Geogebra that indicates the number of primes for each interval of 100 integers from 1 to 10,000. That is, how many primes between 1-100, 101-200, 201-300, etc.  Here is what I did - with some support (mostly in the form of asking questions) from my students. I fully accept that someone with a higher level of expertise with Geogebra may come up with a more efficient way of producing the frequency distribution plot - but this works well, and does not take long. So, below I have attempted to clearly explain the 11 steps (along with some other tips) for producing the plot we wanted.

Creating a frequency distribution plot of prime numbers with Geogebra

This is a set of instructions for creating a list of prime numbers up to some maximum number (10,000 is used here), and then creating a plot that shows the number (frequency) of primes for each interval (interval width is 100 for this example).  The maximum number and interval width can easily be changed to create different frequency plots.  [note: I used Geogebra Classic v.6, but these instructions should be useful for other versions]

Start with Algebra, Graphics and Spreadsheet views open.

1.   So that the dots in the plot are not too large (and possibly overlap), it’s a good idea to change the default size for points.  Choose the Point tool and click on the point symbol (Set point style) in upper right of screen.  I suggest setting the dot to solid format and size 3.

2.   Use the Sequence command to create a list, L1, of integers from 2 (first prime number) up to your chosen maximum number (again, using 10,000). 
L1 = Sequence(i, i, 2, 10000)

3.   Use the Sequence and IsPrime commands to create a list, L2, by testing whether each number in L1 is prime or not.  If a number in L1 is prime then it is not changed, and if the number is not prime it is replaced with the number zero.   
L2 = Sequence(If(IsPrime(L1(i))==true, L1(i), 0) 1, 9999)   

[note: enter this command very carefully because of all the brackets; the numbers in L1 go from 2 to 10000, so there are 9999 numbers in L1; write subscripts using underscore – e.g. L1 is entered as L_1 ]

4.   Use the Unique command to create a list, L3, that removes all the repeated zeros in L2 except one zero at the start of the list.   L3 = Unique(L2)

5.   Use the Remove command to remove the zero at start of L3, creating L4.     L4 = Remove(L3, {0})

6.   Use the Sequence command to create a list, L5, of the interval endpoints (upper & lower values).
L5 = Sequence(100i, i, 0, 100)     [note: the last number, 100, comes from finding how many times the chosen interval width (100 here) divides into the maximum number; e.g. 10 000/100 = 100]

7.   Use the Frequency command (see below) to create a list, L6, that counts the number of primes in each interval. 
L6 = Frequency(L5, L4)

8.   For the points that will eventually be plotted, the 1st coordinate is the upper value for each interval (100, 200, 300, etc) and the 2nd coordinate is the number of primes (frequency) for that interval.  Use the Sequence command to create a list, L7, of the upper value for each interval.  
L7 = Sequence(100i, i, 1, 100)

9.   Use the FillColumn command (twice) to fill column B in the spreadsheet with upper value for each interval (L7); and fill column C with the frequencies (L6).  FillColumn(2, L7) and FillColumn(3, L6)

[note:  In FillColumn command, the number refers to the column; 2=B, 3=C)

Before the final steps, it is a good idea to set suitable graph dimensions and formatting for the Graphics view.  Clearly the x-axis should go from 0 to 10000, for the maximum number of 10000 in this example.  The maximum frequency is 25 (1st interval from 0 to 100), so the y-axis should go from 0 to around 30.  I prefer to turn the grid off (no gridlines shown), or at least have some suitable grid settings – such as show only major gridlines and make the ‘distance’ 500 or 1000 for the x-axis (for this example with interval width of 100).

10.   In Spreadsheet view, select columns B and C.  Choose the {•••} List of Points tool.  Two things should occur:  (i) a plot of all the points appear in the Graphics view, and (ii) a new list, L8, is created in the Algebra view.  L8 contains all the ordered pairs, (L7, L6), of the plotted points.

[note:  A preview of L8 will appear in a box and you need to click on the Create button; it may take a few seconds before the plot of points appear in the Graphics view)

11.   Use the FillColumn command to fill column A with the ordered pairs of all the plotted points.  FillColumn(1, L8)    If you select an ordered pair from column A, the corresponding point is highlighted in the Graphics view.  You can move quickly down the list of points in column A by just repeatedly pressing the down arrow and observe how the frequencies change (decrease) in the Graphics view.  Image of final plot below.

 

download PDF file of the 11-step set of instructions



Comments


To post comments you need to log in. If it is your first time you will need to subscribe.