# Removing factor $x$ from a number [closed]

I am required to implement this code function but I have no idea what it is asking for. Can someone explain this to me in simpler terms so that I can try to turn it into code?

Given $$x$$ and $$y$$, I need to return $$Z$$.

The description of the function:

If $$x$$ can be expressed as $$x=qy^n$$, then $$z = q$$ i.e. remove factor $$y$$ from the number $$x$$, such that $$z$$ no longer has $$y$$ as a factor.

Some example results:

x: 2835, y = 3, result = 35

x: 2357, y = 19, result = 2357

I just need a clearer idea of what they are actually asking for.

Thank you

• hint: divide $x$ by $y$ (without remainder) as often as possible and return the result Jan 28, 2021 at 12:39
• You also need to express clearer what you are actually asking for. I'm guessing this: "Yn" is a very sloppy way to write $Y^n$ and in $X=Y^n\,Q$ you are assuming (without telling us) that $Q$ is not divisble by $Y$, so that we really removed as many factors of $Y$ as possible. Please edit your question to clarify this and also make use of MathJax for typesetting formulas. – We shouldn't have to guess what you might want to ask, be precise. Jan 28, 2021 at 12:44
• As @Christoph said, what is $Yn*Q$ supposed to be? This wasn't clear when I was trying to edit your post. Jan 28, 2021 at 12:46
• Raymond has the correct idea. You take the initial number (2835) and put it on a loop. In each loop, you check if it's divisible by $y$ ($y=3$ in the example) and if it is, then divide the number in the loop by that number. When it no longer is divisible, then exit the loop and return the final number. Pretty easy, it's like 4 or 5 lines of code. Jan 28, 2021 at 13:21
• @MattiP. and RaymondManzoni Thank you so much! This was actually what they were asking for. I always have problems deciphering math problems, even such simple ones. Can you tell me how you derived this? I know it's easy. But from reading the description given (and not doing any test on the inputs), I had no idea this was what they were asking. [at]the rest: my apologies for missing out on the correct formatting. I forgot to ensure that the superscripts were intact after including the question. Jan 28, 2021 at 13:53