Computer Science Canada

A million dollar question

Author:  bugzpodder [ Thu May 06, 2004 7:35 am ]
Post subject:  A million dollar question

similar to the halting problem
will this function terminate for all values of n (prove it)? if not, find a value of n such that it doesnt. (if you do, somebody will give you $1,000,000)

int f(int n){
if (n==1) return 1;
else if (n%2==0) return f(n/2);
else return f(3*n+1);
}

function f(n:int):int
if n=1 then
result 1
elsif n mod 2=0 then
result f(n/2);
else
result f(3*n+1);
end if
end f

Author:  Martin [ Thu May 06, 2004 11:31 am ]
Post subject: 

negative values of n won't terminate.

pwn3d.

Author:  bugzpodder [ Thu May 06, 2004 1:43 pm ]
Post subject: 

good, get your million dollar at:

www.I-want-to-get-a-million-dollar-so-give-it-to-me.com

Author:  Mazer [ Thu May 06, 2004 7:28 pm ]
Post subject: 

Bugz, I think you mispelled the URL or something, the link didn't work for me. Crying or Very sad

Author:  Martin [ Thu May 06, 2004 7:32 pm ]
Post subject: 

Mazer you rock.

Author:  Mazer [ Thu May 06, 2004 7:37 pm ]
Post subject: 

Wha? Why do I rock? Darkness, did the link work for you? I sure could use the million dollars... I broke my original CDs and I need to buy myself a new copy of Linux.

Author:  bugzpodder [ Thu May 06, 2004 7:57 pm ]
Post subject: 

sorry, darkness is the only one eligible for the million dollars. ask him to split the money. btw it is not a link. it is a certificate (use print screen to get it and goto paint and paste it and print it) and you can redeem it at your local bank.

Author:  Mazer [ Thu May 06, 2004 8:00 pm ]
Post subject: 

So if I get to the bank with the certificate before Darkn--

Author:  Martin [ Thu May 06, 2004 9:34 pm ]
Post subject: 

zero doesn't work either Wink Come on mazer, you just missed the boat.

Author:  PaddyLong [ Fri May 07, 2004 9:13 am ]
Post subject: 

the boat to the bank? or what boat are we talkin here?


: