// Numbas version: exam_results_page_options {"name": "Inbbavathie's copy of Find numbers modulo a base", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "
    \n
  1. $\\var{a} \\bmod \\var{n}=$ [[0]]
    Input your answer as an integer $a$, $0 \\le a \\le \\var{n-1}$.
  2. \n
  3. $\\var{a1} \\bmod \\var{n1}=$ [[1]]
    Input your answer as an integer $b$, $0 \\le b \\le \\var{n1-1}$.
  4. \n
  5. $\\var{a2} \\bmod \\var{n2}=$ [[2]]
    Input your answer as an integer $c$, $0 \\le c \\le \\var{n2-1}$.
  6. \n
", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "variableReplacements": [], "type": "gapfill", "gaps": [{"maxValue": "{r}", "correctAnswerFraction": false, "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "minValue": "{r}", "mustBeReduced": false, "marks": "2", "type": "numberentry", "showCorrectAnswer": true}, {"maxValue": "{r1}", "correctAnswerFraction": false, "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "minValue": "{r1}", "mustBeReduced": false, "marks": "2", "type": "numberentry", "showCorrectAnswer": true}, {"maxValue": "{r2}", "correctAnswerFraction": false, "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "minValue": "{r2}", "mustBeReduced": false, "marks": "2", "type": "numberentry", "showCorrectAnswer": true}], "showCorrectAnswer": true}], "functions": {}, "advice": "

a)

\n

We seek a number

\n

\\[r=\\var{a} \\bmod \\var{n} \\implies \\var{a} = m\\var{n}+r \\]

\n

where $m$ is a positive integer and $0 \\le r \\le \\var{n-1}$.

\n

This is achieved by dividing $\\var{a}$ by $\\var{n}$ and we find that:

\n

\\begin{align}
\\frac{\\var{a}}{\\var{n}} &= \\var{m}+\\frac{\\var{r}}{\\var{n}} \\\\
\\implies \\var{a} &= \\var{m}\\times \\var{n}+\\var{r}
\\end{align}

\n

on multiplying through by $\\var{n}$.

\n

Hence $r=\\var{r}$ and $\\var{a} \\bmod \\var{n}=\\var{r}$.

\n

You can use your calculator to find this as follows:

\n

Divide $\\var{a}$ by $\\var{n}$ to get

\n

\\[ \\frac{\\var{a}}{\\var{n}}=\\var{a/n}=\\var{m}+\\var{a/n-m} \\]

\n

Then multiplying $\\var{a/n-m}$ by $\\var{n}$ gives the remainder, i.e.

\n

\\[ \\var{a/n-m}\\times \\var{n} = \\var{r} \\]

\n

This must be an integer if no error is introduced, but the calculator result will be either an integer or very close to an integer – so you need to round to the integer in that case.

\n

b)

\n

As in a),

\n

\\[\\frac{\\var{a1}}{\\var{n1}}=\\var{m1}+\\frac{\\var{r1}}{\\var{n1}}\\]

\n

So $\\var{a1} \\bmod \\var{n1} = \\var{r1}$

\n

c)

\n

\\[\\frac{\\var{a2}}{\\var{n2}}=\\var{m2}+\\frac{\\var{r2}}{\\var{n2}}\\]

\n

So $\\var{a2} \\bmod \\var{n2} = \\var{r2}$

", "ungrouped_variables": ["a", "r1", "r2", "m", "n", "a1", "r", "m1", "m2", "n1", "n2", "a2"], "tags": [], "metadata": {"description": "

Modular arithmetic. Find the following numbers modulo the given number $n$. Three examples to do.

", "licence": "Creative Commons Attribution 4.0 International"}, "name": "Inbbavathie's copy of Find numbers modulo a base", "extensions": [], "statement": "

Find the following numbers modulo the given number $n$.

", "variables": {"m2": {"description": "", "name": "m2", "group": "Ungrouped variables", "definition": "random(2,3,4)", "templateType": "anything"}, "m1": {"description": "", "name": "m1", "group": "Ungrouped variables", "definition": "random(3,4,5,6)", "templateType": "anything"}, "a1": {"description": "", "name": "a1", "group": "Ungrouped variables", "definition": "m1*n1+r1", "templateType": "anything"}, "n1": {"description": "", "name": "n1", "group": "Ungrouped variables", "definition": "random(1001..1999#2)", "templateType": "anything"}, "n2": {"description": "", "name": "n2", "group": "Ungrouped variables", "definition": "random(301..999#2)", "templateType": "anything"}, "r": {"description": "", "name": "r", "group": "Ungrouped variables", "definition": "random(1..5)", "templateType": "anything"}, "r2": {"description": "", "name": "r2", "group": "Ungrouped variables", "definition": "random(10..19)", "templateType": "anything"}, "m": {"description": "", "name": "m", "group": "Ungrouped variables", "definition": "random(5,6,7,8,9,11,12,13)", "templateType": "anything"}, "r1": {"description": "", "name": "r1", "group": "Ungrouped variables", "definition": "random(20..99)", "templateType": "anything"}, "a": {"description": "", "name": "a", "group": "Ungrouped variables", "definition": "m*n+r", "templateType": "anything"}, "a2": {"description": "", "name": "a2", "group": "Ungrouped variables", "definition": "m2*n2+r2", "templateType": "anything"}, "n": {"description": "", "name": "n", "group": "Ungrouped variables", "definition": "random(6,7,8,9,11,12,13,14,15,16,17,18,19)", "templateType": "anything"}}, "preamble": {"js": "", "css": ""}, "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "contributors": [{"name": "Inbbavathie Ravi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1620/"}]}]}], "contributors": [{"name": "Inbbavathie Ravi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1620/"}]}