I was describing to a friend the result that a compact Hausdorff space is determined up to homeomorphism up to by its ring of continuous functions, and he asked how one could see the genus of a surface algebraically. I think it's a good question, and I don't know the answer.

Two parts to this question:

Suppose it is known that $A$ is the ring of continuous functions of a closed surface $X$ (topological manifold, real 2-dimensional) of genus $g$. Where in the algebraic structure of $A$ is the genus of $X$? (There are comments from other users about $K$-theory below... I want to emphasize that I am dreaming of a simple algebraic characterization, analogous to the relationship between idempotents and connected components.)

Does the answer to 1 say something interesting for more general classes of rings (ex, those that are rings of continuous functions on a compact Hausdorff space, or more general rings...)

Any ideas? (Analogous to the idempotents / connected components dictionary.)

Here are some thoughts of my own:

Picking a smooth structure on $X$ amounts to passing to some subring of differentiable functions. In this setting, results about the existence of vector fields with zeros of prescribed index could be interpreted as the existence of derivations with some prescribed zeros (by choosing some arbitrary Riemannian metric and translating the results about vector fields) - though its not clear how to interpret the index of the zero algebraically, or how to describe these subrings.

Consider all ring homomorphisms to $C(X) \to C(S^1)$ up the homotopy relation induced by factoring through $C(S^1 \times I)$ in the right way. This crudely recaptures the fundamental group, but I don't see how to turn it into an algebraic condition.

Vector bundles are the same as finite projective modules via Swan's theorem - so certain sections of the vector bundle are elements of the corresponding module? Maybe one could get at the Poincare-Hopf computation of the genus that way, but again I don't see how to compute the index. (Also as far as I know, one still needs a smooth structure to use Poincare-Hopf.)

I would be happy to just be able to distinguish $S^2$ and $T^2$ via their ring of continuous functions.