First, show a small sample of the output you don't like, and a sample of how you want it to look like.
Next, trim down the code to a minimum that still shows the problem. In this case, it would probably be a short array of primes, and a loop doing sprintf from that array.
Now, my question would be why do you think the number of iterations would be directly proportional to the printed length of the prime numbers?
I'd expect the value of the largest prime to be proportional to the number of iterations. And the printed length of that to be log base 10 of that.
PS: surely there aren't *that* many prime numbers you're collecting. Why not save them all to an array, then check the actual length of the last one and use that to decide how much space you need?
In reply to Re: sprintf not acting like I expect
by SuicideJunkie
in thread sprintf not acting like I expect
by NateTut
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |