// Numbas version: exam_results_page_options {"name": "Euclidean Algorithm", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Euclidean Algorithm", "tags": [], "metadata": {"description": "
This question aims at getting the students to demonstrate their ability to apply the Euclidean algorithm to find the GCD between two numbers.
\nWe provide two randomly generated numbers and ask the students to enter the steps of the Euclidean algorithm, as well as the GCD between the numbers.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "Apply the Euclidean algorithm to find the greatest common denominator between {pq[0]} and {pq[1]}. Show the steps.
", "advice": "In order to apply the Euclidean algorithm to find the gcd, you need to apply integer division repeatedly, until the remainder is 0.
\nOnce you know the gcd between two numbers $p$ and $q$ you can find their lcm using the following formula: \\[\\mathrm{lcm}(p,q) = \\frac{p\\times q}{\\mathrm{gcd}(p,q)} \\]
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"g": {"name": "g", "group": "Solutions", "definition": "Matrix(euclid)", "description": "The steps from Euclid, stored in a matrix (for the purpose of checking the solution).
", "templateType": "anything", "can_override": false}, "m1": {"name": "m1", "group": "Random parameters", "definition": "repeat(random(2..9),random(2..4))", "description": "", "templateType": "anything", "can_override": false}, "pq": {"name": "pq", "group": "Random parameters", "definition": "common_multiples(r0,m1)", "description": "", "templateType": "anything", "can_override": false}, "r0": {"name": "r0", "group": "Random parameters", "definition": "random(2 .. 30#1)", "description": "Number of elements in the array.
", "templateType": "randrange", "can_override": false}, "l": {"name": "l", "group": "Solutions", "definition": "pq[0]*pq[1]/r0", "description": "Lowest common multiple of the numbers in pq.
", "templateType": "anything", "can_override": false}, "euclid": {"name": "euclid", "group": "Solutions", "definition": "euclidean(pq[0],pq[1])", "description": "This variable contains the steps of Euclid's algorithm. Each row contains four numbers that correspond to the integer division performed at that step.
", "templateType": "anything", "can_override": false}, "ee": {"name": "ee", "group": "Ungrouped variables", "definition": "euclid[1]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "pq[0]<5000 && pq[0]>200 && pq[1]<5000 && pq[1]>100 && numrows(g)>2", "maxRuns": "100"}, "ungrouped_variables": ["ee"], "variable_groups": [{"name": "Random parameters", "variables": ["r0", "m1", "pq"]}, {"name": "Solutions", "variables": ["euclid", "g", "l"]}], "functions": {"common_multiples": {"parameters": [["r0", "number"], ["factors", "list"]], "type": "list", "language": "javascript", "definition": "// Generate a pair of numbers with n as a common divisor.\n//var n = factors.length;\nvar r1 = r0;\nvar r2 = 0;\nvar l = [r1];\n//for(var i=0;igcd({pq[0]},{pq[1]})=
", "minValue": "r0", "maxValue": "r0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Part c) LCM", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Use the information above to calculate the lowest common multiple between {pq[0]} and {pq[1]}.
\nlcm({pq[0]},{pq[1]})=
", "minValue": "l", "maxValue": "l", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}]}]}], "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}]}