What does the right arrow mean in the example provided.

17.9k Views Asked by At

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.

1

There are 1 best solutions below

3
On BEST ANSWER

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.