<commit_before>#! /usr/bin/env ruby

# http://projecteuler.net/index.php?section=problems&id=12

def count_factors_in_a_number number
  
  factors = Array.new
  factors.push(number)
  
  (1..(number/2)).each do |potential|
    
    if number % potential == 0
      
      factors.push(potential)
      
    end
    
  end
  
  return factors.length
  
end

def return_first_triangle_number_with_the_following_number_of_factors factors
  
  current_leaders = Array.new
  current_leaders[:number_of_factors] = 0
  current_leaders[:triangle_number] = 0
    
  current_natural_number = 1
  
  while current_leaders[:number_of_factors] < factors
    
    
    
    
  end
  
  
end<commit_msg>Just keeping updated on my work on problem 12<commit_after>#! /usr/bin/env ruby

# http://projecteuler.net/index.php?section=problems&id=12

def count_factors_in_a_number number
  
  factors = Array.new
  factors.push(number)
  
  (1..(number/2)).each do |potential|
    
    if number % potential == 0
      
      factors.push(potential)
      
    end
    
  end
  
  return factors.length
  
end

def return_first_triangle_number_with_the_following_number_of_factors factors
  
  current_leaders = Array.new
  current_leader_number_of_factors = 0
  current_leader_triangle_number = 0
    
  current_natural_number = 1
  number_to_add_to_current_triangle_number = 2
  
  while current_leader_number_of_factors < factors
    
    current_number_of_factors = count_factors_in_a_number(current_natural_number)
    
    if current_number_of_factors > current_leader_number_of_factors
      current_leader_number_of_factors = current_number_of_factors
      current_leader_triangle_number   = current_natural_number
      puts current_number_of_factors
    end
    
    current_natural_number += number_to_add_to_current_triangle_number
    
    number_to_add_to_current_triangle_number += 1
    
  end
  
  return current_leader_triangle_number
  
  
end



puts return_first_triangle_number_with_the_following_number_of_factors(500)
{'fraction_non_alphanumeric': 0.05742574257425743, 'fraction_numerical': 0.011386138613861386, 'mean_word_length': 3.541573033707865, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3572726', 'n_tokens_mistral': 730, 'n_tokens_neox': 668, 'n_words': 107}