// Numbas version: finer_feedback_settings {"name": "Legendre symbol", "extensions": [], "custom_part_types": [{"source": {"pk": 4, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/4/edit"}, "name": "Number entry modulo", "short_name": "number-entry-modulo", "description": "

The student's answer should be equivalent to the expected answer modulo the base set by the question author.

", "help_url": "", "input_widget": "number", "input_options": {"correctAnswer": "string(mod(settings[\"expected\"],settings[\"modulo\"]))", "hint": {"static": false, "value": "if(settings[\"show_hint\"], \"$\\\\pmod{\"+settings[\"modulo\"]+\"}$\", \"\")"}, "allowedNotationStyles": {"static": true, "value": ["plain", "en", "si-en"]}, "allowFractions": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\ncorrectif(interpreted_answer = expected_modulo)\n\ninterpreted_answer:\nmod(studentanswer,settings[\"modulo\"])\n\nexpected_modulo:\nmod(settings[\"expected\"],settings[\"modulo\"])", "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": "correctif(interpreted_answer = expected_modulo)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "mod(studentanswer,settings[\"modulo\"])"}, {"name": "expected_modulo", "description": "

The expected answer, modulo the base.

", "definition": "mod(settings[\"expected\"],settings[\"modulo\"])"}], "settings": [{"name": "expected", "label": "Expected answer", "help_url": "", "hint": "

Answers congruent to this number, modulo the base defined below, will be marked correct.

", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "modulo", "label": "Base", "help_url": "", "hint": "Answers are compared modulo this number.", "input_type": "code", "default_value": "10", "evaluate": true}, {"name": "show_hint", "label": "Show modulo hint?", "help_url": "", "hint": "If ticked, $\\pmod{\\texttt{base}}$ will be shown to the right of the input box.", "input_type": "checkbox", "default_value": true}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Legendre symbol", "tags": ["mathematics", "number theory", "Number theory", "pure"], "metadata": {"description": "

Asks students to calculate a Legendre symbol.

", "licence": "All rights reserved"}, "statement": "

This question asks you to calculate a Legendre Symbol.

", "advice": "", "rulesets": {}, "extensions": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(-100..100)", "description": "

top of the Legendre symbol

", "templateType": "anything"}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "\nrandom(3,5,7,11,13,17,19)", "description": "

Randomised odd prime.

", "templateType": "anything"}, "LS": {"name": "LS", "group": "Ungrouped variables", "definition": "Legendre(a,p)", "description": "

The solution

", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "p", "LS"], "variable_groups": [], "functions": {"Legendre": {"parameters": [["a", "number"], ["p", "number"]], "type": "number", "language": "javascript", "definition": "//calculate the LS\nout = math.pow(a,((p-1)/2)) % p;\n// get this into the form +-1/0\nwhile (out > 1 || out < -1) {\n if (out > 1) {\n out = out - p;\n }\n if (out < -1) {\n out = out + p;\n }\n}\nreturn out;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "number-entry-modulo", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the Legendre Symbol $(\\frac{\\var{a}}{\\var{p}})$

", "alternatives": [{"type": "number-entry-modulo", "useCustomName": true, "customName": "Correctmodp", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

Remember to reduce mod p. Your answer should be -1, 0 or 1.

", "useAlternativeFeedback": false, "settings": {"expected": "LS", "modulo": "p", "show_hint": false}}], "settings": {"expected": "LS", "modulo": "200", "show_hint": false}}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Will Foreman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7659/"}]}]}], "contributors": [{"name": "Will Foreman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7659/"}]}