I found the very well-written and interesting paper "Formulas for Primes" by Underwood Dudley (https://www.jstor.org/stable/2690261).
In this paper Dudley gives plenty of examples of totally useless formulas for finding primes and primality tests etc.
A few things are unclear to me and since I am no number theory expert, I thought maybe someone can explain them to me.
Question 1
On the very first page, Dudley cites a formula from 1895 which says that for an integer $n\geq2$ the expression
$$ \frac{e^{2\pi i(n-1)!/n}-1}{e^{-2\pi i/n}-1}$$
is $1$ if $n$ is prime and $0$ if $n$ is not prime.
The problem is that it is true for all numbers except $4$, where the expression evaluates to $1-i$ which is neither $1$ nor $0$. So, my question is: Why is he stating a wrong formula here?
My guess is that this is just a small mistake, but I do not know wether the original formula from 1895 was already wrong (I could not find the original source) and noone saw that which would be confusing since the counter-example $4$ is not so big. Probably, noone cared because usually you want primality tests only for big numbers and everyone knows that $4$ is composite.
Question 2
On the second page, Dudley says that for an integer $n>1$ the expression
$$ f(n)=\sin^2 \pi n + \sin^2\pi\left(\frac{1+(n-1)!}{n}\right)$$
is integer if and only if $n$ is prime. I believe that this is true but I do not understand why we need the first summand which is always zero. So, why did he include the first summand making this formula unnecessarily complicated?
Question 3
My last question is related to the second formula on the second page. Here, Dudley says the function $f$ can also be written as
$$ f(n)= \frac{\sin^2 \pi n}{(\pi n)^2(1-n^2)^2}\cdot \sum_{k=2}^\infty \frac{\pi n}{k \sin\pi n/k}.$$
This makes no sense whatsoever since now the factor $\sin^2 \pi n$ which is always zero is a factor in front making $f(n)$ always zero if $n$ is an integer. My question here is: Am I not seeing anything and the formula is correct or - if the formula is wrong - what was meant here?
I hope someone can help me. Many thanks in advance!