In Mathematica one can do this:
factors[n_] := factors[n] = FactorInteger[n]
Then, the first time you call factors[2^385-1]
, the result is computed, stored, and returned. Next time you make the call, no computation is needed, and the result is returned immediately. How do I do this in Sage?