Give it a try

Let f ( n ) f(n) be a function defined on the non-negative integers given the following facts:

  • f ( 0 ) = f ( 1 ) = 0 f(0)=f(1)=0 .

  • f ( 2 ) = 1 f(2)=1

  • For n > 2 n>2 , f ( n ) f(n) gives the smallest positive integer, which does not divide n n .

Let g ( n ) = f ( f ( f ( n ) ) ) g(n)=f(f(f(n))) , find g ( 1 ) + g ( 2 ) + g ( 3 ) + + g ( 2016 ) g(1)+g(2)+g(3)+\cdots+g(2016) .


The answer is 1177.

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

Zk Lin
Feb 20, 2016

This question should probably be posted in the Number Theory section since it deals mainly with property of divisibility.

Let's write out a few values of f ( n ) f(n) . We will need them later for reference.

f ( 0 ) = 0 , f ( 1 ) = 0 , f ( 2 ) = 1 , f ( 3 ) = 2 , f ( 4 ) = 3 , f ( 5 ) = 2 , f ( 6 ) = 4 , f ( 7 ) = 2 , f ( 8 ) = 3 f(0)=0, f(1)=0, f(2)=1, f(3)=2, f(4)=3, f(5)=2, f(6)=4, f(7)=2, f(8)=3 .

If n n is an odd number, then f ( n ) = 2 f(n)=2 , so g ( n ) = f ( f ( f ( n ) ) ) = f ( f ( 2 ) ) = f ( 1 ) = 0 g(n)=f(f(f(n)))=f(f(2))=f(1)=0 .

Therefore, n = 1 2016 g ( n ) = g ( 2 ) + g ( 4 ) + g ( 6 ) + + g ( 2016 ) \displaystyle \sum_{n=1}^{2016} g(n)= g(2)+g(4)+g(6)+ \cdots +g(2016) .

To organize my solution, I will form a sequence which comprise the numbers 2 , 4 , 6 , 2016 2,4,6 \cdots, 2016 and remove numbers which are not divisible by 3 3 after computing the sum of g ( n ) g(n) for such numbers. Then, rinse and repeat for 4 , 5 4,5 \cdots

Note that there are 1008 1008 numbers in the sequence 2 , 4 , 6 , , 2016 2,4,6, \cdots, 2016 . Out of these, 2016 3 = 336 \frac{2016}{3}=336 are divisible by 3 3 , while 672 672 are not. For these 672 672 numbers, with the exception of g ( 2 ) = f ( f ( f ( 2 ) ) ) = f ( f ( 1 ) ) = f ( 0 ) = 0 g(2)=f(f(f(2)))=f(f(1))=f(0)=0 , we have f ( n ) = 3 f(n)=3 , which implies g ( n ) = f ( f ( 3 ) ) = f ( 2 ) = 1 g(n)=f(f(3))=f(2)=1 . These g ( n ) g(n) sum up to 671 \boxed{671} .

Out of the remaining 336 336 numbers in the sequence 6 , 12 , 18 , 2016 6,12,18 \cdots, 2016 , we find that 336 2 = 168 \frac{336}{2}=168 are divisible by 4 4 while the other 168 168 aren't. For these 168 168 numbers which aren't divisible by 4 4 , we have f ( n ) = 4 f(n)=4 , which implies g ( n ) = f ( f ( 4 ) ) = f ( 3 ) = 2 g(n)=f(f(4))=f(3)=2 . These g ( n ) g(n) sum up to 2.168 = 336 2.168=\boxed{336} .

Now, 168 168 numbers ( 12 , 24 , , 2016 ) (12,24, \cdots, 2016) remain in our sequence. Out of these, only 33 33 , namely 60 , 120 , , 1980 60,120, \cdots, 1980 are divisible by 5 5 while the other 135 135 aren't. For these 135 135 numbers, we have f ( n ) = 5 f(n)=5 , which implies g ( n ) = f ( f ( 5 ) ) = f ( 2 ) = 1 g(n)=f(f(5))=f(2)=1 . These g ( n ) g(n) sum up to 135 \boxed{135} .

All the 33 33 numbers remaining in the sequence are divisible by 6 6 since they are divisible by both 2 2 and 3 3 . Therefore, we focus our attention on divisibility by 7 7 .

It is easy to see that only 4 4 members in the sequence are divisible by 7 7 , which are 420 , 840 , 1260 420,840,1260 and 1680 1680 . For the remaining 29 29 which aren't divisible by 7 7 , we have f ( n ) = 7 f(n)=7 , which implies g ( n ) = f ( f ( 7 ) ) = f ( 2 ) = 1 g(n)=f(f(7))=f(2)=1 . These g ( n ) g(n) sum up to 29 \boxed{29} .

It is easy to see that f ( 420 ) = f ( 1260 ) = 8 f(420)=f(1260)=8 , while f ( 840 ) = f ( 1680 ) = 9 f(840)=f(1680)=9 . Therefore, g ( 420 ) = g ( 1260 ) = f ( f ( 8 ) ) = f ( 3 ) = 2 g(420)=g(1260)=f(f(8))=f(3)=2 while g ( 840 ) = g ( 1680 ) = f ( f ( 9 ) ) = f ( 2 ) = 1 g(840)=g(1680)=f(f(9))=f(2)=1 . Summing these g ( n ) g(n) up, we get 6 \boxed{6} .

The answer follows from 671 + 336 + 135 + 29 + 6 = 1177 671+336+135+29+6=\boxed{1177} .

Moderator note:

Good clear explanation of how to proceed through this problem. It is better to sort by the value of f ( n ) f(n) , then it is to sort by n n .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...