Sympathetic cooling of 9 Be + and 24 Mg + for quantum logic