// Numbas version: finer_feedback_settings {"name": "Blathnaid's copy of Apply extended Euclidean algorithm to find gcd", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "parts": [{"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "variableReplacements": [], "prompt": "
Find $d$, using the Euclidean algorithm.
\n$d=$ [[0]]
", "type": "gapfill", "marks": 0, "showFeedbackIcon": true, "gaps": [{"correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "integerPartialCredit": 0, "minValue": "{hcf}", "variableReplacements": [], "marks": "10", "maxValue": "{hcf}", "notationStyles": ["plain", "en", "si-en"], "integerAnswer": true, "showCorrectAnswer": true, "allowFractions": false, "scripts": {"mark": {"script": "this.__proto__.mark.apply(this);\n", "order": "instead"}}, "type": "numberentry", "showFeedbackIcon": true, "correctAnswerStyle": "plain"}]}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {"mark": {"script": "this.setCredit(0);\nthis.markingFeedback = [];\n\nvar x = parseFloat(this.gaps[0].studentAnswer);\nvar y = parseFloat(this.gaps[1].studentAnswer);\nvar total = variables.sa*x + variables.sb*y;\nif(total==variables.hcf) {\n this.setCredit(1,'Your answer is correct');\n this.gaps[0].settings.minvalue = this.gaps[0].settings.maxvalue = x;\n this.gaps[1].settings.minvalue = this.gaps[1].settings.maxvalue = y;\n} else {\n this.setCredit(0,'Your values of $x$ and $y$ give $\\\\simplify[]{{sa}'+x+' + {sb}'+y+'} = '+total+' \\\\neq h$');\n this.gaps[0].settings.minvalue = this.gaps[0].settings.maxvalue = x+1;\n this.gaps[1].settings.minvalue = this.gaps[1].settings.maxvalue = y+1;\n}\nthis.gaps[0].submit();\nthis.gaps[1].submit();", "order": "instead"}}, "variableReplacements": [], "prompt": "Find integers $x$ and $y$ such that $\\simplify{d={sa}*x+{sb}*y }$.
\n$x=$ [[0]]
\n$y=$ [[1]]
\nIf you use the extended Euclidean Algorithm, or, essentially equivalently, work backwards from the solution you found in a), then you will obtain suitable values for $x$ and $y$.
\n", "type": "gapfill", "marks": 0, "showFeedbackIcon": true, "gaps": [{"correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "integerPartialCredit": 0, "minValue": "{csa}", "variableReplacements": [], "marks": "10", "maxValue": "{csa}", "notationStyles": ["plain", "en", "si-en"], "integerAnswer": true, "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "showFeedbackIcon": true, "correctAnswerStyle": "plain"}, {"correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "integerPartialCredit": 0, "minValue": "{csb}", "variableReplacements": [], "marks": "10", "maxValue": "{csb}", "notationStyles": ["plain", "en", "si-en"], "integerAnswer": true, "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "showFeedbackIcon": true, "correctAnswerStyle": "plain"}]}], "variables": {"bsb": {"name": "bsb", "group": "Ungrouped variables", "templateType": "anything", "definition": "round(sa/hcf)", "description": ""}, "ub": {"name": "ub", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(l1b..l2b)", "description": ""}, "l2b": {"name": "l2b", "group": "Ungrouped variables", "templateType": "anything", "definition": "floor(3*bsb/4)", "description": ""}, "l1a": {"name": "l1a", "group": "Ungrouped variables", "templateType": "anything", "definition": "floor(bsa/4)", "description": ""}, "csb": {"name": "csb", "group": "Ungrouped variables", "templateType": "anything", "definition": "extendedgcd2(sa,sb)", "description": ""}, "l1b": {"name": "l1b", "group": "Ungrouped variables", "templateType": "anything", "definition": "floor(bsb/4)", "description": ""}, "l2a": {"name": "l2a", "group": "Ungrouped variables", "templateType": "anything", "definition": "floor(3*bsa/4)", "description": ""}, "csa": {"name": "csa", "group": "Ungrouped variables", "templateType": "anything", "definition": "extendedgcd1(sa,sb)", "description": ""}, "lb": {"name": "lb", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(l1b..l2b)", "description": ""}, "ua": {"name": "ua", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(l1a..l2a)", "description": ""}, "hcf": {"name": "hcf", "group": "Ungrouped variables", "templateType": "anything", "definition": "gcd(sa,sb)", "description": ""}, "bsa": {"name": "bsa", "group": "Ungrouped variables", "templateType": "anything", "definition": "round(sb/hcf)", "description": ""}, "sb": {"name": "sb", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(201..901)", "description": ""}, "la": {"name": "la", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(l1a..l2a)", "description": ""}, "sa": {"name": "sa", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1001..2001)", "description": ""}}, "statement": "Let $d=\\text{gcd}(\\var{sa},\\var{sb})$.
", "ungrouped_variables": ["bsa", "bsb", "csa", "csb", "hcf", "l1a", "l1b", "l2a", "l2b", "la", "lb", "sa", "sb", "ua", "ub"], "extensions": [], "functions": {"mdescextgcd": {"language": "javascript", "type": "html", "parameters": [["a", "number"], ["b", "number"], ["c1", "number"], ["c2", "number"], ["d1", "number"], ["d2", "number"]], "definition": "var table=$('$\\\\var{'+a+'}$ | $\\\\var{'+b+'}$ | $'+ disp(c1+'a+'+c2+'b')+'$ | $'+ disp(d1+'a+'+d2+'b')+'$ | $\\\\var{'+a+'}$ | $\\\\var{'+b+'}-\\\\var{'+fl+'}\\\\times\\\\var{'+a+'}$ | $'+ disp(c1+'a+'+c2+'b')+'$ | $'+disp(d1+'a+'+d2+'b-'+fl+'('+c1+'a+'+c2+'b'+')')+'$ | ');\n mdescextgcd(a,b%a,c1,c2,d1-fl*c1,d2-fl*c2);\n }\n else {\n var fl1=Math.floor(a/b);\n table.append('
$\\\\var{'+a+'}-\\\\var{'+fl1+'}\\\\times\\\\var{'+b+'}$ | $\\\\var{'+b+'}$ | $'+disp(c1+'a+'+c2+'b-'+fl1+'('+d1+'a+'+d2+'b'+')')+'$ | $'+ disp(d1+'a+'+d2+'b')+'$ |