title: Sum Subsets Set Formed First N Natural Numbers
signature: func sumSubsetsSetFormedFirstNNaturalNumbers(n int) float64 {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual float64, expected float64) bool {
      return math.Abs(actual - expected) < 1e-09
  }
  
  func driver(n int, expected float64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(26, 11777605632.0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(35, 10823317585920.0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(34, 5111011082240.0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(22, 530579456.0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(3, 24.0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(25, 5452595200.0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(22, 530579456.0)
      fmt.Printf("TEST-6...%s\n", result)
      
          
  }
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 ) );
  }