// Numbas version: exam_results_page_options {"name": "Modulo arithmetic: the least residue of a given number", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "variable_groups": [], "metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": "

determine the least residue mod n of a given number.

"}, "tags": [], "functions": {}, "name": "Modulo arithmetic: the least residue of a given number", "ungrouped_variables": ["a", "lr_a", "b", "lr_b", "c", "lr_c", "small_n", "d", "lr_d", "large_n", "parte", "lr_e"], "parts": [{"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "lr_a", "scripts": {}, "marks": 1, "allowFractions": false, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "lr_a"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

The number $\\var{a}$ is congruent (mod $2$) to the least residue [[0]].

", "variableReplacements": [], "scripts": {}, "marks": 0}, {"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "lr_b", "scripts": {}, "marks": 1, "allowFractions": false, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "lr_b"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

The number $\\var{b}$ is congruent (mod $10$) to the least residue [[0]].

", "variableReplacements": [], "scripts": {}, "marks": 0}, {"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "lr_c", "scripts": {}, "marks": 1, "allowFractions": false, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "lr_c"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

The number $\\var{c}$ is congruent (mod $100$) to the least residue [[0]].

", "variableReplacements": [], "scripts": {}, "marks": 0}, {"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "lr_d", "scripts": {}, "marks": 1, "allowFractions": false, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "lr_d"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

The number $\\var{d}$ is congruent (mod $\\var{small_n}$) to the least residue [[0]].

", "variableReplacements": [], "scripts": {}, "marks": 0}, {"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "lr_e", "scripts": {}, "marks": 1, "allowFractions": false, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "lr_e"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

The number $\\var{parte}$ is congruent (mod $\\var{large_n}$) to the least residue [[0]].

", "variableReplacements": [], "scripts": {}, "marks": 0}], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"lr_e": {"description": "", "definition": "mod(parte,large_n)", "templateType": "anything", "name": "lr_e", "group": "Ungrouped variables"}, "c": {"description": "", "definition": "random(10000..90000)", "templateType": "anything", "name": "c", "group": "Ungrouped variables"}, "lr_b": {"description": "", "definition": "mod(b,10)", "templateType": "anything", "name": "lr_b", "group": "Ungrouped variables"}, "lr_d": {"description": "", "definition": "mod(d,small_n)", "templateType": "anything", "name": "lr_d", "group": "Ungrouped variables"}, "b": {"description": "", "definition": "random(10000..90000)", "templateType": "anything", "name": "b", "group": "Ungrouped variables"}, "a": {"description": "", "definition": "random(2000..9000)", "templateType": "anything", "name": "a", "group": "Ungrouped variables"}, "large_n": {"description": "

large

", "definition": "random(13..99 except 20..100#10)", "templateType": "anything", "name": "large_n", "group": "Ungrouped variables"}, "parte": {"description": "", "definition": "random(3*large_n..12*large_n)", "templateType": "anything", "name": "parte", "group": "Ungrouped variables"}, "lr_a": {"description": "", "definition": "mod(a,2)", "templateType": "anything", "name": "lr_a", "group": "Ungrouped variables"}, "small_n": {"description": "", "definition": "random(3..12 except [5,10])", "templateType": "anything", "name": "small_n", "group": "Ungrouped variables"}, "lr_c": {"description": "", "definition": "mod(c,100)", "templateType": "anything", "name": "lr_c", "group": "Ungrouped variables"}, "d": {"description": "", "definition": "random(3*small_n..12*small_n)", "templateType": "anything", "name": "d", "group": "Ungrouped variables"}}, "extensions": [], "type": "question", "preamble": {"js": "", "css": ""}, "advice": "

One (slow!) way to determine which least residue is congruent to a number, is by repeatedly subtracting off $n$ until the result is one of the numbers from $0$ to $n-1$ (inclusive). A faster way is to divide the number by $n$ and then the remainder is the least residue.

\n

\n

a) We want to determine the remainder when we divide $\\var{a}$ by $2$. Since

\n

$\\var{a}\\div 2=\\var{floor(a/2)}$$\\frac{\\var{lr_a}}{2}$

\n

the remainder, and hence the least residue, is $\\var{lr_a}$.

\n

\n

Note: In the case of mod $2$ the least residue indicates whether the number is odd or even. If the number is even the least residue will be $0$, but if the number is odd the least residue will be $1$!

\n

\n

b) We want to determine the remainder when we divide $\\var{b}$ by $10$. Since

\n

$\\var{b}\\div 10=\\var{floor(b/10)}$$\\frac{\\var{lr_b}}{10}$

\n

the remainder, and hence the least residue, is $\\var{lr_b}$.

\n

\n

Note: In the case of mod $10$ the least residue is simply the last digit of the number!

\n

\n

c) We want to determine the remainder when we divide $\\var{c}$ by $100$. Since

\n

$\\var{c}\\div 100=\\var{floor(c/100)}$$\\frac{\\var{lr_c}}{100}$

\n

the remainder, and hence the least residue, is $\\var{lr_c}$.

\n

\n

Note: In the case of mod $100$ the least residue is simply the last two digits of the number!

\n

\n

d) We want to determine the remainder when we divide $\\var{d}$ by $\\var{small_n}$. Since

\n

$\\var{d}\\div \\var{small_n}=\\var{floor(d/small_n)}$$\\frac{\\var{lr_d}}{\\var{small_n}}$

\n

the remainder, and hence the least residue, is $\\var{lr_d}$.

\n

\n

e) We want to determine the remainder when we divide $\\var{parte}$ by $\\var{large_n}$. Since

\n

$\\var{parte}\\div \\var{large_n}=\\var{floor(parte/large_n)}$$\\frac{\\var{lr_e}}{\\var{large_n}}$

\n

the remainder, and hence the least residue, is $\\var{lr_e}$.

", "statement": "

The set of integers $\\{0, 1, 2,\\ldots, n-1\\}$ is called the set of least residues modulo $n$. 

", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}