Mathematica: How do I program this? Square free part of an integer

ABarrios
Messages
23
Reaction score
0
I am attempting to program Mathematica to multiply the square free terms of an integer. Basically say we are looking at 252, its prime factors are 2^2*3^2*7. So what I want to do is have Mathematica return to me just 2*3*7 when I enter 252.

So I have this

S := FactorInteger[252]
Transpose[[1]]

which returns

{{2, 2}, {3, 2}, {7, 1}}
{2, 3, 7}

So, knowing a way to have Mathematica multiply 2*3*7 will give me what I need. Thanks!
 
Physics news on Phys.org
Times @@ {a, b, c, d, ...} I think is the clever way to do it. I'm pretty sure there is a Product function you could make use of, and in a pinch, you could always write a Function or Module yourself that uses Do to create a loop.
 
Use the Apply operator, @@. Times@@{a,b,c} will return the product of a, b, and c.
 
Thank you very much!
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top