Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 1
- f :: Int -> Int
- f 1 = 18
- f 4 = 131
- f 16 = 16
- -- 2
- g :: Int -> Int
- g 8 = 16
- g 16 = 4
- g 131 = 1
- -- 3
- h :: Int -> Int
- h 8 = f (g 8)
- h 16 = f (g 16)
- h 131 = f (g 131)
- k :: Int -> Int
- k 1 = g (f 1)
- k 4 = g (f 4)
- k 16 = g (f 16)
- -- 4
- f4 :: Int -> Int
- f4 n | n <= 10 = n
- | n > 10 = n+1
- g4 :: Int -> Int
- g4 n | esPrimo n = 1
- n | otherwise = 0
- esPrimo :: Int -> Bool
- esPrimo n | sinDivisoresHasta n n = True
- esPrimo n | otherwise = False
- -- ERROR "pruebas.hs":38
- -- Instance of Num Bool required for definition of sinDivisoresHasta
- sinDivisoresHasta :: Int -> Int -> Bool
- sinDivisoresHasta n t | t == 1 = True
- sinDivisoresHasta n t | mod n t == 0 = False
- sinDivisoresHasta n t | mod n t /= 0 = sinDivisoresHasta n t-1
- sum4 :: Int -> Int
- sum4 n = sumarDesdeHasta 0 n 0
- sumarDesdeHasta :: Int -> Int -> Int -> Int
- sumarDesdeHasta
- sumarDesdeHasta n m i | sumarDesdeHasta n-1 g4()
Advertisement
Add Comment
Please, Sign In to add comment