TITLE: Does this function change signs infinitely often?
QUESTION [10 upvotes]: $$f(n) = \sum_{i = 1}^n (-1)^{\omega(i)}$$
where $\omega(n)$ counts how many distinct prime factors $n$ has.
I don't see any sign changes past $n = 49$, but I've only computed it up to $n = 1{,}000$.

REPLY [4 votes]: The answers so far seem to be not definitive.  This summand is called the Liouville $\lambda$ function, and this exact question was conjectured by Pólya (in the opposite direction, which would have implied the Riemann Hypothesis): https://en.wikipedia.org/wiki/Pólya_conjecture.
As it turns out, it does change sign infinitely often, so Pólya's conjecture is false.  This was first shown by Haselgrove in 1958 (as well as for the Mertens function).  The first sign change occurs just shy of a billion, $n = 906150257$.  See also "Sign changes in sums of the Liouville function" by Borwein, Ferguson and Mossinghoff for some more references.
EDIT: The Liouville function is $(-1)^{\Omega(n)}$, not $(-1)^{\omega(n)}$, so it doesn't apply to this exact question.  So my answer is still not definitive, just suggestive.