Proximity to perfect squares

Calculus Level 1

A function f ( n ) f(n) is defined over positive integers as follows:

f ( n ) = { 0 if n is a perfect square ; 1 if n is closer to the perfect square before it than to the one after it ; 1 otherwise . f(n) = \begin{cases} 0 & \text{if }n\text{ is a perfect square}; \\ 1 & \text{if }n\text{ is closer to the perfect square before it than to the one after it}; \\ -1 & \text{otherwise}. \end{cases}

For example, f ( 1 ) = 0 f(1) = 0 because 1 is a perfect square; f ( 2 ) = 1 f(2) = 1 because 2 is closer to 1 than it is to 4; f ( 7 ) = 1 f(7) = -1 because 7 is closer to 9 than it is to 4.

What can be said about the series n = 1 f ( n ) n ? \displaystyle \sum_{n=1}^{\infty} \frac{f(n)}{n}?

Converges to a number larger than 2 Converges to a number smaller than 2 Converges to 2 Diverges

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.

10 solutions

Leonel Castillo
Jan 31, 2018

The first observation one should make is that this function has a special symmetry around square numbers. Take a look at the following values of the series:

n = 1 f ( n ) n = 1 2 1 3 + 1 5 + 1 6 1 7 1 8 + 1 10 + 1 11 + 1 12 1 13 1 14 1 15 + . . . \sum_{n=1}^{\infty} \frac{f(n)}{n} = \frac{1}{2} - \frac{1}{3} + \frac{1}{5} + \frac{1}{6} - \frac{1}{7} - \frac{1}{8} + \frac{1}{10} + \frac{1}{11} + \frac{1}{12} - \frac{1}{13} - \frac{1}{14} - \frac{1}{15} + ... . If we group the terms that occur before the sum reaches perfect squares we get the following:

n = 1 f ( n ) n = k = 1 ( n = 1 k 1 k 2 + n n = 1 k 1 ( k + 1 ) 2 n ) \sum_{n=1}^{\infty} \frac{f(n)}{n} = \sum_{k=1}^{\infty} \left( \sum_{n=1}^{k} \frac{1}{k^2 + n} - \sum_{n=1}^{k} \frac{1}{(k+1)^2 - n} \right) . This is basically a new infinite series that is equivalent to the previous one but has the property that every term of the infinite sum is a positive one. With this, we can start bounding. Notice that:

k = 1 ( n = 1 k 1 k 2 + n n = 1 k 1 ( k + 1 ) 2 n ) k = 1 ( n = 1 k 1 k 2 + 1 n = 1 k 1 ( k + 1 ) 2 1 ) = k = 1 k k 2 + 1 k ( k + 1 ) 2 1 = k = 1 2 k 1 k 3 + 2 k 2 + k + 2 k = 1 2 k k ( k + 1 ) 2 = k = 1 2 ( k + 1 ) 2 = 1 3 ( π 2 6 ) 1.289... \sum_{k=1}^{\infty} \left( \sum_{n=1}^{k} \frac{1}{k^2 + n} - \sum_{n=1}^{k} \frac{1}{(k+1)^2 - n} \right) \leq \sum_{k=1}^{\infty} \left( \sum_{n=1}^{k} \frac{1}{k^2 + 1} - \sum_{n=1}^{k} \frac{1}{(k+1)^2 - 1} \right) = \sum_{k=1}^{\infty} \frac{k}{k^2 + 1} - \frac{k}{(k+1)^2 - 1} = \sum_{k=1}^{\infty} \frac{2k - 1}{k^3 + 2k^2 + k + 2} \leq \sum_{k=1}^{\infty} \frac{2k}{k(k+1)^2} = \sum_{k=1}^{\infty} \frac{2}{(k+1)^2} = \frac{1}{3} \left( \pi^2 - 6 \right) \approx 1.289...

For the last equality I used the known result that k = 1 1 k 2 = π 2 6 \sum_{k=1}^{\infty} \frac{1}{k^2} = \frac{\pi^2}{6} .


Using a computer to compute this sum up to the 1000000th term I got 0.542513834759228 0.542513834759228 but the convergence is very bad. I can at least say that 0.54... 0.54... are true digits of the real value.


I added up to 1 0 12 10^{12} terms to find 0.543512334760729... 0.543512334760729... and now I can confirm the digits up to 0.543512... 0.543512...

If we collect terms around a square, their sum would be about quartic over n, so the tail would be a third power. This way we obtain the convergence of order 1.5: summing 1000000 terms we get precision about 1e-9. And if we finally add the tail approximation 1 / 6 n 3 1/6n^3 , we get even better precision.

Alexander Maly - 3 years, 4 months ago

It was so easy!!! take the sum out to any sqared no. of terms. It is always zero... p.s. the series is always convergent....

Arijit Dey - 3 years, 3 months ago

Log in to reply

I don't understand what you mean. The partial sums are never 0, and what series is always convergent?

Leonel Castillo - 3 years, 3 months ago

Log in to reply

Take the sums upto any perfect sq. terms (ex- 9 , 16, 36,49.... no. of terms). Sums are always 0;

Arijit Dey - 3 years, 3 months ago

Log in to reply

@Arijit Dey That is not the case. You should check the problem description again.

Leonel Castillo - 3 years, 3 months ago

Log in to reply

@Leonel Castillo I see but there is no restriction on number of terms :-)

