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

Home > Algorithms
Ceiling and Floor Formulation (Posted on 2013-03-04) Difficulty: 3 of 5
Formulate an algorithm for fast evaluation of:
Σj=1,...,n2 (floor (√j) + ceil (√j)), where n is a positive integer.

** ceil(x) is the least integer ≥ x and, floor(x) is the greatest integer ≤ x

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution? | Comment 1 of 6
Would finding the sum as a function of n count as a fast algorithm?

S(n) = (4n-n)/3

The floors from each n-1 to n have a sum n(2n+1) wolfram alpha gives the full sum from 1 to n-1 as (4n-3n-n)/6
The ceilings from each n-1 to n have a sum n(2n-1) wolfram alpha gives the full sum from 1 to n as (4n+3n-n)/6

Then just sum the parts.

  Posted by Jer on 2013-03-04 14:46:40
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (1)
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

Copyright © 2002 - 2019 by Animus Pactum Consulting. All rights reserved. Privacy Information