0

I want to mod out a number that's about 1.7x10^46 by several primes. Things did not look right so I tried hard coding the number mod 3 and 5. It is not giving me the correct answers. Mathematica says they should be 1 and 1, and yet I get 2 and 2.

Can someone please tell me what is going on?

It is my first time working with extremely large numbers, I am aware of the limitations of data types and their ranges, but this is hardcoded there is nothing stored in a variable.

  • The numbers (even if not in a variable) need to be stored as some representation. Try using a library that deals with big numbers. – Ed Heal Dec 04 '14 at 04:25
  • 2
    What bignum library are you using? (hope springs eternal) – Yakk - Adam Nevraumont Dec 04 '14 at 04:25
  • I am not using a a bignum library. I looked into one two days ago and it was not longer maintained so I decided not to get it. If you can direct me to one that is well mantained and reliable I would appreciate it. – ReverseFlowControl Dec 04 '14 at 04:27
  • Numeric literals have types (and the same range limits as variables of the same type). For Bignums, I usually recommend Victor Shoup's [NTL](http://www.shoup.net/ntl/) library. – Jerry Coffin Dec 04 '14 at 04:27
  • Thank you guys. I think I got it now. I did not know about the literals and the representation storage. I will get a bignum library, any suggestions are welcomed. I will look into Yakk's suggestion. – ReverseFlowControl Dec 04 '14 at 04:29
  • @JerryCoffin: how do you install it in windows? I ma having trouble. – ReverseFlowControl Dec 04 '14 at 05:45
  • If memory serves, I've usually just added the path to its headers to the paths in the `INCLUDE` environment variable, compiled all the files in the `src` directory, and put them together into a `.lib` file. – Jerry Coffin Dec 04 '14 at 05:51

1 Answers1

2

Some time ago i used GMP library, maybe it will help you too. https://gmplib.org/

This should be a comment but can`t make one yet.

MarcinG
  • 840
  • 6
  • 21
  • I will mark this as the answer as I read GMP is comparable, or better, than NTL for calculations. I decided for NTL as I am doing number theory. Thanks. – ReverseFlowControl Dec 07 '14 at 14:23