Building on this question, what is the most efficient counting function for distinct prime factors? It would obviously be more efficient if Prime and PrimePi were used instead of PrimeNu, as ybeltukov and Coolwater used in their brilliant solutions to the PrimeOmega counting function question. I was wondering whether there was any way to do something similar in this instance?
The best I have so far is a (very) minor modification of ubpdqn's reply to my previous question:
cnt[k_, n_] := Last@Reap[Sow[1, PrimeNu@#] & /@ Range[n], k, Total@#2 &]
FactorIntegeris faster thanPrimeNuin version 9 as well, which makes no sense to me... – KennyColnago Dec 19 '13 at 16:58