title: Find First Natural Number Whose Factorial Divisible X
signature: func findFirstNaturalNumberWhoseFactorialDivisibleX(x int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(x int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(x),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(67, 66)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(47, 46)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(57, 19)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(89, 88)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(67, 66)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(40, 5)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(16, 6)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(83, 82)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(93, 31)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(43, 42)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def find_first_natural_number_whose_factorial_divisible_x(x):
      i = 1
      fact = 1
      for i in range(1, x):
          fact = (fact * i)
          if ((fact % x) == 0):
              break
      return i
source_cpp: int find_first_natural_number_whose_factorial_divisible_x(int x) {
    int i = 1;
    int fact = 1;
    for ( i = 1;
    i < x;
    i ++ ) {
      fact = fact * i;
      if ( fact % x == 0 ) break;
    }
    return i;
  }