Function for which $f(n) = 1$ is true only if n is prime.

226 Views Asked by At

I was thinking a bit about the primes so I created a function which I checked in Wolfram.
It seems that this function is doing what i expected. It returns $1$ if value is prime otherwise it returns $0$.

Let: $$f(n) = \lceil \frac{\Gamma(n)^2}{n} \rceil- \lfloor\frac{\Gamma(n)^2}{n} \rfloor$$ $$n \in \Bbb{N}$$ Then:
If $n$ is prime then $f(n) = 1$ else $f(n) = 0$.

Function in wolfram: my function.


I know that to truly say that this is true, there is needed a proof.


Can such function be useful in math or it is just a clever useless property ?
Can we say anythink more about this function ?

Are there any other interesting functions that are strongly connected with prime numbers ?
I know that there are :

1

There are 1 best solutions below

4
On

Well, $$\lceil x \rceil - \lfloor x \rfloor = \left\{ \begin{array}{ll} 0 \ \ x \in \mathbb{Z} \\ 1 \ \ x \notin \mathbb{Z} \end{array} \right. $$

Note that $\frac{\Gamma(n)}{n}^2 = \frac{((n-1)!)^2}{n}$ is an integer $\iff$ $n$ is not a prime number.