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$?