Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pSum a1 d lim =
- let n1 = (lim `div` d)
- n2 = ((lim - a1) `div` d + 1)
- in if (a1 == d)
- then (d * n1 * (n1 + 1)) `div` 2
- else (n2 `div` 2) * (a1 + aN(a1, d, n2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement