Skip to main content
Commonmark migration
Source Link

##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(','));

##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(','));

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(','));

saved 5 bytes thanks to Neil
Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

##Javascript (ES6), 53 5151 46 bytes

n=>(i=>{fore=(r=0;i<n;n%in,i=2)=>i<n?i++:r+=!n%i?e(n,i+1):e(n/=i)%i));},i)+!(2n%i)|r:0

Saved 5 bytes thanks to Neil

Example:

let e =
n=>(i=>{fore=(r=0;i<n;n%in,i=2)=>i<n?i++:r+=!n%i?e(n,i+1):e(n/=i)%i));},i)+!(2n%i)|r: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(','));

##Javascript (ES6), 53 51 bytes

n=>(i=>{for(r=0;i<n;n%i?i++:r+=!((n/=i)%i));})(2)|r

Example:

let e =
n=>(i=>{for(r=0;i<n;n%i?i++:r+=!((n/=i)%i));})(2)|r

// computing e(n) for n in [1, 30]
for(var n = 1, list = []; n <= 30; n++) {
  list.push(e(n));
}
console.log(list.join(','));

##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(','));

saved 2 bytes
Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

##Javascript (ES6), 5353 51 bytes

n=>(i=>{for(i=2,r=0;i<n;n%i?i++:r+=!((n/=i)%i));return r;})(2)|r

Example:

let e =
n=>(i=>{for(i=2,r=0;i<n;n%i?i++:r+=!((n/=i)%i));return r;})(2)|r

// computing e(n) for n in [1, 30]
for(var n = 1, list = []; n <= 30; n++) {
  list.push(e(n));
}
console.log(list.join(','));

##Javascript (ES6), 53 bytes

n=>{for(i=2,r=0;i<n;n%i?i++:r+=!((n/=i)%i));return r}

Example:

let e =
n=>{for(i=2,r=0;i<n;n%i?i++:r+=!((n/=i)%i));return r}

// computing e(n) for n in [1, 30]
for(var n = 1, list = []; n <= 30; n++) {
  list.push(e(n));
}
console.log(list.join(','));

##Javascript (ES6), 53 51 bytes

n=>(i=>{for(r=0;i<n;n%i?i++:r+=!((n/=i)%i));})(2)|r

Example:

let e =
n=>(i=>{for(r=0;i<n;n%i?i++:r+=!((n/=i)%i));})(2)|r

// computing e(n) for n in [1, 30]
for(var n = 1, list = []; n <= 30; n++) {
  list.push(e(n));
}
console.log(list.join(','));

Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650
Loading