Skip to main content
added 48 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

VyxalVyxal, 43 bytes

KL2=KḢ₃ 

Try it Online!Try it Online!

I thought something non trivial would be nice for a change. æ does the job for one byte but where's the fun in that?

-1 thanks to EmanresuA

Explained

KL2=KḢ₃ KLKḢ # len(factors(input))[1:] 2= # len(^) == 21 // prime numbers have only [1, n] as factors...other numbers have 1 or 3+ factors 

Vyxal, 4 bytes

KL2= 

Try it Online!

I thought something non trivial would be nice for a change. æ does the job for one byte but where's the fun in that?

Explained

KL2= KL # len(factors(input)) 2= # ^ == 2 // prime numbers have only [1, n] as factors...other numbers have 1 or 3+ factors 

Vyxal, 3 bytes

KḢ₃ 

Try it Online!

I thought something non trivial would be nice for a change. æ does the job for one byte but where's the fun in that?

-1 thanks to EmanresuA

Explained

KḢ₃ KḢ # factors(input)[1:]  # len(^) == 1 // prime numbers have only [1, n] as factors...other numbers have 1 or 3+ factors 
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

Vyxal, 4 bytes

KL2= 

Try it Online!

I thought something non trivial would be nice for a change. æ does the job for one byte but where's the fun in that?

Explained

KL2= KL # len(factors(input)) 2= # ^ == 2 // prime numbers have only [1, n] as factors...other numbers have 1 or 3+ factors