title: Triangular Matchstick Number
signature: func triangularMatchstickNumber(x 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-06
  }
  
  func driver(x int, expected float64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(x),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(6, 63.0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(25, 975.0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(15, 360.0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(30, 1395.0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(17, 459.0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(80, 9720.0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(27, 1134.0)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(13, 273.0)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(12, 234.0)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(67, 6834.0)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def triangular_matchstick_number(x):
      return (((3 * x) * (x + 1)) / 2)
source_cpp: int triangular_matchstick_number(int x) {
    return ( 3 * x * ( x + 1 ) ) / 2;
  }