source/euler47.rb
# I wonder if there's some better wayt do this with analysis
I wonder if there's some better wayt do this with analysis
I wonder if there ' s some better wayt do this with analysis
def first_n_with_n_factors(n)
  consecutive = []
  i = 2 
  while consecutive.length < n
    consecutive << i if i.distinct_prime_factors.length == n
    consecutive = [] if i.distinct_prime_factors.length != n
    i += 1
  end
  consecutive
end
def first_n_with_n_factors ( n ) consecutive = [ ] i = 2 while consecutive . length < n consecutive << i if i . distinct_prime_factors . length == n consecutive = [ ] if i . distinct_prime_factors . length != n i += 1 end consecutive end
I wonder if there's some better wayt do this with analysis
I wonder if there ' s some better wayt do this with analysis
# 1 isn't prime, so it doesn't have prime factors
n