// 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": [{"variable_groups": [], "functions": {}, "statement": "

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

", "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}$.

", "rulesets": {}, "parts": [{"type": "gapfill", "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

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

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

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

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

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

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

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

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

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

", "variableReplacements": [], "gaps": [{"notationStyles": ["plain", "en", "si-en"], "scripts": {}, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "maxValue": "lr_e", "minValue": "lr_e", "type": "numberentry", "showCorrectAnswer": true, "allowFractions": false, "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 1, "mustBeReduced": false}], "marks": 0, "variableReplacementStrategy": "originalfirst", "scripts": {}}], "name": "Modulo arithmetic: the least residue of a given number", "variables": {"small_n": {"description": "", "group": "Ungrouped variables", "definition": "random(3..12 except [5,10])", "name": "small_n", "templateType": "anything"}, "lr_e": {"description": "", "group": "Ungrouped variables", "definition": "mod(parte,large_n)", "name": "lr_e", "templateType": "anything"}, "lr_a": {"description": "", "group": "Ungrouped variables", "definition": "mod(a,2)", "name": "lr_a", "templateType": "anything"}, "a": {"description": "", "group": "Ungrouped variables", "definition": "random(2000..9000)", "name": "a", "templateType": "anything"}, "lr_b": {"description": "", "group": "Ungrouped variables", "definition": "mod(b,10)", "name": "lr_b", "templateType": "anything"}, "parte": {"description": "", "group": "Ungrouped variables", "definition": "random(3*large_n..12*large_n)", "name": "parte", "templateType": "anything"}, "lr_c": {"description": "", "group": "Ungrouped variables", "definition": "mod(c,100)", "name": "lr_c", "templateType": "anything"}, "large_n": {"description": "

large

", "group": "Ungrouped variables", "definition": "random(13..99 except 20..100#10)", "name": "large_n", "templateType": "anything"}, "c": {"description": "", "group": "Ungrouped variables", "definition": "random(10000..90000)", "name": "c", "templateType": "anything"}, "b": {"description": "", "group": "Ungrouped variables", "definition": "random(10000..90000)", "name": "b", "templateType": "anything"}, "lr_d": {"description": "", "group": "Ungrouped variables", "definition": "mod(d,small_n)", "name": "lr_d", "templateType": "anything"}, "d": {"description": "", "group": "Ungrouped variables", "definition": "random(3*small_n..12*small_n)", "name": "d", "templateType": "anything"}}, "ungrouped_variables": ["a", "lr_a", "b", "lr_b", "c", "lr_c", "small_n", "d", "lr_d", "large_n", "parte", "lr_e"], "extensions": [], "metadata": {"description": "

determine the least residue mod n of a given number.

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "preamble": {"css": "", "js": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "tags": [], "type": "question", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}