Prime Numbers and common divisors

Hello.

Stuck on the following pretty badly. Could someone help?

Let a=(pr1)(pr2)(pr3)....(prn) the r1, etc is a superscript

Let b=(ps1)(ps2)(ps3)...(psn) the s1, etc is a superscript

where p1, p2, pn are distinct positive prime numbers and all r,s are greater than or equal to 0.

Prove these:

a) gcd(a,b)=(pt1)(pt2)(pt3)...(ptn) where for i, ti is the minimum of ri and si.

b) lcm(a,b)=(pw1)(pw2)(pw3)...(pwn) where wi is the maximum of ri and si.

I'm sorry about the confusing notation. But I'm kind of running out of time on a school assignment. Again thanks for any help.

Timothy