All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Sum Divisibility Dilemma (Posted on 2014-03-18) Difficulty: 3 of 5
Determine a general formula (in terms of n) for the sum of the first n positive integers that are not divisible by 5.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Slightly different formula Comment 6 of 6 |
Actually, in my first post, my formula, while correct, does not 100% match my description.

What I said was Sum = (n+s)(n+s+1)/2 - 5s(s+1)/2, where s is the number of numbers that need to be skipped to get n that are not multiples of 5.
And then I said s = floor(n/4).  This works, but the formula also works if s = floor((n-1)/4), and it is the 2nd s which better matches my description.  

Take the case where n = 12.
If s = 2, then (n+s)(n+s+1)/2 - 5s(s+1)/2 = 105 - 15 = 90
If s = 3, then (n+s)(n+s+1)/2 - 5s(s+1)/2 = 120 - 30 = 90

The 1st value of s corresponds to summing up all numbers from 1 to 14 and then subtracting out 5 and 10.
The 2nd value of s corresponds to summin up all numbers from 1 to 15 and then subtracting out 5 and 10 and 15.

I leave it to tomarken to say which is more elegant.  I can't tell.

  Posted by Steve Herman on 2014-03-18 17:08:59
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information