Given a number $n$. I need to find the largest $q$ such that $q^2$ divides $n$. I need the fastest method to find $q$. $q$ can be any number prime or composite.

At present I am factorizing the number $n$ to find the highest number $q$. I need a better approach which does not involve to factorize the number $n$ completely or by some other approach which is less than $O(\sqrt n)$. Constraint: $n\leq 10^{18}$

some test cases:

  • if $n=180$ then $q=6$
  • if $n=17$ then $q=1$
  • if $n=10000$ then $q=100$
  • 1
    $\begingroup$ Is there a reason you think there is such an algorithm? $\endgroup$ – Thomas Andrews Jul 19 '14 at 14:27
  • $\begingroup$ I think you still need to break down that number by the multipliers. And then to make up the number. Using multipliers. Which Degree a multiple of 2. $\endgroup$ – individ Jul 19 '14 at 15:09
  • 1
    $\begingroup$ @individ I already did this but this approach times out i.e why I asked for the better approach $\endgroup$ – user157920 Jul 19 '14 at 15:56
  • 1
    $\begingroup$ @ThomasAndrews those who did this question didn't factorize n completely so that is why i thought if there is a such an algorithm. $\endgroup$ – user157920 Jul 19 '14 at 15:57
  • $\begingroup$ @barto when you edit a post, consider giving it a title better than "need help in number theory problem" $\endgroup$ – user147263 Jan 24 '15 at 20:38

It is trivial to to compute square/squarefree parts if we are given the prime factorization. Currently we do not know any better way, and it is widely suspected that there is none, i.e the problem may prove to be equivalent to factorization.

This problem is important because one of the main tasks of computational algebraic number theory reduces to it (in deterministic polynomial time). Namely the problem of computing the ring of integers of an algebraic number field depends upon the square-free decomposition of the polynomial discriminant (when computing an integral basis).

Contrast this difficulty with the trivial squarefree decomposition of polynomials by way of gcd with its derivative. The availability of derivatives for polynomials opens up a powerful toolbox that is not available for integers. For example once derivatives are available so are Wronskians - which provide powerful measures of dependence in transcendence theory and diophantine approximation. A simple yet stunning example is the elementary proof of Mason's ABC theorem for polynomials, which yields as a very special case a high-school-level proof of FLT for polynomials.

For references see my post here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.