Alright, in words... The object is to get all prime numbers up to and including our input. First we take the lowest number, which in this case is 2. We need to eliminate all multiples of that number. In other words, create an array where the element values divided by 2 yields a remainder. At this point we have an array of nothing but stuff that is NOT divisible by 2. This is our new list, so we save it. Now we go up to 3 and repeat, saving our new array as we go. Ahhh, I see what's going on. The first element in each new array is greater than the element we are going to divide by. So it leaves 0 and a remainder. I need to use a floor or int function. Stay tuned...

In reply to Re^2: What am I missing? by neo_
in thread What am I missing? by neo_

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.