title: Program Check Plus Perfect Number
signature: programCheckPlusPerfectNumber :: Integer -> Bool
  programCheckPlusPerfectNumber x = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Bool -> Bool -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: Integer -> Bool -> String
  driver x expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME x) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (371) (True) )
  
      printf "TEST-1...%s\n" (driver (9474) (True) )
  
      printf "TEST-2...%s\n" (driver (85) (False) )
  
      printf "TEST-3...%s\n" (driver (35) (False) )
  
      printf "TEST-4...%s\n" (driver (54) (False) )
  
      printf "TEST-5...%s\n" (driver (17) (False) )
  
      printf "TEST-6...%s\n" (driver (97) (False) )
  
      printf "TEST-7...%s\n" (driver (63) (False) )
  
      printf "TEST-8...%s\n" (driver (12) (False) )
  
      printf "TEST-9...%s\n" (driver (43) (False) )
  
source_py: def program_check_plus_perfect_number(x):
      temp = x
      n = 0
      while (x != 0):
          x = (x // 10)
          n = (n + 1)
      x = temp
      sm = 0
      while (x != 0):
          sm = (sm + int(math.pow((x % 10), n)))
          x = (x // 10)
      return (sm == temp)
source_cpp: bool program_check_plus_perfect_number(int x) {
    int temp = x;
    int n = 0;
    while ( x != 0 ) {
      x /= 10;
      n ++;
    }
    x = temp;
    int sum = 0;
    while ( x != 0 ) {
      sum += pow ( x % 10, n );
      x /= 10;
    }
    return ( sum == temp );
  }