Skip to main content
Code Review

Return to Question

replaced http://math.stackexchange.com/ with https://math.stackexchange.com/
Source Link

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.

edited tags
Link
200_success
  • 145.5k
  • 22
  • 190
  • 479
Tweeted twitter.com/#!/StackCodeReview/status/548604521845624832
added 31 characters in body
Source Link
candied_orange
  • 840
  • 1
  • 7
  • 21

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.

edited body
Source Link
candied_orange
  • 840
  • 1
  • 7
  • 21
Loading
edited body
Source Link
candied_orange
  • 840
  • 1
  • 7
  • 21
Loading
I'm looking for a mathematical optimization
Source Link
candied_orange
  • 840
  • 1
  • 7
  • 21
Loading
deleted 86 characters in body; edited tags; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
Loading
deleted 5 characters in body
Source Link
candied_orange
  • 840
  • 1
  • 7
  • 21
Loading
Source Link
candied_orange
  • 840
  • 1
  • 7
  • 21
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /