Re: How to write a loop

• To: mathgroup at smc.vnet.net
• Subject: [mg2547] Re: How to write a loop
• From: David Pearson <sgspedav at reading.ac.uk>
• Date: Mon, 20 Nov 1995 01:12:58 -0500
• Organization: University of Reading, U.K.

```Hi, y'all.

Mathematica can handle 245^500, no problem (at least it can on
the machine I use).

In[1]:= 245^500

Out[1]=
38286192822286048485411336 etc., I deleted the rest because it takes
up 18 lines.

It took less than a second to calculate it.

But if you want to make a loop anyway, do this:

In[5]:= x=1

Out[5]= 1

In[6]:= Do[x = x * 245, {i, 1, 500}]

This seems a little bit slower, but still less than a second.

Regards,
David Pearson,
England.

On 17 Nov 1995, Enrico C. Walker wrote:

>  I need to raise a number to some large exponent - i.e. 245 ^ 500.
> I know that I may run into a problem by plugging it directly. so I'd like to find the result
> by using some sort of programming loop such.
>
>      DO 250 times
>          begin
>
>               x = x * 245 ^ 2
>
>          end
>      PRINT X
>