// Numbas version: exam_results_page_options {"name": "Rewriting base 10 numbers in other bases", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "preamble": {"js": "", "css": ""}, "variablesTest": {"maxRuns": 100, "condition": ""}, "advice": "

The number $\\var{valueinbase10}$ is written in base $10$, so the place values are all powers of $10$, e.g. $\\ldots 10^3, 10^2, 10^1, 10^0$, also known as $\\ldots 1000, 100, 10, 1$.

\n

Since we want to write this number in base $\\var{b}$, the place values will be powers of $\\var{b}$, that is $\\dots \\var{b}^3, \\var{b}^2, \\var{b}^1,\\var{b}^0$, also known as $\\ldots \\var{b^3}, \\var{b^2}, \\var{b}, 1$.

\n

We now need to determine how many of each of these place values we need to add together in order to get $\\var{valueinbase10}$. We do this by working from largest to smallest.

\n
\n
• Since $\\var{b^3}$ is greater than $\\var{valueinbase10}$ we do not need any of these! (nor any higher powers of $\\var{b}$)
• \n
• {word(hundredsF)} lots of $\\var{b^2}$ fit into $\\var{valueinbase10}$ so the digit for the '$\\var{b^2}$ column' is $\\var{hundredsF}$.\n
\n
• So far our number is $\\var{hundredsF}??_\\var{btext}$ and we have managed to represent $\\var{hundredsF}\\times \\var{b^2}=\\var{hundredsA}$. We now turn our attention to representing the remaining $\\var{valueinbase10}-\\var{hundredsA}=\\var{valueinbase10-hundredsA}$.
• \n
\n
• \n
• {word(tensF)} lots of $\\var{b}$ fit into $\\var{valueinbase10-hundredsA}$ so the digit for the '$\\var{b}$ column' is $\\var{tensF}$.\n
\n
• So far our number is $\\var{hundredsF}\\var{tensF}?_\\var{btext}$ and we have managed to represent $\\var{hundredsF}\\times \\var{b^2}+\\var{hundredsF}\\times \\var{b}=\\var{hundredsA+tensA}$. We now we turn our attention to representing the remaining $\\var{valueinbase10}-\\var{hundredsA+tensA}=\\var{valueinbase10-hundredsA-tensA}$.
• \n
\n
• \n
• {word(units)} lots of $1$ fit into $\\var{valueinbase10-hundredsA-tensA}$ so the digit for the 'units/ones column' is $\\var{units}$.\n
\n
• So now our number is $\\var{hundredsF}\\var{tensF}\\var{units}_\\var{btext}$ and we can say that \$\\var{valueinbase10} = \\var{valueinbaseb}_\\var{btext}. \$
• \n
\n
• \n
\n

\n

\n

\n

\n

", "rulesets": {}, "variable_groups": [{"variables": ["hundredsF", "otherDigits", "listOfDigits"], "name": "try this"}], "variables": {"b": {"group": "Ungrouped variables", "name": "b", "definition": "random(2..9)", "templateType": "anything", "description": ""}, "hundredsA": {"group": "Ungrouped variables", "name": "hundredsA", "definition": "hundredsF*b^2", "templateType": "anything", "description": ""}, "tensF": {"group": "Ungrouped variables", "name": "tensF", "definition": "listOfDigits[1]", "templateType": "anything", "description": ""}, "otherDigits": {"group": "try this", "name": "otherDigits", "definition": "if(b=2,shuffle(0..b-1)[0..2],shuffle(0..b-1 except hundredsF)[0..2])", "templateType": "anything", "description": "

don't want repeated digits unless we really need to (binary)

"}, "tensA": {"group": "Ungrouped variables", "name": "tensA", "definition": "tensF*b", "templateType": "anything", "description": ""}, "units": {"group": "Ungrouped variables", "name": "units", "definition": "listOfDigits[2]", "templateType": "anything", "description": ""}, "hundredsF": {"group": "try this", "name": "hundredsF", "definition": "random(1..b-1)", "templateType": "anything", "description": ""}, "btext": {"group": "Ungrouped variables", "name": "btext", "definition": "switch(b=2,'two', b=3, 'three', b=4, 'four', b=5, 'five', b=6, 'six', b=7,'seven', b=8, 'eight','nine')", "templateType": "anything", "description": ""}, "listOfDigits": {"group": "try this", "name": "listOfDigits", "definition": "[hundredsF]+otherDigits", "templateType": "anything", "description": ""}, "valueinbase10": {"group": "Ungrouped variables", "name": "valueinbase10", "definition": "hundredsA+tensA+units", "templateType": "anything", "description": ""}, "valueinbaseb": {"group": "Ungrouped variables", "name": "valueinbaseb", "definition": "hundredsF*10^2+tensF*10+units", "templateType": "anything", "description": "

This is to get the number to display in base b

Converting base 10 Integers in another base (from 2 to 9)

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "name": "Rewriting base 10 numbers in other bases", "ungrouped_variables": ["b", "valueinbaseb", "hundredsA", "tensF", "tensA", "units", "valueinbase10", "btext"], "extensions": [], "functions": {"word": {"language": "jme", "definition": "switch(r=0, 'Zero', r=1, 'One', r=2,'Two', r=3, 'Three', r=4, 'Four', r=5, 'Five', r=6, 'Six', r=7,'Seven', r=8, 'Eight','Nine')", "type": "string", "parameters": [["r", "number"]]}}, "statement": "

In our usual number system we only have ten digits ($0$ to $9$). We call this the base $10$ system. The place value of numbers are based on the powers of 10.

\n

In the base $\\var{b}$ system we only have $\\var{b}$ digits ($0$ to $\\var{b-1}$) and the place values are based on powers of $\\var{b}$.

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

The base-10 number $\\var{valueinbase10}$ is equal to [[0]]$_\\var{btext}$ in base $\\var{b}$.

"}], "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/"}]}