RosettaCodeData/Task/Attractive-numbers/Mathematica/attractive-numbers.math

4 lines
167 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
ClearAll[AttractiveNumberQ]
AttractiveNumberQ[n_Integer] := FactorInteger[n][[All, 2]] // Total // PrimeQ
Reap[Do[If[AttractiveNumberQ[i], Sow[i]], {i, 120}]][[2, 1]]