PrimeGrid
Please visit donation page to help the project cover running costs for this month
1) Message boards : General discussion : List of prime numbers (Message 120736)
Posted 761 days ago by A_H_O_H
Consecutive List Of Primes, 1.02 (Windows 64-bit) Copyright 2018, Alexander Belogourov aka x3mEn


Consecutive List Of Primes, 1.02 (Windows 64-bit) Copyright 2018, Alexander Belogourov aka x3mEn


What is this?

I said "Ok, the challenge accepted" and yesterday had wrote the application (to be honest, not from the scratch).

Where is this?

I published the project in Github here.

You can use it at your own risk, but remember, the code is not verified so may contain mistakes.


Nice program, fast generation.
Here is modified .c and compiled .exe
You can see changes.txt, comments in the source code,
and do with this code what do you want.
Maybe this can be optimized to working faster,
but this works fine for me (win32 version).

I think about generating many archives with half prime gaps, and then store and hashing this.
Maybe all primes from 0 to 30 Trillions can be saved in the space ~30 x 3500 x 7MBytes,
because prime gap between primes is even number, not big (sometimes)
and this can be saved as one byte, if this will be divided by 2.
In this case each part with 10M primes have only ~10 MBytes and ~6.4Mbytes if this 7z packed.
In trillion range of natural numbers there is ~35 billions primes ~3500 archives. So 1 TB can store all primes up to 30 trillions.

Also can be writted converter between some formats, as the function, inside the program.

Best regards, and have a nice day.
2) Message boards : General discussion : List of prime numbers (Message 120327)
Posted 781 days ago by A_H_O_H
So, the best way now, to generate the txt-parts, like there is on http://primos.mat.br
is this way:

1. Download PARI/GP (Pari64-2-11-0.exe)
2. Install this.
3. Run gp.exe with administrator permissions.
4. Switch keyboard layout to english (EN)
5. paste this code there (one string!):
folder="C:\\Pari64-2-11-0\\data";blockname="2T-3T";part=424;n=0;s="";forprime(p=2119935706183,3000000000000,n++;s=Str(s,p,if(n % 10 != 0,"\t","\n"));if(n % 10^3 == 0, write1(Str(folder,"\\",blockname,"_part",part,".txt"),s);s="");if(n%10000000==0, part++));

6.
In this string need to set two parameters - number of the part and first prime p.
Fist prime can be calulated fastly, because PrimePi(2T) = 73,301,896,139, and +10 millions primes in each part.
So (73,301,896,139+1) + (424-1)*10,000,000 = 73,301,896,140 + 4,230,000,000 = 77531896140 - and this is first prime N for the part 424.
Then, can be available N-th prime here: https://primes.utm.edu/nthprime/index.php?n=77531896140
and this have the value 2,119,935,706,183 (2119935706183).
So this prime number, as result can be used as start prime p for any another part.

As result from start part can be generated many parts.
Each part contains 10M primes,
10 primes in row through '\t' delimiter (0x09),
and 1 million string in each part, through delimiter '\n' (0x0d, 0x0a).


To fast pack many parts in txt format -> to archive, using 7z, can be used a bat-file, with code:
for %%X in ("full_patheway_for_folder_with_txt_parts\*.txt") do "full_pathway_to_7z_folder\7z.exe" a "%%~nX.7z" "%%X"

In this case will be generated many 7z archives near all txt-parts.

After all this work can be paralleled, using many computers and processors,
with comparation of the hashes for the parts.

Pari/GP return me the parts with equal SHA512 hashes (this was been compared with parts generated by my python scrypt),
but PARI/GP generate parts faster. This is not GPU program and using CPU.
__________________________________________________________________________
After all, I want to ask next...
Guys, is there any ways to effective compress prime numbers, without less data?
I think about using Prime gap's + Huffman coding
but if need to search n-th prime, in this case need to sum all previous gaps in the part,
and maybe in all previous parts...
So was been decided to leave prime numbers as packed lists with readable text,
without optimize this to search N-th prime...
3) Message boards : General discussion : List of prime numbers (Message 120318)
Posted 781 days ago by A_H_O_H
try
primesieve 10e6 -p | sed -r 's/\, |\[|\]/\n/g' | tail -n +2 | head -n -1 > primes.txt


Incorrect sed.
4) Message boards : General discussion : List of prime numbers (Message 120313)
Posted 781 days ago by A_H_O_H
I did try -help too, and don't see any delimiters to specify there.
I can rebuild txt files, using python, but this program using CPU calculations.
5) Message boards : General discussion : List of prime numbers (Message 120310)
Posted 781 days ago by A_H_O_H
[quote]
A_H_O_H wrote:

primesieve 10e6 -p > primes.txt

Any delimiters can be specified?
6) Message boards : General discussion : List of prime numbers (Message 120301)
Posted 782 days ago by A_H_O_H
Also, I don't see GPU power loading, when this working...

This is not a GPU app. It will not use the GPU.

Ok, but there is multiprocessing and multithreading.
So this PARI/GP prime generator really working faster.


10 prime numbers in row through TAB, then new string...
Is this possible by using PARI/GP??

You can write programs in PARI/GP. Here is a primitive program:
n=0;s="";forprime(p=10^6,10^7,n++;s=Str(s,p,if(n % 10 != 0,"\t","\n"));if(n % 10^3 == 0, write1("myFile.txt",s);s=""));write("myFile.txt",s)


Nice! Thanks! Your idea to write each 1000 primes using write1 function is very good.
I don't see stack overflows errors in this case,
and no need to using allocatemem(2^30), default(parisizemax, 6G) and default(primelimit, 400M)

So I did write this:
folder="C:\\Python Portable\\PariGPprimes";blockname="2T-3T";part=1;n=0;s="";forprime(p=2000000000000,3000000000000,n++;s=Str(s,p,if(n % 10 != 0,"\t","\n"));if(n % 10^3 == 0, write1(Str(folder,"\\",blockname,"_part",part,".txt"),s);s="");if(n%10000000==0, part++));

and this 7z.bat to zip all txt-files:
for %%X in ("C:\Python Portable\PariGPprimes\*.txt") do "C:\Program Files\7-Zip\7z.exe" a "%%~nX.7z" "%%X"

I have still runned Miller-Rabin generator on python too, and I'll see that's working slowly...
So I'll unpack all txt parts - after compare hashes, using portable MultiHasher 2.9.
[/quote]

Your issues with parisizemax I do not understand.
The intended meaning is that if parisizemax is e.g. 6000000000, then PARI will increase its own stack "on the fly",
when needed, writing "Warning: increasing stack size to ..." in red, but going on with its tasks.
Only if a size over 6 billion (in this example) is needed, will an error be issued.

Ok, just I saw stack overflows errors
when allocatemem(2^30) was not been inserted before commands:
default(parisizemax, 6G) and default(primelimit, 400M)
but program really continued working and successfully finished.
And even there was been an errors, I got full file, using command:
write("myPrimeList.txt", primes([2000000000000,2000040000000]))

A_H_O_H, have you seen this ?
https://primesieve.org/

Yea, I saw, this is compact program without GPU supporting, and this working fastly...
But... I don't see there an option, to write primes in the file directly, or partial,
like here, using PARI/GP (each 1000 primes)...

I did try to generate 10M primes there, and I see need to wait this.
Maybe all primes go to RAM and contains here before finishing generate process. :D
7) Message boards : General discussion : List of prime numbers (Message 120296)
Posted 782 days ago by A_H_O_H
Hm... I cann't write allocatemem(2^30) in gprc.txt
so I using next way to fix errors...

This way is a four consecutive commands:
gp > allocatemem(2^30)
*** Warning: new stack size = 1073741824 (1024.000 Mbytes).
gp > default(parisizemax, 6G)
*** Warning: new maximum stack size = 6000000000 (5722.046 Mbytes).
gp > default(primelimit, 400M)
gp > write("myPrimeList.txt", primes([2000000000000,2000040000000]))
gp >


And no any errors then...
Each 10 million of prime numbers, in range [2 trillions - 3 trillions]
are contains in range between 300M natural numbers,
so 400 millions can be can be enough for finding this all...

But... What about separators in PARI/GP?? '\t' and '\r\n' need to using in txt file...
8) Message boards : General discussion : List of prime numbers (Message 120295)
Posted 782 days ago by A_H_O_H
repeating myself, if you want 10 million primes in a file,
with PARI/GP
you just type
write("myPrimeList.txt", primes(10^7))
/JeppeSN


write("myPrimeList.txt", primes(10^7))

But I see the error:
*** at top-level: write("myPrimeList.txt",primes(10^7))
*** ^-------------
*** primes: the PARI stack overflows !
current stack size: 8000000 (7.629 Mbytes)
[hint] set 'parisizemax' to a non-zero value in your GPRC

write("myPrimeList.txt", primes(10^6))

Tell me this error too.
write("myPrimeList.txt", primes(10^5))

write("myPrimeList.txt", primes([10000000000,10000010000]))
All was been writed successfully... But small range...
write("myPrimeList.txt", primes([2000000000000,2000001000000]))

ERROR.
write("myPrimeList.txt", primes([2000000000000,2000000900000]))

success, but small range...
No one from this examples not tell me consecutive 10M primes...
And I'm not sure what the calculations is made on the GPU...


I did solve the problem with stack overflows by using command:
allocatemem(2^28)
*** allocatemem: Warning: new stack size = 268435456 (256.000 Mbytes).

Then, available the command:
write("myPrimeList.txt", primes([2000000000000,2000030000000]))

Without any errors...

But, inside the file, there is a prime numbers in one row.
Can I specify delimiters for rows,
delimiter between prime numbers in the row,
and number of primes in one row??

Also, I don't see GPU power loading, when this working...



default(parisizemax, 6G)

C:\Program Files (x86)\Pari64-2-11-0\gprc.txt

parisizemax = 6G primelimit = 100M


This not working without
allocatemem(2^28)...


write("myPrimeList.txt", primes([2000000000000,2000030000000]))

*** primes: Warning: increasing stack size to 16000000.
*** primes: Warning: increasing stack size to 32000000.
*** primes: Warning: increasing stack size to 64000000.
*** primes: Warning: increasing stack size to 128000000.
*** primes: Warning: increasing stack size to 256000000.
*** primes: Warning: increasing stack size to 512000000.


And after run
allocatemem(2^28)...

I see the same errors, but file is generating...

Also, I want to using sapararors, like there is in this file
10 prime numbers in row through TAB, then new string...
Is this possible by using PARI/GP??
9) Message boards : General discussion : List of prime numbers (Message 120291)
Posted 782 days ago by A_H_O_H
I published the project in Github here.

I see there is only .c and .cbp file... Do you have compiled portable exe? Can you publish this in releases, as a zip archive?

You can use it at your own risk, but remember, the code is not verified so may contain mistakes.

Not problem, I can re-check results from this generator again...
But if this program not have multithreading, multiprocessing
or if code not vectorized to supporting parallel GPU calculations,
so no make any sense to compile and use this,
because my published python-Miller-rabin generator
working not a slowly even on 1 CPU core...
10) Message boards : General discussion : List of prime numbers (Message 120289)
Posted 783 days ago by A_H_O_H
Consecutive List Of Primes, 1.02 (Windows 64-bit) Copyright 2018, Alexander Belogourov aka x3mEn Command line parameters : 1 22801763489 -p -f 1000000 Number range borders : from 3 to 22801763489 step 2 Total amount of Numbers : 11400881744 Factoring Block Size : 1000000 Starting date timestamp : 03.09.2018 12:25:03 Elapsed time : 00:04:53.125 Total amount of Primes : 1000000000

What is this? Where is this?

As I said, I have consecutive prime numbers, up to 2 trillions of natural numbers.
This is containing 73,301,896,139 prime numbers total, and last prime number is 1,999,999,999,981.
If you want we can compare your primes... But... Tell the link at your lists!

With the danger of repeating myself, if you want 10 million primes in a file, with PARI/GP you just type
write("myPrimeList.txt", primes(10^7))
/JeppeSN

Hehheh... I never not used this program and don't read the documentation...
But... I did download the installer and try this:
write("myPrimeList.txt", primes(10^7))

But I see the error:
*** at top-level: write("myPrimeList.txt",primes(10^7))
*** ^-------------
*** primes: the PARI stack overflows !
current stack size: 8000000 (7.629 Mbytes)
[hint] set 'parisizemax' to a non-zero value in your GPRC

write("myPrimeList.txt", primes(10^6))

Tell me this error too.
write("myPrimeList.txt", primes(10^5))

write("myPrimeList.txt", primes([10000000000,10000010000]))[/quote]
All was been writed successfully... But small range...
write("myPrimeList.txt", primes([2000000000000,2000001000000]))

ERROR.
write("myPrimeList.txt", primes([2000000000000,2000000900000]))

success, but small range...
No one from this examples not tell me consecutive 10M primes...
And I'm not sure what the calculations is made on the GPU...

I'm still confident that the better way to generate consecutive prime numbers - there would be
a compact and portable CUDA-compatible program (like PrimeGen.exe),
with a vectorized and paralleled, this small Miller-Rabin algorithm.


Also, I published the good commented python code of Miller-Rabin generator - here.
This working only on 1 CPU core... No multiprocessing, multithreading, vectorization and parallelizm... =(

Using this code, anyone can make calculation any part of "2T-3T", and upload this on my server.
There is available FOLDER_FOR_UPLOADS in the root directory of the server.
You can drop there a torrent-file, for example.


Next 10 posts
[Return to PrimeGrid main page]
DNS Powered by DNSEXIT.COM
Copyright © 2005 - 2020 Rytis Slatkevičius (contact) and PrimeGrid community. Server load 1.05, 0.78, 0.90
Generated 25 Oct 2020 | 12:19:10 UTC