title: Hexagonal Number
signature: func hexagonalNumber(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) 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(38, 2850)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(44, 3828)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(58, 6670)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(10, 190)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(31, 1891)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(53, 5565)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(94, 17578)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(64, 8128)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(71, 10011)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(59, 6903)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def hexagonal_number(n):
      return (n * ((2 * n) - 1))
source_cpp: int hexagonal_number(int n) {
    return n * ( 2 * n - 1 );
  }