Arijit Dey - 3 years, 3 months ago

@Leonel Castillo Although there are an even number of integers between each perfect square, and therefore an equal number of f(n) terms with value 1 and -1, the problem asks for the sum of f(n) divided by n. As the integer values increase, f(n) divided by n gets smaller and smaller but is always slightly bigger for the positive terms. If the problem had asked for the sum of f(n) for an infinite number of terms this would have a value of either 1, 0 or -1 depending on the 'value' of infinity.

Steven Linnell - 3 years, 3 months ago

I think you are confusing the sum of f(n) with the sum of f(n)/n. While the sum of f(n) is 0 when taken up to a square number of terms, it does not converge; the partial sums can be both arbitrarily positive and arbitrarily negative infinitely often.

Calum Crossley - 3 years, 3 months ago

Could you please explain why it is safe to apply parenthesis here (first step of your proof)? For example if we consider sequence like this 1 1 + 1 2 + 1 2 1 2 1 2 + 1 4 + 1 4 + 1 4 + 1 4 1 4 1 4 1 4 1 4 + . . . 1-1+\frac{1}{2}+\frac{1}{2}-\frac{1}{2}-\frac{1}{2}+\frac{1}{4}+\frac{1}{4}+\frac{1}{4}+\frac{1}{4}-\frac{1}{4}-\frac{1}{4}-\frac{1}{4}-\frac{1}{4}+... and then apply parenthesis ( 1 1 ) + ( 1 2 + 1 2 1 2 1 2 ) + ( 1 4 + 1 4 + 1 4 + 1 4 1 4 1 4 1 4 1 4 ) + . . . \left(1-1\right)+\left(\frac{1}{2}+\frac{1}{2}-\frac{1}{2}-\frac{1}{2}\right)+\left(\frac{1}{4}+\frac{1}{4}+\frac{1}{4}+\frac{1}{4}-\frac{1}{4}-\frac{1}{4}-\frac{1}{4}-\frac{1}{4}\right)+... we can "prove" that it converges to zero, or if we apply them another way 1 + ( 1 + 1 2 + 1 2 ) + ( 1 2 1 2 + 1 4 + 1 4 + 1 4 + 1 4 ) + ( 1 4 1 4 1 4 1 4 + . . . ) 1+\left(-1+\frac{1}{2}+\frac{1}{2}\right)+\left(-\frac{1}{2}-\frac{1}{2}+\frac{1}{4}+\frac{1}{4}+\frac{1}{4}+\frac{1}{4}\right)+\left(-\frac{1}{4}-\frac{1}{4}-\frac{1}{4}-\frac{1}{4}+...\right) - it will converge to 1. (actually, sequence in my example diverges, because partial sums does not converge). So why convergence of sequence with parenthesis means that initial sequence converge to the same value?

