Find
k = 1 ∑ 1 9 9 5 f ( k ) 1 ,
where f ( n ) is the integer closest to 4 n .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Thanks!
By understanding what f ( n ) really is, this question is much easier to tackle. As expressed by @Chew-Seong Cheong , he computed the number of values where f ( n ) = k using a spreadsheet, while you provided the mathematical reasoning behind it.
Great solution. Though I saw the first step almost immediately, I couldn't pursue it analytically and so calculated all terms by hand till k = 7 . How did you imagine this problem Parth?
Log in to reply
Was just doodling with the pen. . . . . When this struck!!
@Parth Lohomi Great solution! However, I am not sure about the use of the floor function to get the number of integers in the interval. It works in this special case, but it may not work in general - try the formula on 3 2 < n < 3 4
If I'm not mistaken, it misses the only solution...
Log in to reply
Indeed. To count the number of integers a < b < n , we could use ⌊ b ⌋ − ⌈ a ⌉ .
Log in to reply
Is that right? In the example above, your formula would yield ⌊ b = 4 / 3 ⌋ − ⌈ a = 2 / 3 ⌉ = 0 soulutions... The idea is to calculate an integer interval inside the real interval, right? If so, I'd say we need to add one: # integers in [ a ; b ] = ? ⌊ b ⌋ − ⌈ a ⌉ + 1
Log in to reply
@Carsten Meyer – ( I think this should be right now. The part that tripped me up was dealing with endpoints.)
For
a
<
n
<
b
, we should use
⌈
b
⌉
−
⌊
a
⌋
−
1
, with the condition that
a
=
b
.
For
a
≤
n
≤
b
, we should use
⌊
b
⌋
−
⌈
a
⌉
+
1
.
The strict / non-strict inequality determines if we should use ceiling or floor function, so that we exclude/include that value. After that, it's counting the number of integers in the interval with open/closed ends.
Log in to reply
@Calvin Lin – "Off-by-one errors", hard to find as always... I agree on both formulae, the symmetry is especially pleasing. Thank you for your effort!
Have an idea, still spreadsheet
I can only come up with a numerical method, using a spreadsheet.
We note that the largest f ( n ) in this case f ( 1 9 9 5 ) = 7 , since 4 1 9 9 5 = 6 . 6 8 3 2 .
Let f ( n ) = i , then the largest n for an i is given by: n i = ⌊ ( i + 0 . 5 ) 4 ⌋ , where ⌊ x ⌋ is the greatest integer function. Then the number of n , which f ( n ) = i is n i − n i − 1 , where n 0 = 0 and n 7 = 1 9 9 5 .
Then, we have:
k = 1 ∑ 1 9 9 5 f ( k ) 1 = i = 1 ∑ 7 i n i − n i − 1
The following table shows the computation of k = 1 ∑ 1 9 9 5 f ( k ) 1 .
i 1 2 3 4 5 6 7 n i 5 3 9 1 5 0 4 1 0 9 1 5 1 7 8 5 1 9 9 5 n i − n i − 1 5 3 4 1 1 1 2 6 0 5 0 5 8 7 0 2 1 0 × i 1 = × 1 1 = × 2 1 = × 3 1 = × 4 1 = × 5 1 = × 6 1 = × 7 1 = ∑ k = 1 1 9 9 5 f ( k ) 1 = i n i − n i − 1 5 1 7 3 7 6 5 1 0 1 1 4 5 3 0 4 0 0
You are actually really close to the "algebraic solution". As you can see from Parth's solution, you have all of the parts needed
Unfortunately, the temptation of merely throwing this into a spreadsheet is extremely high...
I used the same approach sir, but taking help from Graph of y = x 4 1 instead of spreadsheets, but yours is better !!
Here is my J A V A code for the problem:-
I always appreciate Java solutions !!!
Did it returned exact 400? My C++ code gave me 399.857143.
Edit: Sorry, I calculated till i<1995. So one extra term was missing. 😛
Hi, I got this question wrong so I tried your coding, but it says "inner classes cannot have static declarations".
Please help !!
Log in to reply
Try a java thread on some site for detailed info on inner classes. Yet a classic Run program with main, with the function in the same class will work.
Python:
1 2 3 4 5 6 7 |
|
And I'm a little late, but happy birthday!
No no.... My birthday is on 15 may, its satvik Golechha's birthday @Brock Brown
Log in to reply
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Here's C++ program
@Parth Lohomi Waiting for your mathematical solution, its an algebra question, right?
Log in to reply
Challenge accepted
When ( k − 2 1 ) 4 < n < ( k + 2 1 ) 4 , then f(n) = k. Thus there are ⌊ ( k + 2 1 ) 4 − ( k − 2 1 ) 4 ⌋ values of n for which f(n) = k. Expanding using the binomial theorem, ( k + 2 1 ) 4 − ( k − 2 1 ) 4 = 4 k 3 + k
Thus, k 1 appears in the summation 4 k 3 + k times, and the sum for each k is then ( 4 k 3 + k ) ⋅ k 1 = 4 k 2 + 1 . From k = 1 → k = 6 , we get ∑ k = 1 6 4 k 2 + 1 = 3 6 4 + 6 = 3 7 0 (either adding or using the sum of consecutive squares formula). But this only accounts for ∑ k = 1 6 ( 4 k 3 + k ) = 4 ( 2 6 ( 6 + 1 ) ) 2 + 2 6 ( 6 + 1 ) = 1 7 6 4 + 2 1 = 1 7 8 5 terms, so we still have 1995 - 1785 = 210 terms with f(n) = 7. This adds 2 1 0 ⋅ 7 1 = 3 0 to our summation, giving 4 0 0 .
Was anyone saying something
Huh.
Log in to reply
can you post this as a separate solution? Thanks
Indeed a nice solution! Can you post solutions to all questions? -_-
define a function $g(x)$ and let $ \int g(x) dx = 6$
Here is an integer solution without floor/ceil-functions! First, collect all integers n such that f ( n ) = k . f ( n ) = k ⇔ k − 2 1 < 4 n < k + 2 1 ⇔ ( k − 2 1 ) 4 < n < ( k + 2 1 ) 4 Now we need integer estimates for the left and right borders. Taking just the floor between upper and lower bound generally does not determine the number of integers in that interval (see remark below). Let a k : = ( k − 2 1 ) 4 + 1 6 1 5 = k 4 − 2 k 3 + 2 k ( 3 k − 1 ) + 1 ∈ N for any k ∈ N We only need the expanded form of a k to show that it really is an integer. With the factorized form, we notice that for n ∈ N : ( k − 2 1 ) 4 < n < ( k + 2 1 ) 4 ⇔ a k ≤ n < a k + 1 for any k ∈ N
We know that f ( n ) = k = c o n s t if and only if a k ≤ n < a k + 1 and split the sum accordingly: n = 1 ∑ 1 9 9 5 f ( n ) 1 = k = 1 ∑ 6 k a k + 1 − a k + n = a 7 ∑ 1 9 9 5 7 1 = k = 1 ∑ 6 k k ( 4 k 2 + 1 ) + n = a 7 ∑ 1 9 9 5 7 1 ( ∗ ) = 4 ⋅ 6 6 ⋅ 7 ⋅ 1 3 + 6 + 7 1 9 9 5 − 1 7 8 6 + 1 = 4 0 0 Rem.: In the last step ( ∗ ) , we use the formula for the sum of squares.
Rem.: The floor function between upper and lower border of an interval generally does not return the number of integers in that interval. Let n ∈ Z and look at the following examples 3 1 < n 3 2 < n < 3 5 < 3 4 ⇒ ⇒ n n = 1 , = 1 , ⌊ 3 5 − 3 1 ⌋ = 1 ⌊ 3 4 − 3 2 ⌋ = 0 In the second example, the floor function would miss the integer solution! In general, the floor function between upper and lower bound can either return the number of integers in that interval, or it is off by one, making it rather useless here!
f (n) in this question equals to {1, 2, 3, 4, 5, 6 and 7.} only.
Sum of certain number of {1, 1/ 2, 1/ 3, 1/ 4, 1/ 5, 1/ 6 and 1/ 7.} = 400
Using Excel, this question is easy. Round (Power (x, 0.25), 0) is for nearest values.
Problem Loading...
Note Loading...
Set Loading...
When ( k − 2 1 ) 4 < n < ( k + 2 1 ) 4 , then f(n) = k. Thus there are ⌊ ( k + 2 1 ) 4 − ( k − 2 1 ) 4 ⌋ values of n for which f(n) = k. Expanding using the binomial theorem, ( k + 2 1 ) 4 − ( k − 2 1 ) 4 = 4 k 3 + k
Thus, k 1 appears in the summation 4 k 3 + k times, and the sum for each k is then ( 4 k 3 + k ) ⋅ k 1 = 4 k 2 + 1 . From k = 1 → k = 6 , we get ∑ k = 1 6 4 k 2 + 1 = 3 6 4 + 6 = 3 7 0 (either adding or using the sum of consecutive squares formula). But this only accounts for ∑ k = 1 6 ( 4 k 3 + k ) = 4 ( 2 6 ( 6 + 1 ) ) 2 + 2 6 ( 6 + 1 ) = 1 7 6 4 + 2 1 = 1 7 8 5 terms, so we still have 1995 - 1785 = 210 terms with f(n) = 7. This adds 2 1 0 ⋅ 7 1 = 3 0 to our summation, giving 4 0 0 .