A Unique Function

Algebra Level 4

For non-negative integers a 1 , a 2 , a 3 , , a n 9 a_1, a_2, a_3, \ldots , a_n \leq 9 , let

f ( a 1 , a 2 , , a n ) = a 1 + 11 a 2 + 111 a 3 + + 111 111 Number of 1s = n a n f(a_1, a_2, \ldots , a_n) = a_1 + 11a_2 + 111a_3 + \ldots + \underbrace{111 \ldots 111}_{\text{Number of 1s}=n}a_n

Find number of positive integers N < 1 0 7 N \lt 10^7 such that there exists no possible set of non-negative integers a 1 , a 2 , a 3 , , a n 9 a_1, a_2, a_3, \ldots , a_n \leq 9 such that N = f ( a 1 , a 2 , , a n ) N = f(a_1, a_2, \ldots , a_n) .


All of my problems are original .


The answer is 999999.

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.

2 solutions

Aryan Sanghi
Aug 16, 2020

Seeing a 1 , a 2 a n 9 \displaystyle a_1, a_2 \ldots a_n \leq 9 reminds of digits. Let X = a n a n 1 a n 2 a 2 a 1 \displaystyle X = \overline{a_na_{n-1}a_{n-2}\ldots a_2a_1}

Now,

f ( a 1 , a 2 , , a n ) = 1 a 1 + 11 a 2 + 111 a 3 + + 111 111 Number of 1s = n a n f(a_1, a_2, \ldots , a_n) = 1\cdot a_1 + 11\cdot a_2 + 111\cdot a_3 + \ldots + \underbrace{111\ldots111}_{\text{Number of 1s = n }}\cdot a_n

f ( a 1 , a 2 , , a n ) = ( 1 0 n 1 a n + 1 0 n 2 a n 1 + + 1 0 0 a 1 ) + ( 1 0 n 2 a n + 1 0 n 3 a n 1 + + 1 0 0 a 2 ) + ( 1 0 n 3 a n + 1 0 n 4 a n 1 + + 1 0 0 a 1 ) + + ( 10 a n + a n 1 ) + a n f(a_1, a_2, \ldots , a_n) = (10^{n-1}a_n + 10^{n-2}a_{n-1} + \ldots + 10^0a_1) + (10^{n-2}a_n + 10^{n-3}a_{n-1} + \ldots + 10^0a_2) +(10^{n-3}a_n + 10^{n-4}a_{n-1} + \ldots + 10^0a_1) + \ldots + (10a_n + a_{n-1}) + a_n

f ( a 1 , a 2 , , a n ) = a n a n 1 a 1 + a n a n 1 a 2 + a n a n 1 a 3 + + a n a n 1 + a n f(a_1, a_2, \ldots , a_n) = \overline{a_na_{n-1}\ldots a_1} + \overline{a_na_{n-1}\ldots a_2} + \overline{a_na_{n-1}\ldots a_3} + \ldots + \overline{a_na_{n-1}} + a_n

Therefore, we to find number of positive integers X = a n a n 1 a 1 \displaystyle X = \overline{a_na_{n-1}\ldots a_1} such that N = a n a n 1 a 1 + a n a n 1 a 2 + a n a n 1 a 3 + + a n a n 1 + a n < 1 0 7 \displaystyle N = \overline{a_na_{n-1}\ldots a_1} + \overline{a_na_{n-1}\ldots a_2} + \overline{a_na_{n-1}\ldots a_3} + \ldots + \overline{a_na_{n-1}} + a_n \lt 10^7

Now, smallest X = 0 X = 0 and biggest X = 9 × 1 0 6 X = 9 × 10^6 .

So, number of integers = 1 0 7 ( 9 × 1 0 6 + 1 ) \text{number of integers } = 10^7 - (9× 10^6 + 1) N

number of integers = 999999 \boxed{\text{number of integers } = 999999}

Joseph Newton
Aug 16, 2020

Notice that a 1 a_1 is never large enough to reach 11 11 , and a 1 + 11 a 2 a_1+11a_2 is never large enough to reach 111 111 , and so on. This means that we cannot rewrite the sum a 1 + 11 a 2 + + 111 111 a n a_1+11a_2+\dots+111\dots111a_n using different values of a 1 , , a n a_1,\dots,a_n to sum to the same value. Thus, every combination of values of a 1 , , a n a_1,\dots,a_n gives a unique value for f ( a 1 , , a n ) f(a_1,\dots,a_n) .

So, we simply need the number of combinations of a 1 , , a n a_1,\dots,a_n such that 0 < f ( a 1 , , a n ) < 1 0 7 = 10 , 000 , 000 0<f(a_1,\dots,a_n)<10^7=10,000,000 . First note that any nonzero terms past n = 7 n=7 will be larger than 1 0 7 10^7 , so we are only interested in a 1 , , a 7 a_1,\dots,a_7 . If a 7 a_7 is equal to 9, then all the other terms must be zero for the sum to equal 9,999,999 and be less than 10^7. Otherwise, the maximum possible value of the sum will be attained at a 1 = a 2 = = a 6 = 9 a_1=a_2=\dots=a_6=9 , and a 7 = 8 a_7=8 , for a total of 9 + 99 + 999 + 9999 + 99999 + 999999 + 8888888 = 9999992 < 1 0 7 9+99+999+9999+99999+999999+8888888=9999992<10^7 Last of all, we require the sum to be greater than zero, so the combination a 1 = = a 7 = 0 a_1=\dots=a_7=0 does not count. Hence, the total number of values of f ( a 1 , , a n ) f(a_1,\dots,a_n) less than 10^7 is 1 0 6 × 9 10 options for each a k except a 7 + 1 for 9999999 1 for 0 = 9000000 \underbrace{10^6\times9}_{\text{10 options for each }a_k\text{ except }a_7}\qquad\underbrace{+1}_{\text{for }9999999}\qquad\underbrace{-1}_{\text{for }0}\qquad=9000000

There are 1 0 7 1 10^7-1 positive integers less than 1 0 7 10^7 , so the number of positive integers not of this form is 1 0 7 1 9000000 = 999999 10^7-1-9000000=999999

Excellent solution sir. Thanku for sharing it with us.

Aryan Sanghi - 9 months, 4 weeks ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...