Building on this question, what is the most efficient counting function for distinct prime factors? It would obviously be more efficient if
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 &]