Skip to content

Instantly share code, notes, and snippets.

@loveJesus
Created November 15, 2022 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loveJesus/c4fc602bcddbdf5ea76848179b708e10 to your computer and use it in GitHub Desktop.
Save loveJesus/c4fc602bcddbdf5ea76848179b708e10 to your computer and use it in GitHub Desktop.
-- 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