title: Sum Of All Proper Divisors Of A Natural Number
signature: sumOfAllProperDivisorsOfANaturalNumber :: Integer -> Double
  sumOfAllProperDivisorsOfANaturalNumber num = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Double -> Double -> Bool
  validateSolution actual expected = do
      (abs (actual-expected)) < 1e-06
  
  driver :: Integer -> Double -> String
  driver num expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME num) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (2) (1.0) )
  
      printf "TEST-1...%s\n" (driver (57) (23.0) )
  
      printf "TEST-2...%s\n" (driver (28) (28.0) )
  
      printf "TEST-3...%s\n" (driver (43) (1.0) )
  
      printf "TEST-4...%s\n" (driver (38) (22.0) )
  
      printf "TEST-5...%s\n" (driver (29) (1.0) )
  
      printf "TEST-6...%s\n" (driver (45) (33.0) )
  
      printf "TEST-7...%s\n" (driver (47) (1.0) )
  
      printf "TEST-8...%s\n" (driver (44) (40.0) )
  
      printf "TEST-9...%s\n" (driver (3) (1.0) )
  
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 );
  }