I just spotted a typo: The code should obviously read:
n = 2
for(a = n; a > 0; a--)
for(b = n; b > 0; b--)
for(c = n; c > 0; c--)
for(d = n; d > 0; d--)
n++;
print n
Since the version I gave didn't terminate!
Kevin Wampler wrote:
> I was going through some old stuff on my hard drive, and I came across a
> small code snippet which led to a cute little problem:
>
> I have a number which is defined with the following bit of pseudocode,
> with all variables representing ideal mathematical integers:
>
> n = 2
> for(a = n; a > 0; a--)
> for(b = n; b > 0; b--)
> for(c = n; c > 0; c--)
> for(d = n; n > 0; d--)
> n++;
> print n
>
> What are the last 10 digits of the result printed by this program?
Post a reply to this message
|