 ## Question

|

Help Rudy! Anyone can contribute an answer, even non-tutors.

##### Rudy

chevron_right chevron_right chevron_right

Write any number of seven digits. Write another number by reversing the digits. Find which of the two numbers is smaller.

Date Posted: 10 months ago
Views: 115
Eric Nicholas K
10 months ago
Pick any seven digits. It can be repeated since they do not have any restrictions.

Any seven digit number (except numbers starting with 0) has these:

Digit in the millions place
Digit in the hundred thousands place
Digit in the ten thousands place
Digit in the thousands place
Digit in the hundreds place
Digit in the tens place
Digit in the ones place

For example, 1234567 has '1' in the millions place, '2' in the hundred thousands place, '3' in the ten thousands place and so on.

So now we can pick an array of numbers then then reverse it. To see which number is smaller, this is what we do.

1. Compare the digit in the millions place. The number with a smaller millions place digit is the smaller number.

2. If the digit in the millions place is the same, then we move on to the hundred thousands place and make a simiar comparison.

The process repeats until the ones place (actually, the we can just do until the thousands place in this case).

If the reverse number is identical, then there is no 'smaller' number.

So in the case of 1234567 and its reverse 7654321, we compare the digits in the millions place first. Clearly '1' loses outright to '7', so 1234567 is the smaller number.

For the case of 1234561 and 1654321, we see that both the millions place contain '1', but in the hundred thousands place, '2' loses to '6', so 1234561 is the smaller number.

For the case of 1234321, its reverse is also 1234321, so both numbers are equal.

Hope this helps.