Alex L - 3 years, 2 months ago

Log in to reply

It has to do with how much the original sequence can get away from the new sequence. This difference tends to 0 as n goes to infinity.

Leonel Castillo - 3 years, 2 months ago
Mark Hennings
Feb 2, 2018

Note that X n = j = n 2 n + 1 n 2 + n f ( j ) j = j = 1 n 1 1 n 2 j + j = 1 n 1 n 2 + j = 1 n ( n + 1 ) + j = 1 n 1 ( 1 n 2 + j 1 n 2 j ) = 1 n ( n + 1 ) 2 j = 1 n 1 j n 4 j 2 \begin{aligned} X_n \; = \; \sum_{j=n^2-n+1}^{n^2+n} \frac{f(j)}{j} & = \; -\sum_{j=1}^{n-1} \frac{1}{n^2-j} + \sum_{j=1}^n \frac{1}{n^2+j} \\ & = \; \frac{1}{n(n+1)} + \sum_{j=1}^{n-1}\left(\frac{1}{n^2+j} - \frac{1}{n^2-j}\right) \; = \; \frac{1}{n(n+1)} - 2\sum_{j=1}^{n-1}\frac{j}{n^4-j^2} \end{aligned} for all integers n 2 n \ge 2 . Note that 2 j = 1 n 1 j n 4 j 2 2 j = 1 n 1 j n 4 n 2 = n ( n 1 ) n 2 ( n 2 1 ) = 1 n ( n + 1 ) 2\sum_{j=1}^{n-1}\frac{j}{n^4 - j^2} \; \le \; 2\sum_{j=1}^{n-1} \frac{j}{n^4 - n^2} \; = \; \frac{n(n-1)}{n^2(n^2-1)} \; = \; \frac{1}{n(n+1)} for all n 2 n\ge 2 , so we deduce that 0 X n 1 n ( n + 1 ) 0 \le X_n \le \frac{1}{n(n+1)} for all n 2 n \ge 2 . Since j = 1 n 2 + n f ( j ) j = 1 2 + m = 2 n X m \sum_{j=1}^{n^2+n}\frac{f(j)}{j} \; = \; \frac12 + \sum_{m=2}^n X_m we deduce that j = 1 f ( j ) j \sum_{j=1}^\infty \frac{f(j)}{j} is convergent, with limit less than 1 2 + m 2 1 m ( m + 1 ) = 1 \tfrac12 + \sum_{m \ge 2} \tfrac{1}{m(m+1)} = 1 . Certainly, then, the limit is less than 2 2 .

To be picky, if we denote S n = j = 1 n f ( j ) j S_n = \sum_{j=1}^n \frac{f(j)}{j} , we have so far shown that the subsequence S n 2 + n S_{n^2+n} converges to some limit as n n \to \infty . Since S m S n 2 + n j = n 2 n + 1 n 2 + n 1 j 2 n n 2 n + 1 2 n 1 n 2 n + 1 m n 2 + n \big|S_m - S_{n^2+n}\big| \; \le \; \sum_{j=n^2-n+1}^{n^2+n} \frac{1}{j} \; \le \; \frac{2n}{n^2 - n + 1} \le \frac{2}{n-1} \hspace{2cm} n^2-n+1 \le m \le n^2 + n we can now deduce that the entire sequence of partial sums S m S_m converges.

