https://artificialanalysis.ai/leaderboards/models
You will note that in my original comment I very specifically said "deepseek v4 flash 0731", which by many benchmarks/metrics, is "smarter" (again, this is a metaphor) than a smaller or older model. It is also specifically known to be relatively capable of producing code and formulas on demand in several common languages.
And "hallucinating" to mean "outputs plausible sounding gibberish that doesn't hold together consistently". Of course there's no actual hallucination going on.