# What does the right arrow mean in the example provided.

My second question here. Does it show that I know very little about mathematics? :)

I'm doing Project Euler Question 14 and would like to know what the right arrow → means in:

n → n/2 (n is even)
n → 3n + 1 (n is odd)


I gather from the phrasing of the question that it has to do with set theory.

Any links to primers on set theory that would help me to understand the question greatly appreciated.

Thanks.

-
It's assignment. Halve $n$ if it's even; multiply by three and add 1 if odd. Look up the Collatz conjecture. –  Ｊ. Ｍ. May 13 '12 at 6:56

This notation is used to define a function. Usually, one would write

$n\mapsto n/2$ if $n$ is even

$n\mapsto 3n+1$ if $n$ is odd

to defined a function (let's call it $f$) such that $f(n)=n/2$ if $n$ is even and $f(n)=3n+1$ if $n$ is odd.

P.S. - This particular function is sometimes called the Collatz function. You can read more about it on Wikipedia.

-
Thanks Alex! I'll get to reading :) –  gyaresu May 13 '12 at 7:01
Ahhhhhh. So if I start with 1 (which is odd) then 3*1+1=4. So then I take 4 which is even so 4/2=2. Then 2 is even so 2/2=1. "The conjecture is that no matter what number you start with, you will always eventually reach 1". Awesome. Thanks Alex & @j-m A huge help! –  gyaresu May 13 '12 at 7:06
@gyaresu Correct. Note that the conjecture is not known to be true right now. It has been verified by computer that no repeating sequence of length less than 6400 (IIRC) exists except for $1\mapsto 2\mapsto 4\mapsto 1\mapsto\cdots$. My laptop was only able to verify this up to sequences of length 24 before I ran into heap overflow though, so I doub't you'll be able to get near the best current results without significant computing power. –  Alex Becker May 13 '12 at 7:16