// Numbas version: exam_results_page_options {"name": "Marlon's copy of Factorise numbers into products of prime powers", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "advice": "\n\n\n\n\n", "functions": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["p2", "p3", "p1", "p5", "sgp", "ntbf", "mgp", "e5", "lgp", "e1", "e3", "e2"], "showQuestionGroupNames": false, "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "questions": [], "pickQuestions": 0}], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "metadata": {"description": "

Factorising 5 to 7 digit numbers into a product of prime powers.

\n

Uses the marking algorithms from question 1 of this CBA

", "licence": "Creative Commons Attribution 4.0 International", "notes": "

16/08/2012:

\n

Added tags.

\n

Added description.

\n

No advice given.

"}, "statement": "", "type": "question", "tags": ["Arithmetic", "arithmetic", "checked2015", "factorisation", "factorization", "integers", "MAS3214", "number theory", "prime factorisation", "prime factorization", "prime factors", "prime numbers", "prime powers"], "parts": [{"showCorrectAnswer": true, "prompt": "\n\n\n

Factorize completely $\\var{ntbf}$.

\n\n\n\n

Input your answer in the form p^r * q^s * ... where $p, q, \\dots$ are distinct primes and $r, s, \\dots$ are their powers.

\n\n\n\n

$\\var{ntbf}=\\;\\;$[[0]]

\n\n\n\n

(There is a Maple function $\\mathrm{ifactor}(n)$ which factorizes integers.)

\n\n", "type": "gapfill", "marks": 0, "gaps": [{"answersimplification": "unitPower,zeroPower,unitFactor", "checkingtype": "absdiff", "checkingaccuracy": 0.001, "type": "jme", "musthave": {"showStrings": false, "message": "

Split into factors, each factor a power of a prime number and include the multiplication sign * between the factors

", "strings": ["*", "^"], "partialCredit": 0}, "checkvariablenames": false, "marks": 3, "expectedvariablenames": [], "vsetrangepoints": 5, "showCorrectAnswer": true, "answer": "{p1^e1*p2^e2*p3^e3*p5^e5}", "showpreview": true, "scripts": {"constructor": {"script": "question.createFactorisePart(this);", "order": "after"}, "mark": {"script": "question.markFactorisePart(this);", "order": "instead"}}, "vsetrange": [0, 1], "minlength": {"message": "", "length": 7, "partialCredit": 0}}], "scripts": {}}], "name": "Marlon's copy of Factorise numbers into products of prime powers", "preamble": {"js": "question.createFactorisePart = function(p) {\n var n = parseInt(p.settings.correctAnswer);\n var factors = Numbas.math.factorise(n);\n\n p.settings.correctAnswer = p.display.correctAnswer = factors.map(function(pow,i){\n if(pow==1) {\n return Numbas.math.primes[i];\n } else if(pow>0){\n return Numbas.math.primes[i]+'^'+pow;\n } else {\n return '';\n }\n }).filter(function(x){return x}).join(' * ');\n\n p.display.correctAnswerLaTeX = factors.map(function(pow,i){\n if(pow==1) {\n return Numbas.math.primes[i];\n } else if(pow>0){\n return Numbas.math.primes[i]+'^{'+pow+'}';\n } else {\n return '';\n }\n }).filter(function(x){return x}).join(' \\\\times ');\n}\n\nquestion.markFactorisePart = function(p) {\n var m = Numbas.jme.display.matchExpression('m_all(m_any(m_number,m_number^m_number));factors*??',p.studentAnswer,true);\n\n function onlyPrimes(tree) {\n var number;\n if(tree.tok.type=='op' && tree.tok.name=='*') {\n return onlyPrimes(tree.args[0]) && onlyPrimes(tree.args[1]);\n } else if(tree.tok.type=='op' && tree.tok.name=='^') {\n number = tree.args[0].tok.value;\n } else {\n number = tree.tok.value;\n }\n return Numbas.math.primes.contains(number);\n }\n\n if(!onlyPrimes(m.factors)) {\n p.setCredit(0,'Your answer is not completely factorised.');\n return ;\n }\n JMEPart.prototype.mark.apply(p);\n}", "css": ""}, "variables": {"p2": {"name": "p2", "group": "Ungrouped variables", "definition": "random(sgp)", "description": "", "templateType": "anything"}, "e1": {"name": "e1", "group": "Ungrouped variables", "definition": "random(2,3)", "description": "", "templateType": "anything"}, "p3": {"name": "p3", "group": "Ungrouped variables", "definition": "random(mgp)", "description": "", "templateType": "anything"}, "e5": {"name": "e5", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything"}, "p5": {"name": "p5", "group": "Ungrouped variables", "definition": "random(lgp)", "description": "", "templateType": "anything"}, "e2": {"name": "e2", "group": "Ungrouped variables", "definition": "if(e1>1,0,2)", "description": "", "templateType": "anything"}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "random(sgp)", "description": "", "templateType": "anything"}, "sgp": {"name": "sgp", "group": "Ungrouped variables", "definition": "[2,2,2,3,3,3,5,5,5,7,7,7,11,11,13]", "description": "", "templateType": "anything"}, "lgp": {"name": "lgp", "group": "Ungrouped variables", "definition": "[59,61,67,73,79]", "description": "", "templateType": "anything"}, "ntbf": {"name": "ntbf", "group": "Ungrouped variables", "definition": "p1^e1 * p2^e2 * p3^e3 * p5^e5", "description": "", "templateType": "anything"}, "e3": {"name": "e3", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything"}, "mgp": {"name": "mgp", "group": "Ungrouped variables", "definition": "[17,19,23,29,31,37,41,43,47]", "description": "", "templateType": "anything"}}, "contributors": [{"name": "Marlon Arcila", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/321/"}]}]}], "contributors": [{"name": "Marlon Arcila", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/321/"}]}