This is one of the best short stories I’ve read – it’s called “The Last Question” by Isaac Asimov.
Philip