Skip to content

Instantly share code, notes, and snippets.

@AnthonyMikh
Created February 16, 2018 18:40
Show Gist options
  • Save AnthonyMikh/d7e7c0a8d036378cd0dc528f3596ed4e to your computer and use it in GitHub Desktop.
Save AnthonyMikh/d7e7c0a8d036378cd0dc528f3596ed4e to your computer and use it in GitHub Desktop.
Решение задачи №71
--Считает сумму первых n членов арифметической прогрессии
--с разностью d и первым членом n0
ariphmSum d n0 n = ((2*n0 + d*(n-1))*n) `div` 2
treeWater = (+top) . ariphmSum tierDiff initLeaves
where
top = 1
tierDiff = 2
initLeaves = 2
main = print . treeWater $ 4
-- > 21
@AnthonyMikh
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment