prime_plot


prime_plot, a Python code which plots the prime and composite numbers.

An N by N grid A of squares is displayed. If N is prime, then the squares A(N,1:N) are red. If N is composite, then A(N,D) is blue for each divisor of N.

Usage:

prime_plot ( 'n_max' )
where

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

prime_plot is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

box_display, a Python code which displays a box plot, over integer pairs of data, of a function defined by two formulas.

is_prime, a Python code which implements various versions of the sieve of Eratosthenes to determine whether a given integer is prime.

lucas_lehmer, a Python code which determines whether a Mersenne number 2^n-1 is prime by applying the Lucas-Lehmer test.

prime, a Python code which counts the number of primes between 1 and N, intended as a starting point for the creation of a parallel version.

prime_factors, a Python code which returns a list of the prime factors of an integer.

prime_fermat, a Python code which applies Fermat's primality test to an integer n, which always correctly identifies primes, but sometimes also accepts nonprimes. Nonetheless, the test is useful for weeding out most nonprimes. The accuracy of the test can be improved by running it for several bases.

prime_pi, a Python code which evaluates Pi(n), the number of primes less than or equal to an integer n.

python_plots, a Python code which uses plotting to illustrate a mathematical structure, such as an iterative map, a fractal, a curve or surface.

Source Code:


Last revised on 12 January 2023.