Ah, I just came back and saw the "doubles" part. Many apologies; my solution will only work for integers.
Type: Posts; User: Differ
Ah, I just came back and saw the "doubles" part. Many apologies; my solution will only work for integers.
Which is exactly what happened. Everybody in the top 4 filled in at around 3 mil.
As for the half-size array, I did that to conserve memory, not to make it run faster.
Everybody else was way...
Bloodshed made a compiler?
That was really stupid of me. I didn't think of that.
I mean, a hacker can use SoftIce to actually go into the program and change the locations it's downloading from, after everything has been processed. A relatively simple task.
Rules are one prime per line, 20 seconds to generate primes. It's mainly the displaying that's causing problems. The generating is minimal.
I didn't know how smn = (smn == 4) ?2:4; worked, so I...
Put the checksums on a hosting service. Have the program check that website.
Anyways, if they can change the text file, they can change anything. So they can simply alter the md5 sum and insert...
It's at page 2. I'm not quite sure if we're allowed to write it to file; let me check.
It turns out that the code of actually determining the primes is virtually instant. It's the displaying that's the problem. =(
Is there a way I could multi-thread this?
Yes it is. I didn't notice that when I updated my code. Thanks for the heads-up.
Just use a md5 checksum. When it starts downloading things from other sites, have the program connect to your computer and verify the checksum.
Same here, only seems to work with GCC on Linux.
I already did that. What do you think my array is for?
int *ptr;
ptr = new int[5000];
I guess I used a faster version of the Sieve of Eratosthenes.
Same here: the MinGW I have needs the std namespace. I started with the package that came with Dev-C++, then overwrote it with the MinGW from the CVS.
For some reason, my MinGW doesn't let me...
I didn't even know that function existed. It certainly looks cleaner than my way. =)
This info would be interesting to me, too.
My high school programming teacher said that when you declare variables, they contain whatever was left in them from the previous program. However, I'm...
Wait, so it's standard to use lowercase words?
I don't know what's going on, but GCC doesn't seem to need the std namespace. I got used to it (coding in Windows) a project member took it out, and...
Most probably. How else would you do it, though?
Comments don't stack
#IF 0's get lost all over your code (plus you can't keep track of what the code you're 0'ring out does, and whether you...
They aren't good practice in general, but there is one case in which they can be justified (I think):
Let's say you have a program that has multiple versions. You want to compare them, and don't...
It's closed. Sorry.
I have no clue what sieves are, so sorry about that too. =\
//////////
//Kevin Yin
//July 12, 2007
//Lists of primes
It's a competition to see who can generate the hugest list of primes in a given time period. It's gotten so bad that people are trying to optimize their programs just for the 20 second interval.
...
If you want to use system("clear") you must have #include <stdlib.h>.
Ints -> Rounding -> Zero.