Not sure if you are confused by the code itself or my wording of it. By saying pos 0, 1 I didn't mean like a graph or anything, meant 0 and 1 are both not prime so their positions inside the bit array are set to false manually.
Not setting 0 manually will cause the first loops test to succeed when x = 0, turning the second loop into an infinite loop due to the stepping.
y += x will never properly step if x is 0 so it will never continue.
Not setting 1 manually will cause the full array to set to false. Instead of stepping the proper x * x + y which should multiply forward it steps every number because x = 1, so you land up with y = x * x, y += x, 1 * 1 + 1 = 2, 2 + 1 = 3, 3 + 1 etc. so it will end up stepping every number in the bitset.
(This is not including the theory that 0 is/isn't prime and/or is/isn't a number and all that fun jazz.)
oh my bad totally misread the code, my apologies. That's embarrassing >.< _________________
I didn't read into the other posts very much but remember that you only need to count up to the square root of the number to look for multiples. should save time.
didnt work. but counting up to the half of the number does.
You don't need to count up to half. Counting up to the ceiling of the square root will do.
mhmm _________________
Dark Byte wrote:
ce can certainly damage hardware let's say you have a robotarm attached to your computer, and the software limits usually block it from ripping out it's own cpu. If you remove that limit and then issue the command to rip out the cpu, sure, say goodbye to your hardware
All times are GMT - 6 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum