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.)
Solution Solution, might be able to improve | Comment 1 of 6

This may not be the most succinct expression but I believe it works.  The motivation was that this would be related to the sequence of triangular numbers, except after every group of four integers there would be an additional increment. 

f(n) = n(n+1)/2 + floor((n-1)/4) * [ 2*floor((n-1)/4) + (n-1)mod 4 - 1]

To make it a bit easier to read, for (n-1)/4 let q be the quotient and r be the remainder (such that n-1 = 4q + r).  Then

f(n) = n(n+1)/2 + q * (2q + r - 1)

 

 

 

Edited on March 18, 2014, 10:07 am
  Posted by tomarken on 2014-03-18 10:05:52

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