Help:=proc(): print(`SA(n), IsDiv(n,L), OneStep(L)`) : print(`PrimeList(N), PrimeListM(N) `): end : #SA(n): The list of primes <= n SA:=proc(n) local i,j: {seq(i,i=1..n)} minus {seq(seq(j*i,i=2..n/j),j=2..trunc(sqrt(n)))} minus {1}: end: #IsDiv(n,L): inputs a pos. integer n and a list #of pos. integers L, and outputs true if #n is divisible by any of the members of L IsDiv:=proc(n,L) local i: for i from 1 to nops(L) do if n mod L[i]=0 then RETURN(true): fi: od: false: end: #OneStep(L): inputs the list of the first primes #and outputs the same list with one more prime that #comes right after OneStep:=proc(L) local i,n: #n is the largest prime so-far n:=L[nops(L)]: for i from n+1 while IsDiv(i,L) do od: [op(L),i]: end: #The list of the first N prime numbers, our way PrimeList:=proc(N) local i,L: L:=[2]: for i from 2 to N do L:=OneStep(L): od: L: end: #The list of the first N prime numbers, the Maple way PrimeListM:=proc(N) local i: [seq(ithprime(i),i=1..N)]: end: