// Numbas version: finer_feedback_settings {"name": "Arithmetic sequences in an ice cream shop", "extensions": ["random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "variable_groups": [], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "
Given the common difference and first term of an arithmetic sequence, work out the index of the nth term of the sequence.
\nFramed as a word problem with ticket numbers in an ice cream shop.
"}, "tags": ["arithmetic sequence", "calculate the term number", "common difference", "nth term", "sequences", "taxonomy"], "functions": {}, "name": "Arithmetic sequences in an ice cream shop", "ungrouped_variables": ["index", "d", "person"], "parts": [{"variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "steps": [{"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "information", "prompt": "Use the arithmetic formula,
\n\\[a_n = a_1 + (n-1)d \\]
\nwhere
$a_n$ - The n$^{th}$ term in an arithmetic sequence
$a_1$ - The $1^{st}$ term in an arithmetic sequence
$n$ - Term number
$d$ - The common difference.
For this arithmetic sequence, what is $a_1$?
", "correctAnswerFraction": false, "maxValue": "1"}, {"variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "{d}", "scripts": {}, "marks": 1, "allowFractions": false, "type": "numberentry", "prompt": "What is $d$?
", "correctAnswerFraction": false, "maxValue": "{d}"}], "mustBeReduced": false, "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "index", "scripts": {}, "marks": "3", "allowFractions": false, "stepsPenalty": 0, "type": "numberentry", "prompt": "How many customers before {person['name']} have tried the strawberry ice-cream?
", "correctAnswerFraction": false, "maxValue": "index"}], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"person": {"description": "", "definition": "random_person()", "name": "person", "templateType": "anything", "group": "Ungrouped variables"}, "index": {"description": "", "definition": "random(14..34 except [20, 21, 22, 30, 31, 32, 40])", "name": "index", "templateType": "anything", "group": "Ungrouped variables"}, "d": {"description": "", "definition": "random(6..12 except 10)", "name": "d", "templateType": "anything", "group": "Ungrouped variables"}}, "extensions": ["random_person"], "type": "question", "preamble": {"js": "", "css": ""}, "advice": "We know that every $\\var{d}^{\\text{th}}$ ticket after the first receives strawberry ice cream. So, the sequence of ticket numbers which get strawberry ice cream starts like this:
\n\\[ 1, \\var{d+1}, \\var{2d+1}, \\var{3d+1}, \\ldots \\]
\nThe numbers on the tickets for strawberry ice cream form an arithmetic sequence: the first term is $1$ and the common difference is $\\var{d}$.
\nWe can write down a formula for the $n^{\\text{th}}$ term in this sequence and rearrange it to find how many customers received strawberry ice cream before {person['name']}.
\nThe general formula for an arithmetic sequence is
\n\\[a_n = a_1 + (n-1)d \\]
\nwhere
\nWe know that $a_n = \\var{1+d*index}$, $a_1 = 1$, and $d = \\var{d}$, and we want to find $n$.
\nSubstituting these values from the formula gives
\n\\begin{align}
a_n &= a_1 + (n-1)d \\\\
\\var{1+d*index} &= 1 + (n -1)\\var{d}\\,.
\\end{align}
Now we rearrange this to find $n$:
\n\\begin{align}
\\var{1+d*index-1} &= \\var{d}n - \\var{d} \\\\
\\var{d*index +d} &= \\var{d}n \\\\
n &= \\var{(d*index + d)/d}.
\\end{align}
This is the number of people who received strawberry ice cream up to and including {person['name']}. Removing {person['name']} leaves $\\var{index}$ customers who received strawberry ice cream before {person['name']} did.
", "statement": "When customers enter an ice cream shop they receive a numbered ticket for a free sample.
\nThere are $\\var{d}$ flavours of ice cream that the shop alternates through sequentially.
\nThe first ticket was number $1$ and the person with this ticket received strawberry ice cream.
\n{person['name']} was given ticket number $\\var{1+d*(index)}$ and also received strawberry ice cream.
", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}