Inspired by Project Euler

Define reverse ( n ) \text{reverse}(n) as a function which reverses the given integer. For example, reverse ( 23 ) = 32 \text{reverse}(23)=32 and reverse ( 405 ) = 504 \text{reverse}(405)=504 .

Now, some natural numbers n n have a property that n + reverse ( n ) n+\text{reverse}(n) always consists of odd digits. For example, 36 + reverse ( 36 ) = 36 + 63 = 99 36+\text{reverse}(36)=36+63=99 and 409 + reverse ( 409 ) = 409 + 904 = 1313 409+\text{reverse}(409)=409+904=1313 .

We call such numbers Reversible Numbers . Thus, 36 , 63 , 409 , 904 36,63,409,904 are Reversible Numbers.

Calculate the total number of Reversible numbers less than 1 0 11 10^{11} .

Details and Assumptions :

  • Leading zeroes are NOT allowed in n n or reverse ( n ) \text{reverse}(n) .

Here are My CS Problems


The answer is 41808720.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Pranjal Jain
Apr 5, 2015
  • For n = 2 k n=2k , there are 20 × 3 0 k 1 20\times 30^{k-1} n-digit Reversible numbers

  • For n = 4 k + 1 n=4k+1 , there are no \text{no} n-digit Reversible numbers

  • For n = 4 k + 3 n=4k+3 , there are 100 × 50 0 k 100\times 500^{k} Reversible numbers


Analysis

  • There are no 1-digit reversible numbers

  • In case of a two digit number ab \overline{\text{ab}} , a + b a+b must be odd and less than 10. There are 20 20 such numbers.

  • For abc \overline{\text{abc}} to be a three-digit solution, a + c a+c must be odd and greater than 10, 2 b 2b must be less than 10. Five choices for b, 20 choices for ac, 100 solutions.

  • For abcd \overline{\text{abcd}} to be a four-digit solution, a + d a+d must be odd and less than 10, neither a a nor d d can be zero, b + c b+c must be odd and less than 10. Twenty choices for a d ad , thirty for b c bc , 600 solutions.

  • There are no five-digit solutions.

  • For abcdef \overline{\text{abcdef}} to be a six-digit solution, a + f a+f , b + e b+e , c + d c+d must all be odd and less than 10. a a and f f cannot be zero. 20 choices for a f af , 30 for b e be , 30 for c d cd , 18000 solutions.

  • For abcdefg \overline{\text{abcdefg}} to be a seven digit solution, a + g a+g odd and greater than 10, b + f b+f even and greater than 10, c + e c+e odd and greater than 10, 2 d 2d less than 10. 5 choices for d d , 20 for c e ce , 25 for b f bf , 20 for a g ag , 50000 solutions.

  • Eight digit numbers will be same as 2 digit, 4 digit and 6 digit.

In general, the result given above, holds good.

Prove it:


For n = 2 k n=2k , there are 20 × 3 0 k 1 20\times 30^{k-1} n-digit Reversible numbers

For n = 4 k + 1 n=4k+1 , there are no \text{no} n-digit Reversible numbers

For n = 4 k + 3 n=4k+3 , there are 100 × 50 0 k 100\times 500^{k} Reversible numbers

Satyajit Mohanty - 5 years, 11 months ago

I used similar approach and took inspiration from this . :)

David Holcer - 6 years, 2 months ago

Log in to reply

well I go through this but what will happen when we take a+b>10? i.e 38 3+8=11 is odd then ?

Ashutosh Dash - 5 years, 7 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...