# 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:

factor(8095897323)
> 3^3 * 97 * 3091217


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:

prime_factors(8095897323)
> [3, 97, 3091217]


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

max(prime_factors(8095897323))
> 3091217


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:

s = []
for i in range(2,2000):
s.append( (i,max(prime_factors(i)) ))
point(s)


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!