$\=1;`factor $_`=~s/( \d+)(\1)?/$\*=$2?1:$1/gerfor<>;print