ClearAll[Fermat] Fermat[n_] := 2^(2^n) + 1 Fermat /@ Range[0, 9] Scan[FactorInteger /* Print, %]