sample code from Wednesday evening

Mike Slack mike at slacking.org
Fri Feb 22 04:28:18 CST 2002


~sdpm~
Yep, this one most definitely won't work by running a program.  I can post the complete solution if you want, but I don't want to spoil it for anyone.  There is an exact answer, which is in the vicinity of 10**(10**154), a Very Big Number(TM).

Mike

-- 
Mike Slack
mike at slacking.org
--
"If we knew what it was we were doing, it wouldn't
be called research, would it?" --Albert Einstein


Tkil (tkil-sdpm at scrye.com) wrote:
> #include <stdio.h>
> 
> int m(int i, int j, int k)
> {
>   static int count = 0;
>   int rv;
>   if      (i == 0)           { rv = k+1; }
>   else if (i == 1 && k == 0) { rv = j; }
>   else if (i == 2 && k == 0) { rv = 0; }
>   else if (k == 0)           { rv = 1; }
>   else                       { rv = m(i-1, j, m(i, j, k-1)); }
> 
>   ++count;
>   if ((count & 0xffff) == 0x0) 
>   {
>     fprintf(stderr, "%08x: m(%d,%d,%d)=%d\n",
> 	    count, i, j, k, rv);
>   }
>   
>   return rv;
> }
> 
> int main (int argc, char * argv [] )
> {
>   printf("m(4,4,4)=%d\n", m(4,4,4));
>   return 0;
> }
> -------------------------------------------------------------------------------
> 
> I ran it on my friend's box (1GHz Athlon) up to this iteration:
> 
>    11dc0000: m(1,4,23243)=23247
> 
> Since it's still not ending, I basically gave up on actually running
> it.  If I get some more free time, maybe it's solvable "by hand".
> 
> t.

~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list