Density functions for prime and relatively prime numbers