A question about the function $S(n)=\sum_{p\le\sqrt n}\Big\lfloor\frac n p\Big\rfloor$

54 Views Asked by At

Let's define the function $$S(n)=\sum_{p\le\sqrt n}\Big\lfloor\frac n p\Big\rfloor$$ where $\,p\,$ is prime and $\,n\gt4$.

A computation of $\,S(n)\,$ suggests that $\,S(n)=S(n-1)\,$ if and only if $\,n\,$ is a prime.

I ask the reason of this behavior.

Many thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

(Fill in the gaps as needed. If you're stuck, show your work and explain what you've tried.)

Hint: Show that if $n$ is prime, then $ \lfloor \frac{n}{a} \rfloor = \lfloor \frac{n-1}{a} \rfloor $ for $ a < n$.

Hint: Show that if $n$ is composite, then show that $ \lfloor \frac{n}{a} \rfloor \geq \lfloor \frac{n-1}{a} \rfloor $, with strict inequality for certain $a$.

Hence, the result follows.