Created
November 15, 2022 00:01
-
-
Save loveJesus/c4fc602bcddbdf5ea76848179b708e10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- For God so loved the world, that He gave His only begotten Son, that all who believe in Him should not perish but have everlasting life | |
module Euler76CountingSummationsChirho | |
( countingSummationsChirho, | |
) | |
where | |
sumCounter_chirho :: Integer -> Integer -> Integer | |
sumCounter_chirho minSum_chirho sumLeft_chirho | |
| sumLeft_chirho <= 0 = 1 | |
| otherwise = sum([ | |
sumCounter_chirho (minSum_chirho + counter_chirho) (sumLeft_chirho - (minSum_chirho + counter_chirho)) | counter_chirho <- [0 .. (sumLeft_chirho - minSum_chirho)]]) | |
-- call this function like countingSummationsChirho 100 , it took a couple minutes on my computer | |
countingSummationsChirho :: Integer -> Integer | |
countingSummationsChirho n_chirho | |
| n_chirho <= 1 = 0 | |
| n_chirho == 2 = 1 | |
| otherwise = ( sumCounter_chirho 1 (n_chirho) ) - 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment