This question is about preserving this general nature while improving performance, perhaps using math tricks math tricks like sumSkip()
and sumIndetity()
. Unfortunately everything I find that takes advantage of these tricks sacrifices the ability to have a general solution that works with any number of multiples and any limit. Notice how using sumSkip()
and sumIdentity()
require hand tuning to work. I'd like to use the same interface sumMultiples()
uses and allow any number of base numbers with any values. Well, short of causing overflows anyway.
This question is about preserving this general nature while improving performance, perhaps using math tricks like sumSkip()
and sumIndetity()
. Unfortunately everything I find that takes advantage of these tricks sacrifices the ability to have a general solution that works with any number of multiples and any limit. Notice how using sumSkip()
and sumIdentity()
require hand tuning to work. I'd like to use the same interface sumMultiples()
uses and allow any number of base numbers with any values. Well, short of causing overflows anyway.
This question is about preserving this general nature while improving performance, perhaps using math tricks like sumSkip()
and sumIndetity()
. Unfortunately everything I find that takes advantage of these tricks sacrifices the ability to have a general solution that works with any number of multiples and any limit. Notice how using sumSkip()
and sumIdentity()
require hand tuning to work. I'd like to use the same interface sumMultiples()
uses and allow any number of base numbers with any values. Well, short of causing overflows anyway.
In main sumSkip()
and sumIdentity()
are being used with the inclusion–exclusion principle in a rigid hand tuned form. I'm suspecting there is a general way to apply this principle to this problem but frankly I can't see it. I'll accept solutions that don't use it so long as they truly improve this solutions Big O Complexity.
I believe sumMultiples()
is O(below x base) complexity. I'm looking to improve on that.
In main sumSkip()
and sumIdentity()
are being used with the inclusion–exclusion principle in a rigid hand tuned form. I'm suspecting there is a general way to apply this principle to this problem but frankly I can't see it.
I believe sumMultiples()
is O(below x base) complexity.
In main sumSkip()
and sumIdentity()
are being used with the inclusion–exclusion principle in a rigid hand tuned form. I'm suspecting there is a general way to apply this principle to this problem but frankly I can't see it. I'll accept solutions that don't use it so long as they truly improve this solutions Big O Complexity.
I believe sumMultiples()
is O(below x base) complexity. I'm looking to improve on that.