WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Number Conversion

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Prime Number Generator

Keywords:   prime number generator

;Prime finder "Sieve of Erastophanes"
BoxOpen(0,0)
Maxprime=1000
PrimeList="1"
list=ArrDimension(Maxprime+1)

ArrInitialize(list,1)
list[0]=0
list[1]=0


index=0
inc=1
while index <= Maxprime
    BoxTitle("---")
    BoxText(index)
    if list[index] == 0
       index=index+1
       continue
    endif

    num=index
    num2=num*2
    Primelist=strcat(PrimeList," ",num)
    for xx=num2 to MaxPrime by num
       list[xx]=0
       BoxTitle(xx)
    next
    index=index+1
endwhile

AskItemList("Primes",PrimeList," ",@unsorted,@single)

Article ID:   W15219
File Created: 2002:09:05:13:50:42
Last Updated: 2002:09:05:13:50:42