Skip to content

Instantly share code, notes, and snippets.

@niczky12
Last active December 8, 2022 22:32
Show Gist options
  • Save niczky12/8a32cbc36cc5657e28e41c7c745eeba3 to your computer and use it in GitHub Desktop.
Save niczky12/8a32cbc36cc5657e28e41c7c745eeba3 to your computer and use it in GitHub Desktop.
import Primes
num_prime_divisors(n) = length(keys(Primes.factor(n)))
@test num_prime_divisors(1) == 0
@test num_prime_divisors(2) == 1
@test num_prime_divisors(3) == 1
@test num_prime_divisors(4) == 1
@test num_prime_divisors(12) == 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment