Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
#Mathematica, 39 bytes
Count[Union@@FactorInteger@#,_?PrimeQ]&
Try it online!
thanks to Martin Ender (-11 bytes)
#Mathematica, 4639 bytes
Tr[1^Union@Cases[FactorInteger@#Count[Union@@FactorInteger@#,_?PrimeQ,2]]&PrimeQ]&
Try it online!Try it online!
thanks to Martin Ender (-411 bytes @JungHwan Min)
#Mathematica, 46 bytes
Tr[1^Union@Cases[FactorInteger@#,_?PrimeQ,2]]&
-4 bytes @JungHwan Min
#Mathematica, 5046 bytes
Tr[1^Select[Union[Join@@FactorInteger@#]Tr[1^Union@Cases[FactorInteger@#,PrimeQ]]&_?PrimeQ,2]]&
#Mathematica, 50 bytes
Tr[1^Select[Union[Join@@FactorInteger@#],PrimeQ]]&