Why would you use an LLM for this? They are non deterministic models.
This is also an probably part of extended prompt that disallowed coding, Gemini always does calculation with a little python snippet because it is deterministic and accurate.