```
Use 12345 as an example.
h = t = IntegerDigits[12345]
h[[1]] = t[[Length[t]]];
h[[Length[t]]] = t[[1]];
```

If you enter h you will output {5,2,3,4,1}

]]>Do you want the code to solve the above problem or do you just want to switch first and last of any number?

]]>Have any idea how I could switch a number's first and last digit in M?

]]>I had to make the assumption that the problem was incorrectly worded. What he really meant was the anna_g problem in this link:

http://www.mathisfunforum.com/viewtopic.php?id=18524

Because the problem as is worded does not have a solution that I can find.

I can find no solution to problem as worded for 2 digits to 30 digits. There probably is no solution.

]]>-first digit is even number

-last digit is odd number

Your number has 1 as the first digit (odd) and 2 as the last digit (even)]]>

Welcome to the forum. The number is 105263157894736842.

See this link here from post #4 onward:

]]>Today my friend asked me a question.I couldn't find answer and i am not sure that there is a correct one. But he says there is.

Question:

Find a number that if you swap first and last digit you will get two times bigger number (example: 2*abcdef=fbcdea)

Do you have any idea?

Hints:

-number is 18 digit

-first digit is even number

-last digit is odd number

-only one of digits is zero