If the limit is L L , then 0 L j = 1 n 2 + n f ( j ) j = m = n + 1 X m 1 n + 1 0 \le L - \sum_{j=1}^{n^2+n} \frac{f(j)}{j} \; = \; \sum_{m=n+1}^\infty X_m \; \le \; \frac{1}{n+1} and hence we deduce that the error term L j = 1 n f ( j ) j L - \sum_{j=1}^n \frac{f(j)}{j} tends to 0 0 as n n \to \infty no faster than n 1 2 n^{-\frac12} .

Hello Mark Sir. Can you help me to work with the following problem.

n = 0 ( 1 + 2 1 ! + 3 2 ! + n + 1 n ! ( n + 1 ) ( n + 2 ) ) ? \sum_{n=0}^{\infty}\left(\dfrac{1+\frac{2}{1!} +\frac{3}{2!} +\cdots \frac{n+1}{n!}}{(n+1)(n+2)}\right)\,?

Naren Bhandari - 2 years, 10 months ago

Log in to reply

You want n = 0 1 ( n + 1 ) ( n + 2 ) ( j = 0 n j + 1 j ! ) = j = 0 n = j j + 1 ( n + 1 ) ( n + 2 ) j ! = j = 0 j + 1 j ! × 1 j + 1 = j = 0 1 j ! = e \sum_{n=0}^\infty \frac{1}{(n+1)(n+2)}\left(\sum_{j=0}^n \frac{j+1}{j!}\right) \; = \; \sum_{j=0}^\infty \sum_{n=j}^\infty \frac{j+1}{(n+1)(n+2)j!} \; = \; \sum_{j=0}^\infty \frac{j+1}{j!} \times \frac{1}{j+1} \; = \; \sum_{j=0}^\infty \frac{1}{j!} \; = \; e

Mark Hennings - 2 years, 10 months ago

Log in to reply

Thank you so much Sir !! You are indeed so awesome. :)

How do I learn Double series ? I was aware of it regarding this problem however, had no any idea about it .

Naren Bhandari - 2 years, 10 months ago
Chung Kevin
Feb 2, 2018

Let's group the terms around a perfect square 1 n 2 \frac{1}{n^2} .
n = 1 f ( n ) n = ( 1 2 ) + ( 1 3 + 1 5 + 1 6 ) + ( 1 7 1 8 + 1 10 + 1 11 + 1 12 ) + ( 1 13 1 14 1 15 + 1 17 + 1 18 + 1 19 + 1 20 ) + \sum_{n=1}^{\infty} \frac{f(n)}{n} = (\frac{1}{2}) +(- \frac{1}{3} + \frac{1}{5} + \frac{1}{6}) +( - \frac{1}{7} - \frac{1}{8} + \frac{1}{10} + \frac{1}{11} + \frac{1}{12}) +( - \frac{1}{13} - \frac{1}{14} - \frac{1}{15} + \frac{1}{17} + \frac{1}{18} + \frac{1}{19} + \frac{1}{20} ) + \ldots .
In each group, we subtract off n 1 n-1 terms that are larger than 1 n 2 \frac{1}{n^2} , and add on n n terms that are smaller than 1 n 2 \frac{1}{n^2} . Thus, the total sum will be less than ( n 1 ) × 1 n 2 + n × 1 n 2 = 1 n 2 - (n-1) \times \frac{1}{n^2} + n \times \frac{1}{n^2} = \frac{1}{n^2} .

Hence, we can conclude that

n = 1 f ( n ) n < 1 1 + 1 4 + 1 9 + = π 2 6 1.644 \sum_{n=1}^{\infty} \frac{f(n)}{n} < \frac{1}{1} + \frac{1}{4} + \frac{1}{9} + \ldots = \frac{\pi^2}{6} \approx 1.644

We can tighten up the bound by accounting for the initial terms. For example,

