Thursday, April 15, 2010

I.Am.Nerd.

So I was browsing Xkcd and I stumbled upon one cartoon that I thought was pretty interesting.  Being a nerd, I instantly hit up the search function on Wikipedia to see just what the cartoon was all about.  Why will my friends stop calling me to hang out?  Being a scientist, it's in my very nature to instantly want to do an experiment.

The conjecture states: Take any natural number n. If n is even, divide it by 2 to get n / 2, if n is odd multiply it by 3 and add 1 to obtain 3n + 1. Repeat the process indefinitely. No matter what number you start with, you will always eventually reach 1.

I decided to start out simple.  For my first experiment, I chose the number 11.

n = 11.  Step 1: (11x3) + 1 = 34.  Step 2: 34/2 = 17.  Step 3: (17x3) + 1 = 52.  Step 4: 52/2 = 26.  Step 5: 26/2 = 13.  Step 6: (13x3) + 1 = 40.  Step 7: 40/2 = 20.  Step 8:  20/2 = 10.  Step 9: 10/2 = 5.  Step 10: (5x3) + 1 = 16.  Step 11: 16/2 = 8.  Step 12: 8/2 = 4.  Step 13: 4/2 = 2.  Step 14: 2/2 = 1

Experiment 1 - Successful in 14 steps.

For my second experiment, I chose to use a bigger number: 256.

n = 256.  Step 1:  256/2 = 128.  Step 2:  128/2 = 64.  Step 3: 64/2 = 32.  Step 4: 32/2 = 16.  Step 5: 16/2 = 8.  Step 6:  8/2 = 4.  Step 7: 4/2 = 2.  Step 8: 2/2 = 1.

Experiment 2 - Successful in 8 steps.

Holy crap, I'm on a roll!  And there's a correlation between a larger n and fewer steps to get to 1.  One more experiment and I'll be able to publish my results!

For my third experiment, I decided to choose an even bigger number (they always say: go big or go home!). This time I chose: 123,456,789.

n = 123,456,789.  Step 1: (123,456,789x3) + 1 = 370,370,368.  Step 2: 370,370,368/2 = 185,185,184.  Step 3: 185,185,184/2 = 92,592,592.  Step 4: 92,592,592/2 = 46,296,296.  Step 5: 46,296,296/2 = 23,148,148.  Step 6: 23,148,148/2 = 11,574,074.  Step 7: 11,574,074/2 = 5,787,037.  Step 8: (5,787,037x3) + 1 = 17,361,112.  SHIT.  **Fast Forward**  Step 63: (16,313x3) + 1 = 48,940.   **Fast Forward**   Step 102: (395x3) + 1 = 1,186.  **Fast Forward**  Step 143: (3,077x3) + 1 = 9,232.  **Fast Forward**  Step 177: 2/2 = 1.

Experiment 3 - Successful in 177 steps.

Experimental conclusions:  1) Conjecture stands true...so far. 2) Correlation does not equal causation! 3) I.Am.Nerd.

1 comment:

J said...

So am I nerdier for wondering how you calculated the last one? (What Excel formulas?) Surely you didn't manually go through all 177 steps?