{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.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":"2026-04-06T00: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":45253,"title":"Pell numbers ","description":"Find the nth pell number\r\n\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Pell_number\u003e","description_html":"\u003cp\u003eFind the nth pell number\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Pell_number\"\u003ehttps://en.wikipedia.org/wiki/Pell_number\u003c/a\u003e\u003c/p\u003e","function_template":"function p=pell_seq(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 3;\r\ny_correct = 2;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 6;\r\ny_correct = 29;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 408;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 12;\r\ny_correct = 5741;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 15;\r\ny_correct = 80782;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 19;\r\ny_correct = 2744210;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 23;\r\ny_correct = 93222358;\r\nassert(isequal(pell_seq(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":77,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T18:34:11.000Z","updated_at":"2026-01-16T23:48:17.000Z","published_at":"2020-01-03T18:35:25.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\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"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\\n\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\u003eFind the nth pell number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pell_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Pell_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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":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":53955,"title":"Determine Fundamental Solution of Pell Equation ","description":"Given, a positive value (d), determine the fundamental solution [x, y] of the Pell equation: x^2 - d*y^2 = 1.\r\nProvide character arrays of the outputs (x and y).\r\nFor example:\r\nd=5;\r\n[x,y]=pell(d)\r\nx =\r\n    '9'\r\ny =\r\n    '4'","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: 213.625px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 106.813px; transform-origin: 407px 106.813px; 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven, a positive value (d), determine the fundamental solution [x, y] of the Pell equation: x^2 - d*y^2 = 1.\u003c/span\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eProvide character arrays of the outputs (x and y).\u003c/span\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.625px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 61.3125px; transform-origin: 404px 61.3125px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ed=5;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e[x,y]=pell(d)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ex =\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'9'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ey =\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'4'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [x,y] = pell(d)\r\n  x=num2str(9);\r\n  y=num2str(4);\r\nend","test_suite":"%%\r\nd=1:100;\r\n[x,y]=arrayfun(@(n)pell(n),d,'UniformOutput',false);\r\nX=0;Y=0;\r\nfor k=1:length(x)\r\n  X=X+sum(x{k}-'0');\r\n  Y=Y+sum(y{k}-'0');\r\nend\r\nx_correct=1089;\r\ny_correct=628;\r\nassert(isequal(X,x_correct))\r\nassert(isequal(Y,y_correct))\r\n%%\r\nd=17341;\r\n[x,y]=pell(d);\r\nx_correct='81887676936210939197797903931847580410468849545875638045132141892699368760495749878780996203044381390166194841745994774349874560460240508809114948323796270551250394587849728371822001134403114506175468495377695679317299769935725124744992715267748691011204854457386224483426645001';\r\ny_correct='621844047843117342867014815301263314877692319212777415928438823161366179424461033214033067258631331184182790227614956053329122635248131057519704758944495923393396876479164265248530652965988133012116441244365364035364910428437398975765059948188133710470706609294529313871578700';\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n%%\r\nd=29269;\r\n[x,y]=pell(d);\r\nx_correct='505619755878294714028800094090708025797245268358752245269663217402892650883325421032186918670446106059062240584665872837389309508916166156309323943128145415509998184715092624092160673699611801907989286487530838967062983391063329289492137150753065158993645387194719524931323387521540597608741539865778066868762436111317369350240201';\r\ny_correct='2955426017960580263238824177276294334678597420082169278110067874094062091847976293400276041246460381513062561199646824632410591368753808782202169856830572270471751650720093314153468534575534317768067976953748616435494554784021285858821909840481875357848667486710755612041961324421410905356664871016117039927764516328741594534540';\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n%%\r\nd=39901;\r\n[x,y]=pell(d);\r\nx_correct='11014531262071775139254857546254470587809492269499820687249462076724901879133968567573112006797369650685219620230182197005239472938348898948646187246351773125262466634425365325961551264697038934743273358781893695496147313054339601531409703779999804490704281688605707014759622883606167011136045065471332108397000481701104735716607340405235792954772896839522157297234609767206096169312297932192591384646779247672017914511529776087381817374768317586249';\r\ny_correct='55140935491946958397054994797773126053184793124826483006624667226022477045736347117247141822513682441399848213782507999727160237289450363518450454070599207426051338569175139097142455575521497261368516637474292892284365576711783366721156760439812205173247275239904480997663437533110540333689646491988339876823111896306827473281260798739001091591800954772821622444796202370404268661633136005310935075991846904593090831907244580561566624216065476700';\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n%%\r\nd=[81472369,90579194,12698682,91337586,63235925,9754041,27849822,54688152,95750684,96488854];\r\n[x,y]=arrayfun(@(n)pell(d(n)),1:10,'UniformOutput',false);\r\nx_correct={'5188986459877315163245020013418486436684740716191228073010006484015620309304239656559331198597752943832026695643961316111600650380084761047781038639903116476971034247089941096117180731924061174663676453589877495381656626413873779486892996142287661365595222027999002837332408918263239710302094857427679259002225173555978709649877924236662822928717218161235292379305950011100596228316878718788510208309158034646217924269088440967149298180654863837175304840848266795374945184027618163358859431184236649470084795712610956409338163349471898227236796459470381410377571829457294998263754845185569759994876829831489026481939545603755928573429771088218880829057388424151703249098053762439821967845780428107655055768056302243305326677790781363365933533510712845533376982224716771278654930347324308564529104559237015072864669604642069428793116577617206166813979392834323734669218492349244426838324826911601358776912225266584294536278051170476131659503540984311245933960206189495300014238268035097350995265022482897252218422281161901831126244021081511513470790739555378200980465839055248632708360576700421530167496457597270241509508915919748885241839192506604215695137474657311565151318200741664775993958815976657627011243201732540531625803794432157854249388927294236136752817354645359056719580000025533740207017308881314931064333757770625974407071229507955142339033960748358219292827014309862268756837666206499320014361726491245129368200976242647555663012307417375293094769438499192925220581075826101055913852095182761049402100118013516215552606483740524433428588990772768868397729137286200249116556960186661853154867596674966873317601018593364969592496791460522788431550081012321673993916873292726744847979612619888247683600987095290108235336110512940876267455812324183971946285741600155048856512437215753166775356987121992013409922493006265589572418809612683514572557818903847566753828120900099071594507790239310356253956698352330820990246712733382790866927536541577088630726184956692201969764017948582189459092873804546465395133221334092456044663995349470776577346318516984142010139821112116892712939284046345322895787753061893064888883128835092233755366381024958834382583525528028826422856738323486171183100041842892330906018177413439473961578156348665028066794134797381177880802780031805069857685328519946944338987298133213625150198085713237623432296689516646478099728293590066523981434705126177381515573857818850712817597042227385445054204393497619135703031452583688714800560955014611465193034133624452082510351663864256887193477163036663589564864482588244866794666976259266719940522632407084742957060550791548391043286462992350717663716688360637981277812212575690666853295469727663455572743678846355082734537205527282778259494587869966674516856074207466878136390976094228460994704729968718607703874478016510937771044590500184635996390622829013824941288631873744787705901588302691799310817924889258028077330372893960900682583453651571676365507098474045970609891614149327325978335830934038505038945746898722136039488372156309649703085260953031247324777463870133168172148682016532322958677464829311139030294974081357455273954788870497458664171206682808241095245025720551740205362423017371611616106258400500938995307568869568922563618941806257645596085429354322290633066433441595388757304809987084903674269043259079827468992422658000385084447449119704949638137198835132319821848006423620052937913639292069101722377931850628384420079170438431574526502205313972195696788807590607517705680586106405432045228482503069451664728672463085562130143595956402190316820330260766260724813173618745502719473061424442057302691355734294941003495032030425389339043122916760990353663794988915218673105365384735034600867237677032215119866129257500585790912713243683456062525465980627146309159377382122078668741309975243074368151551930166727101399647744976797402429587783934067121333381336325008416511790864101792423007799723130717632197263298614209966611704441419829879316719226376089382022448375225577811097315942147893765573034468968425147183033475703342553059460419194935148446235727258241763548956279696456787132899171107694218852534124361077363300470214688057732502478594980577563202327308659861775670633220664478638740196243655151343433025748174240602604275447781426262143268491887270379410275203495189146621682576517426465812724710945465443814327516279122444711835973523068883314103458089683836104761977958794847051019238250130273981097736126355684795455769785651838199857499242349864395209445500442384287904077765391165969832868639096965138900514535585702127388944098466906262894489770864964226918085827377319807095345437664315706894659109072552933882352557665189374392466311772149426707246381283534201101564887726517670893496987634675828170346267305025925871540855189609180625640860894644741348360499034499272521238725021799310423080102835763342634838347049373905184965463694538602464789555812882227034908308977459544270580189395192094873804785126792720833095516940750933129591128766045183595376656005487084159810189803181996601062499514375125255163594875977635027313070928589921823062913167289649318949917506085394403680039876167285512163563653747416127687992770916867329080768414280043331949085049123161413868474255987781150801188161003128002964449759305021874375856394377101749674921830695500712297358259411868931663997481185970245997308157908624089836674543664867858920797210495072878557223057991215535370439777405595089724668679228175232254646453335258312597300669867599418345626359866416173950024800073678050116377980143242939165707141809728940187659564229823497276201984197181836591653293165862887229664716512057824961112258641097862257305559855550999714446836346803206273342910583265571390694889089441398966310298956103207100079393183504582612718325020616957760964368584903047232385524310261001416892181957761048705173595227793048236290779365120648195434662953111659849221774095571974884210069102671977733407733563624428649970152815719203025462745361757989483828618651566581340145042246949875144171066189786199',...\r\n    '41003880165541717359339946658028683651980661205171550556528510551914374208298044805728360379837746236841892030625047601431986479714412726273423693711566514920781352139090601859480895951591510632283650299412012044625406489321726858617201678414228225390688692797400556092418667645794563490748646806872064234312776023255012685782230723124870948660105193631279144553991312994638416898164677336157493392068619110290712879834429815685880254001290112341220363835713160545009215380126911499607915890593146846341056463997074772920228184032170099713061699402762719424230582029491808679542771261354219146289104971687097724600053646120391859716842268432333335695038365850864629223400266185769912423925713476132874188245702029160625724995722286761067304512853193084012766433397874958611632728978876631822956478395564121691097173401317753135',...\r\n    '2518129726097736418418147634937430136262043009187776682504338506012778875395015061230991590307113496101676765109837701174656335132392922212023279244591091654073269857151637433347757961469902711301999890498203535096904814829199067401226643738276954268590393134478008260801641212537785647289605353087182075695255555853389316835799232210405805519274441604437029483648399349491263348974810272143500605565922687212255791931768056683707020020778470281208136138817308994637695333904774003378096659513129475908749',...\r\n    '177844211390571103193580200766300213479569716523897277671210193721606465633131276051102615980660173052505298574970600234674962622872400128772917412742594374988029992773142995134929723295620272654834803525384631317804664134972432521339369476376663498967141097062820314615372645782776893715141190428242052397242345894947694583158498303659502212242872962673170156522745269283970228901339059976731280840916649040630645842851726223286776899025571960620620095843449958265656451211220205020068538538963801503904917948951622099209332367114080454434043813132125164726747600365529062530859952957417657300492090697142035655909262905103950303313767100970821692374112330543107574925552902622337656338022541916872750605266533319576974413975697054143586562429008310040455114845815453221037968687614127223092387157245878436580571203960455727651974911721732498788100384720752295775126244440802077006106908053840399156866558630694180801277200950167094887282677869534177936574207846881909032248231866288357278832473393820772719962850729649350363180520167903549470247084969272676391805692614817469921408857988095225523469007279126883051039457952330874428992517636237560153815257166884041725131006285341430459630323113796379870247577135145670123343037468760302865',...\r\n    '3263874245912595463467465158810045642430888063427063835610447527390781785316361745511051290355423707899547915848017176539303866039609836169024537105888112390706642162770843779989267420993520691283117206122759692072206712166212974132713337707713589076466789215176156911938196097001135327140658549412202835109295734950040171537746428806701172023789464944234996150589112564837437627168524585230326232147447063453088388785076026890948198880863659387098669820216586312050085017033865998174754297853045557109538477446293207783827341519017052050564870566720362189346305908151',...\r\n    '101387884602570785408008256600263149768033937714694831390216328693320507019220290888102033860103011741414040714944553159644883986115055790219490312781150673850737919774014640835367966429910676924635045476883492862540925482820417515613127082025178998955342793209883986753213693068820553718426873887446881198620934594945096286550941242859082204682084258519886823156126316702551',...\r\n    '343261635523644912262187',...\r\n    '5605373853777897057391461837952577559106474603835965560466907123781298999651390441209966698738717526383677856595676567741963061309473800036474027975828760000489457472406850437825725012248384991505789390858050130733416029856915697023759033864053188244425437246073804439351139626491714408371339988118191008327316276370946458332163359999',...\r\n    '8127688341043904685249783140317779324560974391898794532638550228561584821432652751455295373304050090259481535237106005093106912880215368334110785942880016061586067889241787419314077389449218590670282495637085792683809014761078834790309086920715676894170287775060735622926047196881999999',...\r\n    '252273293414015746774248652223786176762570852447727349841474342635204602955144706307895417814223686733994833054440920407366555424824044081061513838287037853146109582636333630141342132281529764343851067840446352550107893895589737409161801860928758779609469565805996828766841818733751427063287611564844785155233679704230872004864354086907632784420487773930633813516453354353262887035126329604035437821811325353862619965942442815'};\r\ny_correct={'574880218779523464116804413358006130355282666798943663962109710650839140084463907887185894195604435094878829761703364685497340747488383357622025214881805081518270283435763334105354928387455525854697385299337841441961588575127081057568867788872690030926349213960016589756366554955750375314482934975213494897740697691441115347450943265771965535470391035439200151345497059520493237963022621523780010252225519908210846454242081940303645753211600135850358028037734232334555947769579119406323468848366500203853787598004654119369960044147021252636850781126505529946086344294473057580705252131377915584710026802911613005289981978013371896738392397189432145972769450292640490887151567508966974563325540167226654936052213802362817406985337776725862379087273930682754644071718681577456258721817811376743750240101989249523962551800427147865461853520940561813523856042843432530271448667110293961228930457944625982046679182399322862393951783950681653669992263417633101688141396992943671431905017196916259196349842288008540106720127167448764275299578167365046665591029850043004699469956861942835220567155857833061716586029154443216861863112165187289301472289472022157341426003138551186545803247983950128360171003343510654535966891224781814149801354782303725518782472835577351212467429601837419879054141272699736606631689335590582440278384629613189732821023094241281165095785152432261655642327203450698739442883965234980443207324979540378693037414955917238417322582193396574838834962395813817485710503839908641021839347303319434042321175578263745150689973458308860318520661178345215892618315977190728985183679286148645898652495933530965021202397653977155184718158993276038526773920310427666688244575986337808705474867640450611481794889666113562301605929591957639380302271800828946983011936383482490408141380470398826928737378210042069048656717158989822322657391441815782134057144267310537445516721473850972230913154189491632803419733266429809338754170399355815339549296599673921213626612003926727163134740947117413992725257005222341402558088601673990527573840895602033770556874606871246002242900806452024231670703777868330616700450050924862951250087868368214647068837456002533721535723711283283338570320581065806027968129882847881372351511743046027122910390306404700045647713370546544300555037748574567221315116244300242528198537002966279130101946132373563362961733045259399071343291702068845834372232648729184994872786456636042120713766075533518573724076549724037189284507537951995512719898715215416371219678359936363706393179154761237726153912670378089248650932588659698052363980007608382871798985521385476208424205152062365245526465300094834074490534200939734976221387521698539267455405000335177548445523703874347954367645838290069535860243862644170234703239717328859352599320970264689407787474046443084536956559276015078467257536784980854856442558622785371673823400445914844778766637713287638597624788183244017036692106519318359853720037643730821655890178116367490381600599558268780356294131466009293075216239610263114883490626052254556900964891458898755771903666154159692543378830496203858805689586712732518136176411477162452124283734808868544837068557411988615489074620183107029534893665347685423861606206974681013463537199285860694515174604128026390300734917698973622932117728292794546974248268587710389510698672686316246873648986947040701066393102423454907621458749864525555773572366421811414097952470862766507670853216140082798943331514656596840270600250775311060376361362957319834722974265155077282260596017286572994970724362463380913723744386780524529615129814055392382872806911284952331243120069608229564689147615148163490135945112624843563326280983779119471002061736052609942696263080731063999963717058809856102131257946514817823533447720114300395089978029162506977008453349468697010349094956655563859492768823095351900721937383070880502475789938579040871513920234460769657854094382371783620577832744454233294238142312881899246242786576866662381793514743722896046742900848860953912091913233697056359451826380371270619157949650776902650150214163079599940463905273926421429843846284498981468900225032612333277511481447903639763235454037737865150386585260435944421216274508623023631171822759639023145303431827337267830292229710666499794450830974958653954523229125024161051855325921797843747281337494433961871592090144458216398466739276112639015932676663826790096143365531952049336114548587826898609750387793645928205225452951496677376065729909642240463846722047308794008126647281277497617941387291363892561250616672116451156257612258745364108985088202592179871125514614501470477009356882955900793879188808904635145937862408692553181033530665382069218605438646956807724138262894092424596025513326026046885326534570946844070604703136777019148689176888755612603320711744953406872373535603117227678333553208213791225775559525921931726413584603763081030966162699612271268042437224257638973730738399583861513100464835914987339130710453727505958862762926392553785428648197855574049530510430783637391874941415747051229634609591239878838313594700688904527923122636894366386236829841281427899251574200549370994166336031010887892675057915289900265384337056700901715216223264291252154062484583664304411702041932042816344661018056456897684154838706485199616939659353037358510639931586761691048699932522765446053828530865458903784706488363256208062648681342582771241443761115600841475542439442610072440933948620811082027681985514331372834378272356918236225909716067738900923541245050693536278977770750678311297737649788326466771112237468905175684806625603735967600860249565098067127477088291359900584529035810454744529075706460982312359278886725386916794849451188120962791396316885869422469880669474525809583825215370220623535200917159246464422003804628690873184617936851049812179299251649462335473083970505097171796472897209235101206462624181714945548280261841131415914486962804247405313956316822478924991224587295052424854944969174735507676778642171010258672730148986492813794536463165616645713150992263443554732980',...\r\n    '4308347545451893533793886112135110167448150257942130278777386745599652554928397657224320700423549909247465874334876012593372494094116999640383158753017007914240484166533839757450374172799055494346109813183706154034006556330317904352287260249358503792224518223975277184145508913995491883393306699927872619794752938327197270100532181095539759282326693855683005379438466098161114350500110088500680338830320793366350785873392190967698042075882437582985021745621680771875913060802780611401648217177237956762661354392005286909191692525735016313090555904587614234125587198704740553156110645151984629587306597540905754311232323195603750623337502477939222747056538640388667441464303750566494866577481851606261083269472265164187229722092510876995952327037408674352630811344750101763759171771219414128867570508224805142173722455545364',...\r\n    '706640908784338029810646798948083117473089575779933532061617102000726860803962549663261291733799113075707956344454720738157819076553321690771692795761389936374711962847067368730071486714543550871405786397209714403051203617152632416359965251423598028833816632895786416870911510835894512484144368150152022189672966430158857684181471999697500902839253384484320347140567043430862372461609020180899563645305166928565530441874113065341686558088124727467171197715784777550469579980164467233709492425054544150',...\r\n    '18608654362626285711410475608811409493576790502005798055159159459360631777224264864492041281177959484336694195103107843360995348008765130278462926764271807365975783200680413041524444910235028838034344148978148239422032430697206820383654114328713614005699432513803023234132776561526342736640171759599130328482938381202948303615528536000235787187123395532665639858412482839110285832158554714771790670605700496800534151133238023209857705421927856315656406201148780241012401980064479371440267322769245959658787082372497588734100702375073257923228660293856436195417468933502734661136954681258895785801428765766271869931539712021638711937188016318067475494042473503664891471733895591245079965837136946299431673887464173516199960333583876673502547482486492633312770402543003692821794497034198910125850811160921337858947002096136561789781250325440549680410596080589080753952523128559826727131638854144881325318968750460345392368476660029901158766566591202538948803030662153297972985568695716046130338252643453221214362728647913826281309120345258516396499078449191782080636308336765429609073146558957756719276499142812487462004507560151355531543130882994170156805679967790441427072450341568656790692338362823788493331595320906577499816864226346172',...\r\n    '410441701748304272076140867660040410535037654013094573863293415795374898623524761888925610723452122959963523154114197914081067935537712900292523409086105365653722421768513980005124062833709101148061440784751654291028951456255872530202679740841412083547627844792538886576127699940420620719943931375848142128812829755593550630930470652785779996620246743024530367840215398448299206220762625292990951124397558847994245479775288473575338179277070069539837591047093743395599899283949321283082783663713993214706453276106317429878414324447143473641770628089697750333197164',...\r\n    '32463382844346039237076449788327688578585465322999570491637008777573333263413274583453520682962529464504597794195432677560455526050515831184318625431009219666310454783918151519703551681171283349581589707866935465995294075076406223376862738615079610014874557072094754177863766550515583912951349823929089895866715100907684208090706802588756493506944600353793147094482391940',...\r\n    '65045020595669147462',...\r\n    '757980371482489534768135217439013092240352568580788549745922940478270781319816855100169941411231922273511763397481260152417636329485425563111526370188562210547560440229529638089505391223503445630197959303115533678924283156523595230292338761524668578212888944452989774902855223088397974965578959069208917244427659908412748698794200',...\r\n    '830607980608967777810677372851781944275117807135931690138966314574651354342960351368853841031058209993179984784227080968835577707813623193023137994243300327121442243583917738858721194830024579764565150753277751209971749984154424123557853236751602513076865225997611231509414240377000',...\r\n    '25682228329213260218571430271517929192762736279899048418297779872604829804938728191395922605285246149489931422999121872636526962801495428141933225314396911521935891919680850300418532347765081656000970262444805755986816614726668680459289188077504049013322829260408438280768069265785621845780341698303348485897646989759272658536964066812452393900925937902617149568606823491891398835830471390468231116250991895822121363234216'};\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-01-21T03:45:15.000Z","updated_at":"2022-01-21T04:10:24.000Z","published_at":"2022-01-21T04:10:24.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\u003eGiven, a positive value (d), determine the fundamental solution [x, y] of the Pell equation: x^2 - d*y^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\u003eProvide character arrays of the outputs (x and y).\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\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[d=5;\\n[x,y]=pell(d)\\nx =\\n    '9'\\ny =\\n    '4']]\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":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,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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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":45253,"title":"Pell numbers ","description":"Find the nth pell number\r\n\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Pell_number\u003e","description_html":"\u003cp\u003eFind the nth pell number\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Pell_number\"\u003ehttps://en.wikipedia.org/wiki/Pell_number\u003c/a\u003e\u003c/p\u003e","function_template":"function p=pell_seq(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 3;\r\ny_correct = 2;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 6;\r\ny_correct = 29;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 408;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 12;\r\ny_correct = 5741;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 15;\r\ny_correct = 80782;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 19;\r\ny_correct = 2744210;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 23;\r\ny_correct = 93222358;\r\nassert(isequal(pell_seq(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":77,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T18:34:11.000Z","updated_at":"2026-01-16T23:48:17.000Z","published_at":"2020-01-03T18:35:25.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\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"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\\n\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\u003eFind the nth pell number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pell_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Pell_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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":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":53955,"title":"Determine Fundamental Solution of Pell Equation ","description":"Given, a positive value (d), determine the fundamental solution [x, y] of the Pell equation: x^2 - d*y^2 = 1.\r\nProvide character arrays of the outputs (x and y).\r\nFor example:\r\nd=5;\r\n[x,y]=pell(d)\r\nx =\r\n    '9'\r\ny =\r\n    '4'","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: 213.625px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 106.813px; transform-origin: 407px 106.813px; 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven, a positive value (d), determine the fundamental solution [x, y] of the Pell equation: x^2 - d*y^2 = 1.\u003c/span\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eProvide character arrays of the outputs (x and y).\u003c/span\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.625px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 61.3125px; transform-origin: 404px 61.3125px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ed=5;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e[x,y]=pell(d)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ex =\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'9'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ey =\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2188px; transform-origin: 404px 10.2188px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'4'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [x,y] = pell(d)\r\n  x=num2str(9);\r\n  y=num2str(4);\r\nend","test_suite":"%%\r\nd=1:100;\r\n[x,y]=arrayfun(@(n)pell(n),d,'UniformOutput',false);\r\nX=0;Y=0;\r\nfor k=1:length(x)\r\n  X=X+sum(x{k}-'0');\r\n  Y=Y+sum(y{k}-'0');\r\nend\r\nx_correct=1089;\r\ny_correct=628;\r\nassert(isequal(X,x_correct))\r\nassert(isequal(Y,y_correct))\r\n%%\r\nd=17341;\r\n[x,y]=pell(d);\r\nx_correct='81887676936210939197797903931847580410468849545875638045132141892699368760495749878780996203044381390166194841745994774349874560460240508809114948323796270551250394587849728371822001134403114506175468495377695679317299769935725124744992715267748691011204854457386224483426645001';\r\ny_correct='621844047843117342867014815301263314877692319212777415928438823161366179424461033214033067258631331184182790227614956053329122635248131057519704758944495923393396876479164265248530652965988133012116441244365364035364910428437398975765059948188133710470706609294529313871578700';\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n%%\r\nd=29269;\r\n[x,y]=pell(d);\r\nx_correct='505619755878294714028800094090708025797245268358752245269663217402892650883325421032186918670446106059062240584665872837389309508916166156309323943128145415509998184715092624092160673699611801907989286487530838967062983391063329289492137150753065158993645387194719524931323387521540597608741539865778066868762436111317369350240201';\r\ny_correct='2955426017960580263238824177276294334678597420082169278110067874094062091847976293400276041246460381513062561199646824632410591368753808782202169856830572270471751650720093314153468534575534317768067976953748616435494554784021285858821909840481875357848667486710755612041961324421410905356664871016117039927764516328741594534540';\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n%%\r\nd=39901;\r\n[x,y]=pell(d);\r\nx_correct='11014531262071775139254857546254470587809492269499820687249462076724901879133968567573112006797369650685219620230182197005239472938348898948646187246351773125262466634425365325961551264697038934743273358781893695496147313054339601531409703779999804490704281688605707014759622883606167011136045065471332108397000481701104735716607340405235792954772896839522157297234609767206096169312297932192591384646779247672017914511529776087381817374768317586249';\r\ny_correct='55140935491946958397054994797773126053184793124826483006624667226022477045736347117247141822513682441399848213782507999727160237289450363518450454070599207426051338569175139097142455575521497261368516637474292892284365576711783366721156760439812205173247275239904480997663437533110540333689646491988339876823111896306827473281260798739001091591800954772821622444796202370404268661633136005310935075991846904593090831907244580561566624216065476700';\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n%%\r\nd=[81472369,90579194,12698682,91337586,63235925,9754041,27849822,54688152,95750684,96488854];\r\n[x,y]=arrayfun(@(n)pell(d(n)),1:10,'UniformOutput',false);\r\nx_correct={'5188986459877315163245020013418486436684740716191228073010006484015620309304239656559331198597752943832026695643961316111600650380084761047781038639903116476971034247089941096117180731924061174663676453589877495381656626413873779486892996142287661365595222027999002837332408918263239710302094857427679259002225173555978709649877924236662822928717218161235292379305950011100596228316878718788510208309158034646217924269088440967149298180654863837175304840848266795374945184027618163358859431184236649470084795712610956409338163349471898227236796459470381410377571829457294998263754845185569759994876829831489026481939545603755928573429771088218880829057388424151703249098053762439821967845780428107655055768056302243305326677790781363365933533510712845533376982224716771278654930347324308564529104559237015072864669604642069428793116577617206166813979392834323734669218492349244426838324826911601358776912225266584294536278051170476131659503540984311245933960206189495300014238268035097350995265022482897252218422281161901831126244021081511513470790739555378200980465839055248632708360576700421530167496457597270241509508915919748885241839192506604215695137474657311565151318200741664775993958815976657627011243201732540531625803794432157854249388927294236136752817354645359056719580000025533740207017308881314931064333757770625974407071229507955142339033960748358219292827014309862268756837666206499320014361726491245129368200976242647555663012307417375293094769438499192925220581075826101055913852095182761049402100118013516215552606483740524433428588990772768868397729137286200249116556960186661853154867596674966873317601018593364969592496791460522788431550081012321673993916873292726744847979612619888247683600987095290108235336110512940876267455812324183971946285741600155048856512437215753166775356987121992013409922493006265589572418809612683514572557818903847566753828120900099071594507790239310356253956698352330820990246712733382790866927536541577088630726184956692201969764017948582189459092873804546465395133221334092456044663995349470776577346318516984142010139821112116892712939284046345322895787753061893064888883128835092233755366381024958834382583525528028826422856738323486171183100041842892330906018177413439473961578156348665028066794134797381177880802780031805069857685328519946944338987298133213625150198085713237623432296689516646478099728293590066523981434705126177381515573857818850712817597042227385445054204393497619135703031452583688714800560955014611465193034133624452082510351663864256887193477163036663589564864482588244866794666976259266719940522632407084742957060550791548391043286462992350717663716688360637981277812212575690666853295469727663455572743678846355082734537205527282778259494587869966674516856074207466878136390976094228460994704729968718607703874478016510937771044590500184635996390622829013824941288631873744787705901588302691799310817924889258028077330372893960900682583453651571676365507098474045970609891614149327325978335830934038505038945746898722136039488372156309649703085260953031247324777463870133168172148682016532322958677464829311139030294974081357455273954788870497458664171206682808241095245025720551740205362423017371611616106258400500938995307568869568922563618941806257645596085429354322290633066433441595388757304809987084903674269043259079827468992422658000385084447449119704949638137198835132319821848006423620052937913639292069101722377931850628384420079170438431574526502205313972195696788807590607517705680586106405432045228482503069451664728672463085562130143595956402190316820330260766260724813173618745502719473061424442057302691355734294941003495032030425389339043122916760990353663794988915218673105365384735034600867237677032215119866129257500585790912713243683456062525465980627146309159377382122078668741309975243074368151551930166727101399647744976797402429587783934067121333381336325008416511790864101792423007799723130717632197263298614209966611704441419829879316719226376089382022448375225577811097315942147893765573034468968425147183033475703342553059460419194935148446235727258241763548956279696456787132899171107694218852534124361077363300470214688057732502478594980577563202327308659861775670633220664478638740196243655151343433025748174240602604275447781426262143268491887270379410275203495189146621682576517426465812724710945465443814327516279122444711835973523068883314103458089683836104761977958794847051019238250130273981097736126355684795455769785651838199857499242349864395209445500442384287904077765391165969832868639096965138900514535585702127388944098466906262894489770864964226918085827377319807095345437664315706894659109072552933882352557665189374392466311772149426707246381283534201101564887726517670893496987634675828170346267305025925871540855189609180625640860894644741348360499034499272521238725021799310423080102835763342634838347049373905184965463694538602464789555812882227034908308977459544270580189395192094873804785126792720833095516940750933129591128766045183595376656005487084159810189803181996601062499514375125255163594875977635027313070928589921823062913167289649318949917506085394403680039876167285512163563653747416127687992770916867329080768414280043331949085049123161413868474255987781150801188161003128002964449759305021874375856394377101749674921830695500712297358259411868931663997481185970245997308157908624089836674543664867858920797210495072878557223057991215535370439777405595089724668679228175232254646453335258312597300669867599418345626359866416173950024800073678050116377980143242939165707141809728940187659564229823497276201984197181836591653293165862887229664716512057824961112258641097862257305559855550999714446836346803206273342910583265571390694889089441398966310298956103207100079393183504582612718325020616957760964368584903047232385524310261001416892181957761048705173595227793048236290779365120648195434662953111659849221774095571974884210069102671977733407733563624428649970152815719203025462745361757989483828618651566581340145042246949875144171066189786199',...\r\n    '41003880165541717359339946658028683651980661205171550556528510551914374208298044805728360379837746236841892030625047601431986479714412726273423693711566514920781352139090601859480895951591510632283650299412012044625406489321726858617201678414228225390688692797400556092418667645794563490748646806872064234312776023255012685782230723124870948660105193631279144553991312994638416898164677336157493392068619110290712879834429815685880254001290112341220363835713160545009215380126911499607915890593146846341056463997074772920228184032170099713061699402762719424230582029491808679542771261354219146289104971687097724600053646120391859716842268432333335695038365850864629223400266185769912423925713476132874188245702029160625724995722286761067304512853193084012766433397874958611632728978876631822956478395564121691097173401317753135',...\r\n    '2518129726097736418418147634937430136262043009187776682504338506012778875395015061230991590307113496101676765109837701174656335132392922212023279244591091654073269857151637433347757961469902711301999890498203535096904814829199067401226643738276954268590393134478008260801641212537785647289605353087182075695255555853389316835799232210405805519274441604437029483648399349491263348974810272143500605565922687212255791931768056683707020020778470281208136138817308994637695333904774003378096659513129475908749',...\r\n    '177844211390571103193580200766300213479569716523897277671210193721606465633131276051102615980660173052505298574970600234674962622872400128772917412742594374988029992773142995134929723295620272654834803525384631317804664134972432521339369476376663498967141097062820314615372645782776893715141190428242052397242345894947694583158498303659502212242872962673170156522745269283970228901339059976731280840916649040630645842851726223286776899025571960620620095843449958265656451211220205020068538538963801503904917948951622099209332367114080454434043813132125164726747600365529062530859952957417657300492090697142035655909262905103950303313767100970821692374112330543107574925552902622337656338022541916872750605266533319576974413975697054143586562429008310040455114845815453221037968687614127223092387157245878436580571203960455727651974911721732498788100384720752295775126244440802077006106908053840399156866558630694180801277200950167094887282677869534177936574207846881909032248231866288357278832473393820772719962850729649350363180520167903549470247084969272676391805692614817469921408857988095225523469007279126883051039457952330874428992517636237560153815257166884041725131006285341430459630323113796379870247577135145670123343037468760302865',...\r\n    '3263874245912595463467465158810045642430888063427063835610447527390781785316361745511051290355423707899547915848017176539303866039609836169024537105888112390706642162770843779989267420993520691283117206122759692072206712166212974132713337707713589076466789215176156911938196097001135327140658549412202835109295734950040171537746428806701172023789464944234996150589112564837437627168524585230326232147447063453088388785076026890948198880863659387098669820216586312050085017033865998174754297853045557109538477446293207783827341519017052050564870566720362189346305908151',...\r\n    '101387884602570785408008256600263149768033937714694831390216328693320507019220290888102033860103011741414040714944553159644883986115055790219490312781150673850737919774014640835367966429910676924635045476883492862540925482820417515613127082025178998955342793209883986753213693068820553718426873887446881198620934594945096286550941242859082204682084258519886823156126316702551',...\r\n    '343261635523644912262187',...\r\n    '5605373853777897057391461837952577559106474603835965560466907123781298999651390441209966698738717526383677856595676567741963061309473800036474027975828760000489457472406850437825725012248384991505789390858050130733416029856915697023759033864053188244425437246073804439351139626491714408371339988118191008327316276370946458332163359999',...\r\n    '8127688341043904685249783140317779324560974391898794532638550228561584821432652751455295373304050090259481535237106005093106912880215368334110785942880016061586067889241787419314077389449218590670282495637085792683809014761078834790309086920715676894170287775060735622926047196881999999',...\r\n    '252273293414015746774248652223786176762570852447727349841474342635204602955144706307895417814223686733994833054440920407366555424824044081061513838287037853146109582636333630141342132281529764343851067840446352550107893895589737409161801860928758779609469565805996828766841818733751427063287611564844785155233679704230872004864354086907632784420487773930633813516453354353262887035126329604035437821811325353862619965942442815'};\r\ny_correct={'574880218779523464116804413358006130355282666798943663962109710650839140084463907887185894195604435094878829761703364685497340747488383357622025214881805081518270283435763334105354928387455525854697385299337841441961588575127081057568867788872690030926349213960016589756366554955750375314482934975213494897740697691441115347450943265771965535470391035439200151345497059520493237963022621523780010252225519908210846454242081940303645753211600135850358028037734232334555947769579119406323468848366500203853787598004654119369960044147021252636850781126505529946086344294473057580705252131377915584710026802911613005289981978013371896738392397189432145972769450292640490887151567508966974563325540167226654936052213802362817406985337776725862379087273930682754644071718681577456258721817811376743750240101989249523962551800427147865461853520940561813523856042843432530271448667110293961228930457944625982046679182399322862393951783950681653669992263417633101688141396992943671431905017196916259196349842288008540106720127167448764275299578167365046665591029850043004699469956861942835220567155857833061716586029154443216861863112165187289301472289472022157341426003138551186545803247983950128360171003343510654535966891224781814149801354782303725518782472835577351212467429601837419879054141272699736606631689335590582440278384629613189732821023094241281165095785152432261655642327203450698739442883965234980443207324979540378693037414955917238417322582193396574838834962395813817485710503839908641021839347303319434042321175578263745150689973458308860318520661178345215892618315977190728985183679286148645898652495933530965021202397653977155184718158993276038526773920310427666688244575986337808705474867640450611481794889666113562301605929591957639380302271800828946983011936383482490408141380470398826928737378210042069048656717158989822322657391441815782134057144267310537445516721473850972230913154189491632803419733266429809338754170399355815339549296599673921213626612003926727163134740947117413992725257005222341402558088601673990527573840895602033770556874606871246002242900806452024231670703777868330616700450050924862951250087868368214647068837456002533721535723711283283338570320581065806027968129882847881372351511743046027122910390306404700045647713370546544300555037748574567221315116244300242528198537002966279130101946132373563362961733045259399071343291702068845834372232648729184994872786456636042120713766075533518573724076549724037189284507537951995512719898715215416371219678359936363706393179154761237726153912670378089248650932588659698052363980007608382871798985521385476208424205152062365245526465300094834074490534200939734976221387521698539267455405000335177548445523703874347954367645838290069535860243862644170234703239717328859352599320970264689407787474046443084536956559276015078467257536784980854856442558622785371673823400445914844778766637713287638597624788183244017036692106519318359853720037643730821655890178116367490381600599558268780356294131466009293075216239610263114883490626052254556900964891458898755771903666154159692543378830496203858805689586712732518136176411477162452124283734808868544837068557411988615489074620183107029534893665347685423861606206974681013463537199285860694515174604128026390300734917698973622932117728292794546974248268587710389510698672686316246873648986947040701066393102423454907621458749864525555773572366421811414097952470862766507670853216140082798943331514656596840270600250775311060376361362957319834722974265155077282260596017286572994970724362463380913723744386780524529615129814055392382872806911284952331243120069608229564689147615148163490135945112624843563326280983779119471002061736052609942696263080731063999963717058809856102131257946514817823533447720114300395089978029162506977008453349468697010349094956655563859492768823095351900721937383070880502475789938579040871513920234460769657854094382371783620577832744454233294238142312881899246242786576866662381793514743722896046742900848860953912091913233697056359451826380371270619157949650776902650150214163079599940463905273926421429843846284498981468900225032612333277511481447903639763235454037737865150386585260435944421216274508623023631171822759639023145303431827337267830292229710666499794450830974958653954523229125024161051855325921797843747281337494433961871592090144458216398466739276112639015932676663826790096143365531952049336114548587826898609750387793645928205225452951496677376065729909642240463846722047308794008126647281277497617941387291363892561250616672116451156257612258745364108985088202592179871125514614501470477009356882955900793879188808904635145937862408692553181033530665382069218605438646956807724138262894092424596025513326026046885326534570946844070604703136777019148689176888755612603320711744953406872373535603117227678333553208213791225775559525921931726413584603763081030966162699612271268042437224257638973730738399583861513100464835914987339130710453727505958862762926392553785428648197855574049530510430783637391874941415747051229634609591239878838313594700688904527923122636894366386236829841281427899251574200549370994166336031010887892675057915289900265384337056700901715216223264291252154062484583664304411702041932042816344661018056456897684154838706485199616939659353037358510639931586761691048699932522765446053828530865458903784706488363256208062648681342582771241443761115600841475542439442610072440933948620811082027681985514331372834378272356918236225909716067738900923541245050693536278977770750678311297737649788326466771112237468905175684806625603735967600860249565098067127477088291359900584529035810454744529075706460982312359278886725386916794849451188120962791396316885869422469880669474525809583825215370220623535200917159246464422003804628690873184617936851049812179299251649462335473083970505097171796472897209235101206462624181714945548280261841131415914486962804247405313956316822478924991224587295052424854944969174735507676778642171010258672730148986492813794536463165616645713150992263443554732980',...\r\n    '4308347545451893533793886112135110167448150257942130278777386745599652554928397657224320700423549909247465874334876012593372494094116999640383158753017007914240484166533839757450374172799055494346109813183706154034006556330317904352287260249358503792224518223975277184145508913995491883393306699927872619794752938327197270100532181095539759282326693855683005379438466098161114350500110088500680338830320793366350785873392190967698042075882437582985021745621680771875913060802780611401648217177237956762661354392005286909191692525735016313090555904587614234125587198704740553156110645151984629587306597540905754311232323195603750623337502477939222747056538640388667441464303750566494866577481851606261083269472265164187229722092510876995952327037408674352630811344750101763759171771219414128867570508224805142173722455545364',...\r\n    '706640908784338029810646798948083117473089575779933532061617102000726860803962549663261291733799113075707956344454720738157819076553321690771692795761389936374711962847067368730071486714543550871405786397209714403051203617152632416359965251423598028833816632895786416870911510835894512484144368150152022189672966430158857684181471999697500902839253384484320347140567043430862372461609020180899563645305166928565530441874113065341686558088124727467171197715784777550469579980164467233709492425054544150',...\r\n    '18608654362626285711410475608811409493576790502005798055159159459360631777224264864492041281177959484336694195103107843360995348008765130278462926764271807365975783200680413041524444910235028838034344148978148239422032430697206820383654114328713614005699432513803023234132776561526342736640171759599130328482938381202948303615528536000235787187123395532665639858412482839110285832158554714771790670605700496800534151133238023209857705421927856315656406201148780241012401980064479371440267322769245959658787082372497588734100702375073257923228660293856436195417468933502734661136954681258895785801428765766271869931539712021638711937188016318067475494042473503664891471733895591245079965837136946299431673887464173516199960333583876673502547482486492633312770402543003692821794497034198910125850811160921337858947002096136561789781250325440549680410596080589080753952523128559826727131638854144881325318968750460345392368476660029901158766566591202538948803030662153297972985568695716046130338252643453221214362728647913826281309120345258516396499078449191782080636308336765429609073146558957756719276499142812487462004507560151355531543130882994170156805679967790441427072450341568656790692338362823788493331595320906577499816864226346172',...\r\n    '410441701748304272076140867660040410535037654013094573863293415795374898623524761888925610723452122959963523154114197914081067935537712900292523409086105365653722421768513980005124062833709101148061440784751654291028951456255872530202679740841412083547627844792538886576127699940420620719943931375848142128812829755593550630930470652785779996620246743024530367840215398448299206220762625292990951124397558847994245479775288473575338179277070069539837591047093743395599899283949321283082783663713993214706453276106317429878414324447143473641770628089697750333197164',...\r\n    '32463382844346039237076449788327688578585465322999570491637008777573333263413274583453520682962529464504597794195432677560455526050515831184318625431009219666310454783918151519703551681171283349581589707866935465995294075076406223376862738615079610014874557072094754177863766550515583912951349823929089895866715100907684208090706802588756493506944600353793147094482391940',...\r\n    '65045020595669147462',...\r\n    '757980371482489534768135217439013092240352568580788549745922940478270781319816855100169941411231922273511763397481260152417636329485425563111526370188562210547560440229529638089505391223503445630197959303115533678924283156523595230292338761524668578212888944452989774902855223088397974965578959069208917244427659908412748698794200',...\r\n    '830607980608967777810677372851781944275117807135931690138966314574651354342960351368853841031058209993179984784227080968835577707813623193023137994243300327121442243583917738858721194830024579764565150753277751209971749984154424123557853236751602513076865225997611231509414240377000',...\r\n    '25682228329213260218571430271517929192762736279899048418297779872604829804938728191395922605285246149489931422999121872636526962801495428141933225314396911521935891919680850300418532347765081656000970262444805755986816614726668680459289188077504049013322829260408438280768069265785621845780341698303348485897646989759272658536964066812452393900925937902617149568606823491891398835830471390468231116250991895822121363234216'};\r\nassert(isequal(x,x_correct))\r\nassert(isequal(y,y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-01-21T03:45:15.000Z","updated_at":"2022-01-21T04:10:24.000Z","published_at":"2022-01-21T04:10:24.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\u003eGiven, a positive value (d), determine the fundamental solution [x, y] of the Pell equation: x^2 - d*y^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\u003eProvide character arrays of the outputs (x and y).\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\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[d=5;\\n[x,y]=pell(d)\\nx =\\n    '9'\\ny =\\n    '4']]\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":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,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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:\"pell\"","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:\"pell\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"pell\"","","\"","pell","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f0814670d40\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f0814670ca0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f08146703e0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f0814670fc0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f0814670f20\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f0814670e80\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f0814670de0\u003e":"tag:\"pell\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f0814670de0\u003e":"tag:\"pell\""},"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":"cody-search","password":"78X075ddcV44","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:\"pell\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"pell\"","","\"","pell","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f0814670d40\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f0814670ca0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f08146703e0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f0814670fc0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f0814670f20\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f0814670e80\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f0814670de0\u003e":"tag:\"pell\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f0814670de0\u003e":"tag:\"pell\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":45253,"difficulty_rating":"easy-medium"},{"id":51251,"difficulty_rating":"medium"},{"id":53955,"difficulty_rating":"medium-hard"},{"id":55340,"difficulty_rating":"hard"}]}}