![]() ![]() ![]() Print using "time = #.# hour" (stop_time - start_time) / 3600 Print using "time = #.# min " (stop_time - start_time) / 60 Print using "time = #.# sec " (stop_time - start_time) ![]() P(count) = n ' add this prime to the list If ( n Mod p(i) ) = 0 Then Exit Do ' it was composite ' update the search limit only when needed, avoid use of Sqrt(n)įor i = 2 To root ' only odd numbers are tested Square = 4 ' p(root)^2, the value of n when search limit must be updatedįor n = 3 To &HffFFffFDuL Step 2 ' &HffFFffFDuL = 4294967293 ' the file size will be 203M280k221 * 4 bytes = 813,120,884 bytesĭim as string filename = "all_32bit_primes.dat"ĭim As Uinteger i, n, trial, limit, count, rootĭim Shared As Uinteger p( 1 To 203280221 )ĭim As Ulongint square, chunk = 1000000, report = chunk ' use ULL to avoid overflowĭim As Double stop_time, start_time = Timer ' the largest Uinteger prime is 4294967291 = &h0FFFFfffBu ' make a list of all 32 bit Uinteger primes ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |