Second Year
Home Up



Second Year Number Theory

A note of late March 2017. You may encounter a problem opening my Maple worksheets (as indeed I do myself) here at my web site - it would appear to depend on the internet browser being used. Thus, if I attempt to open one of my worksheets using Interner Explorer there is never a problem, whereas if I use Firefox then all that one sees - this is just an example - is something like this: {VERSION 3 0 "IBM INTEL NT" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 0 128 0 128 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "2D Output" 2 20 "" 0 0 0 128 0 1 0 1 0 0 0 0 0 0 0 }{CSTYLE " " -1 256 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" and so on (almost at infinitum)...

I asked Maplesoft for advice on this and they recommended doing the following (and I found it worked):

  1. Don't attempt directly to open the worksheet (by clicking on my link), instead right click and save the worksheet to (say) the download folder.

  2. Now that the worksheet is in the download folder (cut it out if you wish and put into whatever folder you wish) you may open the worksheet in the usual way (I should add that while I see this 'works', I have absolutely no idea as to why it does... ) [END OF NOTE].


To reduce files sizes I have removed all output, and so you will need to re-execute all commands. But be careful about removing certain comment signs (the '#') in command lines; they are there for a reason, and you need to know what they are for. For example, be careful using the 'ifactor' command!! The difficulty of factoring large, specially constructed integers is the basis of public-key cryptography, a point that I emphasise to my students, and which they study in the third year. 200! is easy to factor because..., but the much smaller (and famous) RSA129 is difficult because...

Worksheet demo1.mws (probably only make real sense to students attending class). Here a major aim of mine was to demonstrate the power of Fermat's little theorem, and to sow lots of seeds for later work. The material in this worksheet was developed in a single class, with the commands being entered as the class and its discussion developed (I just got in my punch line as my alarm clock sounded!) Later my students got an opportunity to practice the work seen here in the computer lab.

Worksheet ab_de_pe.mws. Here my aim was to introduce Maple's Number Theory package, to introduce the terms abundant, deficient and perfect numbers... The material was developed in a single class, as above. A much fuller version - with explanatory test etc, and using procedures - but with Maple output removed, is my abun_etc.mws. An interested reader - one wishing to read about how Euclid's theorem on perfect numbers connects with the modern problem of finding record size Mersenne primes - should consult the October 1996 lecture I gave on this; it is in the Public and Other Lectures corner of my site.

Worksheet igcd_int.mws. Here my aim was to introduce the greatest common divisor (factor) of two integers, to alert that Maple does not find the gcd by factoring (which is hard to do, ... the relevance to public-key cryptography of the difficulty of the factoring problem...). Here are some fully developed, related worksheets:

gcd.mws (a fairly complete exposition - without proof - of the Euclidean algorithm). gcd_pict.mws (some graphics - nice crossword type figures - involving gcds. Anyone who knows their Number Theory, and who invested the right amount of effort, could use this as an aid to studying the beautiful result that the probability of two random integers having gcd 1 is ...). i_l_comb.mws (integer linear combinations: the extended Euclidean algorithm). a=bq+r.mws (a gcd worksheet). see_gcd_steps.mws (another gcd worksheet).

Fundamental property of primes (18KB).

(Towards) Sierpinski numbers.

Worksheet proc1.mws. Here I introduced the writing of Maple procedures (some of the above worksheets already employ procedures). The point that I try to emphasise is that procedures are like functions. I show how to access Maple's internal code for various commands (interface(verboseproc=2), etc), point out that Maple doesn't allow access to all its code (e.g., it doesn't allow access to igcd...)

pseudoprimes.mws. Here I introduce - with motivation relating to Fermat's 'little' theorem - the important notion of a pseudoprime, and consider increasing layers of improvement (without getting to a top layer, as it were) of procedures for finding examples.

Contact details. jbcosgrave at