Sage: Working with Maximum Prime Factors

Often, in the Sage notebook, if you need a function you can just guess what it might be called. For instance, say I wanted the prime factorisation of 8095897323:

Notice that I use the symbol “>” for the output of a command. But what if I wanted to have the prime factors as a list instead? We could do:

The object returned is a list in Python. Now suppose I just wanted the largest prime factor. We could use Python’s max function:

What could we do with this? Perhaps we could keep track of the maximum prime factor of a number i as i varies from 2 to 2000:

Notice how I didn’t put an output this time. That’s because the output is a graph! That’s what the point command does to the list of points s: it just plots the points on a graph. Here it is:


Now you can make your own plots involving maximum prime factors!


Leave a comment

Fields marked with * are required. LaTeX snippets may be entered by surrounding them with single dollar signs. Use double dollar signs for display equations.