6
$\begingroup$

$f(n)$ calculates how many times $2$ appears in numbers from $1$ to $n$. For example, $f(1)=0$, $f(2)=1$ and $f(12)=2$.

What is the first $n$ for which $f(n)=n$?

I would need first of all to figure out the function itself, if you can help me. And also the result, so I can compare after I solve the function myself.

Please help me with this one, I am stuck. I tried to do it through MS Excel, but the number is too large for what Excel can handle. Any help is highly appreciated.

Thanks!

p.s: thanks to Sidd, I now have an answer. However, if someone can also figure out the mathematical function for this, it would be very helpful.

  • 3
    Are you sure such an $n$ exists?2012-08-20
  • 0
    You said you used excel to try to do this...does this mean you only want the answer in the end? and the function won't matter?2012-08-20
  • 0
    Does this mean the digit $2$ in the decimal expansion? Or maybe how many times $2$ occurs as a prime factor? Or what?2012-08-20
  • 0
    @Sidd: I used excel just to have an idea of the algorithm behind it. The function does matter, I just didn't know how to get to it. Tell me, how did you obtain the answer?2012-08-20
  • 0
    @Prayera look at my answer below. I know this isn't what you want, but I will try to see if I can find a function for it.2012-08-20
  • 0
    @Sidd Ah, I misinterpreted the question. Apologies.2012-08-20
  • 0
    See http://oeis.org/A1016392012-08-20
  • 0
    Also https://oeis.org/A0947982012-08-21

2 Answers 2