Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Generating Large Relative Primes

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).
(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.

The code has been developed since 1991.


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?

I don't do C++ and I hate Java.

Agreed.

Agreed.

Agreed.

Every time I researched managing large numbers manually, I continually was referred back to the GMP library. It's fairly recent, too. Yes, it was first developed decades ago, but was most recently updated last year.

However, you are right that I should learn about managing such large numbers manually.

k.
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.

By the way, this all stemmed from a completely different project that I'm doing. For that project, I needed a simple LCG, and for that, I needed relative primes. I wrote this code in maybe 3 hours with Netflix in the background, but the point is that I'm not a programmer, so I'd like to know some rookie mistakes that I've undoubtedly made.

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..


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by absojediDec 27, 2020 02:43 PM 3 144 Dec 27, 2020 02:43 PM
Last Post: absojedi
[Java] by .eXeSep 16, 2020 03:39 AM 3 224 Sep 16, 2020 03:39 AM
Last Post: InterestingUser1111
[Java] by PDGLOBALJan 11, 2020 12:01 PM 2 232 Jan 11, 2020 12:01 PM
Last Post: PDGLOBAL