NestList

The documentation for NestList is clear, but it isn't immediatly clear when one might want to use  NestList. I give a usefule example in the next cell which efficiently makes a  list of the ten smallest prime numbers that are larger than 10^15.

Needs["NumberTheory`NumberTheoryFunctions`"] ;    NestList[NextPrime, 10^15, 10]//Rest

{1000000000000037, 1000000000000091, 1000000000000159, 1000000000000187, 1000000000000223, 1000000000000241, 1000000000000249, 1000000000000259, 1000000000000273, 1000000000000279}


Created by Mathematica  (May 16, 2004)