POV-Ray : Newsgroups : povray.off-topic : Small math/programming problem : Re: Small math/programming problem Server Time
18 May 2024 14:28:55 EDT (-0400)
  Re: Small math/programming problem  
From: Kevin Wampler
Date: 30 Jun 2010 20:40:00
Message: <4c2be3e0$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.