## 1 Billion digit prime

For other topics related to the FreeBASIC project or its community.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

I suspect your result is it is correct. I can't wait when I have time to check out your code.
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

### Re: 1 Billion digit prime

As of January 2014, the largest known prime number is 257,885,161 − 1,[1] a number with 17,425,170 digits.
http://en.wikipedia.org/wiki/Largest_known_prime_number
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

### Re: 1 Billion digit prime

There is the possibility that the result is incorrect but I have tested the method with smaller numbers that GMP/MPIR could multiply. The result where equal therefore the method used should give a correct answer.

But only a straight forward multiply will give a answer on the question of result is this method is correct.
My next computer will definitely have more memory so I can calculate this sort of things directly.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

Hi frisian, I'm home now and anxious to test your code. If possible can you help walk me through the install of MPIR. Please feel free to communicate with me via this forum, email or phone. My email is opreese@gmail.com and cell# is 407-655-8537. Thanks Owen P. Reese.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

Actually, I extend my invite to communicate with me to all freebasic programmers via my cell# as I prefer voice comms since I drive a truck for a living and am unable to text and drive.
srvaldez
Posts: 2550
Joined: Sep 25, 2005 21:54

### Re: 1 Billion digit prime

I am not sure that MPIR is any faster than GMP anymore, the latest release of GMP has improved quite a bit.
srvaldez
Posts: 2550
Joined: Sep 25, 2005 21:54

### Re: 1 Billion digit prime

just tested mpir versus gmp and gmp is just a bit faster, so I suggest using gmp.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

@ srvaldez
wasn't just about speed. gmp memory limits was what i was having problemes with last year.
srvaldez
Posts: 2550
Joined: Sep 25, 2005 21:54

### Re: 1 Billion digit prime

hello owen
can you give an example which caused gmp to fail? perhaps the latest release has fixed the problem.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

sure, try using gmp to calculate xxx factorial till the product is apx 1 billion decimal digits.
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

### Re: 1 Billion digit prime

Were you testing with a 32-bit version of gmp or 64-bit? There is an apparently broken link to a 64-bit version in the reply here:

So it looks like a 64-bit version has been available for 4+ years.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

I was Using a 32 bit. Now I remember it wasn't gmp.
Winxp memory cap limited gmp.
owen
Posts: 554
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

### Re: 1 Billion digit prime

I don't know how to do this stuff anymore. For example my original program uses gmp.bi which is part of FB's install package and in order to get it to work I needed a DLL file (libgmp-3.dll)
frisian uses mpir.bi but I have no clue how to build it and or if it requires a DLL file.
srvaldez suggests using a newer version of gmp but I have no idea how to use the newer versions.
srvaldez
Posts: 2550
Joined: Sep 25, 2005 21:54

### Re: 1 Billion digit prime

hello owen
what I do is copy the bi files to the FreeBasic inc folder and copy the *.dll.a files to the FreeBasic lib\win32 folder and the dll's I copy to the windows\system32 folder if your OS is Windows 32-bit, if your OS is Windows 64-bit then the 32-bit dll's go into syswow64 and the 64-bit dll's go into system32, that's counterintuitive I know but that's the way it is.
here's an example by MichaelW viewtopic.php?f=7&t=20144&hilit=brent
Last edited by srvaldez on Apr 17, 2014 13:33, edited 2 times in total.
srvaldez
Posts: 2550
Joined: Sep 25, 2005 21:54

### Re: 1 Billion digit prime

hello owen
I went ahead and compiled your mymultgmp using FB 0.91_x64 as provided by MOD and run yor program, the computation took less than 20 minutes.
but the result is too big for me to upload to media fire.
Last edited by srvaldez on Apr 16, 2014 12:23, edited 1 time in total.