It is known that $\log(p_1),\cdots,\log(p_n)$ are linearly independet over $\mathbb{Q}$, where $p_i$ denotes the $i$-th prime. For a number $1 \le k \le n$ let $Log(k)$ denote the vector with respect to this basis for the numbers $1,\cdots,n$. For a subset $A$ of $1,\cdots,n$ let $rank(A)$ denote the rank of the matrix build by numbers $k$ in $A$ of vectors $Log(k)$. Through experimentation I found the following explicit "formula" for prime-pi function:
$$ \Pi(n)= (-1)^{n+1} \sum rank(A) \cdot (-1)^{|A|}$$
where $A$ runs through the subsets of $1\cdots n$ of size $< n$.
But I have no proof for this. The formula above has some similarity with the inclusion-exclusion principle:
$$\left| \bigcup_{i=1}^n A_i\right| = \sum_{\emptyset\neq J\subseteq\{1,\ldots,n\}}(-1)^{|J|-1} \left |\bigcap_{j\in J} A_j\right|$$
But how does one define the sets $A_i$?
The formula has also similarity with Euler characteristic.
For a set of (possibly repeating) vectors, define:
$$\chi(v_1,\cdots,v_n) = \sum_{A} rank(A) \cdot (-1)^{|A|}$$
where $A$ runs through the subsets (with repetion) of $v_1,\cdots,v_n$.
It is not difficult to show, that if those vectors are linearly independent then $$\chi=0$$
My conjecture is that if $\chi(v_1,\cdots,v_n)=0$ then $$\chi(v_1,\cdots,v_n,w)=0$$ for any vector $w$. This would prove the prime-counting formula.
If you can think of a proof, that would be great.
Related-but-not duplicate question: https://mathoverflow.net/questions/325880/is-this-line-of-thought-using-linear-algebra-to-get-number-theoretic-results-a
Here is some sage code to play around with:
MAXN=100
def Log(a,N=MAXN):
return vector([valuation(a,p) for p in primes(N)])
def findsubsets(S,m):
return Set(S).subsets(m)
def getMatrixA(someSubset,N=MAXN):
return matrix([Log(xx,N=N) for xx in someSubset ])
def eulerCharPrimePi(n,N=MAXN):
return (-1)^(n+1)*sum([ getMatrixA(x).rank()*(-1)^k if k < n else 0 for k in range(0,n+1) for x in findsubsets(range(1,n+1),k) ])