Do LLMs Dream of Discrete Algorithms?