MathWorks interview question

Number Theory Leetcode Based Question