Results 1 to 40 of 49

Thread: Using a mathematical identity to speed up certain calculations.

Threaded View

  1. #10

    Thread Starter
    Hyperactive Member Maven's Avatar
    Join Date
    Feb 2003
    Location
    Greeneville, TN
    Posts
    322

    Re: Using a mathematical identity to speed up certain calculations.

    Quote Originally Posted by Schmidt View Post
    See, that's the problem I have with your postings.

    You didn't gave us *anything* so far in this thread.

    What you gave us, was the (quite wellknown) story about little Gauss -
    and *his* famous (though still easy to grasp for non-mathematicians) Sum-Formula.

    What you then gave us on top of that was a problem you said is
    "easily solved" by applying the Gauss-Sum-Formula - but the way you
    applied it to the problem was entirely wrong, misleading the reader.
    And it is easily solved by the Gauss identity. And it's rather straight forwards. After all, you implemented the method in one of your posts.


    Am I aggressive in pointing that out (even going to some length, to
    correct your wrong adaption)?
    The only thing wrong was the index over the summations were not setup. There is a difference in pointing out that an equation is yielding the wrong answer and trolling.

    Then on top of that you ridiculed everybody who would engage in applying
    "lesser algorithms from now on" as dumb:
    "...The dumb method is to use loops and brute force everything..."
    Brute force is the dumb method. One can't do worse than a brute force algorithm. Hence its name.



    Please don't wiggle around - make good on your own words - and demonstrate
    how easy it is, to write an O(1)-algo for this case.

    I mean;
    - you say "anybody who's resorting to a loop, is doing something dumb"
    - you also say "it's easy"

    And yes, coming up with the power-sets in a generic fasion *is* the easy part -
    what now only remains, is to apply "proper summation or subtraction" of
    these Powersets.
    A power set algorithm is a different algorithm from the calculation algorithm. You should use it to obtain combinations.

    I said a brute force algorithm is dumb, and it is. Your now making strawmen.


    Did you read post #10 at all (studying the second function and what was said there)?
    I just did one test with your algorithm using N=10 and it produced the correct result of 47.

    One thing you will have problems with is common multiples.

    2*5 = 10 and 2*5*3 = 30

    So every so many hops your double counting.
    Last edited by Maven; Jun 30th, 2014 at 12:14 AM.
    Education is an admirable thing, but it is well to remember from time to time that nothing that is worth knowing can be taught. - Oscar Wilde

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width