MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do I do very big integer computing by Mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115406] Re: How do I do very big integer computing by Mathematica?
  • From: Dana DeLouis <dana01 at me.com>
  • Date: Mon, 10 Jan 2011 02:38:25 -0500 (EST)

On Jan 9, 2:19 am, a boy <avv... at gmail.com> wrote:
> I asked how to do  very-big-integer computing. For example:
> Mod[2^2^64,1342352]
> It's pity, this code causes overflow!
> is there some funtions like this: StringMod["111...111","345=94]

Hi.  If I understand correctly, you're looking for the PowerMod 
Function.

Double Check Power is Right to Left

FullForm[a^b^c]
Power[a,Power[b,c]]

2^3^4 == 2^(3^4)
True

Mod[2^2^64, 1342352]
General::ovfl:Overflow occurred in computation. >>
Overflow[]

PowerMod[2, 2^64, 1342352]
963840


On your above =93String Version=94, here's a general idea.
Let's assume n is a large number.
n=123456789;

Break the number (or string) into 2 or more parts.  ie.
{12345, 6789};

Do the first Mod:
Mod[12345,345]
270

Append the results to the next number:
Mod[2706789,345]
264

The results check using the original =93Large=94 number:

Mod[n,345]
264

= = = = = = =
Hope this Helps!
Dana DeLouis
Mathematica 8 on Mac Pro


  • Prev by Date: Re: Clip[] doesn't work as expected
  • Next by Date: Re: How do I do very big integer computing by Mathematica?
  • Previous by thread: Re: How do I do very big integer computing by Mathematica?
  • Next by thread: Re: How do I do very big integer computing by Mathematica?