Re: How to write a loop

• To: mathgroup at smc.vnet.net
• Subject: [mg2550] Re: How to write a loop
• From: drc at gate.net (David Cabana)
• Date: Mon, 20 Nov 1995 01:13:30 -0500
• Organization: CyberGate

```In article <48h4dh\$rd5 at ralph.vnet.net>, "Enrico C. Walker"
<ewalke1 at gl.umbc.edu> 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
>
>
>-RICO-

Yes, you can, but why?  Mma easily handles 245^500.  I am curious, how
would looping help in the event that Mma could not handle 245^500?  In any
case, here is a translation of your code:

x=1;
Do[
x = x * 245^2,
{250}
];
x

This gives x the value 245^500.

--
David Cabana    drc at gate.net

"If five years from now we [the FBI] solve the access problem, but what we're hearing is all encrypted, I'll probably, if I'm still here, be talking about that in a very different way: the objective is the same.  The objective is for us to get those conversations whether they're by an alligator clip or ones and zeros.  Whoever they are, whatever they are, I need them."
- FBI Director Louis Freeh, clarifying statements that the FBI may seek legislation to ban strong encryption, in an Sept. 1994 Q&A session, from a WELL article by Steven Levy.

"Only in a police state is the job of a policeman easy."
- Orson Welles

```

• Prev by Date: Re: Logic Problems
• Next by Date: Rotating animations
• Previous by thread: Re: How to write a loop
• Next by thread: Re: How to write a loop