Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

## #1 2013-07-24 08:31:09

shahinpr
Novice

Offline

### swap last and first digit

Hi,
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

## #2 2013-07-24 11:07:34

bobbym

Online

### Re: swap last and first digit

Hi;

Welcome to the forum. The number is 105263157894736842.

See this link here from post #4 onward:

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

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #3 2013-09-07 04:37:26

Trenin
Novice

Offline

### Re: swap last and first digit

Doesn't this violate the rules:
-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)

Last edited by Trenin (2013-09-07 04:37:44)

## #4 2013-09-07 05:23:19

bobbym

Online

### Re: swap last and first digit

Hi;

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.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #5 2013-09-07 06:24:56

anonimnystefy
Real Member

Offline

### Re: swap last and first digit

Hi bobbym

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

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #6 2013-09-07 06:30:18

bobbym

Online

### Re: swap last and first digit

Yes, I do. I just wrote the subroutine for the 30th time. This time I will keep it.

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

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #7 2013-09-07 06:39:01

anonimnystefy
Real Member

Offline

### Re: swap last and first digit

Just the switching code.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #8 2013-09-07 06:43:50

bobbym

Online

### Re: swap last and first digit

#### Code:

```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}

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.