// Numbas version: exam_results_page_options {"name": "Lowest common multiples: train timetable example", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"extensions": [], "rulesets": {}, "name": "Lowest common multiples: train timetable example", "functions": {"newtime": {"parameters": [["minutes", "number"]], "language": "javascript", "type": "string", "definition": "var newdate = new Date(1970,1,1,12,minutes,00);\nmins = (newdate.getMinutes() < 10) ? (\"0\" + newdate.getMinutes()) : newdate.getMinutes();\nhrs = newdate.getHours();\nreturn hrs+':'+mins\n"}}, "ungrouped_variables": ["c", "d", "lcm1"], "metadata": {"description": "

Two trains arrive at the same platform with different periods. Compute the LCM of the two periods to find the time they clash.

\n

This is a context question testing the student's ability to identify the lowest common multiple of two integer values which are not multiples of each other.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "variable_groups": [], "advice": "

Trains intended for platform A arrive at every multiple of \$\\var{c}\$ minutes after midday. Trains intended for platform B arrive at every multiple of \$\\var{d}\$ minutes after midday. There will be a clash when these times coincide.

\n

The first such time is the lowest common multiple of \$\\var{c}\$ and \$\\var{d}\$.

\n

To calculate the lowest common multiple of two numbers, you first need to calculate a list of common multiples for the individual numbers and then look for numbers that appear in both lists.

\n

Multiples of \$\\var{c}\$ are \$\\var{c}, \\var{2c}, \\var{3c}, \\var{4c}, \\var{5c}\$, \$\\var{6c}\$, \$\\var{7c}\$, \$\\var{8c}\$, \$\\var{9c}\$, \$\\var{10c}\$, \$\\var{11c}\$, \$\\var{12c}\$...

\n

Multiples of \$\\var{d}\$ are \$\\var{d}, \\var{2d}, \\var{3d}, \\var{4d}, \\var{5d}\$, \$\\var{6d}\$, \$\\var{7d}\$, \$\\var{8d}\$, \$\\var{9d}\$, \$\\var{10d}\$, \$\\var{11d}\$, \$\\var{12d}\$...

\n

The first number which appears in both lists is \$\\var{lcm1}\$. This is the lowest common multiple of \$\\var{c}\$ and \$\\var{d}\$.

\n

This means that there will be a clash in the arrival timetable at {newtime(lcm1)}, \$\\var{lcm1}\$ minutes after midday.

", "statement": "

A small train station hosts 2 north-bound platforms, platforms A and B.

\n

Scheduled trains arrive at platform A every \$\\var{c}\$ minutes, and at platform B every \$\\var{d}\$ minutes. The trains arrive and depart in less than a minute.

\n

At midday, trains arrive simultaneously at both platforms. Immediately after they depart, an electrical fault causes platform A to become unusable and the entirety of the arriving trains are diverted to arrive at platform B.

", "preamble": {"js": "", "css": ""}, "variables": {"c": {"templateType": "anything", "description": "", "name": "c", "group": "Ungrouped variables", "definition": "random(8..11)"}, "lcm1": {"templateType": "anything", "description": "", "name": "lcm1", "group": "Ungrouped variables", "definition": "lcm(c,d)"}, "d": {"templateType": "anything", "description": "", "name": "d", "group": "Ungrouped variables", "definition": "random(6..11 except c)"}}, "parts": [{"variableReplacementStrategy": "originalfirst", "prompt": "

How long after midday will it be before there is a clash in the arrival timetable?

\n

[[0]] minutes

", "gaps": [{"variableReplacementStrategy": "originalfirst", "marks": "3", "scripts": {}, "correctAnswerStyle": "plain", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "lcm1", "allowFractions": false, "minValue": "lcm1", "mustBeReduced": false, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0}], "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "type": "gapfill", "marks": 0, "scripts": {}}], "tags": ["lowest common multiples", "taxonomy"], "variablesTest": {"maxRuns": 100, "condition": ""}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Lauren Richards", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1589/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Lauren Richards", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1589/"}]}