A four-part trilogy

Define a function f : N Z + { 0 } f : \mathbb{N} \rightarrow \mathbb{Z}^{+} \cup \{0\} such that

f ( 1 ) = 0 , f ( p ) = 1 f(1) = 0, f(p) = 1 for p p prime, and f ( m n ) = m f ( n ) + n f ( m ) . f(mn) = mf(n) + nf(m).

Let A A be the sum of all n < 1 , 000 , 000 n \lt 1,000,000 such that f ( n ) = n . f(n) = n.

Let B B be the maximum value of f ( n ) n \dfrac{f(n)}{n} for n 1000. n \le 1000.

Let C C be the maximum value of f ( n ) f(n) for n 1000. n \le 1000.

Finally, let D = f ( 1000 ) + f ( 42 ) . D = f(1000) + f(42).

Find A + 2 B + C + D . A + 2B + C + D.

This is my official (and somewhat belated) 1000 follower question.


The answer is 832241.

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

First note that for any prime p p and positive integer a a we have that f ( p a ) = a p a 1 . f(p^{a}) = ap^{a-1}.

(This can be verified by induction on a . a. For a = 1 a = 1 we have f ( p ) = 1 = a p 1 1 . f(p) = 1 = ap^{1-1}. If the statement is true for some a > 1 a \gt 1 then

f ( p a + 1 ) = f ( p p a ) = p f ( p a ) + p a f ( p ) = p a p a 1 + p a = ( a + 1 ) p ( a + 1 ) 1 , f(p^{a+1}) = f(p*p^{a}) = pf(p^{a}) + p^{a}f(p) = pap^{a-1} + p^{a} = (a + 1)p^{(a + 1) - 1},

and thus the statement is true for a + 1 a + 1 as well.)

So for the prime decomposition n = p 1 a 1 p 2 a 2 p 3 a 3 . . . n = p_{1}^{a_{1}}p_{2}^{a_{2}}p_{3}^{a_{3}}... we can show by a similar induction on the number of primes that

f ( n ) = n ( a 1 p 1 + a 2 p 2 + a 3 p 3 + . . . ) . f(n) = n\left(\dfrac{a_{1}}{p_{1}} + \dfrac{a_{2}}{p_{2}} + \dfrac{a_{3}}{p_{3}} + ... \right).

Now to have f ( n ) = n f(n) = n we require that this last bracketed expression, (call it S n S_{n} ), be equal to 1. 1. Since all the denominators are prime, this can only happen if one of the terms a k p k = 1 \frac{a_{k}}{p_{k}} = 1 and all the others equal 0. 0. Thus we can only have f ( n ) = n f(n) = n when n = p p n = p^{p} for some prime p . p. This gives us the value

A = 2 2 + 3 3 + 5 5 + 7 7 = 826699. A = 2^{2} + 3^{3} + 5^{5} + 7^{7} = 826699.

Next, S n S_{n} is equivalent to f ( n ) n . \frac{f(n)}{n}. We can maximize this by maximizing the exponents and minimizing the prime factors under the condition that n 1000. n \le 1000. we have 2 9 = 512 2^{9} = 512 giving us f ( n ) n = 9 2 . \frac{f(n)}{n} = \frac{9}{2}. Next down the list is 2 8 3 2^{8}*3 giving us f ( n ) n = 4 + 1 3 < 9 2 . \frac{f(n)}{n} = 4 + \frac{1}{3} \lt \frac{9}{2}. As we "power down" 2 2 we can increase the powers of other prime factors, but not enough to compensate for the lessening power of 2 , 2, leading us to conclude that B = 9 2 . B = \dfrac{9}{2}.

Now for C , C, we need to maximize the product of n n and S n . S_{n}. We found that S n S_{n} is maximized for n = 512 , n = 512, but for this value n S n = 2304. nS_{n} = 2304. We can do better by increasing n n while sacrificing S n S_{n} to a small extent. The next on the list is n = 2 8 3 , n = 2^{8}*3, for which f ( n ) = 768 ( 4 + 1 3 ) = 3328. f(n) = 768(4 + \frac{1}{3}) = 3328. We can now rule out any S n S_{n} less than 3 + 1 3 . 3 + \frac{1}{3}. Looking for such values for larger n n we next look at n = 2 7 7 , n = 2^{7}*7, for which f ( n ) = 3264. f(n) = 3264. Next we have 2 6 3 5 = 960 , 2^{6}*3*5 = 960, for which f ( n ) = 3392. f(n) = 3392. Any lesser n n and/or power of 2 2 will necessarily yield a smaller f ( n ) f(n) than this, so C = 3392. C = 3392.

