// Numbas version: exam_results_page_options {"name": "Factorise four numbers", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"customName": "", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "useCustomName": false, "prompt": "

$\\var{numbers[0]} =$ [[0]]

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{numbers[0]}", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "failureRate": 1, "customName": "", "checkVariableNames": false, "unitTests": [], "valuegenerators": [], "vsetRange": [0, 1], "showFeedbackIcon": true, "scripts": {"constructor": {"script": "question.createFactorisePart(this);", "order": "after"}, "mark": {"script": "question.markFactorisePart(this);", "order": "instead"}}, "extendBaseMarkingAlgorithm": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "checkingAccuracy": 0.001, "showPreview": true, "variableReplacements": [], "marks": "0.25"}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customName": "", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "useCustomName": false, "prompt": "

$\\var{numbers[1]} =$ [[0]]

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{numbers[1]}", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "failureRate": 1, "customName": "", "checkVariableNames": false, "unitTests": [], "valuegenerators": [], "vsetRange": [0, 1], "showFeedbackIcon": true, "scripts": {"constructor": {"script": "question.createFactorisePart(this);", "order": "after"}, "mark": {"script": "question.markFactorisePart(this);", "order": "instead"}}, "extendBaseMarkingAlgorithm": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "checkingAccuracy": 0.001, "showPreview": true, "variableReplacements": [], "marks": "0.25"}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customName": "", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "useCustomName": false, "prompt": "

$\\var{numbers[2]} =$ [[0]]

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{numbers[2]}", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "failureRate": 1, "customName": "", "checkVariableNames": false, "unitTests": [], "valuegenerators": [], "vsetRange": [0, 1], "showFeedbackIcon": true, "scripts": {"constructor": {"script": "question.createFactorisePart(this);", "order": "after"}, "mark": {"script": "question.markFactorisePart(this);", "order": "instead"}}, "extendBaseMarkingAlgorithm": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "checkingAccuracy": 0.001, "showPreview": true, "variableReplacements": [], "marks": "0.25"}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customName": "", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "useCustomName": false, "prompt": "

$\\var{numbers[3]} =$ [[0]]

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{numbers[3]}", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "failureRate": 1, "customName": "", "checkVariableNames": false, "unitTests": [], "valuegenerators": [], "vsetRange": [0, 1], "showFeedbackIcon": true, "scripts": {"constructor": {"script": "question.createFactorisePart(this);", "order": "after"}, "mark": {"script": "question.markFactorisePart(this);", "order": "instead"}}, "extendBaseMarkingAlgorithm": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "checkingAccuracy": 0.001, "showPreview": true, "variableReplacements": [], "marks": "0.25"}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}], "variables": {"numbers": {"group": "Ungrouped variables", "templateType": "anything", "definition": "shuffle(list(1900..2015))[0..4]", "description": "", "name": "numbers"}}, "ungrouped_variables": ["numbers"], "name": "Factorise four numbers", "functions": {"list": {"type": "number", "language": "javascript", "definition": "return r.slice(3);", "parameters": [["r", "range"]]}}, "variable_groups": [], "preamble": {"css": "", "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 Numbas.parts.JMEPart.prototype.mark.apply(p);\n}"}, "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

Factorize completely the following numbers.

\n

For example if you are factorizing $1998$ then we have $1998 = 2 \\times 3^3 \\times 37$ and you would enter 2 * 3^3 * 37.

", "tags": ["checked2015"], "rulesets": {}, "extensions": [], "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Pick four numbers from $1900\\dots 2015$ and ask the student to factorise them.

\n

Custom marking scripts make sure the student has entered a complete factorisation.

"}, "advice": "", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}