Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
How about to let the functions return (sums mod 1000000000 [one billion]) or something alike?
That is how the 'big numbers' are checked as answers at projecteuler.net.
Similar to most other solutions, I discovered that you could use a simple mathematical formula to derive the result. However, none of the solutions I found dealt with the fact that the functions would return an incorrect value if 'n' was too large. For example, pass in UInt64.MaxValue and you will get a response which is incorrect because C# simply wraps large values around its max.
Does anoyne have a thought on how to address this? I had attempted to set the equations equal to UInt64.MaxValue and then solve for 'n' to see if that would provide a constant limit... but my math-fu is too weak for this. Besides, I am not sure if this is the best apporach since C# may exceed the MaxValue while in the middle of computing the result... say by simply evaluating "n * n" before it ever gets to the division.
Sorry, but I cannot explain the math myself. Here is a reference though if you are interested: https://en.wikipedia.org/wiki/Square_pyramidal_number