title: Count Numbers That Dont Contain 3
signature: countNumbersThatDontContain3 :: Integer -> Double
  countNumbersThatDontContain3 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 :: Double -> Double -> Bool
  validateSolution actual expected = do
      (abs (actual-expected)) < 1e-09
  
  driver :: Integer -> Double -> String
  driver n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (85) (71.5) )
  
      printf "TEST-1...%s\n" (driver (86) (73.39999999999999) )
  
      printf "TEST-2...%s\n" (driver (3) (2.0) )
  
      printf "TEST-3...%s\n" (driver (35) (26.5) )
  
      printf "TEST-4...%s\n" (driver (59) (52.1) )
  
      printf "TEST-5...%s\n" (driver (38) (32.2) )
  
      printf "TEST-6...%s\n" (driver (33) (22.7) )
  
      printf "TEST-7...%s\n" (driver (15) (17.5) )
  
      printf "TEST-8...%s\n" (driver (75) (62.5) )
  
      printf "TEST-9...%s\n" (driver (74) (60.6) )
  
source_py: def count_numbers_that_dont_contain_3(n):
      if (n < 3):
          return n
      elif ((n >= 3) and (n < 10)):
          return (n - 1)
      po = 1
      while ((n / po) > 9):
          po = (po * 10)
      msd = (n / po)
      if (msd != 3):
          return (((count_numbers_that_dont_contain_3(msd) * count_numbers_that_dont_contain_3((po - 1))) + count_numbers_that_dont_contain_3(msd)) + count_numbers_that_dont_contain_3((n % po)))
      else:
          return count_numbers_that_dont_contain_3(((msd * po) - 1))
source_cpp: int count_numbers_that_dont_contain_3(int n) {
    if ( n < 3 ) return n;
    if ( n >= 3 && n < 10 ) return n - 1;
    int po = 1;
    while ( n / po > 9 ) po = po * 10;
    int msd = n / po;
    if ( msd != 3 ) return count_numbers_that_dont_contain_3 ( msd ) * count_numbers_that_dont_contain_3 ( po - 1 ) + count_numbers_that_dont_contain_3 ( msd ) + count_numbers_that_dont_contain_3 ( n % po );
    else return count_numbers_that_dont_contain_3 ( msd * po - 1 );
  }