  We present a theoretical investigation of CN and HCN molecule formation in
dense interstellar clouds. We study the gas-phase CN and HCN production
efficiencies from the outer photon-dominated regions (PDRs) into the opaque
cosmic-ray dominated cores. We calculate the equilibrium densities of CN and
HCN, and of the associated species C+, C, and CO, as functions of the
far-ultraviolet (FUV) optical depth. We consider isothermal gas at 50 K, with
hydrogen particle densities from 10^2 to 10^6 cm^-3. We study clouds that are
exposed to FUV fields with intensities 20 to 2*10^5 times the mean interstellar
FUV intensity. We assume cosmic-ray H2 ionization rates ranging from 5*10^-17
s^-1, to an enhanced value of 5*10^-16 s^-1. We also examine the sensitivity of
the density profiles to the gas-phase sulfur abundance.
