# Prime numbers characterization

When, in one endeavour, I investigated prime numbers, I came up with a formula that characterizes primes, and the job was done in essentially this way:

First i defined a function $sr$ (sum of remainders) which is, for positive integer $n$ defined as $sr(n)=\sum_{i=1}^{n}r(i;n)$ where $r(i;n)$ is the remainder of the division of $n$ with $i$. I carefully watched how this function behaves and managed to prove the following:

$p$ is a prime number if and only if $sn(p)-sn(p-1)=p-2$

And I have some questions related to this theorem:

1) Do you think that this can be transformed in such a way that it would be useful as a formula for producing primes?

2) Is there a currently known way to find explicit dependence of $sn$ as a function of $n$?

-
The OP's sequence $sr(n)$ is oeis.org/A004125 –  Barry Cipra Jan 29 '13 at 15:54
Your observation is completely trivial, and of course there are no useful explicit expressions for $sr$, only useless things like $\sum(n-i[n/i])$. –  Peter Mueller Jan 29 '13 at 15:56
Antisha, based on the questions you've asked to date (and the answers and comments you've received), I think you would do better to post at math.stackexchange.com for the time being. Your observations are fairly nice, and you express your questions reasonably clearly, but they're not at the research level mathoverflow is intended for. Please take this as encouragement to post at stackexchange, not as criticism for posting at overflow. –  Barry Cipra Jan 29 '13 at 16:15
Thank you Barry, I think that it is a good advice not to post here until I have enough experience, and I think I do not have so much experience as you people who post here, I will post on mathstackexchange and if I ever acquire enough knowledge I will probably come back here. Bye bye. :) –  Antisha Jan 29 '13 at 16:30