The secret code

Level pending

You go to visit a freind of yours who lives in another city. when you arrive at the door of his house you find this message: "Welcome to my house. I had an emergency case and I couldn't wait for you.Enter the security code of the house and fell as at home. The code is n = 1 1019090 1 n \lfloor\sum_{n=1}^{1019090} \frac{1}{\sqrt n}\rfloor "

He knows that you will find the code even if you don't have a calculator.

Enter the code.


The answer is 2017.

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.

1 solution

Laurent Shorts
May 23, 2020

Using N = 1 , 019 , 090 N\!=\!1,019,090 , let's write n = 1 N 1 n = 1 1 + n = 2 N 1 n = 1 + n = 2 N 1 n \displaystyle \sum_{n=1}^N\dfrac{1}{\sqrt{n}}\,=\,\dfrac{1}{\sqrt{1}}+\displaystyle \sum_{n=2}^N\dfrac{1}{\sqrt{n}}\,=\,1+\displaystyle \sum_{n=2}^N\dfrac{1}{\sqrt{n}} .

Because the function f ( x ) = 1 n f(x)\!=\!\dfrac{1}{\sqrt{n}} is decreasing, we have 1 + 2 N + 1 1 x d x < 1 + n = 2 N 1 n < 1 + 1 N 1 x d x \boxed{1+\displaystyle \int_2^{N+1}\!\!\dfrac{1}{\sqrt{x}}\,\mathrm{d}x\,\,\,<\,\,\,1+\displaystyle \sum_{n=2}^N\dfrac{1}{\sqrt{n}}\,\,\,<\,\,\,1+ \displaystyle \int_1^{N}\!\!\dfrac{1}{\sqrt{x}}\,\mathrm{d}x}

1 x d x = x 1 2 d x = x 1 2 1 / 2 + c = 2 x + c \displaystyle \int\!\!\dfrac{1}{\sqrt{x}}\,\mathrm{d}x\,=\,\int\!\!x^{-\frac12}\,\mathrm{d}x\,=\,\dfrac{x^\frac12}{^1\!/_2}+c=2\sqrt{x}+c .

We'll have to get the integer part of 2 N and 2 N + 1 2\sqrt{N}\text{ and }2\sqrt{N+1} , that is the square roots with a 0.5 precision.

Without any calculator, we can see that ( 1 , 000 + x ) 2 = 1 , 000 , 000 + 2 , 000 x + x 2 (1,000+x)^2=1,000,000+2,000x+x^2 , so x x must be around 19 , 090 2 , 000 9.5 \frac{19,090}{2,000}\simeq9.5 .

1 , 00 9 2 = 1 , 000 , 000 + 18 , 000 + 81 < 1 , 019 , 090 1,009^2=1,000,000+18,000+81<1,019,090 .

Let's see what gives 1009. 5 2 = ( 1009 + 0.5 ) ( 1010 0.5 ) = 1009 1010 + 0.5 ( 1010 1009 ) 0. 5 2 = 1009 ( 1000 + 10 ) + 0.5 1 0.25 = 1 , 009 , 000 + 10 , 090 + 0.25 = 1 , 019 , 090.25 1009.5^2=(1009+0.5)\cdot(1010-0.5)=1009\cdot1010+0.5\cdot(1010-1009)-0.5^2=1009\cdot(1000+10)+0.5\cdot1-0.25=1,009,000+10,090+0.25=1,019,090.25 .

Therefore, N \sqrt{N} is just a bit short of 1009.5 1009.5 , that is N = 1009.49 2 N = 2018.9 \sqrt{N}=1009.49\!\ldots\implies2\sqrt{N}=2018.9\!\ldots

and N + 1 \sqrt{N+1} is just after 1009.5 1009.5 , that is N + 1 = 1009.5 2 N + 1 = 2019.0 \sqrt{N+1}=1009.5\!…\implies2\sqrt{N+1}=2019.0\!…

2 N + 1 1 x d x = [ 2 x ] 2 N + 1 = 2 N + 1 2 2 = 2019.0 2.828 > 2016 \displaystyle \int_2^{N+1}\!\!\dfrac{1}{\sqrt{x}}\,\mathrm{d}x\,=\,\Big[2\sqrt{x}\,\Big]_2^{N+1}\!=\,2\sqrt{N+1}-2\sqrt2\,=\,2019.0\!…-2.828\!…>2016

1 N 1 x d x = [ 2 x ] 1 N = 2 N 2 1 = 2018.9 2 < 2017 \displaystyle \int_1^{N}\!\!\dfrac{1}{\sqrt{x}}\,\mathrm{d}x\,=\,\Big[2\sqrt{x}\,\Big]_1^{N}\!=\,2\sqrt{N}-2\sqrt1\,=\,2018.9\!…-2<2017 .

Therefore, 1 + 2016 2017 < 1 + n = 2 N 1 n < 1 + 2017 2018 \underbrace{1+2016}_{2017}\,<\,1+\displaystyle \sum_{n=2}^N\dfrac{1}{\sqrt{n}}\,<\,\underbrace{1+ 2017}_{2018} , which gives n = 1 N 1 n = 2017. \displaystyle \sum_{n=1}^N\dfrac{1}{\sqrt{n}}=2017.\,… , that is, rounded down, answer = 2017 \boxed{\text{answer}=2017} .

If we try to keep the first term in the integrals and sum, we'd get 2017 < < 2019 2017<\sum<2019 , which cannot tell if answer is 2017 or 2018. (Actually, the security code could surely be entered at least two times and you could try both numbers.)

Laurent Shorts - 1 year ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...