// Numbas version: exam_results_page_options {"name": "Show all the factors of a number", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "rulesets": {}, "variables": {"factors": {"definition": "filter(x|n, x, 1..n)", "group": "Ungrouped variables", "description": "", "templateType": "anything", "name": "factors"}, "n": {"definition": "random(10000..20000)", "group": "Ungrouped variables", "description": "", "templateType": "anything", "name": "n"}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Show a list of the factors of a number.

\n

Works by testing each number up to $n$ for divisibility by $n$, so won't do well with really big numbers. Certainly fast enough for numbers up to 4 or 5 digits.

"}, "functions": {"join_and": {"definition": "if(len(list)=1, join(list,''), join(list[0..len(list)-1],', ')+' and '+list[-1])", "type": "string", "language": "jme", "parameters": [["list", "list"]]}}, "name": "Show all the factors of a number", "advice": "", "tags": [], "preamble": {"css": "", "js": ""}, "ungrouped_variables": ["n", "factors"], "statement": "

The factors of $\\var{n}$ are $\\var{latex(join(factors,', '))}$.

\n

Or, if you want to be fancy: the factors of $\\var{n}$ are {join_and(map('\\$'+x+'\\$',x,factors))}.

", "parts": [], "extensions": [], "type": "question", "variable_groups": [], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}