// Numbas version: exam_results_page_options {"name": "Square-and-multiply", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Square-and-multiply", "tags": [], "metadata": {"description": "

This question tests students' ability to use repeated squaring to perform modular exponentiation.  Moduli are random numbers between 30 and 70, the base is a number between 10 and 29.  To generate questions of approximately uniform difficult the exponent is taken to be 256 plus two smaller powers of 2. 

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

This question tests your ability to use squaring-and-multiplication to perform modular exponentiation.

", "advice": "

a) We use a calculator to perform the squaring and the modular reduction.

\n

b) We have that $\\var{b}=2^8+2^{\\var{expi}}+2^{\\var{expj}}$, so we multiply together $\\var{a}^{267}$$\\times\\var{a}^{\\var{2^expi}}\\times\\var{a}^{\\var{2^expj}}$ and reduce modulo $\\var{n}$ to obtain the answer.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(30 .. 70#1)", "description": "", "templateType": "randrange", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(10 .. 29#1)", "description": "", "templateType": "randrange", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "(2^expi)+(2^expj)+256 ", "description": "", "templateType": "anything", "can_override": false}, "powermatrix": {"name": "powermatrix", "group": "Ungrouped variables", "definition": "transpose(matrix(powerlist))\n", "description": "", "templateType": "anything", "can_override": false}, "powerlist": {"name": "powerlist", "group": "Ungrouped variables", "definition": "iterate(mod(x^2,n),x,mod(a^2,n),7)", "description": "", "templateType": "anything", "can_override": true}, "expi": {"name": "expi", "group": "Ungrouped variables", "definition": "random(1 .. 6#1)", "description": "", "templateType": "randrange", "can_override": false}, "expj": {"name": "expj", "group": "Ungrouped variables", "definition": "random(2 .. 6#1)", "description": "", "templateType": "randrange", "can_override": false}, "ans": {"name": "ans", "group": "Ungrouped variables", "definition": "mod(powermatrix[7][0]*powermatrix[expi-1][0]*powermatrix[expj-1][0],n)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "expi<>expj", "maxRuns": 100}, "ungrouped_variables": ["n", "a", "expi", "expj", "b", "powerlist", "powermatrix", "ans"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "matrix", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Enter the values $\\var{a}^2\\pmod{\\var{n}},\\var{a}^4\\pmod{\\var{n}},\\dotsc,\\var{a}^{256}\\pmod{\\var{n}}$ in the table from top to bottom.  Each entry should be an integer between $0$ and $\\var{n-1}$ inclusive.

", "correctAnswer": "powermatrix", "correctAnswerFractions": false, "numRows": "8", "numColumns": 1, "allowResize": false, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "prefilledCells": ""}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Evaluate $\\var{a}^\\var{b}\\pmod{\\var{n}}$.  Your answer should be expressed as an integer between $0$ and $\\var{n-1}$ inclusive.

", "minValue": "ans", "maxValue": "ans", "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": "Maura Paterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7001/"}]}]}], "contributors": [{"name": "Maura Paterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7001/"}]}