Why do LLMs sometimes give inconsistent answers to the same logical question?