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

1. Jul 8, 2010

### ABarrios

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!

2. Jul 8, 2010

### Hurkyl

Staff Emeritus
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.

3. Jul 8, 2010

### vela

Staff Emeritus
Use the Apply operator, @@. Times@@{a,b,c} will return the product of a, b, and c.

4. Jul 9, 2010

### ABarrios

Thank you very much!