hello i was just looking back on some stuff i did a few months back and although im aware there is a function for generating the prime subset up to a given number already featured in a package in mape im just curious to know how this one measures up in terms of computational efficiency etc.

anyway, this is code, if anyone has the time to give it a try and let me know what they think ie faster more logical way about it any feed back is appreciated cheers.

restart;

interface(showassumed = 0, rtablesize = infinity);

with(plots); with(numtheory); with(Statistics); with(LinearAlgebra); with(RandomTools); with(codegen, makeproc); with(combinat); with(Maplets[Elements]);

unprotect(real, rational, integer, complex);

alias(P[In] = CurveFitting[PolynomialInterpolation]); alias(L[In] = CurveFitting[LeastSquares]); alias(R[In] = CurveFitting[RationalInterpolation]); alias(S[In] = CurveFitting[Spline]); alias(B[In] = CurveFitting[BSplineCurve]); alias(L[In] = CurveFitting[ThieleInterpolation], rho = frac); alias(`𝒩` = Count); alias(`𝔻` = numtheory:-divisors); alias(sigma = numtheory:-sigma); alias(`ℱ` = ListTools['Flatten']); alias(`𝕊` = seq);

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc;

`𝕄` := proc (X, Y) options operator, arrow; map(X, Y) end proc;

`𝒞`[S, L] := proc (X) options operator, arrow; convert(X, 'list') end proc;

`𝒞`[L, S] := proc (X) options operator, arrow; convert(X, 'set') end proc;

`ℙ` := proc (N) options operator, arrow; `minus`({`𝕊`(k*delta(`𝒩`(`ℱ`(`𝒞`[S, L](`𝕄`(`𝒞`[S, L], `𝕄`(`𝔻`, `𝔻`(k)))))), 3), k = 1 .. N)}, {0}) end proc;

N -> `minus`({(k delta(𝒩(ℱ(𝒞[S, L]((𝒞[S, L])

𝕄 (𝔻 𝕄 (𝔻(k)))))), 3)) 𝕊 (k = 1 .. N)},

{0})

n[P] := proc (N) options operator, arrow; `𝒩`(`𝒞`[S, L](`ℙ`(N)))-1 end proc;

Maple Worksheet - Error

Failed to load the worksheet **/maplenet/convert/prime_subset_up_to_N.mw **.

Download prime_subset_up_to_N.mw