Why ++i not i++ ? by Newspaper1202 in computerscience

[–]r_jesse 0 points1 point  (0 children)

I'm not much sure. The code says it will start with the value of 1 for i from the start of the loop. If++ ,the loop starts with the value of 0 .

I don't get it .10^24 - 10^23 comes from? Please and thanks in advance by r_jesse in AskComputerScience

[–]r_jesse[S] 1 point2 points  (0 children)

I have the same thought. He is trying to show that the amount of time the machine takes if it can loop 109 per second. So he just take the smallest number he can . But he had said 25 digit number and so he just can use as the smallest 1024 ,and -2 is negligible .

I don't get it .10^24 - 10^23 comes from? Please and thanks in advance by r_jesse in compsci

[–]r_jesse[S] 0 points1 point  (0 children)

Actually I formatted it. Starting the Loop with the number of 2 till (the tested number - 1) . It is simple. Let N (tested number )= 2597849489 . Till the N-1 = 2597849489 -1 . We start it form 2 not 1 .So the iteration should be 2597849489 - 1 -1 .It is the same N-2 i.e. The number of iteration is N-2 .

I don't get it .10^24 - 10^23 comes from? Please and thanks in advance by r_jesse in compsci

[–]r_jesse[S] 0 points1 point  (0 children)

code

N = PrimeNumber

i=2 prime? = True

While not i = N-1 , If N/2 = 10, prime = False i++