If n=2 then P(3*n + 1) = 15 = 3 x 5 (two distinct prime factors), so the first term is 2.
MAPLE
with(combinat): with(numtheory): a:=proc(n) if nops(factorset(numbpart(3*n+1)))=2 then n else fi end: seq(a(n), n=1..300); # Emeric Deutsch, Jan 27 2006
MATHEMATICA
For[n = 1, n < 550, n++, If[Length[FactorInteger[PartitionsP[3*n + 1]]] == 2, Print[n]]] (* Stefan Steinerberger, Jan 27 2006 *)