Results 1 to 40 of 49

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

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,272

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

    re post #10, I can see that you are going to have great difficulty avoiding subtracting the same numbers more than once when different multiples 'intersect'. I assume that is what you are struggling to resolve...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

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

    Quote Originally Posted by ColinE66 View Post
    re post #10, I can see that you are going to have great difficulty avoiding subtracting the same numbers more than once when different multiples 'intersect'. I assume that is what you are struggling to resolve...
    Yep - I'm trying to find a generic function which internally makes use of the O(1)-category n*(n+1)/2 approach,
    to avoid the O(n) looping over the whole range.

    Not sure, if your function in #12 really does speed-up what I posted in #8,
    since I already had an early exit there, as soon as a valid factor was found
    (not possible to count something twice).

    When you use my function in #8 with n-1 as the parameter, then it wil always produce
    the same results as yours for the same list of PrimeFactors.

    Olaf

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