title: Sum Of All Proper Divisors Of A Natural Number
signature: def sum_of_all_proper_divisors_of_a_natural_number(num):
test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return abs(actual - expected) < 1e-06
  
  def driver(num, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              num),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver(2, 1.0)
      print(f"TEST-0...{result}")
  
      result = driver(57, 23.0)
      print(f"TEST-1...{result}")
  
      result = driver(28, 28.0)
      print(f"TEST-2...{result}")
  
      result = driver(43, 1.0)
      print(f"TEST-3...{result}")
  
      result = driver(38, 22.0)
      print(f"TEST-4...{result}")
  
      result = driver(29, 1.0)
      print(f"TEST-5...{result}")
  
      result = driver(45, 33.0)
      print(f"TEST-6...{result}")
  
      result = driver(47, 1.0)
      print(f"TEST-7...{result}")
  
      result = driver(44, 40.0)
      print(f"TEST-8...{result}")
  
      result = driver(3, 1.0)
      print(f"TEST-9...{result}")
  
      sys.exit(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 );
  }