Find palindromic numbers in both binary and ternary bases: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: Minor simplification of readBase3)
Line 818: Line 818:
-- Integer value of ternary string.
-- Integer value of ternary string.
readBase3 :: String -> Integer
readBase3 :: String -> Integer
readBase3 = fst . head . readInt 3 isDigit digitToInt
readBase3 s =
let [(n, _)] = readInt 3 isDigit digitToInt s
in n


showBase :: Integer -> Integer -> String
showBase :: Integer -> Integer -> String