using stream.iterate
using stream.iterate