Notices
Results 1 to 5 of 5

Thread: Calculations and cycle times 30,000

  1. #1 Calculations and cycle times 30,000 
    Forum Freshman Goddard's Avatar
    Join Date
    Nov 2009
    Posts
    48
    I'm having trouble with my CS work. This is my question.

    Q1: Using the FORMULA from the background section, what is the sum of the first 30,000 whole numbers, and show the specific formula that you use to calculate the sum.

    (i.e. 1 + 2 + 3 + + 29,998 + 29,999 + 30,000)


    a)Answer (sum of this series):
    I thought it was 450015000 but I wasn't sure. I use the formula. n^2(n+1)/2

    I don't want the answer or you to do my work, but I would like some help.


    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Ph.D. Leszek Luchowski's Avatar
    Join Date
    Jun 2008
    Location
    Gliwice, Poland
    Posts
    807
    Your formula is wrong.

    I could give you the correct formula, and you would apply it and get the correct result, but it is more interesting to understand what is going on.

    Try thinking about it this way:

    The first plus last number in your series add up to 1+30,000=30,001.
    The second and the last but one number add up to 2+29,999=30,001.
    The third and the last but two ... = 3+29,998=30,001.

    If you look carefully, there is a pattern. Yes, taking one number at a time from the beginning, and another from the end of your series, you get pairs that always sum to 30,001, that is, N+1.

    Now how many such pair have you got?

    Obviously, N numbers mean N/2 pairs.

    Getting the idea? Can you now find the formula by yourself?




    Now you may wonder what if N is odd, so after forming a lot of pairs you will be left with one single number and nothing to pair it with.

    Never mind, that remaining number will be the middle element of the series, so it will be equal (1+N)/2, and will be exactly "half a pair".

    Good luck, and keep us posted. Feel free to ask more questions.


    Leszek. Pronounced [LEH-sheck]. The wondering Slav.
    History teaches us that we don't learn from history.
    Reply With Quote  
     

  4. #3  
    Forum Freshman
    Join Date
    Apr 2009
    Posts
    74
    So close - just remove the ^2 from your formula and try again....
    Reply With Quote  
     

  5. #4  
    Forum Freshman Goddard's Avatar
    Join Date
    Nov 2009
    Posts
    48
    Ok so the answer would be 450001500, but I am still having trouble trying to figure out exactly what this means. Which sorting method is this? We are calculating cycles per second correct? Or is this just calculating each cycle pass without the element of time. Thanks for the help btw.
    Reply With Quote  
     

  6. #5  
    Forum Ph.D. Leszek Luchowski's Avatar
    Join Date
    Jun 2008
    Location
    Gliwice, Poland
    Posts
    807
    Quote Originally Posted by Goddard
    Which sorting method is this? We are calculating cycles per second correct?
    So far, we have been adding integer numbers. I don't know how this relates to any sorting method or cycles per second.
    Leszek. Pronounced [LEH-sheck]. The wondering Slav.
    History teaches us that we don't learn from history.
    Reply With Quote  
     

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