Optimize seen calculation by precalculating it.