title: Padovan Sequence
signature: func padovanSequence(n int) int64 {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int64, expected int64) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int64) 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(1, 1)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(92, 124155792775)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(29, 2513)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(52, 1618192)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(55, 3761840)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(13, 28)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(83, 9882257736)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(83, 9882257736)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(10, 12)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(67, 109870576)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def padovan_sequence(n):
      (pPrevPrev, pPrev, pCurr, pNext) = (1, 1, 1, 1)
      for i in range(3, (n + 1)):
          pNext = (pPrevPrev + pPrev)
          pPrevPrev = pPrev
          pPrev = pCurr
          pCurr = pNext
      return pNext
source_cpp: int padovan_sequence(int n) {
    int pPrevPrev = 1, pPrev = 1, pCurr = 1, pNext = 1;
    for ( int i = 3;
    i <= n;
    i ++ ) {
      pNext = pPrevPrev + pPrev;
      pPrevPrev = pPrev;
      pPrev = pCurr;
      pCurr = pNext;
    }
    return pNext;
  }