Finally, since 1000 = 2 3 5 3 1000 = 2^{3}5^{3} we have f ( 1000 ) = 1000 ( 3 2 + 3 5 ) = 2100 , f(1000) = 1000(\frac{3}{2} + \frac{3}{5}) = 2100, and since 42 = 2 3 7 42 = 2*3*7 we have f ( 42 ) = 42 ( 1 2 + 1 3 + 1 7 ) = 41 , f(42) = 42(\frac{1}{2} + \frac{1}{3} + \frac{1}{7}) = 41, making D = 2141. D = 2141.

(The "four-part trilogy" in the title is in reference to the 42 42 component of this question, in case anyone was wondering.)

Thus A + 2 B + C + D = 826699 + 9 + 3392 + 2141 = 832241 . A + 2B + C + D = 826699 + 9 + 3392 + 2141 = \boxed{832241}.

Especially since this is my 1000 follower question I sure hope I haven't messed up somewhere. :P My solution involved a bit of hand-waving so if anyone has suggestions about tightening things up I would be appreciative.

A big "Thank you!" to all those, (both staff and members), who make this such an amazing site to participate on. :D

Brian Charlesworth - 6 years ago

Log in to reply

NO, THANK YOU for making this such an amazing site! I've learned great things from great people like you. Next stop: 1 trillionz followers!

Pi Han Goh - 6 years ago

Log in to reply

Haha. Thanks! I can certainly say the same thing about you. :D

Brian Charlesworth - 6 years ago

I've solved A B D but haven't got C and I didn't understand the solution for C can u please explain me clearly

aravind kollipara - 6 years ago

Log in to reply

Finding C C involved a bit of trial and error. I basically looked first at n n that had large S n S_{n} values and established lower bounds along the way. Once I found that f ( 2 8 3 ) = 3328 , f(2^{8}*3) = 3328, I could establish a lower bound on S n S_{n} of 3 + 1 3 , 3 + \frac{1}{3}, (since n 1000 n \le 1000 ). Then it was just a matter of finding the few S n S_{n} that met this criteria and calculating the corresponding f ( n ) f(n) values. Using the formulas I established for f ( n ) f(n) and S n S_{n} this was manageable to do by hand, but if we were looking at all n n less than, say, a million, we would need to write a computer program to assist us.

Brian Charlesworth - 6 years ago

Frankly , when I solved this question using 2 and a half pages and some cheating(took help from a sir from my coaching class :P Btw both of you think alike ) , I figured I was going wrong somewhere .But got chilled when I saw it matched with your solution .

Congrats sir! \huge\text{Congrats sir!}

Yes , you are late in posting this question . Also , go for 1 Trillion Fllowers ! \stackrel{{\Large\wedge\,\wedge}}{{\Large\smile}}

Log in to reply

Thanks, Azhaghu! I'm glad you were able to persevere and solve this problem. I did have this idea in mind around the time I reached 1000 followers, but I didn't get around to figuring out the details until last night. Better late than never. :)

Brian Charlesworth - 6 years ago

My half-a-strip-of-paper-working:

Julian Poon - 6 years ago

A beautiful question! I messed up on finding C C but managed to recover. Just curious, what's with the name? "A four-part trilogy", specifically the trilogy bit.

Thank you for all the wonderful questions you've posted. Congratulations on the well earned 1000 follows. Keep on being awesome Brian.

Isaac Buckley - 6 years ago

Log in to reply

Thanks Isaac; I really appreciate the kind words. Finding C C was probably the trickiest part; there were quite a few cases to check in order to find the best "balance" of n n and S n . S_{n}.

The title is an homage to Douglas Adams' "Hitchhiker's Guide to the Galaxy" series of books. He had originally written three books and referred to them (appropriately) as a trilogy, but then decided to write a fourth (and fifth) book. Despite the series no longer being a "proper" trilogy he nevertheless continued to refer to it as such just for fun. To mirror this humour I threw in D D at the end while still calling the problem a "trilogy", and included the number 42 42 , (a number of great significance in the book series), to further the connection.

Brian Charlesworth - 6 years ago

Same here ¨ \ddot\smile . But still a great question!

Karthik Kannan - 6 years ago

Beautiful problem! I had some trouble with C C though, but I made it...

Julian Poon - 6 years ago

Thanks for giving such a wonderful problem . I couldn't solve it. Anyway,From your solution , I gained some knowledge .I'm expecting more problems from you..!

Mano Prakash - 5 years, 11 months ago

This is A BLOCK BLUSTER Question With a SUPER SOLUTION!!!!UPVOTED AND LIKED!!!!

rajdeep brahma - 3 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...