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 5 of 6 |
Looking at the result for n = 4 we get:

ceil  1  2  2  2  3  3  3  3  3  4  4  4  4  4  4  4
j     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
floor 1  1  1  2  2  2  2  2  3  3  3  3  3  3  3  4
The ceilings produce 1x1, 3x2, 5x3, 7x4
The floors produce           3x1, 5x2, 7x3, 1x4

This suggests the answer can be obtained by the sum of squares of the first n odd numbers plus one plus n.

  Posted by snark on 2013-03-05 20:12:00
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 (6)
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