Skip to main content
added 4 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js),  57 54 5450 bytes

f=(n,i=1,s=0)=>n%1?0:n<++i*i?s+!s:fn>=++i*i&&f(n,i,s+f)+f(n/i)*f(i))||i<3

Try it online!Try it online!

If there's no way to factor, then it's a prime and return 1

JavaScript (Node.js), 57 54 bytes

f=(n,i=1,s=0)=>n%1?0:n<++i*i?s+!s:f(n,i,s+f(n/i)*f(i))

Try it online!

If there's no way to factor, then it's a prime and return 1

JavaScript (Node.js),  57 54 50 bytes

f=(n,i=1)=>n%1?0:n>=++i*i&&f(n,i)+f(n/i)*f(i)||i<3

Try it online!

If there's no way to factor, then it's a prime and return 1

deleted 440 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js), 54 57 54 bytes

f=(n,i=1,s=0)=>n%1?0:n<++i*i?s+!s:f(n,i,s+f(n/i)*f(i))

Try it online!Try it online!

JavaScript (Node.js), 57 bytes

f=(n,i=1,s=0)=>n/++i>=i?f(n,i,s+=n%i<1&&f(n/i)*f(i)):s+!s

Try it online!

If there's no way to factor, then it's a prime and return 1

If there's no way to factor, then it's a prime and return 1

JavaScript (Node.js), 54 bytes

f=(n,i=1,s=0)=>n%1?0:n<++i*i?s+!s:f(n,i,s+f(n/i)*f(i))

Try it online!

JavaScript (Node.js), 57 bytes

f=(n,i=1,s=0)=>n/++i>=i?f(n,i,s+=n%i<1&&f(n/i)*f(i)):s+!s

Try it online!

If there's no way to factor, then it's a prime and return 1

JavaScript (Node.js), 57 54 bytes

f=(n,i=1,s=0)=>n%1?0:n<++i*i?s+!s:f(n,i,s+f(n/i)*f(i))

Try it online!

If there's no way to factor, then it's a prime and return 1

Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js), 54 bytes

f=(n,i=1,s=0)=>n%1?0:n<++i*i?s+!s:f(n,i,s+f(n/i)*f(i))

Try it online!

JavaScript (Node.js), 57 bytes

f=(n,i=1,s=0)=>n/++i>=i?f(n,i,s+=n%i<1&&f(n/i)*f(i)):s+!s

Try it online!

If there's no way to factor, then it's a prime and return 1