// Numbas version: finer_feedback_settings {"name": "Mark a number given in a different base system", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Mark a number given in a different base system", "tags": [], "metadata": {"description": "
The student is given a number in base 10 and asked to write it in a given base, between 2 and 16. The number has at most 3 digits in the other base.
\nUntil it's possible to derive the expected answer for a part in the marking algorithm (see the issue tracker), this question has \"show expected answer\" turned off, because it just shows the base 10 number.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "The least-significant base-{base} digit of $\\var{n}$ is
\n\\[ \\simplify{mod({n},{base})} = \\var{mod(n,base)} \\]
\nSubtract this from $\\var{n}$ and divide by $\\var{base}$, then repeat to obtain the next most significant digit.
\nWhen you reach $0$, you have found all the digits.
\nHere's the process in full:
\n$\\var{derivation}$
\nSo $\\var{n}_{10} = \\mathrm{\\var{latex(upper(tobase(n,base)))}}_{\\var{base}}$.
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2*base..base^3-1)", "description": "", "templateType": "anything", "can_override": false}, "base": {"name": "base", "group": "Ungrouped variables", "definition": "random(2..16 except 10)", "description": "", "templateType": "anything", "can_override": false}, "steps": {"name": "steps", "group": "Ungrouped variables", "definition": "iterate_until(\n (a-mod(a,base))/base, \n a,\n n,\n a=0\n)[0..-1]", "description": "The steps of the process $n \\to (n - (n \\mod b)) \\div b$.
", "templateType": "anything", "can_override": false}, "lines": {"name": "lines", "group": "Ungrouped variables", "definition": "map(\n let(\n r, floor(mod(a,base)),\n m, (a-r)/base,\n \"{a} &= {m} \\\\times {base} + {r}\" + if(r>=10,\" & (\\\\mathrm{\"+upper(tobase(r,base))+\"}_{\"+base+\"})\",\"\")\n ),\n a,\n steps\n)", "description": "Lines showing the derivation of the digits: the digits are the produced remainders, in reverse order.
", "templateType": "anything", "can_override": false}, "derivation": {"name": "derivation", "group": "Ungrouped variables", "definition": "latex(\n safe(\"\\\\begin{align}\\n\")\n + join(lines,\"\\\\\\\\\\n\")\n + safe(\"\\\\end{align}\")\n)", "description": "A LaTeX rendering of the derivation of the digits.
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["base", "n", "steps", "lines", "derivation"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "studentNumber (The student's answer, parsed as a number):\n frombase(studentAnswer,base)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write $\\var{n}_{10}$ in base $\\var{base}$.
", "minValue": "n", "maxValue": "n", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}