##Javascript (ES6), 53 51 46 bytes
Javascript (ES6), 53 51 46 bytes
e=(n,i=2)=>i<n?n%i?e(n,i+1):e(n/=i,i)+!(n%i):0
Saved 5 bytes thanks to Neil
Example:
e=(n,i=2)=>i<n?n%i?e(n,i+1):e(n/=i,i)+!(n%i):0
// computing e(n) for n in [1, 30]
for(var n = 1, list = []; n <= 30; n++) {
list.push(e(n));
}
console.log(list.join(','));