n = 1 f ( n ) n < 1 2 + 1 4 + 1 9 + = 1 2 + π 2 6 1 1.144 \sum_{n=1}^{\infty} \frac{f(n)}{n} < \frac{1}{2} + \frac{1}{4} + \frac{1}{9} + \ldots = \frac{1}{2} + \frac{\pi^2}{6} - 1 \approx 1.144
n = 1 f ( n ) n < 1 2 1 30 + 1 9 + = 14 30 + π 2 6 ( 1 + 1 4 ) 0.86 \sum_{n=1}^{\infty} \frac{f(n)}{n} < \frac{1}{2} - \frac{1}{30} + \frac{1}{9} + \ldots = \frac{14}{30} + \frac{\pi^2}{6} - (1 + \frac{1}{4}) \approx 0.86
n = 1 f ( n ) n < 1 2 1 30 59 9240 + = 4253 9240 + π 2 6 ( 1 + 1 4 + 1 9 ) 0.74 \sum_{n=1}^{\infty} \frac{f(n)}{n} < \frac{1}{2} - \frac{1}{30} - \frac{59}{9240} + \ldots = \frac{4253}{9240} + \frac{\pi^2}{6} - (1+\frac{1}{4} + \frac{1}{9}) \approx 0.74
The next line (too ugly to write out) is < 0.68 < 0.68 and the line after that is < 0.64 < 0.64 .


Note: We can improve the bounding of each group. As Alexander Maly shows in the comments, each parenthesis is very slightly larger than 1 2 n 4 \frac{1}{2 n^ 4} . ζ ( 4 ) 2 0.5411 \frac{ \zeta (4) } {2 } \approx 0.5411 , which is much closer to the true value.

Which terms in parentheses are negative? It looks they all are positive, asymptotically 1 / ( 2 n 4 ) 1/(2n^4) .

Alexander Maly - 3 years, 3 months ago

I think, you should prove the fact about a sign of parenthesis groups.

Андрей Фасалов - 3 years, 3 months ago

Log in to reply

That looks easy. b n = 1 n 2 n + 1 1 n 2 n + 2 1 n 2 1 + 1 n 2 + 1 + + 1 n 2 + n = k = 1 n 1 ( 1 n 2 k 1 n 2 + k ) + 1 n 2 + n = k = 1 n 1 2 k n 4 k 2 + k = 1 n 1 2 k ( n 2 + n ) ( n 2 n ) = k = 1 n 1 2 k ( n 2 k 2 ) ( n 4 k 2 ) ( n 4 n 2 ) b_n = -\frac{1}{n^2-n+1}-\frac{1}{n^2-n+2}-\cdots\frac{1}{n^2-1}+\frac{1}{n^2+1}+\cdots+\frac{1}{n^2+n}=-\sum_{k=1}^{n-1}\left( \frac{1}{n^2-k}-\frac{1}{n^2+k} \right) + \frac{1}{n^2+n} = -\sum_{k=1}^{n-1}\frac{2k}{n^4-k^2} + \sum_{k=1}^{n-1}\frac{2k}{(n^2+n)(n^2-n)} = \sum_{k=1}^{n-1}\frac{2k(n^2-k^2)}{(n^4-k^2)(n^4-n^2)} , because k = 1 n 1 2 k = n 2 n \sum_{k=1}^{n-1}2k = n^2-n . Next, k = 1 n 1 2 k ( n 2 k 2 ) = n 4 n 2 2 \sum_{k=1}^{n-1}2k(n^2-k^2) = \frac{n^4-n^2}{2} , so 0 < 1 2 n 4 < b n < 1 2 ( n 4 n 2 ) 0 < \frac{1}{2n^4} < b_n < \frac{1}{2(n^4-n^2)} , if n 2 n \ge 2 . Q.e.d.

