-2

Say we try to find the closest square number to 26. we already know the closest square number is $25$. However, how do I calculate out 25?

Because, if I try to prime factorize it like so:
$\sqrt{26}$ = $\sqrt{2*13}$

And I try to round 13 to the closest even number, I would get this equation here from prime factorization:
$\sqrt{26}$ = $\sqrt{2*13}$
-> $\sqrt{2*2*2*3}$

Then, if I write out the equation, it wouls turn up as:
$\sqrt{24}$ ,
Which is not 25.

I there a way to find out the closest square number to a certain number without using a calculator?

  • This is the same as asking how to manually compute roots – lulu Mar 10 '20 at 12:11
  • @lulu Not exactly because in that case, you are trying to compute roots but in my case, I don't know that case exactly what square number I'm computing –  Mar 10 '20 at 12:22
  • @UnidentifiedX You are wrong: if you have some number and compute the square root manually, just drop the fractional part from the result, square it and you will get the nearest perfect square smaller than the given number. – Oldboy Mar 10 '20 at 12:35
  • 1
    It is the same problem. Coincidentally, the link I gave you specifically addresses $\sqrt {26}$. They get approximately $5.1$. It follows that the nearest square is either $5^2$ or $6^2$ and a simple calculation settles the point. – lulu Mar 10 '20 at 12:36

3 Answers3

0

Well it's a little bit difficult since to find the nearest perfect square, you round the square root, but to find the square root you have to find the nearest perfect square. Thus, the only way to find the nearest perfect square is through a loop checking:

In python code this would be:

y = 1
x = int(input("x: "))

while abs(x - (y ** 2)) > abs(x - ((y + 1) ** 2)): y += 1

#Nearest interger to the square root of x print(y)

#Nearest Perfect Square to x print(y ** 2)

So to find the closest perfect square to x it would be $ f(x, 1) $ using the following piecewise function (can be done without a calculator): $$ f(x, y)=\begin{cases} y^2 & |x-y^2|\le|x-(y+1)^2| \\ f(x, (y+1)) & |x-y^2|>|x-(y+1)^2| \\ \end{cases} $$ btw if you input 0 or a negative number it should output 1 as the nearest square

  • You can do the function without a calculator (although the larger the x, the longer it takes). – A Tasty Apple Pi Nov 23 '24 at 00:27
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Nov 23 '24 at 01:43
0

The question is given real number $x>0$, what's the perfect square $y$ so that $|x-y|$ is minimized? It is

$$\arg\min_{y\in \{ \lfloor \sqrt x \text{ }\rfloor ^2, \lceil \sqrt x\text{ } \rceil ^2\}} |x-y|.$$

Golden_Ratio
  • 12,834
-1

You have to subtract all the digits but the first one from the number then add this to the original number. e.g with 745, we would subtract the 45 as those are the digits after the first one. We are left with 700, we add 700 to 745 therefore are answer will be 1445. Weeeee did it!!

Anonymous
  • 4,310
bobby
  • 1