// Numbas version: exam_results_page_options {"name": "Merryn's copy of Subtraction", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Merryn's copy of Subtraction", "tags": ["algorithms", "minus", "subtracting", "subtraction", "take away"], "metadata": {"description": "

The subtraction algortihm using the borrow and pay back method with integers.

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

Write the following question down on paper and evaluate it without using a calculator using any method you choose.

\n

If you click on Show steps you will see full working using the standard algorithm. Click on Try another question like this one to get a new pair of numbers.

", "advice": "", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"newtopten": {"name": "newtopten", "group": "c", "definition": "if(unitdiff>=0,top[1],top[1]-1)", "description": "", "templateType": "anything", "can_override": false}, "ansunit": {"name": "ansunit", "group": "c", "definition": "mod(ans,10)", "description": "", "templateType": "anything", "can_override": false}, "hundiff": {"name": "hundiff", "group": "c", "definition": "if(tendiff>=0,top[2]-bot[2],top[2]-1-bot[2])", "description": "", "templateType": "anything", "can_override": false}, "botnum": {"name": "botnum", "group": "c", "definition": "bot[0]+bot[1]*10+bot[2]*100", "description": "", "templateType": "anything", "can_override": false}, "ansten": {"name": "ansten", "group": "c", "definition": "mod(floor(ans/10),10)", "description": "", "templateType": "anything", "can_override": false}, "tendiff": {"name": "tendiff", "group": "c", "definition": "if(unitdiff>=0,top[1]-bot[1],top[1]-1-bot[1])", "description": "", "templateType": "anything", "can_override": false}, "unitdiff": {"name": "unitdiff", "group": "c", "definition": "top[0]-bot[0]", "description": "", "templateType": "anything", "can_override": false}, "bot": {"name": "bot", "group": "c", "definition": "random(\nif(top[0]<9,[random(top[0]+1..9), random(top[1]..9), random(1..top[2]-1)],\n if(top[1]<9,[random(top[0]..9), random(top[1]+1..9), random(1..top[2]-1)],\"error\")),\nif(top[1]<9,[random(0..top[0]), random(top[1]+1..9), random(1..top[2]-1)],\n if(top[1]=9,[random(top[0]..9), random(0..9), random(1..top[2]-1)],\"error\"))\n)\n", "description": "

This should force some borrowing and paying back, and that the final answer is positive.

", "templateType": "anything", "can_override": false}, "newtophun": {"name": "newtophun", "group": "c", "definition": "if(tendiff>=0,top[2],top[2]-1)", "description": "", "templateType": "anything", "can_override": false}, "topnum": {"name": "topnum", "group": "c", "definition": "top[0]+top[1]*10+top[2]*100", "description": "", "templateType": "anything", "can_override": false}, "anshun": {"name": "anshun", "group": "c", "definition": "mod(floor(ans/100),10)", "description": "", "templateType": "anything", "can_override": false}, "ans": {"name": "ans", "group": "c", "definition": "topnum-botnum", "description": "", "templateType": "anything", "can_override": false}, "top": {"name": "top", "group": "c", "definition": "random([random(0..9),random(1..8),random(2..9)],[random(0..8),random(1..9),random(2..9)])", "description": "

Borrowing from the hundreds to do the units is not covered with this randomisation. We will do that in another part.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "c", "variables": ["top", "bot", "topnum", "botnum", "ans", "unitdiff", "tendiff", "hundiff", "ansunit", "ansten", "anshun", "newtopten", "newtophun"]}], "functions": {}, "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": "

$\\var{topnum}-\\var{botnum} = $ [[0]]

", "stepsPenalty": "1", "steps": [{"type": "information", "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": "

Generally we set up $\\var{topnum}-\\var{botnum}$ with the ones, tens and hundreds columns lined up vertically:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{top[2]}$$\\var{top[1]}$$\\var{top[0]}$$-$
$\\var{bot[2]}$$\\var{bot[1]}$$\\var{bot[0]}$
$\\phantom{0}$
\n

\n

Now we try to subtract the digits in the ones column.

\n

Since this is $\\var{ansunit}$ we write $\\var{ansunit}$ under the line in the ones column.

\n

Since we can't take $\\var{bot[0]}$ away from $\\var{top[0]}$ (without using negative numbers) we borrow a ten from the tens column. This means we cross out the $\\var{top[1]}$ in the tens column and replace it with a $\\var{top[1]-1}$, and the $\\var{top[0]}$ becomes a $\\var{10+top[0]}$. Now we can do $\\var{10+top[0]}-\\var{bot[0]}$, and write the result, $\\var{ansunit}$, under the line in the ones column. 

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\overset{\\phantom{1}}{\\var{top[2]}}$$\\overset{\\color{red}{\\var{newtopten}}}{\\var{top[1]}\\mkern-7.5mu\\color{red}/}$ $\\overset{\\phantom{1}}{\\var{top[1]}}$$\\color{red}{^1}\\overset{\\phantom{1}}{\\var{top[0]}}$ $\\overset{\\phantom{1}}{\\var{top[0]}}$$-$
$\\var{bot[2]}$$\\var{bot[1]}$$\\var{bot[0]}$
$\\color{red}{\\var{ansunit}}$
\n

\n

Now we try to subtract the digits in the tens column.

\n

Since this is $\\var{ansten}$ we write $\\var{ansten}$ under the line in the tens column.

\n

Since we can't take $\\var{bot[1]}$ away from $\\var{newtopten}$ (without using negative numbers) we borrow a hundred from the hundred column. This means we cross out the $\\var{top[2]}$ in the hundreds column and replace it with a $\\var{top[2]-1}$, and the $\\var{newtopten}$ in the tens column becomes a $\\var{10+newtopten}$. Now we can do $\\var{10+newtopten}-\\var{bot[1]}$, and write the result, $\\var{ansten}$, under the line in the tens column. 

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

$\\overset{\\color{red}{\\var{newtophun}}}{\\var{top[2]}\\mkern-7.5mu\\color{red}{/}}$ $\\overset{\\phantom{1}}{\\var{top[2]}}$

\n
\n

$\\overset{\\color{red}{1}\\var{newtopten}}{\\var{top[1]}\\mkern-7.5mu/}$ $\\overset{\\var{newtopten}}{\\var{top[1]}\\mkern-7.5mu/}$ $\\color{red}{^1}\\overset{\\phantom{1}}{\\var{top[1]}}$ $\\overset{\\phantom{1}}{\\var{top[1]}}$

\n
${^1}\\overset{\\phantom{1}}{\\var{top[0]}}$ $\\overset{\\phantom{1}}{\\var{top[0]}}$$-$
$\\var{bot[2]}$$\\var{bot[1]}$$\\var{bot[0]}$
$\\color{red}{\\var{ansten}}$$\\var{ansunit}$
\n

\n

Now we try to subtract the digits in the hundreds column.

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

$\\overset{\\var{newtophun}}{\\var{top[2]}\\mkern-7.5mu/}$ $\\overset{\\phantom{1}}{\\var{top[2]}}$

\n
\n

$\\overset{{1}\\var{newtopten}}{\\var{top[1]}\\mkern-7.5mu/}$ $\\overset{\\var{newtopten}}{\\var{top[1]}\\mkern-7.5mu/}$ ${^1}\\overset{\\phantom{1}}{\\var{top[1]}}$ $\\overset{\\phantom{1}}{\\var{top[1]}}$

\n
${^1}\\overset{\\phantom{1}}{\\var{top[0]}}$ $\\overset{\\phantom{1}}{\\var{top[0]}}$$-$
$\\var{bot[2]}$$\\var{bot[1]}$$\\var{bot[0]}$
$\\color{red}{\\var{anshun}}$$\\var{ansten}$$\\var{ansunit}$
\n

\n

The answer is therefore $\\var{ans}$.

"}], "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": "ans", "maxValue": "ans", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}