Neutron-rich Ca and Ni nuclei have been studied in a spherical relativistic mean-field formalism in coordinate space. A Î interaction has been adopted to treat the pairing correlations for the neutrons. Odd nuclei have been treated in the blocking approximation. The effect of the positive-energy continuum and the role of pairing in the stability of nuclei have been investigated by use of the resonant-BCS approach. In Ca isotopes, N=50 is no longer a magic number, whereas in Ni nuclei, a new magic number emerges at N=70. There is a remarkable difference in the relative positions of the drip lines for odd and even isotopes. In Ca isotopes, the last bound even and odd nuclei are found to be Ca72 and Ca59, respectively. In Ni isotopes, the corresponding nuclei are Ni98 and Ni97, respectively. The origin of this difference in relative positions of the drip line in even and odd isotopes in the two chains is traced to the difference in the single-particle level structures and consequent modification in the magic numbers in the two elements. Pairing interaction is seen to play a major role. The effect of the width of the resonance states on pairing has also been investigated. © 2005 The American Physical Society.