A Christian legend of the same shape was in circulation well before the Qur'an. In it, seven young Christians of Ephesus refuse to sacrifice during a persecution under the emperor Decius in the middle of the third century, give away their property, and hide in a cave in a nearby mountain; the entrance is walled up on the emperor's order, and they sleep. Nearly two centuries later the stones are removed by workmen and the sleepers wake, believing they have slept one night, and send one of their number into the city to buy bread. He is bewildered by the crosses on the buildings, and the money he offers, struck under a long-dead emperor, is what betrays him: he is taken for a treasure-finder and brought before the bishop and the authorities, and the whole company is discovered. In the standard telling they die shortly afterward, having been raised as a demonstration of the resurrection of the body at a time when it was being disputed.
The legend is attested in Syriac by the sixth century and in Latin in the same period through Gregory of Tours, and it was widely known in the eastern Mediterranean and in Arabia before the rise of Islam. The two versions differ in exactly the ways that matter to each tradition. The Christian legend fixes the number at seven, names them, dates them, and makes the point about bodily resurrection explicit. The Qur'anic account leaves the number unfixed, declines to date them beyond a figure it then qualifies, and turns the episode toward trust in God and toward the folly of speaking with certainty about the unseen. Both are told about the same kind of event, and neither is a copy of the other in any sense that the sources allow anyone to demonstrate.