Proposal for realizing Majorana fermions in chains of magnetic atoms on a superconductor