title: Sum Of All Proper Divisors Of A Natural Number
signature: class Solution {
  
      public Float sumOfAllProperDivisorsOfANaturalNumber(Integer num) {
source_py: def sum_of_all_proper_divisors_of_a_natural_number(num):
      result = 0
      i = 2
      while (i <= math.sqrt(num)):
          if ((num % i) == 0):
              if (i == (num / i)):
                  result = (result + i)
              else:
                  result = (result + (i + (num / i)))
          i = (i + 1)
      return (result + 1)
source_cpp: int sum_of_all_proper_divisors_of_a_natural_number(int num) {
    int result = 0;
    for ( int i = 2;
    i <= sqrt ( num );
    i ++ ) {
      if ( num % i == 0 ) {
        if ( i == ( num / i ) ) result += i;
        else result += ( i + num / i );
      }
    }
    return ( result + 1 );
  }
question_info.extension: java
question_info.entry_fn_name: sumOfAllProperDivisorsOfANaturalNumber
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"num": 2}}, {"idx": 1, "outputs": 23.0, "inputs": {"num": 57}}, {"idx": 2, "outputs": 28.0, "inputs": {"num": 28}}, {"idx": 3, "outputs": 1, "inputs": {"num": 43}}, {"idx": 4, "outputs": 22.0, "inputs": {"num": 38}}, {"idx": 5, "outputs": 1, "inputs": {"num": 29}}, {"idx": 6, "outputs": 33.0, "inputs": {"num": 45}}, {"idx": 7, "outputs": 1, "inputs": {"num": 47}}, {"idx": 8, "outputs": 40.0, "inputs": {"num": 44}}, {"idx": 9, "outputs": 1, "inputs": {"num": 3}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer num, Float expected){
          try{
              Driver driver = new Driver();
              if (driver.run(num,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(2, 1.0f);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(57, 23.0f);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(28, 28.0f);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(43, 1.0f);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(38, 22.0f);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(29, 1.0f);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(45, 33.0f);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(47, 1.0f);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(44, 40.0f);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(3, 1.0f);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer num, Float expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(num),expected);
      }
      
      public boolean validateSolution(Float actual, Float expected){
          return Math.abs(actual - expected) < 1e-06f;
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__