clueless...making sieve of eratosthenes "sieve.asm" program

Trying to make a sieve.asm program but am very clueless on how to even begin. Its sopost to be a basic prime number generator using tables. If someone could help me I would be very thankful.


  • If I remember right,your eratosthenes uses a table which initialy holdes all number from 1(or 2?) up to N.Then you do a loop like this:

    1. take first element of table
    2. erase all multiples of it from the table.multiples are easy and fast to calculate by add the number again and again on a temporary value until you have killed all multiples in your table
    3. repeat step 2 with all following items in your table.


    table = {2,3,4,5,6,7,8,9,10}

    first element is 2,killing all mutliples of 2:

    table = {2,3,5,7,9}

    next item is 3:

    table = {2,3,5,7}

    your highest number in the table was '9',so you only have to repeat this,until your current item is half the biggest number.

    hope this helps a little...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion