summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Wisniowski <matthias.wisniowski@gmail.com>2012-03-25 19:42:13 +0200
committerMatthias Wisniowski <matthias.wisniowski@gmail.com>2012-03-25 19:42:13 +0200
commitd01a91022cc55841cf968a60ecee8f27b57b88e2 (patch)
tree2e62927465961cd7ade0435912f0ab8ecb615ea7
parent12ad8b53c5be7e22975082baa715e96aa2f1b9dd (diff)
downloadffp-d01a91022cc55841cf968a60ecee8f27b57b88e2.tar.gz
ffp-d01a91022cc55841cf968a60ecee8f27b57b88e2.tar.bz2
ffp-d01a91022cc55841cf968a60ecee8f27b57b88e2.zip
2.4 implemented
2.3 still to be fixed.
-rw-r--r--AufgabeFFP2.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/AufgabeFFP2.hs b/AufgabeFFP2.hs
index e4e646b..9e466b7 100644
--- a/AufgabeFFP2.hs
+++ b/AufgabeFFP2.hs
@@ -75,3 +75,22 @@ hSlow :: Int -> Int -> Float
75hSlow z i = (fromIntegral $ z^i) / (fromInteger $ fac $ fromIntegral i) 75hSlow z i = (fromIntegral $ z^i) / (fromInteger $ fac $ fromIntegral i)
76 76
77------------------------------------------------------------------------------- 77-------------------------------------------------------------------------------
78
79-- 4
80
81-- gets the digits of an integer as a list
82digits :: Integer -> [Integer]
83digits x
84 | x<=0 = []
85 | otherwise = (digits $ x `div` 10)++[x `mod` 10]
86
87-- calculates the goedel-number for the given integer
88-- returns 0 for non-positive numbers
89gz :: Integer -> Integer
90gz n
91 | n<=0 = 0
92 | otherwise = product $ zipWith (^) primes (digits n)
93
94-- goedel-number generator
95gzs :: [Integer]
96gzs = map (gz) [1..]