We can further rewrite b n 1 2 n 4 = k = 1 n 1 2 k ( n 2 k 2 ) ( n 4 k 2 ) ( n 4 n 2 ) k = 1 n 1 4 k ( n 2 k 2 ) 2 n 4 ( n 4 n 2 ) = k = 1 n 1 2 k 3 ( n 2 k 2 ) n 4 ( n 4 k 2 ) ( n 4 n 2 ) ( 1 6 n 4 ( n 2 + 1 ) , 1 6 n 6 ) b_n-\frac{1}{2n^4} = \sum_{k=1}^{n-1}\frac{2k(n^2-k^2)}{(n^4-k^2)(n^4-n^2)} - \sum_{k=1}^{n-1}\frac{4k(n^2-k^2)}{2n^4(n^4-n^2)} = \sum_{k=1}^{n-1}\frac{2k^3(n^2-k^2)}{n^4(n^4-k^2)(n^4-n^2)} \in (\frac{1}{6n^4(n^2+1)}, \frac{1}{6n^6} ) .

Alexander Maly - 3 years, 3 months ago

Log in to reply

Great observation! That gets us very close to the actual bound. You should write that as a solution!

Thanks for your comments, I wrote this up quickly and made some wrong guesses.

Chung Kevin - 3 years, 3 months ago
Sahit Dodda
Feb 12, 2018

Using symmetry, you can figure that it must be smaller than a certain number, which could eventually be figured as 2.

Can you elaborate?

Calvin Lin Staff - 3 years, 3 months ago
Elan Pelletier
Feb 13, 2018

You can solve this intuitively. Square numbers add nothing to f(n) so all we are concerned with is the distance between consecutive, perfect squares.

If you take the distance between any two very large, consecutive, perfect squares and tally all of the scenarios resulting in (1)s and (-1)s you will notice that the tallies differ by at most 2. Let's say that we have a distance of 1,000,000 between two arbitrary perfect squares, the first 499,999 are (1)s and the last 500,000 are (-1)s, there is now a 50/50 chance that our last number is either a (1) or (-1). Regardless of who gets the tally, the percent total of each tally will be approximately 50%, and will continue to get closer to exactly 50% so we can deduce that the function converges somewhere around .5

I like this idea, and indeed the value is around 0.543512... like you say, but could you put this solution in more formal terms? I see that your results are correct, but I don't quite follow your idea.

Leonel Castillo - 3 years, 3 months ago

Yes could you elaborate a little more please? What do you mean by "who gets the tally?" Thanks!

Michael Ma - 3 years, 3 months ago

I don't know if my deduction is correct but what i thought is that, as the denominator keeps getting bigger and the numerator go from -1 to 1, it's not able to get higher than 2

Not necessarily. We know that 1 n \sum \frac{1}{ n} goes to infinity, so there is no guarantee that the sum must be bounded.

Calvin Lin Staff - 3 years, 3 months ago
Ivan Lobaskin
Feb 13, 2018

We write the series as:

S = ( 1 2 1 3 ) + ( 1 5 + 1 6 1 7 1 8 ) = k = 1 n = 1 k ( 1 k 2 + n 1 k 2 + k + n ) = k = 1 n = 1 k k ( k 2 + n ) ( k 2 + k + n ) S=(\frac{1}{2}-\frac{1}{3})+(\frac{1}{5}+\frac{1}{6}-\frac{1}{7}-\frac{1}{8}) \cdots = \sum\limits_{k=1}^{\infty} \sum\limits_{n=1}^k (\frac{1}{k^2+n}-\frac{1}{k^2+k+n}) = \sum\limits_{k=1}^{\infty} \sum\limits_{n=1}^k \frac{k}{(k^2+n)(k^2+k+n)}

Since n > 0 n> 0 ,

k ( k 2 + n ) ( k 2 + k + n ) < k k 2 ( k 2 + k ) \frac{k}{(k^2+n)(k^2+k+n)}< \frac{k}{k^2(k^2+k)}

Therefore,

S < k = 1 n = 1 k k k 2 ( k 2 + k ) = k = 1 k 2 k 2 ( k 2 + k ) = k = 1 1 k ( k + 1 ) = 1 S < \sum\limits_{k=1}^{\infty} \sum\limits_{n=1}^k \frac{k}{k^2(k^2+k)} = \sum\limits_{k=1}^{\infty} \frac{k^2}{k^2(k^2+k)}= \sum\limits_{k=1}^{\infty} \frac{1}{k(k+1)} = 1

