The death toll from an earthquake off the coast of Indonesia has risen to 38.