title: Divisibility 9 Using Bitwise Operators
signature: divisibility9UsingBitwiseOperators :: Integer -> Bool
  divisibility9UsingBitwiseOperators n = 
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 n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (96) (False) )
  
      printf "TEST-1...%s\n" (driver (85) (False) )
  
      printf "TEST-2...%s\n" (driver (54) (True) )
  
      printf "TEST-3...%s\n" (driver (14) (False) )
  
      printf "TEST-4...%s\n" (driver (47) (False) )
  
      printf "TEST-5...%s\n" (driver (11) (False) )
  
      printf "TEST-6...%s\n" (driver (49) (False) )
  
      printf "TEST-7...%s\n" (driver (99) (True) )
  
      printf "TEST-8...%s\n" (driver (28) (False) )
  
      printf "TEST-9...%s\n" (driver (82) (False) )
  
source_py: def divisibility_9_using_bitwise_operators(n):
      if ((n == 0) or (n == 9)):
          return True
      if (n < 9):
          return False
      return divisibility_9_using_bitwise_operators((int((n >> 3)) - int((n & 7))))
source_cpp: bool divisibility_9_using_bitwise_operators(int n) {
    if ( n == 0 || n == 9 ) return true;
    if ( n < 9 ) return false;
    return divisibility_9_using_bitwise_operators ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) );
  }