Hi there,
I wrote a Prim Number Calculator in the console and i want to save the prims in some textdocuments.
The problem is that those files are getting to huge to open ( 500 mb ) for a textdocument.
I startet to put them into serval documents, after every 500 prims a new txt,
Now here the Problem: the program works and works, after reaching the ammount of 500, it is creating the new file, when it does, it sops at
2543
2549
2551
2
it even skips some more in the new doc, it starts with 3581 so he ignored about 1000 possible prim numbers.
The exe starts with calculating if number n is a prim, if ist true, ist adding it onto a list.
at the end of the exe it stars writing it into the txt.
int WriteMax = 500;
for (int loop= 0; loop< primes.Count; loop++)
{
if(WriteMax == Schleife)
{
WriteMax += 500;
myWriter = new StreamWriter("PrimUpto"+WriteMax+".txt");
}
myWriter.WriteLine(primes[loop]);
What I have tried:
I even tried to put a Thread.sleep in it, which didnt work at all.
I there another possible solution which i forgot there?
Thx for helping me.