// Numbas version: finer_feedback_settings {"name": "Modular Arithmetic: Greatest Common Divisor", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Modular Arithmetic: Greatest Common Divisor", "tags": [], "metadata": {"description": "
Introduces the GCD and a simple form of the Euclidian Algorithm
", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "A number $n$ divides $a$ when $a = nq$ for some $q$.
\nAny number which divides both $a$ and $b$ is called a common divisor of $a$ and $b$, the largest common divisor is called the greatest common divisor and is denoted $\\gcd(a,b)$.
", "advice": "Every number divides zero, so the largest number to divide $\\var{a1}$ is the greatest common divisor of $0$ and $\\var{a1}$. This means that $\\gcd(\\var{a1},0) = \\var{a1}$.
\nThe Euclidian Algorithm presented here is a variation on the usual presentation. Another common method keeps track of the quotients:
\n$ \\var{gcd*(1+b*(1+a))} = \\var{b}\\times (\\var{gcd*(1+a)}) + \\var{a1} $
\n$ \\var{gcd*(1+a)} = \\var{gcd*(1+a)/a1}\\times (\\var{a1}) + 0 $
\nto write the $\\gcd$ in the form of Bézout's identity
\n$ \\var{gcd*(1+b*(1+a))} - \\var{b}\\times (\\var{gcd*(1+a)}) = \\var{a1}$.
", "rulesets": {}, "extensions": [], "variables": {"a2": {"name": "a2", "group": "Ungrouped variables", "definition": "mod(gcd*(a+1),a1)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(2..9 except [a,gcd])", "description": "", "templateType": "anything"}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "mod(gcd*(1+b*(1+a)),gcd*(1+a))", "description": "", "templateType": "anything"}, "big": {"name": "big", "group": "Ungrouped variables", "definition": "random(100..199)", "description": "", "templateType": "anything"}, "gcd": {"name": "gcd", "group": "Ungrouped variables", "definition": "random(3..19)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(2..9 except gcd)", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "gcd*(1+a)/a1", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "gcd", "a1", "a2", "c", "big"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "As a consequence of these definitions, every number $n$ divides zero because $0 = n\\times 0$.
\nSo $\\gcd(\\var{big},0)$ is
", "minValue": "{big}", "maxValue": "{big}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "3", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "What is $\\gcd(\\var{gcd*(1+b*(1+a))},\\var{gcd*(1+a)})$?
", "stepsPenalty": 0, "steps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "The procedure is to use the identity
\n$\\gcd(a,b) = \\gcd(a\\mod b, b)$.
\nto simplify the question.
\nCompute $\\var{gcd*(1+b*(1+a))} \\mod{\\var{gcd*(1+a)}}$.
", "minValue": "{a1}", "maxValue": "{a1}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "Hence $\\gcd(\\var{gcd*(1+b*(1+a))},\\var{gcd*(1+a)}) = \\gcd(\\var{a1},\\var{gcd*(1+a)})$. We can simplify this again using the identity
\n$\\gcd(a,b) = \\gcd(a, b\\mod a)$.
\nCompute $\\var{gcd*(a+1)} \\mod{\\var{a1}} $.
", "minValue": "{a2}", "maxValue": "{a2}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "information", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "By re-applying these identities, the question has been simplified to something managable:
\n$\\gcd(\\var{gcd*(1+b*(1+a))},\\var{gcd*(1+a)}) = \\gcd(\\var{a1},\\var{gcd*(1+a)}) = \\gcd(\\var{a1}, 0)$.
"}], "minValue": "{gcd}", "maxValue": "{gcd}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "type": "question", "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}], "resources": []}]}], "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}