1
$\begingroup$

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.

  • 2
    It's assignment. Halve $n$ if it's even; multiply by three and add 1 if odd. Look up the Collatz conjecture.2012-05-13

1 Answers 1

5

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.

  • 0
    @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.2012-05-13