title: Sum Subsets Set Formed First N Natural Numbers
signature: function sumSubsetsSetFormedFirstNNaturalNumbers($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return abs($actual - $expected) < 1e-09;
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        26, 
        11777605632.0));
      
      printf("TEST-1...%s\n",driver(
        35, 
        10823317585920.0));
      
      printf("TEST-2...%s\n",driver(
        34, 
        5111011082240.0));
      
      printf("TEST-3...%s\n",driver(
        22, 
        530579456.0));
      
      printf("TEST-4...%s\n",driver(
        3, 
        24.0));
      
      printf("TEST-5...%s\n",driver(
        25, 
        5452595200.0));
      
      printf("TEST-6...%s\n",driver(
        22, 
        530579456.0));
      
  }
  
  main();
  ?>
source_py: def sum_subsets_set_formed_first_n_natural_numbers(n):
      return (((n * (n + 1)) / 2) * (1 << (n - 1)))
source_cpp: unsigned long long sum_subsets_set_formed_first_n_natural_numbers(int n) {
    return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) );
  }