{
  "index": "1991-B-5",
  "type": "NT",
  "tag": [
    "NT",
    "ALG"
  ],
  "difficulty": "",
  "question": "Let $p$ be an odd prime and let $\\Z_p$ denote (the field of) integers\nmodulo $p$. How many elements are in the set\n\\[\n\\{x^2: x \\in \\Z_p\\} \\cap \\{y^2 + 1 : y \\in \\Z_p\\}?\n\\]",
  "solution": "Solution 1. Let \\( S \\) be the set of solutions to \\( x^{2}=y^{2}+1 \\) over \\( \\mathbb{F}_{p} \\). The linear change of coordinates \\( (u, v)=(x+y, x-y) \\) is invertible since \\( \\operatorname{det}\\left(\\begin{array}{cc}1 & 1 \\\\ 1 & -1\\end{array}\\right)=-2 \\) is nonzero in \\( \\mathbb{F}_{p} \\). Hence \\( |S| \\) equals the number of solutions to \\( u v=1 \\) over \\( \\mathbb{F}_{p} \\). There is one possible \\( v \\) for each nonzero \\( u \\), and no \\( v \\) for \\( u=0 \\), so \\( |S|=p-1 \\).\n\nThe problem asks for the size of the image of the map \\( \\phi: S \\rightarrow \\mathbb{F}_{p} \\) taking \\( (x, y) \\) to \\( x^{2} \\). If \\( z=x^{2} \\) for some \\( (x, y) \\in S \\), then \\( \\phi^{-1}(z)=\\{( \\pm x, \\pm y)\\} \\), which has size 4 , except in the cases \\( z=1 \\) (in which case \\( x= \\pm 1 \\) and \\( y=0 \\), making \\( \\phi^{-1}(z) \\) of size 2 ) and \\( z=0 \\) (in which case \\( x=0 \\) and \\( y^{2}=-1 \\), again making \\( \\phi^{-1}(z) \\) of size 2); the latter exception occurs if and only if -1 is a square in \\( \\mathbb{F}_{p} \\). Hence \\( |S|=4|\\phi(S)|-2-2 c \\), where \\( c \\) is 1 or 0 according as -1 is a square in \\( \\mathbb{F}_{p} \\) or not. Thus the answer to the problem is\n\\[\n|\\phi(S)|=\\frac{(p-1)+2+2 c}{4}=\\frac{p+1+2 c}{4} .\n\\]\n\nThis should be an integer, so \\( c=1 \\) if \\( p \\equiv 1(\\bmod 4) \\) and \\( c=0 \\) if \\( p \\equiv 3(\\bmod 4) \\). In either case, \\( |\\phi(S)|=\\lceil p / 4\\rceil \\) as claimed.\n\nSolution 2. We use the Legendre symbol, defined by\n\\[\n\\left(\\frac{a}{p}\\right)=\\left\\{\\begin{array}{ll}\n1, & \\text { if } a \\equiv k^{2} \\quad(\\bmod p) \\text { for some } k \\not \\equiv 0 \\quad(\\bmod p) \\\\\n0, & \\text { if } a \\equiv 0 \\quad(\\bmod p) \\\\\n-1, & \\text { otherwise }\n\\end{array}\\right.\n\\]\n\nThe number of nonzero squares in \\( \\mathbb{F}_{p} \\) equals the number of nonsquares, so\n\\[\n\\sum_{a=0}^{p-1}\\left(\\frac{a-k}{p}\\right)=0\n\\]\nfor any \\( k \\in \\mathbb{Z} \\).\nIn this solution only, if \\( P \\) is a statement, let \\( [P] \\) be 1 if \\( P \\) is true, and 0 if \\( P \\) is false. Let \\( \\mathbb{F}_{p}^{2} \\) denote the set of squares in \\( \\mathbb{F}_{p} \\), including 0 . The problem asks us to compute\n\\[\nN=\\sum_{a=0}^{p-1}\\left[a \\in \\mathbb{F}_{p}^{2}\\right] \\cdot\\left[a-1 \\in \\mathbb{F}_{p}^{2}\\right]\n\\]\n\nSubstituting the identity\n\\[\n\\left[a \\in \\mathbb{F}_{p}^{2}\\right]=\\frac{1}{2}\\left(1+\\left(\\frac{a}{p}\\right)+[a=0]\\right)\n\\]\nwe obtain\n\\[\n\\begin{aligned}\nN & =\\frac{1}{4}\\left(1+\\left(\\frac{-1}{p}\\right)+1+\\left(\\frac{1}{p}\\right)+\\sum_{a=0}^{p-1}\\left(1+\\left(\\frac{a}{p}\\right)\\right)\\left(1+\\left(\\frac{a-1}{p}\\right)\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{p}\\right)=1\\right]+\\frac{1}{2}+\\frac{1}{4} \\sum_{a=0}^{p-1}\\left(1+\\left(\\frac{a}{p}\\right)+\\left(\\frac{a-1}{p}\\right)+\\left(\\frac{a}{p}\\right)\\left(\\frac{a-1}{p}\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{p}\\right)=1\\right]+\\frac{1}{2}+\\frac{p}{4}+\\frac{1}{4} \\sum_{a=0}^{p-1}\\left(\\frac{a}{p}\\right)\\left(\\frac{a-1}{p}\\right),\n\\end{aligned}\n\\]\nby (1) twice. For \\( k \\in \\mathbb{Z} \\), let \\( S(k)=\\sum_{a=0}^{p-1}\\left(\\frac{a}{p}\\right)\\left(\\frac{a-k}{p}\\right) \\). We want \\( S(1) \\). For \\( k \\) not divisible by \\( p \\), the substitution \\( a=k b \\), with \\( b \\) running over the residue classes modulo \\( p \\), shows that\n\\[\n\\begin{aligned}\nS(k) & =\\sum_{b=0}^{p-1}\\left(\\frac{k}{p}\\right)\\left(\\frac{b}{p}\\right)\\left(\\frac{k}{p}\\right)\\left(\\frac{b-1}{p}\\right) \\\\\n& =\\sum_{b=0}^{p-1}\\left(\\frac{b}{p}\\right)\\left(\\frac{b-1}{p}\\right) \\quad\\left(\\text { since }\\left(\\frac{k}{p}\\right)^{2}=1\\right) \\\\\n& =S(1)\n\\end{aligned}\n\\]\n\nAlso,\n\\[\n\\sum_{k=0}^{p-1} S(k)=\\sum_{a=0}^{p-1}\\left(\\frac{a}{p}\\right) \\sum_{k=0}^{p-1}\\left(\\frac{a-k}{p}\\right)=0\n\\]\nsince each inner sum is zero by (1). Thus\n\\[\nS(1)=-\\frac{S(0)}{p-1}=-\\frac{p-1}{p-1}=-1\n\\]\n\nHence\n\\[\nN=\\frac{1}{2}\\left[\\left(\\frac{-1}{p}\\right)=1\\right]+\\frac{p+1}{4} .\n\\]\n\nBut \\( N \\) is an integer. Thus if \\( p \\equiv 1(\\bmod 4) \\), then \\( \\left(\\frac{-1}{p}\\right)=1 \\) and \\( N=(p+3) / 4 \\); if \\( p \\equiv 3(\\bmod 4) \\), then \\( \\left(\\frac{-1}{p}\\right)=-1 \\) and \\( N=(p+1) / 4 \\).",
  "vars": [
    "a",
    "b",
    "k",
    "N",
    "P",
    "S",
    "u",
    "v",
    "x",
    "y",
    "z"
  ],
  "params": [
    "c",
    "p",
    "Z_p",
    "F_p"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "a": "elementa",
        "b": "elementb",
        "k": "elementk",
        "N": "countn",
        "P": "predicatep",
        "S": "solutionset",
        "u": "coordu",
        "v": "coordv",
        "x": "coordx",
        "y": "coordy",
        "z": "coordz",
        "c": "parityflag",
        "p": "primep",
        "Z_p": "integersmodprime",
        "F_p": "fieldmodprime"
      },
      "question": "Let $primep$ be an odd prime and let $integersmodprime$ denote (the field of) integers modulo $primep$. How many elements are in the set\n\\[\n\\{coordx^2: coordx \\in integersmodprime\\} \\cap \\{coordy^2 + 1 : coordy \\in integersmodprime\\}?\n\\]",
      "solution": "Solution 1. Let \\( solutionset \\) be the set of solutions to \\( coordx^{2}=coordy^{2}+1 \\) over \\( \\mathbb{F}_{primep} \\). The linear change of coordinates \\( (coordu, coordv)=(coordx+coordy, coordx-coordy) \\) is invertible since \\( \\operatorname{det}\\left(\\begin{array}{cc}1 & 1 \\\\ 1 & -1\\end{array}\\right)=-2 \\) is nonzero in \\( \\mathbb{F}_{primep} \\). Hence \\( |solutionset| \\) equals the number of solutions to \\( coordu \\, coordv=1 \\) over \\( \\mathbb{F}_{primep} \\). There is one possible \\( coordv \\) for each nonzero \\( coordu \\), and no \\( coordv \\) for \\( coordu=0 \\), so \\( |solutionset|=primep-1 \\).\n\nThe problem asks for the size of the image of the map \\( \\phi: solutionset \\rightarrow \\mathbb{F}_{primep} \\) taking \\( (coordx, coordy) \\) to \\( coordx^{2} \\). If \\( coordz=coordx^{2} \\) for some \\( (coordx, coordy) \\in solutionset \\), then \\( \\phi^{-1}(coordz)=\\{( \\pm coordx, \\pm coordy)\\} \\), which has size 4 , except in the cases \\( coordz=1 \\) (in which case \\( coordx= \\pm 1 \\) and \\( coordy=0 \\), making \\( \\phi^{-1}(coordz) \\) of size 2 ) and \\( coordz=0 \\) (in which case \\( coordx=0 \\) and \\( coordy^{2}=-1 \\), again making \\( \\phi^{-1}(coordz) \\) of size 2); the latter exception occurs if and only if -1 is a square in \\( \\mathbb{F}_{primep} \\). Hence \\( |solutionset|=4|\\phi(solutionset)|-2-2 parityflag \\), where \\( parityflag \\) is 1 or 0 according as -1 is a square in \\( \\mathbb{F}_{primep} \\) or not. Thus the answer to the problem is\n\\[\n|\\phi(solutionset)|=\\frac{(primep-1)+2+2 parityflag}{4}=\\frac{primep+1+2 parityflag}{4} .\n\\]\n\nThis should be an integer, so \\( parityflag=1 \\) if \\( primep \\equiv 1(\\bmod 4) \\) and \\( parityflag=0 \\) if \\( primep \\equiv 3(\\bmod 4) \\). In either case, \\( |\\phi(solutionset)|=\\lceil primep / 4\\rceil \\) as claimed.\n\nSolution 2. We use the Legendre symbol, defined by\n\\[\n\\left(\\frac{elementa}{primep}\\right)=\\left\\{\\begin{array}{ll}\n1, & \\text { if } elementa \\equiv elementk^{2} \\quad(\\bmod primep) \\text { for some } elementk \\not \\equiv 0 \\quad(\\bmod primep) \\\\\n0, & \\text { if } elementa \\equiv 0 \\quad(\\bmod primep) \\\\\n-1, & \\text { otherwise }\n\\end{array}\\right.\n\\]\n\nThe number of nonzero squares in \\( \\mathbb{F}_{primep} \\) equals the number of nonsquares, so\n\\[\n\\sum_{elementa=0}^{primep-1}\\left(\\frac{elementa-elementk}{primep}\\right)=0\n\\]\nfor any \\( elementk \\in \\mathbb{Z} \\).\nIn this solution only, if \\( predicatep \\) is a statement, let \\( [predicatep] \\) be 1 if \\( predicatep \\) is true, and 0 if \\( predicatep \\) is false. Let \\( \\mathbb{F}_{primep}^{2} \\) denote the set of squares in \\( \\mathbb{F}_{primep} \\), including 0 . The problem asks us to compute\n\\[\ncountn=\\sum_{elementa=0}^{primep-1}\\left[elementa \\in \\mathbb{F}_{primep}^{2}\\right] \\cdot\\left[elementa-1 \\in \\mathbb{F}_{primep}^{2}\\right]\n\\]\n\nSubstituting the identity\n\\[\n\\left[elementa \\in \\mathbb{F}_{primep}^{2}\\right]=\\frac{1}{2}\\left(1+\\left(\\frac{elementa}{primep}\\right)+[elementa=0]\\right)\n\\]\nwe obtain\n\\[\n\\begin{aligned}\ncountn & =\\frac{1}{4}\\left(1+\\left(\\frac{-1}{primep}\\right)+1+\\left(\\frac{1}{primep}\\right)+\\sum_{elementa=0}^{primep-1}\\left(1+\\left(\\frac{elementa}{primep}\\right)\\right)\\left(1+\\left(\\frac{elementa-1}{primep}\\right)\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{primep}\\right)=1\\right]+\\frac{1}{2}+\\frac{1}{4} \\sum_{elementa=0}^{primep-1}\\left(1+\\left(\\frac{elementa}{primep}\\right)+\\left(\\frac{elementa-1}{primep}\\right)+\\left(\\frac{elementa}{primep}\\right)\\left(\\frac{elementa-1}{primep}\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{primep}\\right)=1\\right]+\\frac{1}{2}+\\frac{primep}{4}+\\frac{1}{4} \\sum_{elementa=0}^{primep-1}\\left(\\frac{elementa}{primep}\\right)\\left(\\frac{elementa-1}{primep}\\right),\n\\end{aligned}\n\\]\nby (1) twice. For \\( elementk \\in \\mathbb{Z} \\), let \\( solutionset(elementk)=\\sum_{elementa=0}^{primep-1}\\left(\\frac{elementa}{primep}\\right)\\left(\\frac{elementa-elementk}{primep}\\right) \\). We want \\( solutionset(1) \\). For \\( elementk \\) not divisible by \\( primep \\), the substitution \\( elementa=elementk elementb \\), with \\( elementb \\) running over the residue classes modulo \\( primep \\), shows that\n\\[\n\\begin{aligned}\nsolutionset(elementk) & =\\sum_{elementb=0}^{primep-1}\\left(\\frac{elementk}{primep}\\right)\\left(\\frac{elementb}{primep}\\right)\\left(\\frac{elementk}{primep}\\right)\\left(\\frac{elementb-1}{primep}\\right) \\\\\n& =\\sum_{elementb=0}^{primep-1}\\left(\\frac{elementb}{primep}\\right)\\left(\\frac{elementb-1}{primep}\\right) \\quad\\left(\\text { since }\\left(\\frac{elementk}{primep}\\right)^{2}=1\\right) \\\\\n& =solutionset(1)\n\\end{aligned}\n\\]\n\nAlso,\n\\[\n\\sum_{elementk=0}^{primep-1} solutionset(elementk)=\\sum_{elementa=0}^{primep-1}\\left(\\frac{elementa}{primep}\\right) \\sum_{elementk=0}^{primep-1}\\left(\\frac{elementa-elementk}{primep}\\right)=0\n\\]\nsince each inner sum is zero by (1). Thus\n\\[\nsolutionset(1)=-\\frac{solutionset(0)}{primep-1}=-\\frac{primep-1}{primep-1}=-1\n\\]\n\nHence\n\\[\ncountn=\\frac{1}{2}\\left[\\left(\\frac{-1}{primep}\\right)=1\\right]+\\frac{primep+1}{4} .\n\\]\n\nBut \\( countn \\) is an integer. Thus if \\( primep \\equiv 1(\\bmod 4) \\), then \\( \\left(\\frac{-1}{primep}\\right)=1 \\) and \\( countn=(primep+3) / 4 \\); if \\( primep \\equiv 3(\\bmod 4) \\), then \\( \\left(\\frac{-1}{primep}\\right)=-1 \\) and \\( countn=(primep+1) / 4 \\)."
    },
    "descriptive_long_confusing": {
      "map": {
        "a": "pineapple",
        "b": "strawberry",
        "k": "raspberry",
        "N": "blueberry",
        "P": "honeycomb",
        "S": "watermelon",
        "u": "butterfly",
        "v": "dragonfly",
        "x": "sunflower",
        "y": "blackberry",
        "z": "rhinoceros",
        "c": "caterpillar",
        "p": "lighthouse",
        "Z_p": "chocolate",
        "F_p": "marshmallow"
      },
      "question": "Let $lighthouse$ be an odd prime and let $chocolate$ denote (the field of) integers modulo $lighthouse$. How many elements are in the set\n\\[\n\\{sunflower^2: sunflower \\in chocolate\\} \\cap \\{blackberry^2 + 1 : blackberry \\in chocolate\\}?\\\n",
      "solution": "Solution 1. Let \\( watermelon \\) be the set of solutions to \\( sunflower^{2}=blackberry^{2}+1 \\) over \\( marshmallow \\). The linear change of coordinates \\( (butterfly, dragonfly)=(sunflower+blackberry, sunflower-blackberry) \\) is invertible since \\( \\operatorname{det}\\left(\\begin{array}{cc}1 & 1 \\\\ 1 & -1\\end{array}\\right)=-2 \\) is nonzero in \\( marshmallow \\). Hence \\( |watermelon| \\) equals the number of solutions to \\( butterfly \\, dragonfly=1 \\) over \\( marshmallow \\). There is one possible \\( dragonfly \\) for each nonzero \\( butterfly \\), and no \\( dragonfly \\) for \\( butterfly=0 \\), so \\( |watermelon|=lighthouse-1 \\).\n\nThe problem asks for the size of the image of the map \\( \\phi: watermelon \\rightarrow marshmallow \\) taking \\( (sunflower, blackberry) \\) to \\( sunflower^{2} \\). If \\( rhinoceros=sunflower^{2} \\) for some \\( (sunflower, blackberry) \\in watermelon \\), then \\( \\phi^{-1}(rhinoceros)=\\{( \\pm sunflower, \\pm blackberry)\\} \\), which has size 4 , except in the cases \\( rhinoceros=1 \\) (in which case \\( sunflower= \\pm 1 \\) and \\( blackberry=0 \\), making \\( \\phi^{-1}(rhinoceros) \\) of size 2 ) and \\( rhinoceros=0 \\) (in which case \\( sunflower=0 \\) and \\( blackberry^{2}=-1 \\), again making \\( \\phi^{-1}(rhinoceros) \\) of size 2); the latter exception occurs if and only if -1 is a square in \\( marshmallow \\). Hence \\( |watermelon|=4|\\phi(watermelon)|-2-2 caterpillar \\), where \\( caterpillar \\) is 1 or 0 according as -1 is a square in \\( marshmallow \\) or not. Thus the answer to the problem is\n\\[\n|\\phi(watermelon)|=\\frac{(lighthouse-1)+2+2 caterpillar}{4}=\\frac{lighthouse+1+2 caterpillar}{4} .\n\\]\n\nThis should be an integer, so \\( caterpillar=1 \\) if \\( lighthouse \\equiv 1(\\bmod 4) \\) and \\( caterpillar=0 \\) if \\( lighthouse \\equiv 3(\\bmod 4) \\). In either case, \\( |\\phi(watermelon)|=\\lceil lighthouse / 4\\rceil \\) as claimed.\n\nSolution 2. We use the Legendre symbol, defined by\n\\[\n\\left(\\frac{pineapple}{lighthouse}\\right)=\\left\\{\\begin{array}{ll}\n1, & \\text { if } pineapple \\equiv strawberry^{2} \\quad(\\bmod lighthouse) \\text { for some } strawberry \\not \\equiv 0 \\quad(\\bmod lighthouse) \\\\\n0, & \\text { if } pineapple \\equiv 0 \\quad(\\bmod lighthouse) \\\\\n-1, & \\text { otherwise }\n\\end{array}\\right.\n\\]\n\nThe number of nonzero squares in \\( marshmallow \\) equals the number of nonsquares, so\n\\[\n\\sum_{pineapple=0}^{lighthouse-1}\\left(\\frac{pineapple-raspberry}{lighthouse}\\right)=0\n\\]\nfor any \\( raspberry \\in \\mathbb{Z} \\).\nIn this solution only, if \\( honeycomb \\) is a statement, let \\( [honeycomb] \\) be 1 if \\( honeycomb \\) is true, and 0 if \\( honeycomb \\) is false. Let \\( marshmallow^{2} \\) denote the set of squares in \\( marshmallow \\), including 0 . The problem asks us to compute\n\\[\nblueberry=\\sum_{pineapple=0}^{lighthouse-1}\\left[pineapple \\in marshmallow^{2}\\right] \\cdot\\left[pineapple-1 \\in marshmallow^{2}\\right]\n\\]\n\nSubstituting the identity\n\\[\n\\left[pineapple \\in marshmallow^{2}\\right]=\\frac{1}{2}\\left(1+\\left(\\frac{pineapple}{lighthouse}\\right)+[pineapple=0]\\right)\n\\]\nwe obtain\n\\[\n\\begin{aligned}\nblueberry & =\\frac{1}{4}\\left(1+\\left(\\frac{-1}{lighthouse}\\right)+1+\\left(\\frac{1}{lighthouse}\\right)+\\sum_{pineapple=0}^{lighthouse-1}\\left(1+\\left(\\frac{pineapple}{lighthouse}\\right)\\right)\\left(1+\\left(\\frac{pineapple-1}{lighthouse}\\right)\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{lighthouse}\\right)=1\\right]+\\frac{1}{2}+\\frac{1}{4} \\sum_{pineapple=0}^{lighthouse-1}\\left(1+\\left(\\frac{pineapple}{lighthouse}\\right)+\\left(\\frac{pineapple-1}{lighthouse}\\right)+\\left(\\frac{pineapple}{lighthouse}\\right)\\left(\\frac{pineapple-1}{lighthouse}\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{lighthouse}\\right)=1\\right]+\\frac{1}{2}+\\frac{lighthouse}{4}+\\frac{1}{4} \\sum_{pineapple=0}^{lighthouse-1}\\left(\\frac{pineapple}{lighthouse}\\right)\\left(\\frac{pineapple-1}{lighthouse}\\right),\n\\end{aligned}\n\\]\nby (1) twice. For \\( raspberry \\in \\mathbb{Z} \\), let \\( watermelon(raspberry)=\\sum_{pineapple=0}^{lighthouse-1}\\left(\\frac{pineapple}{lighthouse}\\right)\\left(\\frac{pineapple-raspberry}{lighthouse}\\right) \\). We want \\( watermelon(1) \\). For \\( raspberry \\) not divisible by \\( lighthouse \\), the substitution \\( pineapple=raspberry \\, strawberry \\), with \\( strawberry \\) running over the residue classes modulo \\( lighthouse \\), shows that\n\\[\n\\begin{aligned}\nwatermelon(raspberry) & =\\sum_{strawberry=0}^{lighthouse-1}\\left(\\frac{raspberry}{lighthouse}\\right)\\left(\\frac{strawberry}{lighthouse}\\right)\\left(\\frac{raspberry}{lighthouse}\\right)\\left(\\frac{strawberry-1}{lighthouse}\\right) \\\\\n& =\\sum_{strawberry=0}^{lighthouse-1}\\left(\\frac{strawberry}{lighthouse}\\right)\\left(\\frac{strawberry-1}{lighthouse}\\right) \\quad\\left(\\text { since }\\left(\\frac{raspberry}{lighthouse}\\right)^{2}=1\\right) \\\\\n& =watermelon(1)\n\\end{aligned}\n\\]\n\nAlso,\n\\[\n\\sum_{raspberry=0}^{lighthouse-1} watermelon(raspberry)=\\sum_{pineapple=0}^{lighthouse-1}\\left(\\frac{pineapple}{lighthouse}\\right) \\sum_{raspberry=0}^{lighthouse-1}\\left(\\frac{pineapple-raspberry}{lighthouse}\\right)=0\n\\]\nsince each inner sum is zero by (1). Thus\n\\[\nwatermelon(1)=-\\frac{watermelon(0)}{lighthouse-1}= -\\frac{lighthouse-1}{lighthouse-1}=-1\n\\]\n\nHence\n\\[\nblueberry=\\frac{1}{2}\\left[\\left(\\frac{-1}{lighthouse}\\right)=1\\right]+\\frac{lighthouse+1}{4} .\n\\]\n\nBut \\( blueberry \\) is an integer. Thus if \\( lighthouse \\equiv 1(\\bmod 4) \\), then \\( \\left(\\frac{-1}{lighthouse}\\right)=1 \\) and \\( blueberry=(lighthouse+3) / 4 \\); if \\( lighthouse \\equiv 3(\\bmod 4) \\), then \\( \\left(\\frac{-1}{lighthouse}\\right)=-1 \\) and \\( blueberry=(lighthouse+1) / 4 \\)."
    },
    "descriptive_long_misleading": {
      "map": {
        "a": "specificval",
        "b": "universal",
        "k": "staticindex",
        "N": "uncounted",
        "P": "falsehood",
        "S": "emptiness",
        "u": "downelem",
        "v": "reststate",
        "x": "knownval",
        "y": "givenval",
        "z": "baseline",
        "c": "uncertain",
        "p": "composite",
        "Z_p": "realfield",
        "F_p": "complexset"
      },
      "question": "Let $composite$ be an odd prime and let $\\realfield$ denote (the field of) integers modulo $composite$. How many elements are in the set\n\\[\n\\{knownval^2: knownval \\in \\realfield\\} \\cap \\{givenval^2 + 1 : givenval \\in \\realfield\\}?\n\\]",
      "solution": "Solution 1. Let \\( emptiness \\) be the set of solutions to \\( knownval^{2}=givenval^{2}+1 \\) over \\( \\mathbb{complexset}_{composite} \\). The linear change of coordinates \\( (downelem, reststate)=(knownval+givenval, knownval-givenval) \\) is invertible since \\( \\operatorname{det}\\left(\\begin{array}{cc}1 & 1 \\\\ 1 & -1\\end{array}\\right)=-2 \\) is nonzero in \\( \\mathbb{complexset}_{composite} \\). Hence \\( |emptiness| \\) equals the number of solutions to \\( downelem\\, reststate=1 \\) over \\( \\mathbb{complexset}_{composite} \\). There is one possible \\( reststate \\) for each nonzero \\( downelem \\), and no \\( reststate \\) for \\( downelem=0 \\), so \\( |emptiness|=composite-1 \\).\n\nThe problem asks for the size of the image of the map \\( \\phi: emptiness \\rightarrow \\mathbb{complexset}_{composite} \\) taking \\( (knownval, givenval) \\) to \\( knownval^{2} \\). If \\( baseline=knownval^{2} \\) for some \\( (knownval, givenval) \\in emptiness \\), then \\( \\phi^{-1}(baseline)=\\{( \\pm knownval, \\pm givenval)\\} \\), which has size 4, except in the cases \\( baseline=1 \\) (in which case \\( knownval= \\pm 1 \\) and \\( givenval=0 \\), making \\( \\phi^{-1}(baseline) \\) of size 2) and \\( baseline=0 \\) (in which case \\( knownval=0 \\) and \\( givenval^{2}=-1 \\), again making \\( \\phi^{-1}(baseline) \\) of size 2); the latter exception occurs if and only if -1 is a square in \\( \\mathbb{complexset}_{composite} \\). Hence \\( |emptiness|=4|\\phi(emptiness)|-2-2 uncertain \\), where \\( uncertain \\) is 1 or 0 according as -1 is a square in \\( \\mathbb{complexset}_{composite} \\) or not. Thus the answer to the problem is\n\\[\n|\\phi(emptiness)|=\\frac{(composite-1)+2+2 uncertain}{4}=\\frac{composite+1+2 uncertain}{4} .\n\\]\n\nThis should be an integer, so \\( uncertain=1 \\) if \\( composite \\equiv 1(\\bmod 4) \\) and \\( uncertain=0 \\) if \\( composite \\equiv 3(\\bmod 4) \\). In either case, \\( |\\phi(emptiness)|=\\lceil composite / 4\\rceil \\) as claimed.\n\nSolution 2. We use the Legendre symbol, defined by\n\\[\n\\left(\\frac{specificval}{composite}\\right)=\\left\\{\\begin{array}{ll}\n1, & \\text { if } specificval \\equiv knownval^{2} \\quad(\\bmod composite) \\text { for some } knownval \\not \\equiv 0 \\quad(\\bmod composite) \\\\\n0, & \\text { if } specificval \\equiv 0 \\quad(\\bmod composite) \\\\\n-1, & \\text { otherwise }\n\\end{array}\\right.\n\\]\n\nThe number of nonzero squares in \\( \\mathbb{complexset}_{composite} \\) equals the number of nonsquares, so\n\\[\n\\sum_{specificval=0}^{composite-1}\\left(\\frac{specificval-staticindex}{composite}\\right)=0\n\\]\nfor any \\( staticindex \\in \\mathbb{Z} \\).\nIn this solution only, if \\( falsehood \\) is a statement, let \\( [falsehood] \\) be 1 if \\( falsehood \\) is true, and 0 if \\( falsehood \\) is false. Let \\( \\mathbb{complexset}_{composite}^{2} \\) denote the set of squares in \\( \\mathbb{complexset}_{composite} \\), including 0. The problem asks us to compute\n\\[\nuncounted=\\sum_{specificval=0}^{composite-1}\\left[specificval \\in \\mathbb{complexset}_{composite}^{2}\\right] \\cdot \\left[specificval-1 \\in \\mathbb{complexset}_{composite}^{2}\\right]\n\\]\n\nSubstituting the identity\n\\[\n\\left[specificval \\in \\mathbb{complexset}_{composite}^{2}\\right]=\\frac{1}{2}\\left(1+\\left(\\frac{specificval}{composite}\\right)+[specificval=0]\\right)\n\\]\nwe obtain\n\\[\n\\begin{aligned}\nuncounted &= \\frac{1}{4}\\left(1+\\left(\\frac{-1}{composite}\\right)+1+\\left(\\frac{1}{composite}\\right)+\\sum_{specificval=0}^{composite-1}\\left(1+\\left(\\frac{specificval}{composite}\\right)\\right)\\left(1+\\left(\\frac{specificval-1}{composite}\\right)\\right)\\right) \\\\\n&= \\frac{1}{2}\\left[\\left(\\frac{-1}{composite}\\right)=1\\right]+\\frac{1}{2}+\\frac{1}{4} \\sum_{specificval=0}^{composite-1}\\left(1+\\left(\\frac{specificval}{composite}\\right)+\\left(\\frac{specificval-1}{composite}\\right)+\\left(\\frac{specificval}{composite}\\right)\\left(\\frac{specificval-1}{composite}\\right)\\right) \\\\\n&= \\frac{1}{2}\\left[\\left(\\frac{-1}{composite}\\right)=1\\right]+\\frac{1}{2}+\\frac{composite}{4}+\\frac{1}{4} \\sum_{specificval=0}^{composite-1}\\left(\\frac{specificval}{composite}\\right)\\left(\\frac{specificval-1}{composite}\\right),\n\\end{aligned}\n\\]\nby (1) twice. For \\( staticindex \\in \\mathbb{Z} \\), let \\( emptiness(staticindex)=\\sum_{specificval=0}^{composite-1}\\left(\\frac{specificval}{composite}\\right)\\left(\\frac{specificval-staticindex}{composite}\\right) \\). We want \\( emptiness(1) \\). For \\( staticindex \\) not divisible by \\( composite \\), the substitution \\( specificval=staticindex\\,universal \\), with \\( universal \\) running over the residue classes modulo \\( composite \\), shows that\n\\[\n\\begin{aligned}\nemptiness(staticindex) &= \\sum_{universal=0}^{composite-1}\\left(\\frac{staticindex}{composite}\\right)\\left(\\frac{universal}{composite}\\right)\\left(\\frac{staticindex}{composite}\\right)\\left(\\frac{universal-1}{composite}\\right) \\\\\n&= \\sum_{universal=0}^{composite-1}\\left(\\frac{universal}{composite}\\right)\\left(\\frac{universal-1}{composite}\\right) \\quad\\left(\\text { since } \\left(\\frac{staticindex}{composite}\\right)^{2}=1 \\right) \\\\\n&= emptiness(1)\n\\end{aligned}\n\\]\n\nAlso,\n\\[\n\\sum_{staticindex=0}^{composite-1} emptiness(staticindex)=\\sum_{specificval=0}^{composite-1}\\left(\\frac{specificval}{composite}\\right) \\sum_{staticindex=0}^{composite-1}\\left(\\frac{specificval-staticindex}{composite}\\right)=0\n\\]\nsince each inner sum is zero by (1). Thus\n\\[\nemptiness(1)=-\\frac{emptiness(0)}{composite-1}=-\\frac{composite-1}{composite-1}=-1\n\\]\n\nHence\n\\[\nuncounted=\\frac{1}{2}\\left[\\left(\\frac{-1}{composite}\\right)=1\\right]+\\frac{composite+1}{4} .\n\\]\n\nBut \\( uncounted \\) is an integer. Thus if \\( composite \\equiv 1(\\bmod 4) \\), then \\( \\left(\\frac{-1}{composite}\\right)=1 \\) and \\( uncounted=(composite+3) / 4 \\); if \\( composite \\equiv 3(\\bmod 4) \\), then \\( \\left(\\frac{-1}{composite}\\right)=-1 \\) and \\( uncounted=(composite+1) / 4 \\)."
    },
    "garbled_string": {
      "map": {
        "a": "qzxwvtnp",
        "b": "hjgrksla",
        "k": "mvcqsdfa",
        "N": "ptlgwrhz",
        "P": "sdbgkzru",
        "S": "xhvdmteq",
        "u": "ykcjlsmp",
        "v": "dfrnqxoh",
        "x": "wptzskya",
        "y": "nlbycgev",
        "z": "brfajkwi",
        "c": "slnvocwe",
        "p": "lskdjfgh",
        "Z_p": "hqkwmsuf",
        "F_p": "kjdhsfla"
      },
      "question": "Let $lskdjfgh$ be an odd prime and let $\\hqkwmsuf$ denote (the field of) integers\nmodulo $lskdjfgh$. How many elements are in the set\n\\[\n\\{wptzskya^2: wptzskya \\in \\hqkwmsuf\\} \\cap \\{nlbycgev^2 + 1 : nlbycgev \\in \\hqkwmsuf\\}?\n\\]",
      "solution": "Solution 1. Let \\( xhvdmteq \\) be the set of solutions to \\( wptzskya^{2}=nlbycgev^{2}+1 \\) over \\( \\mathbb{kjdhsfla} \\). The linear change of coordinates \\( (ykcjlsmp, dfrnqxoh)=(wptzskya+nlbycgev, wptzskya-nlbycgev) \\) is invertible since \\( \\operatorname{det}\\left(\\begin{array}{cc}1 & 1 \\\\ 1 & -1\\end{array}\\right)=-2 \\) is nonzero in \\( \\mathbb{kjdhsfla} \\). Hence \\( |xhvdmteq| \\) equals the number of solutions to \\( ykcjlsmp dfrnqxoh=1 \\) over \\( \\mathbb{kjdhsfla} \\). There is one possible \\( dfrnqxoh \\) for each nonzero \\( ykcjlsmp \\), and no \\( dfrnqxoh \\) for \\( ykcjlsmp=0 \\), so \\( |xhvdmteq|=lskdjfgh-1 \\).\n\nThe problem asks for the size of the image of the map \\( \\phi: xhvdmteq \\rightarrow \\mathbb{kjdhsfla} \\) taking \\( (wptzskya, nlbycgev) \\) to \\( wptzskya^{2} \\). If \\( brfajkwi=wptzskya^{2} \\) for some \\( (wptzskya, nlbycgev) \\in xhvdmteq \\), then \\( \\phi^{-1}(brfajkwi)=\\{( \\pm wptzskya, \\pm nlbycgev)\\} \\), which has size 4 , except in the cases \\( brfajkwi=1 \\) (in which case \\( wptzskya= \\pm 1 \\) and \\( nlbycgev=0 \\), making \\( \\phi^{-1}(brfajkwi) \\) of size 2 ) and \\( brfajkwi=0 \\) (in which case \\( wptzskya=0 \\) and \\( nlbycgev^{2}=-1 \\), again making \\( \\phi^{-1}(brfajkwi) \\) of size 2); the latter exception occurs if and only if -1 is a square in \\( \\mathbb{kjdhsfla} \\). Hence \\( |xhvdmteq|=4|\\phi(xhvdmteq)|-2-2 slnvocwe \\), where \\( slnvocwe \\) is 1 or 0 according as -1 is a square in \\( \\mathbb{kjdhsfla} \\) or not. Thus the answer to the problem is\n\\[\n|\\phi(xhvdmteq)|=\\frac{(lskdjfgh-1)+2+2 slnvocwe}{4}=\\frac{lskdjfgh+1+2 slnvocwe}{4} .\n\\]\n\nThis should be an integer, so \\( slnvocwe=1 \\) if \\( lskdjfgh \\equiv 1(\\bmod 4) \\) and \\( slnvocwe=0 \\) if \\( lskdjfgh \\equiv 3(\\bmod 4) \\). In either case, \\( |\\phi(xhvdmteq)|=\\lceil lskdjfgh / 4\\rceil \\) as claimed.\n\nSolution 2. We use the Legendre symbol, defined by\n\\[\n\\left(\\frac{qzxwvtnp}{lskdjfgh}\\right)=\\left\\{\\begin{array}{ll}\n1, & \\text { if } qzxwvtnp \\equiv mvcqsdfa^{2} \\quad(\\bmod lskdjfgh) \\text { for some } mvcqsdfa \\not \\equiv 0 \\quad(\\bmod lskdjfgh) \\\\\n0, & \\text { if } qzxwvtnp \\equiv 0 \\quad(\\bmod lskdjfgh) \\\\\n-1, & \\text { otherwise }\n\\end{array}\\right.\n\\]\n\nThe number of nonzero squares in \\( \\mathbb{kjdhsfla} \\) equals the number of nonsquares, so\n\\[\n\\sum_{qzxwvtnp=0}^{lskdjfgh-1}\\left(\\frac{qzxwvtnp-mvcqsdfa}{lskdjfgh}\\right)=0\n\\]\nfor any \\( mvcqsdfa \\in \\mathbb{Z} \\).\nIn this solution only, if \\( sdbgkzru \\) is a statement, let \\( [sdbgkzru] \\) be 1 if \\( sdbgkzru \\) is true, and 0 if \\( sdbgkzru \\) is false. Let \\( \\mathbb{kjdhsfla}^{2} \\) denote the set of squares in \\( \\mathbb{kjdhsfla} \\), including 0 . The problem asks us to compute\n\\[\nptlgwrhz=\\sum_{qzxwvtnp=0}^{lskdjfgh-1}\\left[qzxwvtnp \\in \\mathbb{kjdhsfla}^{2}\\right] \\cdot\\left[qzxwvtnp-1 \\in \\mathbb{kjdhsfla}^{2}\\right]\n\\]\n\nSubstituting the identity\n\\[\n\\left[qzxwvtnp \\in \\mathbb{kjdhsfla}^{2}\\right]=\\frac{1}{2}\\left(1+\\left(\\frac{qzxwvtnp}{lskdjfgh}\\right)+[qzxwvtnp=0]\\right)\n\\]\nwe obtain\n\\[\n\\begin{aligned}\nptlgwrhz & =\\frac{1}{4}\\left(1+\\left(\\frac{-1}{lskdjfgh}\\right)+1+\\left(\\frac{1}{lskdjfgh}\\right)+\\sum_{qzxwvtnp=0}^{lskdjfgh-1}\\left(1+\\left(\\frac{qzxwvtnp}{lskdjfgh}\\right)\\right)\\left(1+\\left(\\frac{qzxwvtnp-1}{lskdjfgh}\\right)\\right)\\right) \\\\\n& =\\frac{1}{2}\\left[\\left(\\frac{-1}{lskdjfgh}\\right)=1\\right]+\\frac{1}{2}+\\frac{lskdjfgh}{4}+\\frac{1}{4} \\sum_{qzxwvtnp=0}^{lskdjfgh-1}\\left(\\frac{qzxwvtnp}{lskdjfgh}\\right)\\left(\\frac{qzxwvtnp-1}{lskdjfgh}\\right),\n\\end{aligned}\n\\]\nby (1) twice. For \\( mvcqsdfa \\in \\mathbb{Z} \\), let \\( xhvdmteq(mvcqsdfa)=\\sum_{qzxwvtnp=0}^{lskdjfgh-1}\\left(\\frac{qzxwvtnp}{lskdjfgh}\\right)\\left(\\frac{qzxwvtnp-mvcqsdfa}{lskdjfgh}\\right) \\). We want \\( xhvdmteq(1) \\). For \\( mvcqsdfa \\) not divisible by \\( lskdjfgh \\), the substitution \\( qzxwvtnp=mvcqsdfa hjgrksla \\), with \\( hjgrksla \\) running over the residue classes modulo \\( lskdjfgh \\), shows that\n\\[\n\\begin{aligned}\nxhvdmteq(mvcqsdfa) & =\\sum_{hjgrksla=0}^{lskdjfgh-1}\\left(\\frac{mvcqsdfa}{lskdjfgh}\\right)\\left(\\frac{hjgrksla}{lskdjfgh}\\right)\\left(\\frac{mvcqsdfa}{lskdjfgh}\\right)\\left(\\frac{hjgrksla-1}{lskdjfgh}\\right) \\\\\n& =\\sum_{hjgrksla=0}^{lskdjfgh-1}\\left(\\frac{hjgrksla}{lskdjfgh}\\right)\\left(\\frac{hjgrksla-1}{lskdjfgh}\\right) \\quad\\left(\\text { since }\\left(\\frac{mvcqsdfa}{lskdjfgh}\\right)^{2}=1\\right) \\\\\n& =xhvdmteq(1)\n\\end{aligned}\n\\]\n\nAlso,\n\\[\n\\sum_{mvcqsdfa=0}^{lskdjfgh-1} xhvdmteq(mvcqsdfa)=\\sum_{qzxwvtnp=0}^{lskdjfgh-1}\\left(\\frac{qzxwvtnp}{lskdjfgh}\\right) \\sum_{mvcqsdfa=0}^{lskdjfgh-1}\\left(\\frac{qzxwvtnp-mvcqsdfa}{lskdjfgh}\\right)=0\n\\]\nsince each inner sum is zero by (1). Thus\n\\[\nxhvdmteq(1)=-\\frac{xhvdmteq(0)}{lskdjfgh-1}=-\\frac{lskdjfgh-1}{lskdjfgh-1}=-1\n\\]\n\nHence\n\\[\nptlgwrhz=\\frac{1}{2}\\left[\\left(\\frac{-1}{lskdjfgh}\\right)=1\\right]+\\frac{lskdjfgh+1}{4} .\n\\]\n\nBut \\( ptlgwrhz \\) is an integer. Thus if \\( lskdjfgh \\equiv 1(\\bmod 4) \\), then \\( \\left(\\frac{-1}{lskdjfgh}\\right)=1 \\) and \\( ptlgwrhz=(lskdjfgh+3) / 4 \\); if \\( lskdjfgh \\equiv 3(\\bmod 4) \\), then \\( \\left(\\frac{-1}{lskdjfgh}\\right)=-1 \\) and \\( ptlgwrhz=(lskdjfgh+1) / 4 \\)."
    },
    "kernel_variant": {
      "question": "Let $q$ be an odd prime power and write $\\Bbb F_{q}$ for the finite field with $q$ elements.  \nFix two distinct non–zero elements $\\alpha ,\\beta \\in\\Bbb F_{q}^{\\times}$ with $\\alpha\\neq\\beta$ and set\n\\[\n\\mathcal S_{0}= \\{x^{2}:x\\in\\Bbb F_{q}\\},\\qquad\n\\mathcal S_{\\alpha}= \\{y^{2}+\\alpha :y\\in\\Bbb F_{q}\\},\\qquad\n\\mathcal S_{\\beta}= \\{z^{2}+\\beta :z\\in\\Bbb F_{q}\\}.\n\\]\n\nDenote by $\\chi:\\Bbb F_{q}\\longrightarrow\\{0,\\pm1\\}$ the quadratic (multiplicative) character extended by $\\chi(0)=0$, put $\\varepsilon=\\chi(-1)$ and write  \n\\[\na_q(\\alpha,\\beta)=q+1-\\#E_{\\alpha,\\beta}(\\Bbb F_{q}),\\qquad \nE_{\\alpha,\\beta} :\\; Y^{2}=X(X-\\alpha)(X-\\beta).\n\\]\n\n(a)  Show that the triple intersection  \n\\[\nN_{\\alpha,\\beta}(q)=\\bigl|\\mathcal S_{0}\\cap\\mathcal S_{\\alpha}\\cap\\mathcal S_{\\beta}\\bigr|\n\\]\nadmits the closed formula  \n\\[\nN_{\\alpha,\\beta}(q)=\n\\frac{q-a_{q}(\\alpha,\\beta)\n       +(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n       +\\chi(\\alpha)\\chi(\\beta)\n       +\\chi(\\alpha)\\chi(\\alpha-\\beta)\n       +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)}{8}.\n\\tag{$\\star$}\n\\]\n\n(b)  Prove that the right–hand side of $(\\star)$ is an integer and that it satisfies  \n\\[\n0\\;\\le\\;N_{\\alpha,\\beta}(q)\\;\\le\\;q .\n\\]\n\nNo information other than $q$, $\\varepsilon$, $\\chi(\\alpha)$, $\\chi(\\beta)$, $\\chi(\\alpha-\\beta)$ and $a_q(\\alpha,\\beta)$ may appear in the final expression.",
      "solution": "Throughout let $\\chi:\\Bbb F_{q}\\to\\{0,\\pm1\\}$ be the quadratic character, $\\chi(0)=0$, and put $\\varepsilon=\\chi(-1)\\in\\{\\pm1\\}$.\n\n1.  Indicator reformulation.  \nDefine  \n\\[\nI(u)=\\begin{cases}1,&u\\in\\mathcal S_{0},\\\\[2pt]0,&u\\notin\\mathcal S_{0},\\end{cases}\n\\qquad \nN_{\\alpha,\\beta}(q)=\\sum_{t\\in\\Bbb F_{q}}I(t)\\,I(t-\\alpha)\\,I(t-\\beta).\n\\]\n\n2.  Character expansion of $I$.  \nBecause $0$ is a square,\n\\[\nI(u)=\\frac{1+\\chi(u)}{2}+\\frac{\\delta(u)}{2},\\qquad \n\\delta(u)=\\begin{cases}1,&u=0,\\\\[2pt]0,&u\\neq0.\\end{cases}\n\\]\n\n3.  Separation into generic and exceptional arguments.  \nThe factors $t$, $t-\\alpha$, $t-\\beta$ can vanish only for $t\\in\\{0,\\alpha,\\beta\\}$.  Put  \n\\[\nA=\\Bbb F_{q}\\setminus\\{0,\\alpha,\\beta\\},\\qquad \nN_{\\alpha,\\beta}(q)=N_{\\operatorname{gen}}+N_{\\operatorname{exc}} .\n\\]\n\n4.  Generic contribution.  \nFor $t\\in A$ all $\\delta$–terms disappear:\n\\[\nI(t)I(t-\\alpha)I(t-\\beta)=\\frac18\\bigl(1+\\chi(t)\\bigr)\\bigl(1+\\chi(t-\\alpha)\\bigr)\\bigl(1+\\chi(t-\\beta)\\bigr).\n\\]\nExpanding yields the sums\n\\[\n\\Sigma_0=q-3,\\qquad\n\\Sigma_1=\\sum_{t\\in A}\\bigl(\\chi(t)+\\chi(t-\\alpha)+\\chi(t-\\beta)\\bigr),\n\\]\n\\[\n\\Sigma_2=\\sum_{t\\in A}\\bigl(\\chi(t)\\chi(t-\\alpha)+\\chi(t)\\chi(t-\\beta)+\\chi(t-\\alpha)\\chi(t-\\beta)\\bigr),\n\\qquad\n\\Sigma_3=\\sum_{t\\in A}\\chi\\!\\bigl(t(t-\\alpha)(t-\\beta)\\bigr).\n\\]\n\n4(a)  Linear sums.  \nBecause $\\sum_{x\\in\\Bbb F_{q}}\\chi(x)=0$ and translating variables does not change the sum, one finds\n\\[\n\\Sigma_1=-(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr).\n\\tag{4.1}\n\\]\n\n4(b)  Quadratic sums – a correct evaluation of the Jacobi sum.  \nFor $\\gamma\\neq0$ define  \n\\[\nJ(\\gamma)=\\sum_{x\\in\\Bbb F_{q}}\\chi(x)\\chi(x-\\gamma).\n\\]\nThe change of variables $x=\\gamma u$ gives $J(\\gamma)=J(1)$, so $J(\\gamma)$\nis independent of $\\gamma\\neq0$.  \nTo determine $J(1)$ count the $\\Bbb F_{q}$–points on the conic\n\\[\nC:\\qquad Y^{2}=X(X-1).\n\\]\nFor $X=0$ or $X=1$ there is exactly one $Y$, while for\n$X\\notin\\{0,1\\}$ the fibre contains $1+\\chi(X(X-1))$ points.\nHence\n\\[\n\\#C(\\Bbb F_{q})=2+\\sum_{X\\notin\\{0,1\\}}\\bigl(1+\\chi(X)\\chi(X-1)\\bigr)\n                =q+J(1).\n\\]\nSince $C$ is a nonsingular genus–$0$ curve, it is birational to\n$\\Bbb P^{1}$ and therefore $\\#C(\\Bbb F_{q})=q+1$; hence $J(1)=-1$.\nConsequently\n\\[\nJ(\\gamma)=-1\\qquad(\\gamma\\neq0).\n\\tag{4.2}\n\\]\n\nRemoving the three exceptional arguments ($t=0,\\alpha,\\beta$) gives\n\\[\n\\Sigma_2=-3-\\Bigl[\\chi(\\alpha)\\chi(\\beta)+\\chi(\\alpha)\\chi(\\alpha-\\beta)\n                +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)\\Bigr].\n\\tag{4.3}\n\\]\n\n4(c)  Cubic sum via the elliptic curve.  \nBecause $\\chi(0)=0$, deleting $t\\in\\{0,\\alpha,\\beta\\}$ does not affect\n\\[\n\\Sigma_3=\\sum_{t\\in\\Bbb F_{q}}\\chi\\!\\bigl(t(t-\\alpha)(t-\\beta)\\bigr)=:S(\\alpha,\\beta).\n\\]\nFor any $x\\in\\Bbb F_{q}$ the equation $y^{2}=x(x-\\alpha)(x-\\beta)$\nhas exactly $1+\\chi\\!\\bigl(x(x-\\alpha)(x-\\beta)\\bigr)$ solutions in $y$,\nwhence\n\\[\n\\#E_{\\alpha,\\beta}(\\Bbb F_{q})=q+1+S(\\alpha,\\beta),\n\\qquad S(\\alpha,\\beta)=-a_q(\\alpha,\\beta).\n\\tag{4.4}\n\\]\n\n4(d)  Collecting the generic part.  \nInserting (4.1)–(4.4) yields\n\\[\nN_{\\operatorname{gen}}\n=\\frac18\\Bigl[\n         q-6-a_q(\\alpha,\\beta)\n        -(1+\\varepsilon)\\!\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n        -\\bigl(\\chi(\\alpha)\\chi(\\beta)+\\chi(\\alpha)\\chi(\\alpha-\\beta)\n               +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)\\bigr)\n      \\Bigr].\n\\tag{4.5}\n\\]\n\n5.  Exceptional contribution.  \nEvaluating $I$ at $t=0,\\alpha,\\beta$ gives\n\\[\n\\begin{aligned}\nt=0:&\\quad \nP_{0}=\\dfrac{\\bigl(1+\\varepsilon\\chi(\\alpha)\\bigr)\\bigl(1+\\varepsilon\\chi(\\beta)\\bigr)}{4},\\\\[6pt]\nt=\\alpha:&\\quad \nP_{\\alpha}=\\dfrac{\\bigl(1+\\chi(\\alpha)\\bigr)\\bigl(1+\\chi(\\alpha-\\beta)\\bigr)}{4},\\\\[6pt]\nt=\\beta:&\\quad \nP_{\\beta}=\\dfrac{\\bigl(1+\\chi(\\beta)\\bigr)\\bigl(1+\\varepsilon\\chi(\\alpha-\\beta)\\bigr)}{4}.\n\\end{aligned}\n\\]\nThus $N_{\\operatorname{exc}}=P_{0}+P_{\\alpha}+P_{\\beta}$ and\n\\[\n2\\,N_{\\operatorname{exc}}\n      =\\frac{3+(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n              +\\chi(\\alpha)\\chi(\\beta)\n              +\\chi(\\alpha)\\chi(\\alpha-\\beta)\n              +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)}{2}.\n\\tag{5.1}\n\\]\n\n6.  Final combination.  \nAdding (4.5) and $\\tfrac12\\,$(5.1) gives\n\\[\nN_{\\alpha,\\beta}(q)=\n\\frac{q-a_q(\\alpha,\\beta)\n       +(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n       +\\chi(\\alpha)\\chi(\\beta)\n       +\\chi(\\alpha)\\chi(\\alpha-\\beta)\n       +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)}{8},\n\\]\nexactly the announced formula $(\\star)$.\n\n7.  Integrality of $(\\star)$.  \nAll manipulations from Section 1 to Section 6 were carried out inside\n$\\Bbb Z$; in particular we established the equality\n\\[\n8\\,N_{\\alpha,\\beta}(q)=\nq-a_q(\\alpha,\\beta)\n+(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n+\\chi(\\alpha)\\chi(\\beta)\n+\\chi(\\alpha)\\chi(\\alpha-\\beta)\n+\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta).\n\\]\nBecause the left–hand side is an integer, the numerator of $(\\star)$\nis automatically a multiple of $8$, so $(\\star)\\in\\Bbb Z$ and\n$N_{\\alpha,\\beta}(q)$ is an integer.\n\n8.  Non–negativity and the upper bound.  \n\n8(a)  Range of the character expression.  \nLet $A,B,C\\in\\{\\pm1\\}$ and denote $s=A+B+C$, $p=AB+AC+BC$.\nA short inspection shows  \n\\[\n-3\\le (1+\\varepsilon)s+p\\le 9\n\\quad\\text{and}\\quad\n-3\\le p\\le 3.\n\\tag{8.1}\n\\]\n\n8(b)  Use of Hasse’s bound.  \nThe Hasse–Weil inequality $|a_q(\\alpha,\\beta)|\\le 2\\sqrt q$ together\nwith (8.1) furnishes  \n\\[\nq-2\\sqrt q-3\\le \nq-a_q(\\alpha,\\beta)+(1+\\varepsilon)s+p\\le q+2\\sqrt q+9 .\n\\]\nFor $q\\ge9$ the left–hand side is non–negative, while the right–hand\nside is $\\le 8q$; dividing by $8$ yields $0\\le N_{\\alpha,\\beta}(q)\\le q$.\n\n8(c)  Small fields $q=3,5,7$.  \nBecause at most $q$ elements can lie in the intersection of three\nsubsets of $\\Bbb F_{q}$, the upper bound is automatic.\nDirect substitution of the eight possible triples\n$(\\chi(\\alpha),\\chi(\\beta),\\chi(\\alpha-\\beta))$\nshows non–negativity of $(\\star)$ for $q=3,5,7$ as well.\n\nThus $(\\star)$ is integral and\n\\[\n0\\;\\le\\;N_{\\alpha,\\beta}(q)\\;\\le\\;q .\n\\]",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T19:09:31.720959",
        "was_fixed": false,
        "difficulty_analysis": "1.  Higher dimensional intersection:  the original problem intersects two quadratic images; the enhanced variant intersects three, creating a cubic condition.\n2.  Advanced machinery:  evaluation of the cubic character sum is translated into counting $\\mathbb F_q$-points on an elliptic curve, introducing algebraic–geometry (elliptic curves, Frobenius trace, Hasse bound).\n3.  Non-elementary constants:  the answer involves the Frobenius trace $a_q(\\alpha,\\beta)$, a subtle arithmetic invariant that generally cannot be expressed by elementary Legendre symbols alone.\n4.  Multiple interacting concepts:  quadratic characters, Jacobi sums, elliptic curves, and the correction for the special value $0$ all interact.\n5.  Longer derivation:  the solution requires partitioning the sum, expanding products, using classical character-sum identities, and invoking elliptic-curve point counting—considerably deeper and more elaborate than the linear change-of-variables trick that solved the original exercise."
      }
    },
    "original_kernel_variant": {
      "question": "Let $q$ be an odd prime power and write $\\Bbb F_{q}$ for the finite field with $q$ elements.  \nFix two distinct non–zero elements $\\alpha,\\beta\\in\\Bbb F_{q}^{\\times}$ with $\\alpha\\neq\\beta$ and set  \n\\[\n\\mathcal S_{0}= \\{x^{2}:x\\in\\Bbb F_{q}\\},\\qquad\n\\mathcal S_{\\alpha}= \\{y^{2}+\\alpha :y\\in\\Bbb F_{q}\\},\\qquad\n\\mathcal S_{\\beta}= \\{z^{2}+\\beta :z\\in\\Bbb F_{q}\\}.\n\\]\n\nDenote by $\\chi:\\Bbb F_{q}\\to\\{0,\\pm1\\}$ the quadratic (multiplicative) character extended by $\\chi(0)=0$, put $\\varepsilon=\\chi(-1)$ and write  \n\\[\na_q(\\alpha,\\beta)=q+1-\\#E_{\\alpha,\\beta}(\\Bbb F_{q}),\\qquad \nE_{\\alpha,\\beta} :\\; Y^{2}=X(X-\\alpha)(X-\\beta).\n\\]\n\nDetermine a closed formula for  \n\\[\nN_{\\alpha,\\beta}(q)=\\bigl|\\mathcal S_{0}\\cap\\mathcal S_{\\alpha}\\cap\\mathcal S_{\\beta}\\bigr|\n\\]\nexpressed solely through $q$, $\\varepsilon$, $\\chi(\\alpha)$, $\\chi(\\beta)$, $\\chi(\\alpha-\\beta)$ and $a_q(\\alpha,\\beta)$.  \nProve that your expression is an integer satisfying $0\\le N_{\\alpha,\\beta}(q)\\le q$.",
      "solution": "Throughout let $\\chi:\\Bbb F_{q}\\to\\{0,\\pm1\\}$ be the quadratic character with $\\chi(0)=0$ and put $\\varepsilon=\\chi(-1)\\in\\{\\pm1\\}$.\n\n1.\\;Indicator reformulation.  \nWrite the indicator of squares as  \n\\[\nI(u)=\\begin{cases}1,&u\\in\\mathcal S_{0},\\\\[2pt]0,&u\\notin\\mathcal S_{0}.\\end{cases}\n\\qquad \nN_{\\alpha,\\beta}(q)=\\sum_{t\\in\\Bbb F_{q}}I(t)\\,I(t-\\alpha)\\,I(t-\\beta).\n\\]\n\n2.\\;Character expansion of $I$.  \nBecause $0$ is a square while $\\chi(0)=0$,\n\\[\nI(u)=\\frac{1+\\chi(u)}{2}+\\frac{\\delta(u)}{2},\\qquad \n\\delta(u)=\\begin{cases}1,&u=0,\\\\[2pt]0,&u\\neq0.\\end{cases}\n\\]\n\n3.\\;Generic versus exceptional arguments.  \nThe arguments $t$, $t-\\alpha$, $t-\\beta$ vanish precisely when $t\\in\\{0,\\alpha,\\beta\\}$.  \nPut  \n\\[\nA=\\Bbb F_{q}\\setminus\\{0,\\alpha,\\beta\\},\\qquad \nN_{\\alpha,\\beta}(q)=N_{\\mathrm{gen}}+N_{\\mathrm{exc}} .\n\\]\n\n4.\\;Generic contribution.  \nFor $t\\in A$ all $\\delta$–terms disappear, giving  \n\\[\nI(t)I(t-\\alpha)I(t-\\beta)=\\frac18\\bigl(1+\\chi(t)\\bigr)\\bigl(1+\\chi(t-\\alpha)\\bigr)\\bigl(1+\\chi(t-\\beta)\\bigr).\n\\]\nExpanding produces three character sums\n\n\\[\n\\Sigma_1=\\sum_{t\\in A}\\bigl(\\chi(t)+\\chi(t-\\alpha)+\\chi(t-\\beta)\\bigr),\n\\]\n\\[\n\\Sigma_2=\\sum_{t\\in A}\\bigl(\\chi(t)\\chi(t-\\alpha)+\\chi(t)\\chi(t-\\beta)+\\chi(t-\\alpha)\\chi(t-\\beta)\\bigr),\n\\]\n\\[\n\\Sigma_3=\\sum_{t\\in A}\\chi\\!\\bigl(t(t-\\alpha)(t-\\beta)\\bigr).\n\\]\n\n4(a) Constant term: $q-3$.\n\n4(b) Linear sums.  Using $\\sum_{x\\in\\Bbb F_{q}}\\chi(x)=0$ and translating variables,\n\\[\n\\Sigma_1=-(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr).\n\\]\n\n4(c) Quadratic sums.  For $\\gamma\\neq0$ one has\n\\[\n\\sum_{x\\in\\Bbb F_{q}}\\chi(x)\\chi(x-\\gamma)=-1 .\n\\]\nRemoving the exceptional points gives exactly\n\\[\n\\Sigma_2=-3-\\Bigl[\\chi(\\alpha)\\chi(\\beta)+\\chi(\\alpha)\\chi(\\alpha-\\beta)\n                +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)\\Bigr].\n\\]\n\n4(d) Cubic sum.  Since $\\chi(0)=0$, deleting the three exceptional $t$ does not alter the value:\n\\[\n\\Sigma_3=\\sum_{t\\in\\Bbb F_{q}}\\chi\\!\\bigl(t(t-\\alpha)(t-\\beta)\\bigr)=:S(\\alpha,\\beta).\n\\]\n\nCollecting,\n\\[\nN_{\\mathrm{gen}}\n      =\\frac18\\Bigl[(q-3)+\\Sigma_1+\\Sigma_2+\\Sigma_3\\Bigr].\n\\tag{1}\n\\]\n\n5.\\;Elliptic–curve interpretation of $S(\\alpha,\\beta)$.  \nFor any $x\\in\\Bbb F_{q}$ the equation $y^{2}=x(x-\\alpha)(x-\\beta)$ has $1+\\chi\\!\\bigl(x(x-\\alpha)(x-\\beta)\\bigr)$ solutions in $y$.  Summing over $x$ gives\n\\[\n\\#E_{\\alpha,\\beta}(\\Bbb F_{q})=q+1+S(\\alpha,\\beta),\n\\]\nhence\n\\[\nS(\\alpha,\\beta)=-a_q(\\alpha,\\beta).\n\\]\nInsert into (1):\n\n\\[\nN_{\\mathrm{gen}}\n   =\\frac18\\Bigl[\n        q-6-a_q(\\alpha,\\beta)\n       -(1+\\varepsilon)\\!\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n       -\\bigl(\\chi(\\alpha)\\chi(\\beta)+\\chi(\\alpha)\\chi(\\alpha-\\beta)\n              +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)\\bigr)\n     \\Bigr].\n\\tag{2}\n\\]\n\n6.\\;Exceptional contribution.  \nEvaluate $I$ at $t=0,\\alpha,\\beta$ (note $\\delta(\\alpha)=\\delta(\\beta)=0$):\n\n\\[\n\\begin{array}{ll}\nt=0: & P_{0}=\\dfrac{\\bigl(1+\\varepsilon\\chi(\\alpha)\\bigr)\\bigl(1+\\varepsilon\\chi(\\beta)\\bigr)}{4},\\\\[8pt]\nt=\\alpha: & P_{\\alpha}=\\dfrac{\\bigl(1+\\chi(\\alpha)\\bigr)\\bigl(1+\\chi(\\alpha-\\beta)\\bigr)}{4},\\\\[8pt]\nt=\\beta: & P_{\\beta}=\\dfrac{\\bigl(1+\\chi(\\beta)\\bigr)\\bigl(1+\\varepsilon\\chi(\\alpha-\\beta)\\bigr)}{4}.\n\\end{array}\n\\]\nHence\n\\[\nN_{\\mathrm{exc}}=P_{0}+P_{\\alpha}+P_{\\beta}.\n\\tag{3}\n\\]\n\n7.\\;Final combination.  \nWrite\n\\[\n\\Sigma_1'=\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta),\\qquad\n\\Sigma_2'=\\chi(\\alpha)\\chi(\\beta)+\\chi(\\alpha)\\chi(\\alpha-\\beta)\n          +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta).\n\\]\nA short calculation from (3) shows\n\\[\n2\\,N_{\\mathrm{exc}}=\\frac{3+(1+\\varepsilon)\\Sigma_1'+\\Sigma_2'}{2}.\n\\tag{4}\n\\]\nAdding (2) and (3) and simplifying with (4) yields\n\\[\n\\boxed{\\,N_{\\alpha,\\beta}(q)=\n       \\frac{q-a_q(\\alpha,\\beta)\n              +(1+\\varepsilon)\\Sigma_1'\n              +\\Sigma_2'}{8}\\,}.\n\\tag{5}\n\\]\n\nExplicitly,\n\\[\nN_{\\alpha,\\beta}(q)=\n\\frac{q-a_q(\\alpha,\\beta)\n       +(1+\\varepsilon)\\bigl(\\chi(\\alpha)+\\chi(\\beta)+\\chi(\\alpha-\\beta)\\bigr)\n       +\\chi(\\alpha)\\chi(\\beta)\n       +\\chi(\\alpha)\\chi(\\alpha-\\beta)\n       +\\varepsilon\\,\\chi(\\beta)\\chi(\\alpha-\\beta)}{8}.\n\\]\n\n8.\\;Integrality.  \nFormula (5) arose by summing integer quantities and dividing exactly once by $8$.  \nEach intermediate coefficient of $\\tfrac18$ in (1) originates from\neight equal terms and is therefore already an integer; likewise $N_{\\mathrm{exc}}$ is a sum of three quarter–integers, hence an element of $\\tfrac14\\Bbb Z$.  \nConsequently the numerator in (5) is a multiple of $8$, so $N_{\\alpha,\\beta}(q)\\in\\Bbb Z$.\n\n9.\\;Automatic non–negativity and upper bound.  \nBecause (5) equals the cardinality $N_{\\alpha,\\beta}(q)$ found at the outset, it is automatically $\\ge 0$ and $\\le q$.  \nNevertheless one can verify it directly from the formula:\n\n(i) Range of the character part.  \nFor $A,B,C\\in\\{\\pm1\\}$ set  \n$s=A+B+C$, $p=AB+AC+BC$.  One checks the pairwise possibilities to see  \n$-3\\le 2s+p\\le 9$ and $-3\\le p\\le 3$.  Hence\n\\[\n-3\\le(1+\\varepsilon)\\Sigma_1'+\\Sigma_2'\\le 9 .\n\\]\n\n(ii) Hasse’s bound $|a_q(\\alpha,\\beta)|\\le2\\sqrt q$ then gives\n\\[\nq-2\\sqrt q-3\\;\\le\\; \nq-a_q(\\alpha,\\beta)+(1+\\varepsilon)\\Sigma_1'+\\Sigma_2'\n\\;\\le\\; \nq+2\\sqrt q+9 .\n\\]\nFor $q\\ge9$ the left–hand side is non–negative; for $q=3,5,7$ a short\ndirect inspection of (5) (or explicit counting) confirms\n$N_{\\alpha,\\beta}(q)\\ge0$.  In every case $N_{\\alpha,\\beta}(q)\\le q$\nbecause it is the count of elements of a subset of $\\Bbb F_{q}$.\n\n10.\\;Numerical check.  \nTake $q=7$, $\\alpha=1$, $\\beta=2$.  Then\n$\\varepsilon=-1$, $\\chi(\\alpha)=\\chi(\\beta)=1$, $\\chi(\\alpha-\\beta)=-1$ and\n$\\#E_{1,2}(\\Bbb F_{7})=8$, so $a_{7}(1,2)=0$.  Formula (5) gives\n\\[\nN_{1,2}(7)=\\frac{7-0+(1-1)(1+1-1)+(1-1+1)}{8}=1,\n\\]\nmatching a direct enumeration.\n\nHence (5) completes the determination of $N_{\\alpha,\\beta}(q)$.",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T01:37:45.560859",
        "was_fixed": false,
        "difficulty_analysis": "1.  Higher dimensional intersection:  the original problem intersects two quadratic images; the enhanced variant intersects three, creating a cubic condition.\n2.  Advanced machinery:  evaluation of the cubic character sum is translated into counting $\\mathbb F_q$-points on an elliptic curve, introducing algebraic–geometry (elliptic curves, Frobenius trace, Hasse bound).\n3.  Non-elementary constants:  the answer involves the Frobenius trace $a_q(\\alpha,\\beta)$, a subtle arithmetic invariant that generally cannot be expressed by elementary Legendre symbols alone.\n4.  Multiple interacting concepts:  quadratic characters, Jacobi sums, elliptic curves, and the correction for the special value $0$ all interact.\n5.  Longer derivation:  the solution requires partitioning the sum, expanding products, using classical character-sum identities, and invoking elliptic-curve point counting—considerably deeper and more elaborate than the linear change-of-variables trick that solved the original exercise."
      }
    }
  },
  "checked": true,
  "problem_type": "calculation"
}