// Numbas version: finer_feedback_settings {"feedback": {"showactualmark": true, "showanswerstate": true, "allowrevealanswer": true, "intro": "", "advicethreshold": 0, "showtotalmark": true, "feedbackmessages": [], "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 1, "name": "Group", "questions": [{"name": "Blathnaid's copy of Perform arithmetic in Z_n", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Blathnaid Sheridan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/447/"}], "functions": {}, "ungrouped_variables": ["a1", "g5", "ans3", "g3", "ans1", "ans2", "t5", "ans4", "ans5", "s5", "h5", "b4", "b5", "a3", "a2", "a5", "b1", "b2", "b3", "a4"], "tags": ["checked2015", "MAS3214", "Modular arithmetic", "modular arithmetic"], "advice": "
In the the last part, working out $(\\var{a5}+\\var{b5})\\times (\\var{g5}+\\var{h5}) \\bmod{X}$, it is sometimes easier to work out $(\\var{a5}+\\var{b5}) \\bmod{X}$ and $(\\var{g5}+\\var{h5}) \\bmod{X}$ separately, giving two numbers in the range $[0 \\dots X-1]$, and then to multiply them together.
\nFor example, working $\\bmod{9}$ we have:
\n\\begin{align}
\\var{a5}+\\var{b5}&\\equiv \\var{mod(a5+b5,9)} \\bmod{9}, \\\\
\\var{g5}+\\var{h5}&\\equiv \\var{mod(g5+h5,9)} \\bmod{9}. \\\\ \\\\
(\\var{a5}+\\var{b5})\\times (\\var{g5}+\\var{h5}) &\\equiv \\var{s5} \\times \\var{t5} \\bmod{9} \\\\
&\\equiv \\var{mod(ans5,9)} \\bmod{9}
\\end{align}
Perform the following calculations in $\\mathbb{Z}_{2},\\;\\;\\mathbb{Z}_{9},\\;\\;\\mathbb{Z}_{10}$.
\n \n \n \n\n \n | $\\mathbb{Z}_{2}$ | \n \n$\\mathbb{Z}_{9}$ | \n \n$\\mathbb{Z}_{10}$ | \n \n
---|---|---|---|
$\\var{a1}+\\var{b1}$ | \n \n[[0]] | \n \n[[1]] | \n \n[[2]] | \n \n
$\\var{a2}\\times\\var{b2}$ | \n \n[[3]] | \n \n[[4]] | \n \n[[5]] | \n \n
$\\var{a3}\\times(\\var{b3}+\\var{g3})$ | \n \n[[6]] | \n \n[[7]] | \n \n[[8]] | \n \n
$\\var{a4}\\times\\var{b4}$ | \n \n[[9]] | \n \n[[10]] | \n \n[[11]] | \n \n
$(\\var{a5}+\\var{b5})\\times (\\var{g5}+\\var{h5})$ | \n \n[[12]] | \n \n[[13]] | \n \n[[14]] | \n \n
16/08/2012:
\n
Added tags.
Added description.
", "description": "Calculations in $\\mathbb{Z_n}$ for three values of $n$.
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Factorise four numbers", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "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"], "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.
\nFor example if you are factorizing $1998$ then we have $1998 = 2 \\times 3^3 \\times 37$ and you would enter 2 * 3^3 * 37
.
Pick four numbers from $1900\\dots 2015$ and ask the student to factorise them.
\nCustom marking scripts make sure the student has entered a complete factorisation.
"}, "advice": ""}, {"name": "Factorise numbers into products of prime powers", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"e2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "if(e1>1,0,2)", "description": "", "name": "e2"}, "lgp": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[59,61,67,73,79]", "description": "", "name": "lgp"}, "e1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(2,3)", "description": "", "name": "e1"}, "p1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(sgp)", "description": "", "name": "p1"}, "e3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "1", "description": "", "name": "e3"}, "p3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(mgp)", "description": "", "name": "p3"}, "e5": {"group": "Ungrouped variables", "templateType": "anything", "definition": "1", "description": "", "name": "e5"}, "p5": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(lgp)", "description": "", "name": "p5"}, "sgp": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[2,2,2,3,3,3,5,5,5,7,7,7,11,11,13]", "description": "", "name": "sgp"}, "p2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(sgp)", "description": "", "name": "p2"}, "mgp": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[17,19,23,29,31,37,41,43,47]", "description": "", "name": "mgp"}, "ntbf": {"group": "Ungrouped variables", "templateType": "anything", "definition": "p1^e1 * p2^e2 * p3^e3 * p5^e5", "description": "", "name": "ntbf"}}, "ungrouped_variables": ["p2", "p3", "p1", "p5", "sgp", "ntbf", "mgp", "e5", "lgp", "e1", "e3", "e2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "showQuestionGroupNames": false, "functions": {}, "parts": [{"scripts": {}, "gaps": [{"answer": "{p1^e1*p2^e2*p3^e3*p5^e5}", "musthave": {"message": "Split into factors, each factor a power of a prime number and include the multiplication sign *
between the factors
Factorize completely $\\var{ntbf}$.
\n\n\n\nInput your answer in the form p^r * q^s * ...
where $p, q, \\dots$ are distinct primes and $r, s, \\dots$ are their powers.
$\\var{ntbf}=\\;\\;$[[0]]
\n\n\n\n(There is a Maple function $\\mathrm{ifactor}(n)$ which factorizes integers.)
\n\n", "showCorrectAnswer": true, "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "", "tags": ["Arithmetic", "arithmetic", "checked2015", "factorisation", "factorization", "integers", "MAS3214", "number theory", "prime factorisation", "prime factorization", "prime factors", "prime numbers", "prime powers"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "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 JMEPart.prototype.mark.apply(p);\n}"}, "type": "question", "metadata": {"notes": "16/08/2012:
\nAdded tags.
\nAdded description.
\nNo advice given.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Factorising 5 to 7 digit numbers into a product of prime powers.
\nUses the marking algorithms from question 1 of this CBA
"}, "advice": "\n\n\n\n\n"}]}], "navigation": {"preventleave": true, "showresultspage": "oncompletion", "showfrontpage": true, "onleave": {"action": "none", "message": ""}, "browse": true, "reverse": true, "allowregen": true}, "showstudentname": true, "duration": 0, "name": "Peter's copy of Blathnaid's copy of Blathnaid's copy of Number theory and cryptography", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Questions used in a university course titled \"Number theory and cryptography\""}, "timing": {"timedwarning": {"action": "none", "message": ""}, "allowPause": true, "timeout": {"action": "none", "message": ""}}, "percentPass": "0", "showQuestionGroupNames": false, "type": "exam", "contributors": [{"name": "Peter Neary", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2520/"}], "extensions": [], "custom_part_types": [], "resources": []}