Skip to content

Instantly share code, notes, and snippets.

@codeboost
Last active December 12, 2015 00:49
Show Gist options
  • Save codeboost/4686754 to your computer and use it in GitHub Desktop.
Save codeboost/4686754 to your computer and use it in GitHub Desktop.
superSum = (k, n) ->
sum = n
sum = (sum * (n + i)) / (i + 1) for i in [1..k]
sum
console.log 'superSum(1,3)=', superSum(1, 3)
console.log 'superSum(2,3)=', superSum(2, 3)
console.log 'superSum(10,10)=', superSum(10,10)
console.log 'superSum(20,20)=', superSum(20,20)
@codeboost
Copy link
Author

Output:

superSum(1,3)= 6
superSum(2,3)= 10
superSum(10,10)= 167960
superSum(20,20)= 131282408400

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