A seemingly strange function may be quite simple instead

Algebra Level 5

S ( n ) = n 1 0 lg n + 10 ( n 1 0 lg n n 1 0 lg n ) \large S(n) = \left \lfloor \frac n{10^{\lfloor \lg n\rfloor}}\right \rfloor + 10\left(n - 10^{\lfloor \lg n\rfloor} \left \lfloor \frac n{10^{\lfloor \lg n\rfloor}}\right \rfloor \right)

Let S ( n ) S(n) be defined as above for all positive integers n n . Find the number of n 5000 n \le 5000 such that S ( S ( n ) ) = n S(S(n)) = n .

Notations:

  • \lfloor \cdot \rfloor denotes the floor function .
  • lg ( ) = log 10 ( ) \lg (\cdot) = \log_{10} (\cdot) denotes the logarithm to the base 10.


The answer is 135.

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

Haosen Chen
Mar 10, 2018

1. Suppose n = x k x 1 x 0 \displaystyle\large n=\overline{x_{k}\cdots x_{1}x_{0}} ,here x i { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } x_{i}\in \{1,2,3,4,5,6,7,8,9\} for i = 0 , 1 , , k i=0,1,\cdots,k .

Then 1 0 k < n < 1 0 k + 1 \displaystyle\large 10^{k}<n<10^{k+1} ,which implies k < l g n < k + 1 \displaystyle\large k<lgn<k+1 .Thus l g n = k \displaystyle\large \lfloor lgn \rfloor = k .

Now easy to see n 1 0 l g n = x k \displaystyle\large \Big\lfloor\frac{n}{10^{\lfloor lgn \rfloor}}\Big\rfloor =x_{k} .

So S ( n ) = x k + 10 ( x k x 1 x 0 x k 0 00 k 1 ) = x k 1 x 1 x 0 x k \displaystyle\large S(n)=x_{k}+10\big(\overline{x_{k}\cdots x_{1}x_{0}}-\overline{x_{k}\underbrace{0\cdots 00}_{k-1}}\big)=\overline{x_{k-1}\cdots x_{1}x_{0}x_{k}} ,

and S ( S ( n ) ) = x k 2 x 1 x 0 x k 1 x k \displaystyle\large S(S(n))=\overline{x_{k-2}\cdots x_{1}x_{0}x_{k-1}x_{k}} .

2. Apply the result above. If n has the digit 0 0 , then n cannot equal to S ( S ( n ) ) S(S(n)) . (You can check it in Sir. Mark Hennings's comment below.)

In the following statement, a , b , c , d a,b,c,d are positive integers less than 10, A |A| stands for the number of elements in set A A .

S ( S ( a ) ) = a S(S(\overline{a}))=\overline{a} \longrightarrow A 1 = A_{1}= { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } \{1,2,3,4,5,6,7,8,9\} , A 1 = 9 |A_{1}|=9

S ( S ( a b ) ) = a b S(S(\overline{ab}))=\overline{ab} \longrightarrow A 2 = A_{2}= { 11 , 12 , , 19 ; 21 , 22 , , 29 ; ; 91 , 92 , , 99 } \{11,12,\cdots ,19; 21,22,\cdots ,29; \cdots ;91,92,\cdots ,99\} , A 2 = 81 |A_{2}|=81

S ( S ( a b c ) ) = c a b S(S(\overline{abc}))=\overline{cab} \longrightarrow A 3 = A_{3}= { 111 , 222 , , 999 } \{111,222,\cdots ,999\} , A 3 = 9 |A_{3}|=9

S ( S ( a b c d ) ) = c d a b S(S(\overline{abcd}))=\overline{cdab} \longrightarrow A 4 = A_{4}= { 1111 , 1212 , 1313 , , 1919 ; 2121 , 2222 , 2323 , , 2929 ; ; 4141 , 4242 , , 4949 } \{1111,1212,1313,\cdots ,1919; 2121,2222,2323,\cdots ,2929; \cdots ; 4141,4242,\cdots ,4949\} , A 4 = 36 |A_{4}|=36

So the answer is i = 1 4 A i = 135 . \displaystyle\sum^{4}_{i=1}{|Ai|}=\boxed{135}.

You have said that the x j x_j cannot be equal to 0 0 too early. While identifying the function S S in part 1, the only thing we have for certain is that x k 0 x_k \neq 0 . We can then show that S S moves the first digit of n n to the end. This means that, if x k 1 = 0 x_{k-1} = 0 , then S ( n ) S(n) will be a number with fewer digits than n n , and your formula for S ( S ( n ) ) S(S(n)) will be incorrect.

However, moving on to part 2, if x k 1 = 0 x_{k-1} = 0 then S ( S ( n ) ) S(S(n)) will not be equal to n n . Thus, for S ( S ( n ) ) = n S(S(n))=n , we must have both x k x_k and x k 1 x_{k-1} nonzero, which then forces all the other digits to be nonzero as well. Your count of solutions then proceeds as you indicate.

Mark Hennings - 3 years, 3 months ago

Log in to reply

Thanks,sir,and I had corrected that mistake.

Haosen Chen - 3 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...