You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: calcmonosize.rb
    path of file: ./repos/genometools/scripts
    
    the code of the file until where you have to start completion: #!/usr/bin/env ruby

# compute the size of the representation of a monotone sequence of integers
# the representation is described in author =
# Gonnella, G. and Kurtz, S.
# Readjoiner: a fast and memory efficient 
    
def monotonesize(numofelems,maxvalue,trace=false)
  beta = log2 maxvalue.ceil
  minbits = nil
  mindelta = nil
  extra = nil
  0.upto(beta) do |delta|
    bits = numofelems * delta + 2 ** (beta-delta)
    if trace
      puts "delta=#{delta},beta=#{beta},bits=#{bits/8}"
    end
    if minbits.nil? or bits < minbits
      minbits = bits
      mindelta = delta
      extra = 2 ** (beta-delta)
    end