Flowdock
method

extend_table

Importance_0
extend_table() private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/prime.rb, line 471
    def extend_table
      lbound = NUMS_PER_TABLE * @tables.length
      ubound = lbound + NUMS_PER_TABLE
      new_table = [FILLED_ENTRY] * ENTRIES_PER_TABLE # which represents primarity in lbound...ubound
      (3..Integer(Math.sqrt(ubound))).step(2) do |p|
        i, j, k = indices(p)
        next if @tables[i][j][k].zero?

        start = (lbound.div(p)+1)*p  # least multiple of p which is >= lbound
        start += p if start.even?
        (start...ubound).step(2*p) do |n|
          _, j, k = indices(n)
          new_table[j] &= FILLED_ENTRY^(1<<k)
        end
      end
      @tables << new_table.freeze
    end
Register or log in to add new notes.