0
$\begingroup$

I have a function of the form $f(x)=\sum^x_{k=1}\lfloor \frac{1}{1+(x \bmod k)} \rfloor$ and I want to know whether it's possible to simplify this. I think that since the $\bmod$ operator can be rephrased as a function involving a floor function that maybe these can cancel out?

$\endgroup$
3
  • $\begingroup$ @DougM I don't follow... If $1 + (x \bmod k) > 1$, then $\lfloor \frac{1}{1+(x \bmod k)} \rfloor = 0$ right? I think that what you're saying applies for a ceiling function - not a floor? $\endgroup$ Nov 28 '17 at 20:37
  • 1
    $\begingroup$ You are right. I am getting sloppy... so $\lfloor \frac 1{1+(x\mod k)} \rfloor = 1$ when $k$ divides $x,$ and $0$ otherwise. $f(x)$ equals the number of factors of $x.$ $\endgroup$
    – Doug M
    Nov 28 '17 at 21:42
  • $\begingroup$ And in case you didn't catch the import of Doug M's comment: if $$x = p_1^{e_1}p_2^{e_2}\dots p_n^{e_n}$$ is the prime factorization, then $$f(x) = \sigma_0(x) = (e_1 +1)(e_2 + 1)...(e_n+1)$$ $\endgroup$ Nov 29 '17 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.