// Numbas version: finer_feedback_settings {"name": "Factorise a number", "extensions": ["stats"], "custom_part_types": [{"source": {"pk": 1, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/1/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "
The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Factorise a number", "tags": [], "metadata": {"description": "An example of an iterative procedure: the student must factorise a given number. At each step, they're asked if the number is factorised. If not, they must give a prime factor. If it is fully factorised, they can then work out the number of factors of the number.This is advice.
", "rulesets": {}, "extensions": ["stats"], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "prod(actual_factors)", "description": "The number to factorise.
", "templateType": "anything"}, "factors": {"name": "factors", "group": "Ungrouped variables", "definition": "[]", "description": "The prime factors entered by the student.
", "templateType": "anything"}, "fully_factorised": {"name": "fully_factorised", "group": "Ungrouped variables", "definition": "all(map(mod(current_n,k)<>0,k,2..floor(sqrt(current_n))))", "description": "Is the number fully factorised? True if no integer between 2 and $\\sqrt{\\texttt{current_n}}$ divides current_n
, so it's prime.
The part of $n$ still left to factorise.
", "templateType": "anything"}, "weighted_primes": {"name": "weighted_primes", "group": "Ungrouped variables", "definition": "[2,2,2,2,3,3,3,5,5,7,11]", "description": "A list of prime numbers, weighted so smaller primes are picked more often
", "templateType": "anything"}, "num_factors": {"name": "num_factors", "group": "Ungrouped variables", "definition": "prod(map(len(filter(x=k,x,actual_factors))+1,k,set(actual_factors)))", "description": "The number of factors of $n$.
", "templateType": "anything"}, "actual_factors": {"name": "actual_factors", "group": "Ungrouped variables", "definition": "repeat(random(weighted_primes),3)", "description": "Pick three (not necessarily unique) prime factors for $n$.
", "templateType": "anything"}, "factorisation_latex": {"name": "factorisation_latex", "group": "Ungrouped variables", "definition": "latex(current_n+if(len(factors),' \\\\times '+join(factors,' \\\\times '),''))", "description": "LaTeX expression showing the current statre of the factorisation.
", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["weighted_primes", "actual_factors", "n", "factors", "fully_factorised", "current_n", "num_factors", "factorisation_latex"], "variable_groups": [], "functions": {"isprime": {"parameters": [["n", "number"]], "type": "boolean", "language": "jme", "definition": "n>=2 and isint(n) and all(map(mod(n,k)>0,k,2..floor(sqrt(n))))"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "yes-no", "useCustomName": true, "customName": "Is it factorised?", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Write a factor", "rawLabel": "", "otherPart": 1, "variableReplacements": [], "availabilityCondition": "not interpreted_answer", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}, {"label": "How many factors?", "rawLabel": "", "otherPart": 2, "variableReplacements": [], "availabilityCondition": "interpreted_answer", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Is $\\var{n} = \\var{factorisation_latex}$ fully factorised?
", "settings": {"correct_answer_expr": "fully_factorised"}}, {"type": "numberentry", "useCustomName": true, "customName": "Write a factor", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "is_factor:\n if(mod(current_n,studentNumber)=0,\n if(isprime(studentNumber),\n correct()\n ,\n set_credit(0.5,\"Your answer is a factor of {current_n} but is not prime.\")\n )\n ,\n incorrect(\"Your answer is not a factor of {current_n}\")\n )\n \n\nmark (Mark the student's answer):\n apply(validNumber);\n apply(is_factor)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Is it factorised?", "rawLabel": "", "otherPart": 0, "variableReplacements": [{"variable": "factors", "definition": "factors+[interpreted_answer]"}], "availabilityCondition": "answered and credit=1", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Identify the factors of $\\var{n}$", "prompt": "Write a prime factor of $\\var{current_n}$.
", "minValue": "1", "maxValue": "1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "How many factors?", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Calculate how many factors", "prompt": "How many factors does $\\var{n} = \\var{factorisation_latex}$ have?
", "minValue": "num_factors", "maxValue": "num_factors", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "explore", "maxMarks": "4", "objectives": [{"name": "Identify the factors of $\\var{n}$", "limit": "3", "mode": "sum"}, {"name": "Calculate how many factors", "limit": "2", "mode": "sum"}], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}