{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":51471,"title":"Find integer solutions to an equation with a sum of binomial coefficients","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 145.25px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 72.625px; transform-origin: 407px 72.625px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 115.125px 7.91667px; transform-origin: 115.125px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTheorem 1 of chapter 27 of the book \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 70.425px 7.91667px; transform-origin: 70.425px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eDiophantine Equations\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 198.45px 7.91667px; transform-origin: 198.45px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by Louis J. Mordell shows that the equation                                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 34px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 17px; text-align: left; transform-origin: 384px 17px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-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2 = (x choose 0) + (x choose 1) + (x choose 2) + (x choose 3)\" style=\"width: 186.5px; height: 34px;\" width=\"186.5\" height=\"34\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 137.7px 7.91667px; transform-origin: 137.7px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ehas a finite number of real, integer solutions \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAmCAYAAABnE91tAAACbklEQVRoge2ZYZHjMAyFPw5hsARMoAiCwAzKIAxKIRgKoRxCIRhKoffD1sXJpakt2+1ex29mZ6fjWo4USe/JhYaGhoaGr4EBLp9+iAwMwKmWcQPcgK7WAW9AB1wBW9qwAWb+7+AIOmAC+pIG55IGfwF+gLv/n40RV1rfhoECfv0ADyo2tg+iw/mW1Y9GXL1+K7L8kwgPxR7n96HH+Wg0my268jLAmf3AniijRTpvo/f29pqtrB05n5UEo98ciwGnMSa/74EL1Nbew39HKxkkyLfA3p54lbVX8mRG2axvOCpMRef3PYKDxaEeF8RSZStBuvNvEOzB2taGxs+Vg6m4sry9nnoiU3rIMzaKoXJ51mTkBOjMOsVVTTASkq3jztrIusz3MKBs1DkBMiwB2nvwkpDets1SmQBeqWUJUDJx5AQIljdbe/qXXrN1cog8+yMBMiwBmpU2YiFqP2TN2OyBdLb+iwmdypRpOaT7IkPhAWZ/ztV/vhCfucKEydB299HvDftQ8fuXnTNFX0n2xrLmhLJShIlSurtlXVJbhjGss9LggnnjNdu8OjcUoSkvRN0npbaPDpNbxhHX7LZ3LKEekuCZnXX50945hdmakg2io9R3XRNLXe9BGEAU65YJ7Iv1cPwIe4gGckZKxl/IJBFx8FmT7VgG02ffsQfr4f6ZPEmwnf1icKfA2DOVMBJ5jjbVz6Rnn5R89ggk9V2Tqi16zXUi3VEZqIvds1vq3SxKcDRvUn5tSZ2jrlRQ+APl56qONEq+sDCVlEjqiHCm4nxoaxqPQCgLNJljecMvw5/88VBYT6vMa488DQ0NDQ3vxB/S+dLV0jP65QAAAABJRU5ErkJggg==\" alt=\"(x,y)\" style=\"width: 36px; height: 19px;\" width=\"36\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 57.55px 7.91667px; transform-origin: 57.55px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. One of them has \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABb0lEQVRoge2YbZGDMBCGHw91gIEaQAEKcFAHdVALaEDCeaiFaMBC70f6Dh9zBY6ESXK3z0x+0WY2L/vuLgHDMAzDMMqkBe47V5soxqRcgAF47Vz3NGGmpcUf3gFfK0siVWnCTIsDHhu/qfACPc8PJz9qfJZsceMfWw322eeJF+l6cizFIqu50E3UQpdvpaL8timrbdWtH2mAnnnl7yfPW+atc09aS9TQVR850AdkteA9JdSAnztqfHo2QMdcvDVq9s8ra+sWeqA3UawmlJJS3HFM+ViZFKvABlltyZVRpIGya9CUaFYTGu2jpGYGRLWa6PlbU2lUq4Ev1krNkO+bnLqbI7LVOuYiHa1JuXQ31dhoVmvfm02vHLqDe+XS3R5E7mqOMSjVJb0B2bC06wVZrTny5wteiB6f0sNio+m81OIFKm0ckNU0GP+aZc1Yer/aeF4CstrRkgGMH7Ofqn698Tx3dD67FjEMwzAMwzDO5xv4Ur5E4b6XigAAAABJRU5ErkJggg==\" alt=\"x = 7\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.3417px 7.91667px; transform-origin: 30.3417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYYAAAAnCAYAAAALt+8aAAAHOklEQVR4nO2dbZGzMBSFjwcc1EANVMEqqIM6qINaQEMl1EMtrIZa2PcHPcMtJSFAAlze88wws7P9IiS5J/eDAAghhBBCCCGEEEIIIYQQQmyHA4AzgCuAC4Bq3dMRQoj/ngrADxq7fEVjpxfjDOAPwAPA6/33631CQgghlueIxg4/Afyisct/aASiOKf3j1oPoUYrDvIchBBiWSo0dvlk/scF/F/n/0Wo0e8Z0HOQ1yCEEMtyBnDr+f8djV3uey0rIcP/gIRBiC1xxD7m4wHNipdxc0Ulvjmh/7pcsZAwhKAweOy0Cs0F/F37RBL5QesiDh0vNAZiq5zQrGrocTJ3Ndagnd6fu2Q9u/Kc0HjhjAm/0FyP1D5jGDfU94smHzNSoelLxstrjA+HMOZ+z3tqi0CbdEczrpnPHTs3KAyrLRD+4K8DePFtAt0DdA9TjudK55jCDfFzT1nlUBD4GU/CwBjwL5o22IRhymQ+IH79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w9jvTLkPYivY6x7ru1vP+yiCobHiWRi4OGLbuuNzMXGwP2wVmVsOeEsoj2EvwjAnjLSFNnCijxW2vQkDkFa2GMJGAPYiDH33OTwQ9zK8CgNFsDsPmGDndVjsOQv8wW5m31OFwxT2EEoqGUYCyreBCcS53o7nUJKlwrw2eRGG1L6z77tj+kJm6yLBeRwKj1lxWGzTT148Wx5V0ltYO7nTPQ/PwhBaZeSiZBvmiAKwT2EA2jZN8QCnjuccXtPUqqTY52wf37CMMKxhnxgGjH1uzM2fWeCFYPxqqJ461+9JGObDBFWpXFCpNqSKQmxxskdhoMcw5Q5Whl08VCUBbQg0Fje3oaTU/JPHqiR7Y2cIO94XEQZ7UtwL/H/AuzDw3pKSVSil2lAnfCdLpEPsURiYY5gSR+ZWy14KRmw+ZWhvqDGPD/aYY7ACGGqn3Utrkdxvt6bY0zbac/AuDHQtS5YUl2iD3fohtHU0yzdjY9GbMBzR7ukTiyP3VQhaA9l3LnMEZS3szVmh8cXXx1x/j8IADLe1dNj4i7kJL4909yYpocClhYEDqWTYL3cbYk8eGxuasJUtpSZLTmGw5aQUdAoh9/sJ7aLbvW5PtMLKJ8F53IrbJlW7fTj24TTEqzDYa9HtS3oUi1eKrvKjK8CJ1L2zkOWSOY1sSWGwYaSSfZZ76/AxcdrYZnLPnvfzuRE5r0dOYeDeNd0dUrknUMw7so+htWOWbfbs5bNtfJYIH2nJKqSxeBUG4PNacGzwWFz4eWON58G1RfiQm9UeyJ2BPbRhDtx2weNqXIjJsDpk7/csCCGESKSGr4SVEEKIjHCzLsbtaozb5lcIIcTOsDdu8LGAEgUhhPiP4T7fXkvbhBBCCCGEEEIIIYQQQgghhBBCLMw/W1zhyJXSTA8AAAAASUVORK5CYII=\" alt=\"y^2 = 1 + 7 + 21 + 35 + 64 = 8^2\" style=\"width: 195px; height: 19.5px;\" width=\"195\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42.25px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21.125px; text-align: left; transform-origin: 384px 21.125px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 107.217px 7.91667px; transform-origin: 107.217px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a value \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGkAAAAoCAYAAAD9htTzAAACkklEQVR4nO2Z25GjMBBFbw5k4ARIgAiIwBnwMf9k4BSIgRDIwSk4BlLwfqjv6iLDYvDMgmr6VLns0gv1Q90tDDiO4ziO4ziO4ziO4ziO4zg/xgXAFUBrv9O+1vpzoMLyfpdkPDU1gB7AAOBpn176r9L+xHvC0aiffqqNsnQmx0P2W1pfAeAu7d3GtU8DDTUiCFUhCFwjCNUvT51QYWrYvZ9mpxz6/FZkuyE43WAyZUmDKBwNtNWbge87SWW68AZGxKjQ4n0HOz0lopFG5JOD5ugR5XgcvJdvhx6Yu2AaFXJ2tlnogfejN/IhGhWyzT9zpBXQ3jL1qOpO0ao020pujg5TI+0NE0dXdyVCuGYpnnvo/ssVQZgCMS/t9cAjqztGgwbTvJTV5XUOeh6VwrxED6TgOQjaITqX5iVGhQbhvgTE0vxucwr7ZlUIBJlTfSiFrX2zuVcbzzzIO6Y6/dXWH/EPCluot02PmCbXtDK647wVEi+nVFJa8DAqDAhypYqmAbgOv6mTAfHOmJ5IOvcNQaf6vDQK0PCVPbPESs5Nc0Ya+y8r/WdCX2cxXCvdSv8dQXn6FoJ3KyqzxOtJKm1cekleeg73uSki8UXjkjWrlf6zwPzX4FUxsLZmob9ANCBDoDoojcbIojmahYmemMvMONLi/A5/SmpE76YBWbrrCdGQCMwbDYiGWHr7rs7gvAlDoXo3DaIRJM1Hw8wYrYrTcKb3z9xfEvx3HgiKVaUyH/FkMYSxTfO5zuuScdrXIxZgT+svkUe1fChU/iBtLBA0jGmY6jGt9GrEsp2hjv/NfdncRtbTk9vDjbQK84qGuhtecwrHafWnhmK7VoC1rMX7F+exkvzkbxjHcRzHcRzHcZxfwR+hzjgyLDVwrgAAAABJRU5ErkJggg==\" alt=\"x = xmax\" style=\"width: 52.5px; height: 20px;\" width=\"52.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e­\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 118.242px 7.91667px; transform-origin: 118.242px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and returns a two-column matrix with \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAmCAYAAABnE91tAAACbklEQVRoge2ZYZHjMAyFPw5hsARMoAiCwAzKIAxKIRgKoRxCIRhKoffD1sXJpakt2+1ex29mZ6fjWo4USe/JhYaGhoaGr4EBLp9+iAwMwKmWcQPcgK7WAW9AB1wBW9qwAWb+7+AIOmAC+pIG55IGfwF+gLv/n40RV1rfhoECfv0ADyo2tg+iw/mW1Y9GXL1+K7L8kwgPxR7n96HH+Wg0my268jLAmf3AniijRTpvo/f29pqtrB05n5UEo98ciwGnMSa/74EL1Nbew39HKxkkyLfA3p54lbVX8mRG2axvOCpMRef3PYKDxaEeF8RSZStBuvNvEOzB2taGxs+Vg6m4sry9nnoiU3rIMzaKoXJ51mTkBOjMOsVVTTASkq3jztrIusz3MKBs1DkBMiwB2nvwkpDets1SmQBeqWUJUDJx5AQIljdbe/qXXrN1cog8+yMBMiwBmpU2YiFqP2TN2OyBdLb+iwmdypRpOaT7IkPhAWZ/ztV/vhCfucKEydB299HvDftQ8fuXnTNFX0n2xrLmhLJShIlSurtlXVJbhjGss9LggnnjNdu8OjcUoSkvRN0npbaPDpNbxhHX7LZ3LKEekuCZnXX50945hdmakg2io9R3XRNLXe9BGEAU65YJ7Iv1cPwIe4gGckZKxl/IJBFx8FmT7VgG02ffsQfr4f6ZPEmwnf1icKfA2DOVMBJ5jjbVz6Rnn5R89ggk9V2Tqi16zXUi3VEZqIvds1vq3SxKcDRvUn5tSZ2jrlRQ+APl56qONEq+sDCVlEjqiHCm4nxoaxqPQCgLNJljecMvw5/88VBYT6vMa488DQ0NDQ3vxB/S+dLV0jP65QAAAABJRU5ErkJggg==\" alt=\"(x, y)\" style=\"width: 36px; height: 19px;\" width=\"36\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 29.1667px 7.91667px; transform-origin: 29.1667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e pairs for \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGkAAAAoCAYAAAD9htTzAAAC1UlEQVR4nO2a3XGrMBCFTw90QAM0QAVUQAc85N0duAVqoAR6cAuugRacB+mMDjJcEowUuLPfDOOMAEmrXe2PCGAYhmEYhmEYhmFcmRLA3f8aJ6ME0AN4+av62+kYSqycCUAHoPjLSRkOU86JMeXspATQArjhPWCXvr39cIwawIj0yqmxPt81GU9NA2DAfPEGud9K+wv7hMulnN6P88R78lEAeEh7f/DY2eBCTnBC1XACN3BCDeuvLpJLOUvjcsybbxvh0vrW/90knkMyOgThqKB6Z193zHfgiLwxZ0LwCjf83sBOS4W51X8ag1rMXczjgD5/yoAgxzPTmNmgBR4pWOz2cihLvUIuw8gGLfCRoO+cylKvcNn4s0ScAaVKU5eUdXRCoVnpZTO5JXrMlZTaTdRIU9RWcO6aqfh/E5NaOGEKhLiUywKPPIGgN+gwj0uXKl6XoOWx8GNcogVS8NSCHnEK3iMYl8YleoUOrjwAQmr+8O8UMv4kc4rXQyl833f/buufZxxkjalG3/r+J/yDwnc0+ElPmAfXODPKmToDQVk/qdFYnHKR4oSHXmGEkyteaCqA/fCXazIi1IzxjqRx3xF2PceLDYyKr/2Y1ZZ8WpG//OSVcuP+mdAEhO5a6TfuP+AWT08hWFtxMSu876TKPxcXyWvjcJ6/8kg8aFzTZr1x/yzw8HcthhUI8Sm+XyAokC5QDZRKo2fRGM3ERHdMufAcueGEBk8j+ORKHQMbBOumApm66w5RlwgsKw0Iilg7fVdjOAXqhvZeqT+f0xWqdVMh6kHieDQuPKNZcWxcWn+mOCTYzRE7KfWB7BNuYXVRGY84Nl0Y2zSe63t99JzeGzA/xyzgDPDyZUFquPijtDFBUDembmrAPNNrENJ2ujp+m/vy73bSn+7cAaakTRhX1NXx80q78Jxmf6ootmsG2EhfrL/4HjNJ+08owzAMwzAMwzCMDb4BkIRTCxuZ9zgAAAAASUVORK5CYII=\" alt=\"x \u003c= xmax\" style=\"width: 52.5px; height: 20px;\" width=\"52.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54.8333px 7.91667px; transform-origin: 54.8333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Sort the pairs in order of increasing \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function xy = Mordell(xmax)\r\n  xy = f(xmax);\r\nend","test_suite":"%%\r\nxmax = 2;\r\nxy = Mordell(xmax);\r\nn_correct = 3;  %  Be careful here\r\nassert(isequal(size(xy,1),n_correct))\r\n\r\n%%\r\nxmax = 10;\r\nxy = Mordell(xmax);\r\nn_correct = 4;\r\nxy_last = [7 8];\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(xy(end,:),xy_last));\r\n\r\n%%\r\nxmax = 50;\r\nxy = Mordell(xmax);\r\nn_correct = 5;\r\nPS_correct = -2340;\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(prod(sum(xy,2)),PS_correct));\r\n\r\n%%\r\nxmax = 100;\r\nxy = Mordell(xmax);\r\nn_correct = 6;\r\nPS_correct = -781560;\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(prod(sum(xy,2)),PS_correct));\r\n    \r\n%%\r\nxmax = 500;\r\nxy = Mordell(xmax);\r\nn_correct = 6;\r\nPS_correct = -781560;\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(prod(sum(xy,2)),PS_correct));\r\n\r\n%%\r\nxmax = 1000;\r\nxy = Mordell(xmax);\r\nPS_correct = -7377144840;\r\nassert(isequal(prod(sum(xy,2)),PS_correct));\r\n\r\n%%\r\nxmax = 5000;\r\nxy = Mordell(xmax);\r\nPSD_correct = 4254584400;\r\nassert(isequal(prod(sum(diff(xy),2)),PSD_correct));\r\n\r\n%%\r\nxmax = 10000;\r\nxy = Mordell(xmax);\r\nSPCS_correct = 7776998;\r\nassert(isequal(sum(prod(cumsum(xy),2)),SPCS_correct));","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-04-19T03:35:35.000Z","updated_at":"2021-04-19T15:20:33.000Z","published_at":"2021-04-19T03:38:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTheorem 1 of chapter 27 of the book \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDiophantine Equations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e by Louis J. Mordell shows that the equation                                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"y^2 = (x choose 0) + (x choose 1) + (x choose 2) + (x choose 3)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ey^2={x \\\\choose 0} + {x \\\\choose 1} + {x \\\\choose 2} + {x \\\\choose 3} \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehas a finite number of real, integer solutions \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"(x,y)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(x, y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. One of them has \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x = 7\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"y^2 = 1 + 7 + 21 + 35 + 64 = 8^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ey^2 = 1 + 7 + 21 + 35 = 64 = 8^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a value \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x = xmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = x_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e­\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and returns a two-column matrix with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"(x, y)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(x, y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e pairs for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x \u0026lt;= xmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex \\\\le x_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Sort the pairs in order of increasing \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":51251,"title":"Locate a family on a long street ","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 186.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 93.25px; transform-origin: 407px 93.25px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.983px 7.91667px; transform-origin: 374.983px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTwo children, Matilda and Labrun, live on a street in which—unlike many streets in the U.S.—the houses on one side are numbered consecutively, starting at 1. They notice that the sum of the numbers on the houses to the left of theirs equals the sum of the numbers to the right. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.5px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.75px; text-align: left; transform-origin: 384px 31.75px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 82.7083px 7.91667px; transform-origin: 82.7083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAoCAYAAAC1mQk2AAAB+0lEQVRoge2XzXGDMBBGXw/ugAbSADO5u4AMHXDPwR24BWqgBHpwC9RAC+Sg/aJFln1wYifM7JvhYO0i9l8yBEEQBEEQBEGw4Q042iMOQAecivV/Tw9MwOqezmRHYClku3IO4EIyfCFnaQZakjNy7PxXBj7KTDJ8JDkzkxzEfsux9k+se5CGbHhPzpQ4sc3mbujIjs0k5zwjOZu7QoavpEFS4rO5KzT5FtLI9/j+al5s14/whg8V+ZlcortChq9cZwvyMaAxv5usyfBaRvy0bEkTcSIFoCFNy8ne7Wxdh70GTeu+UauIhtS7Z5N3tkdDPk+1py4OSsbNYXZwhp8q8p5tf13c5mKx52gGqLSlO7q1Mni6BGgovTk9f6zo/dHsPJlurcK+N7538Hp5bSoqMLN9VB/TdB1NRwHyGdPefk/vQMl6R3ZFS47ALXqT13rLX7V0h5TBMzmiOk6UbZX4xDYzXaHnUTnezNJvolr3mRi4zoSOEwWndFRMhZ5H+77kEq77pY/iYusyTtnx/bUWOnC7DyXTt55+CZfBF7em/vJ9oPIaTP7BtQMHtpNTE9HL/FCCJ2ZOBvv+1JDwJTa4tQl4J/flgeTs4PTOpvdpxg9uP2XtyBPvreoTX4aKelPRG5xuT+47rSsoOicvplML3MDO/mUEQRAEwT2+AKH4zRSYnlePAAAAAElFTkSuQmCC\" alt=\"nmax\" style=\"width: 27px; height: 20px;\" width=\"27\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 281.6px 7.91667px; transform-origin: 281.6px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, the maximum number of houses on the street, and returns the largest possible number of houses and the number of the house where the family of Matilda and Labrun lives. For example, if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAoCAYAAAC1mQk2AAAB+0lEQVRoge2XzXGDMBBGXw/ugAbSADO5u4AMHXDPwR24BWqgBHpwC9RAC+Sg/aJFln1wYifM7JvhYO0i9l8yBEEQBEEQBEGw4Q042iMOQAecivV/Tw9MwOqezmRHYClku3IO4EIyfCFnaQZakjNy7PxXBj7KTDJ8JDkzkxzEfsux9k+se5CGbHhPzpQ4sc3mbujIjs0k5zwjOZu7QoavpEFS4rO5KzT5FtLI9/j+al5s14/whg8V+ZlcortChq9cZwvyMaAxv5usyfBaRvy0bEkTcSIFoCFNy8ne7Wxdh70GTeu+UauIhtS7Z5N3tkdDPk+1py4OSsbNYXZwhp8q8p5tf13c5mKx52gGqLSlO7q1Mni6BGgovTk9f6zo/dHsPJlurcK+N7538Hp5bSoqMLN9VB/TdB1NRwHyGdPefk/vQMl6R3ZFS47ALXqT13rLX7V0h5TBMzmiOk6UbZX4xDYzXaHnUTnezNJvolr3mRi4zoSOEwWndFRMhZ5H+77kEq77pY/iYusyTtnx/bUWOnC7DyXTt55+CZfBF7em/vJ9oPIaTP7BtQMHtpNTE9HL/FCCJ2ZOBvv+1JDwJTa4tQl4J/flgeTs4PTOpvdpxg9uP2XtyBPvreoTX4aKelPRG5xuT+47rSsoOicvplML3MDO/mUEQRAEwT2+AKH4zRSYnlePAAAAAElFTkSuQmCC\" alt=\"nmax\" style=\"width: 27px; height: 20px;\" width=\"27\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46.8667px 7.91667px; transform-origin: 46.8667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 10, then the function should find that the street has 8 houses and Matilda and Labrun live in house 6 because 1+2+3+4+5 = 7+8 = 15.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 157.158px 7.91667px; transform-origin: 157.158px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHenry Dudeney posed a version of this problem in \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 52.9083px 7.91667px; transform-origin: 52.9083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eStrand Magazine\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 79.3417px 7.91667px; transform-origin: 79.3417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in the early part of the 20\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 5.83333px 7.91667px; transform-origin: 5.83333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 69.4917px 7.91667px; transform-origin: 69.4917px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e century. Although the connections might not be immediately clear, you might try Cody Problems \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/groups/25/problems/1215\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e1215\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8057\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e8057\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 17.5px 7.91667px; transform-origin: 17.5px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45253\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e45253\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 25.2833px 7.91667px; transform-origin: 25.2833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e as well.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [x,y] = houseNumber(nmax)\r\n  % x = number of the house of Matilda and Labrun\r\n  % y = number of houses on the street\r\n  x = f1(nmax)\r\n  y = f2(nmax)\r\nend","test_suite":"%%\r\nnmax = 10;\r\nx_correct = 6;\r\ny_correct = 8;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 100;\r\nx_correct = 35;\r\ny_correct = 49;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%% Dudeney's problem\r\nnmax = 500;\r\nx_correct = 204;\r\ny_correct = 288;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 2000;\r\nx_correct = 1189;\r\ny_correct = 1681;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 10000;\r\nx_correct = 6930;\r\ny_correct = 9800;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 100000;\r\nx_correct = 40391;\r\ny_correct = 57121;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 500000;\r\nx_correct = 235416;\r\ny_correct = 332928;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 2e6;\r\nx_correct = 1372105;\r\ny_correct = 1940449;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\n\r\n%%\r\nnmax = 2e7;\r\nx_correct = 7997214;\r\ny_correct = 11309768;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\n\r\n%%\r\nnmax = 1834432;\r\np_correct = 78376578048;\r\nds_correct = 48;\r\ndp_correct = 1866240;\r\n[x,y] = houseNumber(nmax);\r\nd = [num2str(x)-'0' num2str(y)-'0'];\r\nassert(isequal(x*y,p_correct) \u0026\u0026 isequal(sum(d),ds_correct) \u0026\u0026 isequal(prod(d),dp_correct))","published":true,"deleted":false,"likes_count":8,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":22,"test_suite_updated_at":"2021-05-16T01:51:40.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2021-03-29T00:43:22.000Z","updated_at":"2026-03-22T23:36:57.000Z","published_at":"2021-03-29T00:53:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTwo children, Matilda and Labrun, live on a street in which—unlike many streets in the U.S.—the houses on one side are numbered consecutively, starting at 1. They notice that the sum of the numbers on the houses to the left of theirs equals the sum of the numbers to the right. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"nmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, the maximum number of houses on the street, and returns the largest possible number of houses and the number of the house where the family of Matilda and Labrun lives. For example, if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"nmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e = 10, then the function should find that the street has 8 houses and Matilda and Labrun live in house 6 because 1+2+3+4+5 = 7+8 = 15.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHenry Dudeney posed a version of this problem in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eStrand Magazine\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in the early part of the 20\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eth\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e century. Although the connections might not be immediately clear, you might try Cody Problems \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/groups/25/problems/1215\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1215\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8057\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e8057\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45253\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e45253\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e as well.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1215,"title":"Diophantine Equations (Inspired by Project Euler, problem 66)","description":"Consider the quadratic Diophantine equation of the form:\r\n\r\nx^2 – Dy^2 = 1\r\n\r\nWhen D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.  It can be assumed that there are no solutions in positive integers when D is square.\r\n\r\nGiven a value of D, find the minimum value of X that gives a solution to the equation.","description_html":"\u003cp\u003eConsider the quadratic Diophantine equation of the form:\u003c/p\u003e\u003cp\u003ex^2 – Dy^2 = 1\u003c/p\u003e\u003cp\u003eWhen D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.  It can be assumed that there are no solutions in positive integers when D is square.\u003c/p\u003e\u003cp\u003eGiven a value of D, find the minimum value of X that gives a solution to the equation.\u003c/p\u003e","function_template":"function y = Diophantine(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 2; y_correct = 3; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 151; y_correct = 1728148040; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 61; y_correct = 1766319049; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 66; y_correct = 65; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 12000; y_correct = 13007560326001; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 2345; y_correct = 15129001; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nj=[10:10:90 110:10:200]; v=arrayfun(@(x) Diophantine(j(x)),1:length(j));\r\ny_correct=[19 9 11 19 99 31 251 9 19 21 11 6499 71 49 721 339 161 52021 99];\r\nassert(all(isequal(v,y_correct)))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":8,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":70,"test_suite_updated_at":"2013-10-17T19:30:05.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-01-18T19:13:15.000Z","updated_at":"2026-02-15T03:32:35.000Z","published_at":"2013-01-18T19:13:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider the quadratic Diophantine equation of the form:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex^2 – Dy^2 = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhen D=13, the minimal solution in x is 649^2 – 13×180^2 = 1. It can be assumed that there are no solutions in positive integers when D is square.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a value of D, find the minimum value of X that gives a solution to the equation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":55340,"title":"Solutions to Generalized Pell Equation or Quadratic Diophantine","description":"The generalized Pell equation is of the form: . Given D and N as inputs, output the first 50 positive integer solutions [x, y] sorted by x (smallest to largest). Both outputs should be a cell array of character arrays containing the integer solutions.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe generalized Pell equation is of the form: \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMQAAAAmCAYAAACbKjTiAAAAAXNSR0IArs4c6QAADCtJREFUeF7tnHnMpdccxz/nrb0p0SoqTcQyaJpQSksxdoPSqq2ltc5UqaAqtYQiFbsqbdHGktAZS4ga1dgiVFRCbBVLELHVaKldrfU+8r33nPue57nnec5yz11m2uePydz3nvM7v+X89t9zDav6GKBZMHI1zqwBY8FkX3fcBgckvtZznTzH7Ajy4VrCnGsJmUE7MKUQRdYihYMpa3IPrwizIqh0EzO/Q3M52WcCCuAsbss82DdSiHTA6SsnbIluiS7I5HAhvJxtu7v7yKE1k/t1l9dHNAZx7CFiqwqonAPIAizSjfXswPMhLJZHsdNi36fTVw9S+pklK0N41gmZErFZFqOWcq4B0yy+LhASxVLoT7wTi1iWQ389hRifqn83r8HJ64bDgX9huJh13g78ehHEVzsjh4vVDm0B2hd4NsYcDc3BNOZSaN4DfAq4Zh5efT5k7F5QJwpRSf7HGTilgXcDVxvY1mC2YNhJ05yE4cpFllIr0dRKh/RhAdXg/YF3AVcAFwOHYXghcH0angN8eDFoeJe5MjMrg0tPWXv00+ET8BBdVJNRPwA4E3gt8CN77t7AWWBOhOYEYMfuZS+Whu1W4BaWn9dYLB4MZjs0lwFPBa6qhV2yhGsduMJw6oVMcF/gLsD7O9brKDA7oXmVVZYVZsdKoHZj4KWAwqPfeBjdDHgvsAnMsdD8eCWwDSCxagoWx2dj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71npXRAmgknOVp/V5Cc8exuwIOQZDk/Sjo21AAwqxhzGw4ArOyIH7eD/Mph971ospsYpKAZYDW6YImJGiutjFoS0BXU8h8k/P3xHnwSqvyKe3syMfgGWHE9OccvBivGaV1tIO7kV8uSHTrPzM3h8SwCxCKdxbuC2b3DluqElCTVizkvx/TbMwVbgvCjYAAAAASUVORK5CYII=\" width=\"98\" height=\"19\" style=\"width: 98px; height: 19px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Given D and N as inputs, output the first 50 positive integer solutions [x, y] sorted by x (smallest to largest). Both outputs should be a cell array of character arrays containing the integer solutions.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [x,y] = genPell(D,N)\r\n  x=D;y=N;\r\nend","test_suite":"%%\r\nD=5;N=4;\r\n[x,y]=genPell(D,N);\r\nxc='1149851';\r\nyc='514229';\r\nassert(isequal(x{20},xc));\r\nassert(isequal(y{20},yc));\r\n%%\r\nD=221;N=217;\r\n[x,y]=genPell(D,N);\r\nxc='332876589744830';\r\nyc='53210398631041';\r\nassert(isequal(x{50},xc));\r\nassert(isequal(y{50},yc));\r\n%%\r\nD=13;N=101;\r\n[x,y]=genPell(D,N);\r\nX=0;Y=0;\r\nfor k=1:50\r\n X=X+sum(x{k}-'0');\r\n Y=Y+sum(y{k}-'0');\r\nend\r\nxc='3623278382061607649320985199308667';\r\nyc='1004916614754102227986611702029474';\r\nassert(isequal(X,4699));\r\nassert(isequal(Y,4456));\r\nassert(isequal(x{43},xc));\r\nassert(isequal(y{43},yc));\r\n%%\r\nD=15;N=34;\r\n[x,y]=genPell(D,N);\r\nxc='2427336873403';\r\nyc='626735685755';\r\nassert(isequal(x{27},xc));\r\nassert(isequal(y{27},yc));\r\nassert(isequal(x{48}(10:20),'36212499752'));\r\nassert(isequal(y{48}(10:20),'95249371677'));\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":145982,"edited_by":145982,"edited_at":"2022-08-22T01:39:08.000Z","deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-08-22T01:32:43.000Z","updated_at":"2026-03-15T18:48:05.000Z","published_at":"2022-08-22T01:39:09.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe generalized Pell equation is of the form: \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex^2-Dy^2 = \\\\pm N\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Given D and N as inputs, output the first 50 positive integer solutions [x, y] sorted by x (smallest to largest). Both outputs should be a cell array of character arrays containing the integer solutions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":51471,"title":"Find integer solutions to an equation with a sum of binomial coefficients","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 145.25px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 72.625px; transform-origin: 407px 72.625px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 115.125px 7.91667px; transform-origin: 115.125px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTheorem 1 of chapter 27 of the book \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 70.425px 7.91667px; transform-origin: 70.425px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eDiophantine Equations\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 198.45px 7.91667px; transform-origin: 198.45px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by Louis J. Mordell shows that the equation                                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 34px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 17px; text-align: left; transform-origin: 384px 17px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-14px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXUAAABECAYAAAB+rKV0AAAMSUlEQVR4nO2d7XUqOw+Fdw90QANpgApSAR3QQTpIC9RACfSQFlJDWsj9Mew1upPBnxLHH3rWYr33PZCBsaVtWZY9gOM4juM4juM4juM4juM4juM4juM4juM4juM483IAc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tCtXLqjIBGSBOQAxYjLxXVWlFnBDSSALFNauyEz0rIbVPmoEcaJIF0v09BbkBKSZON6PdNQRGK5YEtql8Y/Y+2CYxtVZKzrBF19qX1g17+BbSVkvs6YLHvmqMBej2+4hmpfp8Ko/WUFNWoft8UNNxQI3N0jRl46ucoXr2eoxGCDlNybzWiPqoAAWu75N5bjaCPPEgCaX6fCoU6Fn2P7PdNkTJqy1Ko0GgsI/qQsdAIRljM26M0Wi8VdZn2GVGAgMVmcmqiawQdWPtw1MU8zWid/hxL54zu903BFfFQp2id/cJovteDkVL5Rn4utlTUmUvv9UC0FLgInJqLvSNuYxfs2zIPr9NKT7RKit+nkDKjmcXvm4K7w551TM4pjc+i9ANWsRs1oiSsxc1JGZSIOr9nlJK7EFyUi6UMrlhEPWRjZzwXba2Kmx6I+T2fRfAM9kloYJjJ75uCDR/Kd4XOU6cjhEZi7kKbwVmAdBEick0iRdSZYgidpDcaMRHijPIL63nq2xdnlHtCpBW99kLI7+VmQj4UR8K2igUus/l9U7D0K9RJZ6wLge9Yn3wU69zZnIXQoGOi+45VbJ450bNrz+QsHMj2REgerRt77fUJ7X+2crtnfs+8u2w3tv03Fr+P2d6sft8UKZ2wfVbhO9KOPJ2xY1Oi6Y/Ia+/vuPFjJkEne+J7RLwd5WubQmTEOpugk2d+f3j8G9vtgvTHGM7s981xQt1hPRI64MwdywOQtBbeOFuaUdDJEXXVLRIOvLMKOnG/H5wjdLbxphy0PwtaGy60+qZ3NG3LN8MsuN87juM4juM4juM4juM4juM4juM4juM4juM4juM4juPs8x+l8OmPBJ22DAAAAABJRU5ErkJggg==\" alt=\"y^2 = (x choose 0) + (x choose 1) + (x choose 2) + (x choose 3)\" style=\"width: 186.5px; height: 34px;\" width=\"186.5\" height=\"34\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 137.7px 7.91667px; transform-origin: 137.7px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ehas a finite number of real, integer solutions \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAmCAYAAABnE91tAAACbklEQVRoge2ZYZHjMAyFPw5hsARMoAiCwAzKIAxKIRgKoRxCIRhKoffD1sXJpakt2+1ex29mZ6fjWo4USe/JhYaGhoaGr4EBLp9+iAwMwKmWcQPcgK7WAW9AB1wBW9qwAWb+7+AIOmAC+pIG55IGfwF+gLv/n40RV1rfhoECfv0ADyo2tg+iw/mW1Y9GXL1+K7L8kwgPxR7n96HH+Wg0my268jLAmf3AniijRTpvo/f29pqtrB05n5UEo98ciwGnMSa/74EL1Nbew39HKxkkyLfA3p54lbVX8mRG2axvOCpMRef3PYKDxaEeF8RSZStBuvNvEOzB2taGxs+Vg6m4sry9nnoiU3rIMzaKoXJ51mTkBOjMOsVVTTASkq3jztrIusz3MKBs1DkBMiwB2nvwkpDets1SmQBeqWUJUDJx5AQIljdbe/qXXrN1cog8+yMBMiwBmpU2YiFqP2TN2OyBdLb+iwmdypRpOaT7IkPhAWZ/ztV/vhCfucKEydB299HvDftQ8fuXnTNFX0n2xrLmhLJShIlSurtlXVJbhjGss9LggnnjNdu8OjcUoSkvRN0npbaPDpNbxhHX7LZ3LKEekuCZnXX50945hdmakg2io9R3XRNLXe9BGEAU65YJ7Iv1cPwIe4gGckZKxl/IJBFx8FmT7VgG02ffsQfr4f6ZPEmwnf1icKfA2DOVMBJ5jjbVz6Rnn5R89ggk9V2Tqi16zXUi3VEZqIvds1vq3SxKcDRvUn5tSZ2jrlRQ+APl56qONEq+sDCVlEjqiHCm4nxoaxqPQCgLNJljecMvw5/88VBYT6vMa488DQ0NDQ3vxB/S+dLV0jP65QAAAABJRU5ErkJggg==\" alt=\"(x,y)\" style=\"width: 36px; height: 19px;\" width=\"36\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 57.55px 7.91667px; transform-origin: 57.55px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. One of them has \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABb0lEQVRoge2YbZGDMBCGHw91gIEaQAEKcFAHdVALaEDCeaiFaMBC70f6Dh9zBY6ESXK3z0x+0WY2L/vuLgHDMAzDMMqkBe47V5soxqRcgAF47Vz3NGGmpcUf3gFfK0siVWnCTIsDHhu/qfACPc8PJz9qfJZsceMfWw322eeJF+l6cizFIqu50E3UQpdvpaL8timrbdWtH2mAnnnl7yfPW+atc09aS9TQVR850AdkteA9JdSAnztqfHo2QMdcvDVq9s8ra+sWeqA3UawmlJJS3HFM+ViZFKvABlltyZVRpIGya9CUaFYTGu2jpGYGRLWa6PlbU2lUq4Ev1krNkO+bnLqbI7LVOuYiHa1JuXQ31dhoVmvfm02vHLqDe+XS3R5E7mqOMSjVJb0B2bC06wVZrTny5wteiB6f0sNio+m81OIFKm0ckNU0GP+aZc1Yer/aeF4CstrRkgGMH7Ofqn698Tx3dD67FjEMwzAMwzDO5xv4Ur5E4b6XigAAAABJRU5ErkJggg==\" alt=\"x = 7\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.3417px 7.91667px; transform-origin: 30.3417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYYAAAAnCAYAAAALt+8aAAAHOklEQVR4nO2dbZGzMBSFjwcc1EANVMEqqIM6qINaQEMl1EMtrIZa2PcHPcMtJSFAAlze88wws7P9IiS5J/eDAAghhBBCCCGEEEIIIYQQQmyHA4AzgCuAC4Bq3dMRQoj/ngrADxq7fEVjpxfjDOAPwAPA6/33631CQgghlueIxg4/Afyisct/aASiOKf3j1oPoUYrDvIchBBiWSo0dvlk/scF/F/n/0Wo0e8Z0HOQ1yCEEMtyBnDr+f8djV3uey0rIcP/gIRBiC1xxD7m4wHNipdxc0Ulvjmh/7pcsZAwhKAweOy0Cs0F/F37RBL5QesiDh0vNAZiq5zQrGrocTJ3Ndagnd6fu2Q9u/Kc0HjhjAm/0FyP1D5jGDfU94smHzNSoelLxstrjA+HMOZ+z3tqi0CbdEczrpnPHTs3KAyrLRD+4K8DePFtAt0DdA9TjudK55jCDfFzT1nlUBD4GU/CwBjwL5o22IRhymQ+IH79vM1H8oN2TtaYLm5P+LwOFLQHvtvOhUCqB0BBWYUz/K1OftBcZGucPAgDjQFXUKGDA2iRioQJ0Ou5v/8+oRlH1sjHDD1FvUZrADwJww8aIeie7wmtURzyYNn20Bjw6L1zPr4wb+zaee1JGCo0bY95+hzvqQuHVbwFZsPPa/z4DKyI0RiVEgYavBxG+obGIAzxRN4wU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T148Wx5V0ltYO7nTPQ/PwhBaZeSiZBvmiAKwT2EA2jZN8QCnjuccXtPUqqTY52wf37CMMKxhnxgGjH1uzM2fWeCFYPxqqJ461+9JGObDBFWpXFCpNqSKQmxxskdhoMcw5Q5Whl08VCUBbQg0Fje3oaTU/JPHqiR7Y2cIO94XEQZ7UtwL/H/AuzDw3pKSVSil2lAnfCdLpEPsURiYY5gSR+ZWy14KRmw+ZWhvqDGPD/aYY7ACGGqn3Utrkdxvt6bY0zbac/AuDHQtS5YUl2iD3fohtHU0yzdjY9GbMBzR7ukTiyP3VQhaA9l3LnMEZS3szVmh8cXXx1x/j8IADLe1dNj4i7kJL4909yYpocClhYEDqWTYL3cbYk8eGxuasJUtpSZLTmGw5aQUdAoh9/sJ7aLbvW5PtMLKJ8F53IrbJlW7fTj24TTEqzDYa9HtS3oUi1eKrvKjK8CJ1L2zkOWSOY1sSWGwYaSSfZZ76/AxcdrYZnLPnvfzuRE5r0dOYeDeNd0dUrknUMw7so+htWOWbfbs5bNtfJYIH2nJKqSxeBUG4PNacGzwWFz4eWON58G1RfiQm9UeyJ2BPbRhDtx2weNqXIjJsDpk7/csCCGESKSGr4SVEEKIjHCzLsbtaozb5lcIIcTOsDdu8LGAEgUhhPiP4T7fXkvbhBBCCCGEEEIIIYQQQgghhBBCLMw/W1zhyJXSTA8AAAAASUVORK5CYII=\" alt=\"y^2 = 1 + 7 + 21 + 35 + 64 = 8^2\" style=\"width: 195px; height: 19.5px;\" width=\"195\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42.25px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21.125px; text-align: left; transform-origin: 384px 21.125px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 107.217px 7.91667px; transform-origin: 107.217px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a value \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGkAAAAoCAYAAAD9htTzAAACkklEQVR4nO2Z25GjMBBFbw5k4ARIgAiIwBnwMf9k4BSIgRDIwSk4BlLwfqjv6iLDYvDMgmr6VLns0gv1Q90tDDiO4ziO4ziO4ziO4ziO4zg/xgXAFUBrv9O+1vpzoMLyfpdkPDU1gB7AAOBpn176r9L+xHvC0aiffqqNsnQmx0P2W1pfAeAu7d3GtU8DDTUiCFUhCFwjCNUvT51QYWrYvZ9mpxz6/FZkuyE43WAyZUmDKBwNtNWbge87SWW68AZGxKjQ4n0HOz0lopFG5JOD5ugR5XgcvJdvhx6Yu2AaFXJ2tlnogfejN/IhGhWyzT9zpBXQ3jL1qOpO0ao020pujg5TI+0NE0dXdyVCuGYpnnvo/ssVQZgCMS/t9cAjqztGgwbTvJTV5XUOeh6VwrxED6TgOQjaITqX5iVGhQbhvgTE0vxucwr7ZlUIBJlTfSiFrX2zuVcbzzzIO6Y6/dXWH/EPCluot02PmCbXtDK647wVEi+nVFJa8DAqDAhypYqmAbgOv6mTAfHOmJ5IOvcNQaf6vDQK0PCVPbPESs5Nc0Ya+y8r/WdCX2cxXCvdSv8dQXn6FoJ3KyqzxOtJKm1cekleeg73uSki8UXjkjWrlf6zwPzX4FUxsLZmob9ANCBDoDoojcbIojmahYmemMvMONLi/A5/SmpE76YBWbrrCdGQCMwbDYiGWHr7rs7gvAlDoXo3DaIRJM1Hw8wYrYrTcKb3z9xfEvx3HgiKVaUyH/FkMYSxTfO5zuuScdrXIxZgT+svkUe1fChU/iBtLBA0jGmY6jGt9GrEsp2hjv/NfdncRtbTk9vDjbQK84qGuhtecwrHafWnhmK7VoC1rMX7F+exkvzkbxjHcRzHcRzHcZxfwR+hzjgyLDVwrgAAAABJRU5ErkJggg==\" alt=\"x = xmax\" style=\"width: 52.5px; height: 20px;\" width=\"52.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e­\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 118.242px 7.91667px; transform-origin: 118.242px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and returns a two-column matrix with \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAmCAYAAABnE91tAAACbklEQVRoge2ZYZHjMAyFPw5hsARMoAiCwAzKIAxKIRgKoRxCIRhKoffD1sXJpakt2+1ex29mZ6fjWo4USe/JhYaGhoaGr4EBLp9+iAwMwKmWcQPcgK7WAW9AB1wBW9qwAWb+7+AIOmAC+pIG55IGfwF+gLv/n40RV1rfhoECfv0ADyo2tg+iw/mW1Y9GXL1+K7L8kwgPxR7n96HH+Wg0my268jLAmf3AniijRTpvo/f29pqtrB05n5UEo98ciwGnMSa/74EL1Nbew39HKxkkyLfA3p54lbVX8mRG2axvOCpMRef3PYKDxaEeF8RSZStBuvNvEOzB2taGxs+Vg6m4sry9nnoiU3rIMzaKoXJ51mTkBOjMOsVVTTASkq3jztrIusz3MKBs1DkBMiwB2nvwkpDets1SmQBeqWUJUDJx5AQIljdbe/qXXrN1cog8+yMBMiwBmpU2YiFqP2TN2OyBdLb+iwmdypRpOaT7IkPhAWZ/ztV/vhCfucKEydB299HvDftQ8fuXnTNFX0n2xrLmhLJShIlSurtlXVJbhjGss9LggnnjNdu8OjcUoSkvRN0npbaPDpNbxhHX7LZ3LKEekuCZnXX50945hdmakg2io9R3XRNLXe9BGEAU65YJ7Iv1cPwIe4gGckZKxl/IJBFx8FmT7VgG02ffsQfr4f6ZPEmwnf1icKfA2DOVMBJ5jjbVz6Rnn5R89ggk9V2Tqi16zXUi3VEZqIvds1vq3SxKcDRvUn5tSZ2jrlRQ+APl56qONEq+sDCVlEjqiHCm4nxoaxqPQCgLNJljecMvw5/88VBYT6vMa488DQ0NDQ3vxB/S+dLV0jP65QAAAABJRU5ErkJggg==\" alt=\"(x, y)\" style=\"width: 36px; height: 19px;\" width=\"36\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 29.1667px 7.91667px; transform-origin: 29.1667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e pairs for \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGkAAAAoCAYAAAD9htTzAAAC1UlEQVR4nO2a3XGrMBCFTw90QAM0QAVUQAc85N0duAVqoAR6cAuugRacB+mMDjJcEowUuLPfDOOMAEmrXe2PCGAYhmEYhmEYhmFcmRLA3f8aJ6ME0AN4+av62+kYSqycCUAHoPjLSRkOU86JMeXspATQArjhPWCXvr39cIwawIj0yqmxPt81GU9NA2DAfPEGud9K+wv7hMulnN6P88R78lEAeEh7f/DY2eBCTnBC1XACN3BCDeuvLpJLOUvjcsybbxvh0vrW/90knkMyOgThqKB6Z193zHfgiLwxZ0LwCjf83sBOS4W51X8ag1rMXczjgD5/yoAgxzPTmNmgBR4pWOz2cihLvUIuw8gGLfCRoO+cylKvcNn4s0ScAaVKU5eUdXRCoVnpZTO5JXrMlZTaTdRIU9RWcO6aqfh/E5NaOGEKhLiUywKPPIGgN+gwj0uXKl6XoOWx8GNcogVS8NSCHnEK3iMYl8YleoUOrjwAQmr+8O8UMv4kc4rXQyl833f/buufZxxkjalG3/r+J/yDwnc0+ElPmAfXODPKmToDQVk/qdFYnHKR4oSHXmGEkyteaCqA/fCXazIi1IzxjqRx3xF2PceLDYyKr/2Y1ZZ8WpG//OSVcuP+mdAEhO5a6TfuP+AWT08hWFtxMSu876TKPxcXyWvjcJ6/8kg8aFzTZr1x/yzw8HcthhUI8Sm+XyAokC5QDZRKo2fRGM3ERHdMufAcueGEBk8j+ORKHQMbBOumApm66w5RlwgsKw0Iilg7fVdjOAXqhvZeqT+f0xWqdVMh6kHieDQuPKNZcWxcWn+mOCTYzRE7KfWB7BNuYXVRGY84Nl0Y2zSe63t99JzeGzA/xyzgDPDyZUFquPijtDFBUDembmrAPNNrENJ2ujp+m/vy73bSn+7cAaakTRhX1NXx80q78Jxmf6ootmsG2EhfrL/4HjNJ+08owzAMwzAMwzCMDb4BkIRTCxuZ9zgAAAAASUVORK5CYII=\" alt=\"x \u003c= xmax\" style=\"width: 52.5px; height: 20px;\" width=\"52.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54.8333px 7.91667px; transform-origin: 54.8333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Sort the pairs in order of increasing \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function xy = Mordell(xmax)\r\n  xy = f(xmax);\r\nend","test_suite":"%%\r\nxmax = 2;\r\nxy = Mordell(xmax);\r\nn_correct = 3;  %  Be careful here\r\nassert(isequal(size(xy,1),n_correct))\r\n\r\n%%\r\nxmax = 10;\r\nxy = Mordell(xmax);\r\nn_correct = 4;\r\nxy_last = [7 8];\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(xy(end,:),xy_last));\r\n\r\n%%\r\nxmax = 50;\r\nxy = Mordell(xmax);\r\nn_correct = 5;\r\nPS_correct = -2340;\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(prod(sum(xy,2)),PS_correct));\r\n\r\n%%\r\nxmax = 100;\r\nxy = Mordell(xmax);\r\nn_correct = 6;\r\nPS_correct = -781560;\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(prod(sum(xy,2)),PS_correct));\r\n    \r\n%%\r\nxmax = 500;\r\nxy = Mordell(xmax);\r\nn_correct = 6;\r\nPS_correct = -781560;\r\nassert(isequal(size(xy,1),n_correct) \u0026\u0026 isequal(prod(sum(xy,2)),PS_correct));\r\n\r\n%%\r\nxmax = 1000;\r\nxy = Mordell(xmax);\r\nPS_correct = -7377144840;\r\nassert(isequal(prod(sum(xy,2)),PS_correct));\r\n\r\n%%\r\nxmax = 5000;\r\nxy = Mordell(xmax);\r\nPSD_correct = 4254584400;\r\nassert(isequal(prod(sum(diff(xy),2)),PSD_correct));\r\n\r\n%%\r\nxmax = 10000;\r\nxy = Mordell(xmax);\r\nSPCS_correct = 7776998;\r\nassert(isequal(sum(prod(cumsum(xy),2)),SPCS_correct));","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-04-19T03:35:35.000Z","updated_at":"2021-04-19T15:20:33.000Z","published_at":"2021-04-19T03:38:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTheorem 1 of chapter 27 of the book \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDiophantine Equations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e by Louis J. Mordell shows that the equation                                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"y^2 = (x choose 0) + (x choose 1) + (x choose 2) + (x choose 3)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ey^2={x \\\\choose 0} + {x \\\\choose 1} + {x \\\\choose 2} + {x \\\\choose 3} \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehas a finite number of real, integer solutions \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"(x,y)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(x, y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. One of them has \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x = 7\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"y^2 = 1 + 7 + 21 + 35 + 64 = 8^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ey^2 = 1 + 7 + 21 + 35 = 64 = 8^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a value \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x = xmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = x_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e­\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and returns a two-column matrix with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"(x, y)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(x, y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e pairs for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x \u0026lt;= xmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex \\\\le x_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Sort the pairs in order of increasing \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":51251,"title":"Locate a family on a long street ","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 186.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 93.25px; transform-origin: 407px 93.25px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.983px 7.91667px; transform-origin: 374.983px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTwo children, Matilda and Labrun, live on a street in which—unlike many streets in the U.S.—the houses on one side are numbered consecutively, starting at 1. They notice that the sum of the numbers on the houses to the left of theirs equals the sum of the numbers to the right. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.5px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.75px; text-align: left; transform-origin: 384px 31.75px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 82.7083px 7.91667px; transform-origin: 82.7083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAoCAYAAAC1mQk2AAAB+0lEQVRoge2XzXGDMBBGXw/ugAbSADO5u4AMHXDPwR24BWqgBHpwC9RAC+Sg/aJFln1wYifM7JvhYO0i9l8yBEEQBEEQBEGw4Q042iMOQAecivV/Tw9MwOqezmRHYClku3IO4EIyfCFnaQZakjNy7PxXBj7KTDJ8JDkzkxzEfsux9k+se5CGbHhPzpQ4sc3mbujIjs0k5zwjOZu7QoavpEFS4rO5KzT5FtLI9/j+al5s14/whg8V+ZlcortChq9cZwvyMaAxv5usyfBaRvy0bEkTcSIFoCFNy8ne7Wxdh70GTeu+UauIhtS7Z5N3tkdDPk+1py4OSsbNYXZwhp8q8p5tf13c5mKx52gGqLSlO7q1Mni6BGgovTk9f6zo/dHsPJlurcK+N7538Hp5bSoqMLN9VB/TdB1NRwHyGdPefk/vQMl6R3ZFS47ALXqT13rLX7V0h5TBMzmiOk6UbZX4xDYzXaHnUTnezNJvolr3mRi4zoSOEwWndFRMhZ5H+77kEq77pY/iYusyTtnx/bUWOnC7DyXTt55+CZfBF7em/vJ9oPIaTP7BtQMHtpNTE9HL/FCCJ2ZOBvv+1JDwJTa4tQl4J/flgeTs4PTOpvdpxg9uP2XtyBPvreoTX4aKelPRG5xuT+47rSsoOicvplML3MDO/mUEQRAEwT2+AKH4zRSYnlePAAAAAElFTkSuQmCC\" alt=\"nmax\" style=\"width: 27px; height: 20px;\" width=\"27\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 281.6px 7.91667px; transform-origin: 281.6px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, the maximum number of houses on the street, and returns the largest possible number of houses and the number of the house where the family of Matilda and Labrun lives. For example, if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAoCAYAAAC1mQk2AAAB+0lEQVRoge2XzXGDMBBGXw/ugAbSADO5u4AMHXDPwR24BWqgBHpwC9RAC+Sg/aJFln1wYifM7JvhYO0i9l8yBEEQBEEQBEGw4Q042iMOQAecivV/Tw9MwOqezmRHYClku3IO4EIyfCFnaQZakjNy7PxXBj7KTDJ8JDkzkxzEfsux9k+se5CGbHhPzpQ4sc3mbujIjs0k5zwjOZu7QoavpEFS4rO5KzT5FtLI9/j+al5s14/whg8V+ZlcortChq9cZwvyMaAxv5usyfBaRvy0bEkTcSIFoCFNy8ne7Wxdh70GTeu+UauIhtS7Z5N3tkdDPk+1py4OSsbNYXZwhp8q8p5tf13c5mKx52gGqLSlO7q1Mni6BGgovTk9f6zo/dHsPJlurcK+N7538Hp5bSoqMLN9VB/TdB1NRwHyGdPefk/vQMl6R3ZFS47ALXqT13rLX7V0h5TBMzmiOk6UbZX4xDYzXaHnUTnezNJvolr3mRi4zoSOEwWndFRMhZ5H+77kEq77pY/iYusyTtnx/bUWOnC7DyXTt55+CZfBF7em/vJ9oPIaTP7BtQMHtpNTE9HL/FCCJ2ZOBvv+1JDwJTa4tQl4J/flgeTs4PTOpvdpxg9uP2XtyBPvreoTX4aKelPRG5xuT+47rSsoOicvplML3MDO/mUEQRAEwT2+AKH4zRSYnlePAAAAAElFTkSuQmCC\" alt=\"nmax\" style=\"width: 27px; height: 20px;\" width=\"27\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46.8667px 7.91667px; transform-origin: 46.8667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 10, then the function should find that the street has 8 houses and Matilda and Labrun live in house 6 because 1+2+3+4+5 = 7+8 = 15.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 157.158px 7.91667px; transform-origin: 157.158px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHenry Dudeney posed a version of this problem in \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 52.9083px 7.91667px; transform-origin: 52.9083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eStrand Magazine\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 79.3417px 7.91667px; transform-origin: 79.3417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in the early part of the 20\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 5.83333px 7.91667px; transform-origin: 5.83333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 69.4917px 7.91667px; transform-origin: 69.4917px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e century. Although the connections might not be immediately clear, you might try Cody Problems \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/groups/25/problems/1215\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e1215\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8057\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e8057\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 17.5px 7.91667px; transform-origin: 17.5px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45253\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e45253\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 25.2833px 7.91667px; transform-origin: 25.2833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e as well.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [x,y] = houseNumber(nmax)\r\n  % x = number of the house of Matilda and Labrun\r\n  % y = number of houses on the street\r\n  x = f1(nmax)\r\n  y = f2(nmax)\r\nend","test_suite":"%%\r\nnmax = 10;\r\nx_correct = 6;\r\ny_correct = 8;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 100;\r\nx_correct = 35;\r\ny_correct = 49;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%% Dudeney's problem\r\nnmax = 500;\r\nx_correct = 204;\r\ny_correct = 288;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 2000;\r\nx_correct = 1189;\r\ny_correct = 1681;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 10000;\r\nx_correct = 6930;\r\ny_correct = 9800;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 100000;\r\nx_correct = 40391;\r\ny_correct = 57121;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 500000;\r\nx_correct = 235416;\r\ny_correct = 332928;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\nassert(isequal(sum(1:x-1),sum(x+1:y)))\r\n\r\n%%\r\nnmax = 2e6;\r\nx_correct = 1372105;\r\ny_correct = 1940449;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\n\r\n%%\r\nnmax = 2e7;\r\nx_correct = 7997214;\r\ny_correct = 11309768;\r\n[x,y] = houseNumber(nmax);\r\nassert(isequal(x,x_correct) \u0026\u0026 isequal(y,y_correct))\r\n\r\n%%\r\nnmax = 1834432;\r\np_correct = 78376578048;\r\nds_correct = 48;\r\ndp_correct = 1866240;\r\n[x,y] = houseNumber(nmax);\r\nd = [num2str(x)-'0' num2str(y)-'0'];\r\nassert(isequal(x*y,p_correct) \u0026\u0026 isequal(sum(d),ds_correct) \u0026\u0026 isequal(prod(d),dp_correct))","published":true,"deleted":false,"likes_count":8,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":22,"test_suite_updated_at":"2021-05-16T01:51:40.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2021-03-29T00:43:22.000Z","updated_at":"2026-03-22T23:36:57.000Z","published_at":"2021-03-29T00:53:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTwo children, Matilda and Labrun, live on a street in which—unlike many streets in the U.S.—the houses on one side are numbered consecutively, starting at 1. They notice that the sum of the numbers on the houses to the left of theirs equals the sum of the numbers to the right. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"nmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, the maximum number of houses on the street, and returns the largest possible number of houses and the number of the house where the family of Matilda and Labrun lives. For example, if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"nmax\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en_{max}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e = 10, then the function should find that the street has 8 houses and Matilda and Labrun live in house 6 because 1+2+3+4+5 = 7+8 = 15.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHenry Dudeney posed a version of this problem in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eStrand Magazine\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in the early part of the 20\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eth\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e century. Although the connections might not be immediately clear, you might try Cody Problems \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/groups/25/problems/1215\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1215\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8057\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e8057\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45253\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e45253\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e as well.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1215,"title":"Diophantine Equations (Inspired by Project Euler, problem 66)","description":"Consider the quadratic Diophantine equation of the form:\r\n\r\nx^2 – Dy^2 = 1\r\n\r\nWhen D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.  It can be assumed that there are no solutions in positive integers when D is square.\r\n\r\nGiven a value of D, find the minimum value of X that gives a solution to the equation.","description_html":"\u003cp\u003eConsider the quadratic Diophantine equation of the form:\u003c/p\u003e\u003cp\u003ex^2 – Dy^2 = 1\u003c/p\u003e\u003cp\u003eWhen D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.  It can be assumed that there are no solutions in positive integers when D is square.\u003c/p\u003e\u003cp\u003eGiven a value of D, find the minimum value of X that gives a solution to the equation.\u003c/p\u003e","function_template":"function y = Diophantine(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 2; y_correct = 3; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 151; y_correct = 1728148040; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 61; y_correct = 1766319049; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 66; y_correct = 65; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 12000; y_correct = 13007560326001; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nx = 2345; y_correct = 15129001; assert(isequal(Diophantine(x),y_correct))\r\n%%\r\nj=[10:10:90 110:10:200]; v=arrayfun(@(x) Diophantine(j(x)),1:length(j));\r\ny_correct=[19 9 11 19 99 31 251 9 19 21 11 6499 71 49 721 339 161 52021 99];\r\nassert(all(isequal(v,y_correct)))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":8,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":70,"test_suite_updated_at":"2013-10-17T19:30:05.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-01-18T19:13:15.000Z","updated_at":"2026-02-15T03:32:35.000Z","published_at":"2013-01-18T19:13:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider the quadratic Diophantine equation of the form:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex^2 – Dy^2 = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhen D=13, the minimal solution in x is 649^2 – 13×180^2 = 1. It can be assumed that there are no solutions in positive integers when D is square.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a value of D, find the minimum value of X that gives a solution to the equation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":55340,"title":"Solutions to Generalized Pell Equation or Quadratic Diophantine","description":"The generalized Pell equation is of the form: . Given D and N as inputs, output the first 50 positive integer solutions [x, y] sorted by x (smallest to largest). Both outputs should be a cell array of character arrays containing the integer solutions.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe generalized Pell equation is of the form: \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMQAAAAmCAYAAACbKjTiAAAAAXNSR0IArs4c6QAADCtJREFUeF7tnHnMpdccxz/nrb0p0SoqTcQyaJpQSksxdoPSqq2ltc5UqaAqtYQiFbsqbdHGktAZS4ga1dgiVFRCbBVLELHVaKldrfU+8r33nPue57nnec5yz11m2uePydz3nvM7v+X89t9zDav6GKBZMHI1zqwBY8FkX3fcBgckvtZznTzH7Ajy4VrCnGsJmUE7MKUQRdYihYMpa3IPrwizIqh0EzO/Q3M52WcCCuAsbss82DdSiHTA6SsnbIluiS7I5HAhvJxtu7v7yKE1k/t1l9dHNAZx7CFiqwqonAPIAizSjfXswPMhLJZHsdNi36fTVw9S+pklK0N41gmZErFZFqOWcq4B0yy+LhASxVLoT7wTi1iWQ389hRifqn83r8HJ64bDgX9huJh13g78ehHEVzsjh4vVDm0B2hd4NsYcDc3BNOZSaN4DfAq4Zh5efT5k7F5QJwpRSf7HGTilgXcDVxvY1mC2YNhJ05yE4cpFllIr0dRKh/RhAdXg/YF3AVcAFwOHYXghcH0angN8eDFoeJe5MjMrg0tPWXv00+ET8BBdVJNRPwA4E3gt8CN77t7AWWBOhOYEYMfuZS+Whu1W4BaWn9dYLB4MZjs0lwFPBa6qhV2yhGsduMJw6oVMcF/gLsD7O9brKDA7oXmVVZYVZsdKoHZj4KWAwqPfeBjdDHgvsAnMsdD8eCWwDSCxagoWx2djRVAhfPeRER7cwPLmPx0eSVG+CiNXf36uEOPEhCEW7jvSwBENPB648wCu3wFkqT8OfFnhYS5dA+uFupTinx3Dor+dZfE6HthV8czdKSW5IXAkcBzwRMuDvwHHAF8cf56Svu7g44BngNl3FPQaPk3D2cAXfD7W9BB98jkKOA94LPCNmkKcI6ynAR+w8H8JPAv4kr2gupj3Ak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\" width=\"98\" height=\"19\" style=\"width: 98px; height: 19px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Given D and N as inputs, output the first 50 positive integer solutions [x, y] sorted by x (smallest to largest). Both outputs should be a cell array of character arrays containing the integer solutions.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [x,y] = genPell(D,N)\r\n  x=D;y=N;\r\nend","test_suite":"%%\r\nD=5;N=4;\r\n[x,y]=genPell(D,N);\r\nxc='1149851';\r\nyc='514229';\r\nassert(isequal(x{20},xc));\r\nassert(isequal(y{20},yc));\r\n%%\r\nD=221;N=217;\r\n[x,y]=genPell(D,N);\r\nxc='332876589744830';\r\nyc='53210398631041';\r\nassert(isequal(x{50},xc));\r\nassert(isequal(y{50},yc));\r\n%%\r\nD=13;N=101;\r\n[x,y]=genPell(D,N);\r\nX=0;Y=0;\r\nfor k=1:50\r\n X=X+sum(x{k}-'0');\r\n Y=Y+sum(y{k}-'0');\r\nend\r\nxc='3623278382061607649320985199308667';\r\nyc='1004916614754102227986611702029474';\r\nassert(isequal(X,4699));\r\nassert(isequal(Y,4456));\r\nassert(isequal(x{43},xc));\r\nassert(isequal(y{43},yc));\r\n%%\r\nD=15;N=34;\r\n[x,y]=genPell(D,N);\r\nxc='2427336873403';\r\nyc='626735685755';\r\nassert(isequal(x{27},xc));\r\nassert(isequal(y{27},yc));\r\nassert(isequal(x{48}(10:20),'36212499752'));\r\nassert(isequal(y{48}(10:20),'95249371677'));\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":145982,"edited_by":145982,"edited_at":"2022-08-22T01:39:08.000Z","deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-08-22T01:32:43.000Z","updated_at":"2026-03-15T18:48:05.000Z","published_at":"2022-08-22T01:39:09.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe generalized Pell equation is of the form: \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex^2-Dy^2 = \\\\pm N\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Given D and N as inputs, output the first 50 positive integer solutions [x, y] sorted by x (smallest to largest). Both outputs should be a cell array of character arrays containing the integer solutions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"diophantine\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"diophantine\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"diophantine\"","","\"","diophantine","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4ce8\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fac27cc4c48\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4388\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4f68\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fac27cc4ec8\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fac27cc4e28\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fac27cc4d88\u003e":"tag:\"diophantine\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4d88\u003e":"tag:\"diophantine\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"diophantine\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"diophantine\"","","\"","diophantine","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4ce8\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fac27cc4c48\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4388\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4f68\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fac27cc4ec8\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fac27cc4e28\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fac27cc4d88\u003e":"tag:\"diophantine\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fac27cc4d88\u003e":"tag:\"diophantine\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":51471,"difficulty_rating":"easy-medium"},{"id":51251,"difficulty_rating":"medium"},{"id":1215,"difficulty_rating":"medium-hard"},{"id":55340,"difficulty_rating":"hard"}]}}