sumaPotenciasDe2y3.hs
unknown
haskell
a year ago
424 B
11
Indexable
esPotenciaDeX :: Int -> Int -> Bool
esPotenciaDeX x n
| n <= 0 = False
| n == 1 = True
| mod n x /= 0 = False
| otherwise = esPotenciaDeX x (div n x)
sumaPotenciasDe2y3 :: [Int] -> Int
sumaPotenciasDe2y3 [] = 0
sumaPotenciasDe2y3 (x:xs)
| esPotenciaDeX 2 x = x + sumaPotenciasDe2y3 xs
| esPotenciaDeX 3 x = x + sumaPotenciasDe2y3 xs
| otherwise = sumaPotenciasDe2y3 xsEditor is loading...
Leave a Comment