title: Nth Pentagonal Number
signature: class Solution {
  
      public Float nthPentagonalNumber(Integer n) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Float expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(96, 13776.0f);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(93, 12927.0f);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(15, 330.0f);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(8, 92.0f);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(21, 651.0f);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(14, 287.0f);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(11, 176.0f);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(79, 9322.0f);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(24, 852.0f);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(94, 13207.0f);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Float expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Float actual, Float expected){
          return Math.abs(actual - expected) < 1e-06f;
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
  }