
-----------------------------------
Homer_simpson
Thu Dec 17, 2009 12:08 pm

Prime numbers elimination method(c++ vs turing)
-----------------------------------
finds prime numbers by elimination method. fairly quick in turing but no match for c++

View.Set ("text:400;100000")
const top := 15000 %replace this value



var arr1 : array 1 .. top of int
var newtop, oldtop, counter := 0

for i : 1 .. top
    if ((i mod 2) not= 0) and i not= 1 then
        newtop += 1
        arr1 (newtop) := i
    end if
end for

oldtop := newtop
newtop := 0
counter := 1
loop
    for i : 1 .. oldtop
        if (arr1 (i) mod arr1 (counter)) not= 0 or (arr1 (i) 