extended prime.hs