This is a very silly question with no practical usage. But always important to know exactly where the processor cycles are being used. You are complaining about writing to a file taking too long. Well, are you sure it is actually the file that's slow? Or is it BigInteger.ToString() that's slow?
Best way to find out is just doing the file writing so you can isolate the problem:
using System;
using System.Text;
using System.IO;
class Program {
static void Main(string[] args) {
var big = new StringBuilder(1600 * 1000);
big.Append('0', big.Capacity);
var sw = System.Diagnostics.Stopwatch.StartNew();
// Your code here
FileStream fs1 = new FileStream("BigInteger.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter writer = new StreamWriter(fs1);
writer.WriteLine(big);
writer.Close();
// End of your code
sw.Stop();
Console.WriteLine("That took {0} milliseconds", sw.ElapsedMilliseconds);
Console.ReadLine();
}
}
Output on my machine:
That took 13 milliseconds
Writing a file is very fast, the file system cache makes it a memory-to-memory copy. The operating system lazily writes it to the disk, long after your program stopped running. It is only ever not capable of hiding the slow disk write speed when you write more data than can fit in the cache. You are not close to that on any modern machine, they have lots of RAM and can easily store a gigabyte. 1.6 megabytes is dental floss.
So you know it is actually BigInteger.ToString() that is so slow. Yes, it is. It stores that Big Mother in base 2, makes the math as quick as possible. Processors like base 2, they count with 2 fingers. Converting to the human format, base 10, that's expensive. It requires division, one of the most expensive thing you can ever do with a processor.