0

how can we find the greatest integer which is a perfect square and which divides an integer? I believe factorisation can be used here but am not sure how to get the result out of it for all prime, non-prime, and also integers which are themselves perfect square(e.g 1296) ? Thanks.

pranay
  • 405
  • 1
    If $n = \prod_i p_i^{\alpha_i}$ then $k = \prod_i p_i^{f(\alpha_i)}$ where $f(x)$ is the greatest even number smaller than $x$, i.e. $f(x) = 2\left\lfloor\frac{x}{2}\right\rfloor$. – dtldarek Mar 30 '12 at 09:30
  • https://oeis.org/A008833 – Charles Apr 04 '12 at 15:03
  • you can use the sum of two squares to find the greatest perfect square that divides an integer $N$ without having to factor $N$. The details can be found here: https://math.stackexchange.com/questions/3064068/can-the-sum-of-two-squares-be-used-to-determine-if-a-number-is-square-free?rq=1 – user25406 Feb 03 '19 at 00:48

1 Answers1

8

Say that you are given the integer $n$ and want to find the largest perfect square $k$ such that $k \mid n$.

First, find the prime factorization of $n$: $$n = p_1^{e_1} \cdots p_m^{e_m}$$ Let $$k = p_{1}^{e_1'} \cdots p_{m}^{e_m'}$$ where $e_m'$ is the largest even integer smaller than or equal to $e_m$, which will make $k$ the largest perfect square which divides $n$.

For example $$1296 = 2^4 \cdot 3^4$$ and both exponents are even, so you get the same number.

Since $$1 609 699 = 7^3 \cdot 13 \cdot 19^2$$ the largest perfect square which divides this is $7^2 \cdot 19^2 = 17689$.

And $$3458 = 2 \cdot 7 \cdot 13 \cdot 19$$ has no exponents larger than one, so the largest perfect square which divides it is 1.

Calle
  • 7,857
  • A quick question about generalizing (for example to largest perfect cube). Would you just set $e'_m$ to the largest multiple of 3 smaller than or equal to $e_m$? Because then all the $e'_m$ are divisible by 3 so $k$ is a perfect cube? – ydd Nov 24 '24 at 19:18
  • 1
    @ydd, yes, that sounds correct to me. – Calle Nov 25 '24 at 20:51