So S S converges to a value smaller than 1.

George Bougas
Feb 17, 2018

We can see that between two adjacent squared integers n , n + 1 n, n+1 , there are exactly 2 n 2n integers. Half of them will contribute to the series with a plus sign, while the rest will get a minus sign. We can thus write the series as:

n = 1 ( k = 1 n ( 1 k + n 2 1 k + n 2 + n ) ) \sum_{n=1}^{\infty} \left( \sum_{k=1}^n ( \frac{1}{k+n^2}- \frac{1}{k+n^2+n} ) \right) We can express the above nested sum in terms of the digamma function ψ ( x ) \psi(x) , making use of the properties appearing in Digamma function , like ψ ( x + N ) ψ ( x ) = k = 0 N 1 1 x + k \psi(x+N)- \psi(x) = \sum_{k=0}^{N-1} \frac{1}{x+k} . We have: n = 1 [ 2 ψ ( 1 + n + n 2 ) ψ ( 1 + n 2 ) ψ ( 1 + 2 n + n 2 ) ] \sum_{n=1}^{\infty} \left[2\psi(1+n+n^2)-\psi(1+n^2)-\psi(1+2n+n^2) \right] We can then approximate the digamma function by: ψ ( x ) l n ( x ) 1 2 x + O ( 1 / x 2 ) \psi(x) \approx ln(x)-\frac{1}{2x}+ \mathcal{O}(1/x^2) , which gets better and better as we sum over larger integers. We can drop the logarithmic behaviour, since for large n, all three functions behave as 2 l n ( n ) 2ln(n) . So n = 1 f ( n ) n n = 1 ( 1 2 ( n 2 + 1 ) 1 1 + n + n 2 + 1 2 ( 1 + 2 n + n 2 ) ) \sum_{n=1}^{\infty}\frac{f(n)}{n} \approx \sum_{n=1}^{\infty} \left( \frac{1}{2(n^2+1)}-\frac{1}{1+n+n^2}+\frac{1}{2(1+2n+n^2)} \right) If you work out the fractions, you can see that n = 1 f ( n ) n < n = 1 1 n 3 = 1.20206 \sum_{n=1}^{\infty}| \frac{f(n)}{n}| < \sum_{n=1}^{\infty} \frac{1}{n^3}= 1.20206 . The series is thus bounded by above and converges to a number smaller than 2

Nice idea, but in your last inequality you should drop the absolute value because the series is not absolutely convergent.

Leonel Castillo - 3 years, 3 months ago

Log in to reply

Yes, you are right.In fact you can just take into account only the positive fractions, so you can establish an inequality with 1/n^2.

George Bougas - 3 years, 3 months ago

Kind of stupid approach: ask computer to calculate first 1000 sums

Obviously converges to something around 0.5

Code

Yeah, it looks like it converges when x 1000 x\approx 1000 , but does it converge when x x\to\infty ?

Pi Han Goh - 3 years, 3 months ago
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# https://brilliant.org/weekly-problems/2018-02-12/advanced/?p=3
import numpy as np

thresh = 6000
squares = np.array([x**2 for x in range(1,thresh+1)])
candidates = np.array([x for x in range(1,thresh**2+1) if x not in squares])

y = []
for k,x in enumerate(candidates[1:-1]):
    if abs(x - squares[squares < x].max()) < abs(x - squares[squares > x].min()):
        y.append(x)
    else:
        y.append(-x)

y.insert(0, 2)            # insert the first value (2)
y.append(-(thresh**2-1))  # append the last negative value before last square
y = np.array(y,dtype='float64')
y = np.reciprocal(y)    

print '%0.12f' %(np.sum(y))

1
0.543346681981

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...