title: Nth Pentagonal Number
signature: func nthPentagonalNumber(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-06
  }
  
  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(96, 13776.0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(93, 12927.0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(15, 330.0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(8, 92.0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(21, 651.0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(14, 287.0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(11, 176.0)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(79, 9322.0)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(24, 852.0)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(94, 13207.0)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def nth_pentagonal_number(n):
      return ((((3 * n) * n) - n) / 2)
source_cpp: int nth_pentagonal_number(int n) {
    return ( 3 * n * n - n ) / 2;
  }