// Numbas version: exam_results_page_options {"name": "Base Conversion to base 10", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Base Conversion to base 10", "tags": [], "metadata": {"description": "

Convert a number given in base 10 to a different base.

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

Convert {b} from base {n} to base 10.

", "advice": "

To solve this problem you can just multiply each digit by the corresponding powers of {n}:

\n

{Advice}

\n

Then, using the remainders, we find that $\\var{b}_{\\var{n}} = \\var{a}_{10}$.

", "rulesets": {}, "extensions": [], "variables": {"a": {"name": "a", "group": "Problem parameters", "definition": "random(n^3..n^4)", "description": "

This number is in base 10 and the problem is to find it given its representation in base {n}.

", "templateType": "anything"}, "n": {"name": "n", "group": "Problem parameters", "definition": "random(2 .. 9#1)", "description": "

Base to which to convert the number {a}.

", "templateType": "randrange"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "convertToBase(a,n)", "description": "", "templateType": "anything"}, "advice": {"name": "advice", "group": "Ungrouped variables", "definition": "getAdvice(a,n)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["b", "advice"], "variable_groups": [{"name": "Problem parameters", "variables": ["n", "a"]}], "functions": {"convertToBase": {"parameters": [["a", "number"], ["n", "number"]], "type": "number", "language": "javascript", "definition": "x = a\nb = 0\ni = 0\nwhile (x!=0) {\n r = x%n\n b = b + r*10**i\n i = i+1\n x = Math.floor(x/n)\n}\nreturn b"}, "getAdvice": {"parameters": [["a", "number"], ["n", "number"]], "type": "html", "language": "javascript", "definition": "x = a\nb = 0\ni = 0\nL=\"$$\"\nwhile (x!=0) {\n r = x%n\n b = b + r*10**i\n L = r + \"\\\\cdot \" + n + \"^{\" + i + \"}\" + L\n i = i+1\n x = Math.floor(x/n)\n if (x!=0) L = \"+\" + L\n}\nL = \"=\" + a + \"$$\" + L\nreturn L"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{b}{n} = [[0]]10

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "a", "maxValue": "a", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}]}]}], "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}]}