I could definitely optimize this in c without the usage of mpz_* to make it more clear for those that have never used mpz_* datatypes & functions such as myself (primitive types).
|
C
Generating Large Relative Primes |
(Sep 30, 2015 12:46 AM)Goodies Wrote: mpz_t is the data type used in GMP. In order to work with numbers potentially hundreds if not thousands of characters in length, I need to use mpz_t. And how do you think this works in memory? Hence primitive types. There's something called the big integer class in java; most similarly can be constructed in C using an integer array (Think of integer vectors in c++). You don't need to use mpz_*, although there is nothing wrong with it. But it's better to use primitive types and take your time to show your true understanding instead of using unnecessary libraries... otherwise this project is useless because anyone that wants to waste 10 minutes downloading a library in order to write 50 loc for finding prime numbers is just ridiculous, at least show some understanding barriers of memory and how to manage such large numbers... like seriously man ??? It's like releasing an ssl bot with boost library, anyone can fucking do it. Quote:According to the website the code can be used to calculate 1000000000 digits of pi in 1957 seconds on an AMD Phenom II @ 3.2 GHz. Jeez. Better algorithms have been developed since then, at least use something viable. 1 billion digits in 1957 seconds.... numberworld.org/y-cruncher/ do the math (Yes i notice it's different processors but compare the rates, download the program y cruncher and use it yourself for '1957' seconds for constant pi) it's not only performance that's the issue here.. (Sep 30, 2015 12:52 AM)Voxfames Wrote: Just ignore him he has over 228 accounts here. He is only here to troll Yeah, sorry if you didn't understand what i said. I only troll when it's not relevant to code you god damn shit box. (Sep 30, 2015 01:17 AM)Goodies Wrote: Relevance? Why should I re-invent the wheel starting from the bottom instead of using tools I have available to me?Ok you hate java, the big integer class was an example. You can rip it right from the jdk, it's not difficult to convert and understand. Relevance? Why should I re-invent the wheel starting from the bottom instead of using tools I have available to me? Re-invent what wheel exactly? a third party library capable of computing with shitty performance? Yeah.. you might want to fix that flat tire mate. (Sep 30, 2015 01:26 AM)Goodies Wrote: I'm not doing that. That seems like a huge waste of time. I'm sure there's plenty of documentation in C to guide me. If this is for engineering/math major, why aren't you using fortran? regardless, it doesn't matter considering you're not a programmer. Oh well, LCG isn't all that, once you get more into number theory you'll develop your own algorithms. Hopefully it all goes well.. |
|
|
