Definition

Euclid(c, m)
Euclid(c, m) is the set resulting from the application of the eXtended Eratosthenes Sieve to the base sequence c + m k, with k ranging from 1 to infinity, and with c relatively prime to m and such that 0 < c < m.

For evident reasons, to calculate Euclid(c, m) we have to stop k at a top t value. So we can write the operating definition of Euclid(c, m) as follows:

Here is the formulation as a Mathematica function:

Euclid[ c, m, t ]
Euclid[ c_Integer, m_Integer, t_Integer ] :=
  pXES[ Range[ c + m, t, m ] ]  /; IsCoprime[ c, m ] && 0 < c < m && IsNaturalZ[ t ]

It gives the terms of Euclid(c, m) up to t.

Note that Euclid and other functions use p-rivate versions of the exposed functions to speed up computation time, reducing tests on arguments.

 

 

Properties

As you can see in the example above, the terms of the Euclid(c, m) set are prime numbers only for Euclid(1, 2), but they are composite and prime in any other case. To study a little bit deeper the divisibility of the terms of the Euclid(c, m) set I provided the following functions:

CompositeTerms[ set ]
CompositeTerms[ set_List ] := Cases[ set, x_ /; Not[ PrimeQ[ x ] ] ] /; IsNaturalZ[ set ]

It gives the subset of the composite numbers in the set.

CompositeRatio[ set ]
CompositeRatio[ {} ] := 0.0
CompositeRatio[ set_List ] := N[ 100 Length[ CompositeTerms[ set ] ] / Length[ set ] ]

It gives the percentual of composite numbers in the set.

PlotCompositeRatio[ c, m, start, stop, step ]
PlotCompositeRatio[ c_Integer, m_Integer, start_Integer, stop_Integer, step_Integer ] :=
  ListPlot[ Table[ {k, CompositeRatio[ Euclid[ c, m, k ] ]}, {k, start, stop, step} ],
    PlotJoined -> True,
    PlotRange -> All,
    Axes -> False,
    Frame -> True,
    FrameTicks -> {Automatic, Range[ 1, 100, 2 ]},
    GridLines -> {Range[ start, stop, step ], Range[ 1, 100, 1 ]}
  ]

It plots CompositeRatio[ Euclid[ c, m, k ] ] with k ranging from start to stop, by step.