// Numbas version: finer_feedback_settings {"name": "21.c LCM of two numbers", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "21.c LCM of two numbers", "tags": [], "metadata": {"description": "
Calculating the LCM of two numbers by using prime factorisation.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "By considering the prime factorisation of $\\var{x}$ and $\\var{y}$, or otherwise, find the lowest common multiple (LCM) of $\\var{x}$ and $\\var{y}$.
", "advice": "We can write $\\var{x}$ and $\\var{y}$ as a product of prime factors as follows:
\n$\\var{x}=\\var{show_factors(x)}$
\n$\\var{y}=\\var{show_factors(y)}$.
\n\nFor LCM of $\\var{x}$ and $\\var{y}$ we need to multiply each factor the greatest number of times it occurs in either $\\var{x}$ or $\\var{y}$.
\ni.e. LCM$(x,y) = \\var{show_factors(lcm_xy)}=\\var{lcm_xy}$.
\n\nUse this link to find some resources which will help you revise this topic.
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"x": {"name": "x", "group": "Ungrouped variables", "definition": "random(2..70)", "description": "", "templateType": "anything", "can_override": false}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "random(2..70)", "description": "", "templateType": "anything", "can_override": false}, "lcm_xy": {"name": "lcm_xy", "group": "Ungrouped variables", "definition": "lcm(x,y)", "description": "", "templateType": "anything", "can_override": false}, "primes": {"name": "primes", "group": "Ungrouped variables", "definition": "[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]", "description": "", "templateType": "anything", "can_override": false}, "XPrimePowersList": {"name": "XPrimePowersList", "group": "Ungrouped variables", "definition": "string(d[0])+\"^\"+string(d[1]) for: d of: filter(x[1]>0,x,zip(primes,factorise(x)))", "description": "", "templateType": "anything", "can_override": false}, "DisplayXPrimePowers": {"name": "DisplayXPrimePowers", "group": "Ungrouped variables", "definition": "expression(join(XPrimePowersList,\"*\"))", "description": "", "templateType": "anything", "can_override": false}, "YPrimePowersList": {"name": "YPrimePowersList", "group": "Ungrouped variables", "definition": "string(d[0])+\"^\"+string(d[1]) for: d of: filter(x[1]>0,x,zip(primes,factorise(y)))", "description": "", "templateType": "anything", "can_override": false}, "DisplayYPrimePowers": {"name": "DisplayYPrimePowers", "group": "Ungrouped variables", "definition": "expression(join(YPrimePowersList,\"*\"))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": "500"}, "ungrouped_variables": ["primes", "lcm_xy", "x", "y", "XPrimePowersList", "DisplayXPrimePowers", "YPrimePowersList", "DisplayYPrimePowers"], "variable_groups": [], "functions": {"show_factors": {"parameters": [["n", "number"]], "type": "string", "language": "jme", "definition": "latex( // mark the output as a string of raw LaTeX\n join(\n map(\n if(a=1,p,p+'^{'+a+'}'), // when the exponent is 1, return p, otherwise return p^{exponent}\n [p,a],\n filter(x[1]>0,x,zip(primes,factorise(n))) // for all the primes p which are factors of n, return p and its exponent\n ),\n ' \\\\times ' // join all the prime powers up with \\times symbols\n )\n)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "lcm_xy", "maxValue": "lcm_xy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}, {"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Andrew Neate", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21832/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}], "resources": []}]}], "contributors": [{"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}, {"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Andrew Neate", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21832/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}]}