Ruby/problem037.rb
# NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
2, 3, 5, and 7 are not considered to be truncatable primes.
2 3 5 and 7 are not considered to be truncatable primes .
def find_primes(limit)
  num_array = (2...limit).to_a
  num_array.each_with_index do |val, index|
    if val
      index += val
      while index < limit-2
        num_array[index] = nil
        index += val
      end
    else
      next
    end
  end
  num_array
end
def find_primes ( limit ) num_array = ( 2 ... limit ) . to_a num_array . each_with_index do | val , index | if val index += val while index < limit - 2 num_array [ index ] = nil index += val end else next end end num_array end
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
NOTE : 2 3 5 and 7 are not considered to be truncatable primes .
limit
<not_specific>