Ramanujan was a genius, but he didn&#x27;t just factor 1729 on the spot in the hospital bed.  According to Wikipedia, he&#x27;d already known about it a few years before, so it was just coincidence that Hardy happened to present a number he already knew about, although to be honest, he probably knew interesting facts about most numbers below 1 million or so.