static void WriteToFile(string path, IIterable <int> iterator)
 {
     using (StreamWriter file = new StreamWriter(path))
     {
         while (iterator.HasNext())
         {
             file.WriteLine(iterator.Next().ToString());
         }
     }
 }