{"group":{"group":{"id":2001,"name":"Number theory","lockable":false,"created_at":"2020-01-20T18:05:04.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":" \"its a very interesting number\"","is_default":false,"created_by":363598,"badge_id":62,"featured":false,"trending":false,"solution_count_in_trending_period":120,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":2685,"published":true,"community_created":true,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"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\u003e \\\"its a very interesting number\\\"\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\"}]}","description_html":"\u003cdiv style = \"text-align: start; line-height: normal; 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=\"display: block; min-width: 0px; padding-top: 0px; perspective-origin: 289.5px 10.24px; transform-origin: 289.5px 10.24px; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 10.24px; transform-origin: 266.5px 10.24px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \"its a very interesting number\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2020-01-21T18:43:47.000Z"},"current_player":null},"problems":[{"id":45272,"title":"Pseudo-vampire number ","description":"refer to \u003chttps://en.wikipedia.org/wiki/Vampire_number\u003e\r\nGiven a number x, determine whether it is a pseudo-vampire number.\r\nA pseudo-vampire number is similar to vampire numbers except -\r\nIt can be of any length unlike the vampire numbers which have even no of digits.\r\nIt can have n-number of fangs which need not to be of the same length unlike the vampire numbers which can have only two fangs.\r\nBut the fangs must contain precisely all the digits of the original number.","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: 172.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 86.3667px; transform-origin: 407px 86.3667px; 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: 23px 8px; transform-origin: 23px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003erefer to\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Vampire_number\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e\u0026lt;https://en.wikipedia.org/wiki/Vampire_number\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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u0026gt;\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: 217px 8px; transform-origin: 217px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a number x, determine whether it is a pseudo-vampire number.\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: 204px 8px; transform-origin: 204px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA pseudo-vampire number is similar to vampire numbers except -\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 81.7333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 40.8667px; transform-origin: 391px 40.8667px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 252px 8px; transform-origin: 252px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIt can be of any length unlike the vampire numbers which have even no of digits.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 363px 8px; transform-origin: 363px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIt can have n-number of fangs which need not to be of the same length unlike the vampire numbers which can have only two fangs.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 226px 8px; transform-origin: 226px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut the fangs must contain precisely all the digits of the original number.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf=pseudovampire(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 99;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 126;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 153;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 688;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 1010;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 1206;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 4545;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 6880;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 6969;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 12760;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 12768;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 11439;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 27040;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 52652;\r\ny_correct = 0;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 146137;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n%%\r\nx = 13078260;\r\ny_correct = 1;\r\nassert(isequal(pseudovampire(x),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363598,"edited_by":223089,"edited_at":"2022-11-17T06:54:39.000Z","deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":"2022-11-17T06:54:39.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-19T07:32:26.000Z","updated_at":"2026-01-10T14:17:44.000Z","published_at":"2020-01-19T07:33:58.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\u003erefer to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Vampire_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Vampire_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\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 number x, determine whether it is a pseudo-vampire 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA pseudo-vampire number is similar to vampire numbers except -\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIt can be of any length unlike the vampire numbers which have even no of digits.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIt can have n-number of fangs which need not to be of the same length unlike the vampire numbers which can have only two fangs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBut the fangs must contain precisely all the digits of the original number.\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":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":45249,"title":"Frugal number","description":"check whether n is a frugal number\r\n\r\n* a frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\r\n","description_html":"\u003cp\u003echeck whether n is a frugal number\u003c/p\u003e\u003cul\u003e\u003cli\u003ea frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = frugal_no(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 18;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 36;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 79;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))%%\r\nn = 105;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 106;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 125;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 128;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 243;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 344;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 11421;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 115248;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 111050;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn=97969;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":11,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":51,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-31T07:08:41.000Z","updated_at":"2026-04-01T15:15:43.000Z","published_at":"2019-12-31T07:09:42.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\u003echeck whether n is a frugal number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ea frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\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":45250,"title":"Be happy","description":"check whether the given number is happy in b-base.\r\n\r\n* A happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\r\n\r\nThis is the case for base-10. For other bases, different scenerios would occur.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Happy_number\u003e\r\n\r\n","description_html":"\u003cp\u003echeck whether the given number is happy in b-base.\u003c/p\u003e\u003cul\u003e\u003cli\u003eA happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThis is the case for base-10. For other bases, different scenerios would occur.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Happy_number\"\u003ehttps://en.wikipedia.org/wiki/Happy_number\u003c/a\u003e\u003c/p\u003e","function_template":"function tf=be_happy(n,b)","test_suite":"%%\r\nn =11123;\r\nb=10;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 347;\r\nb=6;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 998;\r\nb=10;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%% \r\nn = 1234;\r\nb=4;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 149121303586;\r\nb=10;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn =742356;\r\nb=3;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 14916;\r\nb=7;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=6;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=7;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=13;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":13,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":36,"test_suite_updated_at":"2020-01-11T09:21:53.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-02T22:16:41.000Z","updated_at":"2026-03-22T22:09:02.000Z","published_at":"2020-01-03T04:25:08.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\u003echeck whether the given number is happy in b-base.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy 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:r\u003e\u003cw:t\u003eThis is the case for base-10. For other bases, different scenerios would occur.\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/Happy_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Happy_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":45229,"title":"Bell Triangle","description":"Form the bell triangle upto nth bell number posotion;\r\n\r\n* if n=5\r\n* \r\n y= [1     0     0     0     0;\r\n     1     2     0     0     0;\r\n     2     3     5     0     0;\r\n     5     7    10    15     0;\r\n    15    20    27    37    52]\r\n\r\nsince 5th bell number is 52.\r\n","description_html":"\u003cp\u003eForm the bell triangle upto nth bell number posotion;\u003c/p\u003e\u003cul\u003e\u003cli\u003eif n=5\u003c/li\u003e\u003cli\u003ey= [1     0     0     0     0;\r\n     1     2     0     0     0;\r\n     2     3     5     0     0;\r\n     5     7    10    15     0;\r\n    15    20    27    37    52]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003esince 5th bell number is 52.\u003c/p\u003e","function_template":"function y = Bell_tri(n)\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 1;\r\nassert(isequal(Bell_tri(n),y_correct))\r\n%%\r\nn = 5;\r\ny_correct = [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52];\r\nassert(isequal(Bell_tri(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = [ 1           0           0           0           0           0           0           0           0;\r\n           1           2           0           0           0           0           0           0           0;\r\n           2           3           5           0           0           0           0           0           0;\r\n           5           7          10          15           0           0           0           0           0;\r\n          15          20          27          37          52           0           0           0           0;\r\n          52          67          87         114         151         203           0           0           0;\r\n         203         255         322         409         523         674         877           0           0;\r\n         877        1080        1335        1657        2066        2589        3263        4140           0;\r\n        4140        5017        6097        7432        9089       11155       13744       17007       21147];\r\nassert(isequal(Bell_tri(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2019-12-11T00:40:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-11T00:37:30.000Z","updated_at":"2026-01-13T23:37:08.000Z","published_at":"2019-12-11T00:40:02.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\u003eForm the bell triangle upto nth bell number posotion;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif n=5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ey= [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52]\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:r\u003e\u003cw:t\u003esince 5th bell number is 52.\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":45223,"title":"find nth even fibonacci number","description":"1st even fibonacci number=2 ; \r\n2nd even fibonacci number=8 ..","description_html":"\u003cp\u003e1st even fibonacci number=2 ; \r\n2nd even fibonacci number=8 ..\u003c/p\u003e","function_template":"function y = even_fib(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 2;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 3;\r\ny_correct = 34;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 10;\r\ny_correct = 832040;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 20;\r\ny_correct = 1548008755920;\r\nassert(isequal(even_fib(n),y_correct))\r\n\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":93,"test_suite_updated_at":"2019-12-04T11:48:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-04T11:45:17.000Z","updated_at":"2026-03-02T19:12:20.000Z","published_at":"2019-12-04T11:48:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1st even fibonacci number=2 ; 2nd even fibonacci number=8 ..\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":45194,"title":"Cantor counting","description":"Find the nth cantor's rational number. the sequence is given below in the link.\r\nSequence: 1/1,1/2,2/1,3/1,2/2,1/3,1/4... ... ...\r\nfor n=5, out=[2,2].\r\n\r\n\u003chttps://www.google.com/search?q=george+cantor+rational+numbers\u0026sxsrf=ACYBGNRVSQwqht5aNwdOW_gz4u5v5be2Bg:1572821754264\u0026source=lnms\u0026tbm=isch\u0026sa=X\u0026ved=0ahUKEwjpydTPkc_lAhUG8HMBHcyRA5cQ_AUIEigB\u0026biw=1340\u0026bih=722#imgrc=ERbtWs-JE4EhRM:\u003e","description_html":"\u003cp\u003eFind the nth cantor's rational number. the sequence is given below in the link.\r\nSequence: 1/1,1/2,2/1,3/1,2/2,1/3,1/4... ... ...\r\nfor n=5, out=[2,2].\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://www.google.com/search?q=george+cantor+rational+numbers\u0026sxsrf=ACYBGNRVSQwqht5aNwdOW_gz4u5v5be2Bg:1572821754264\u0026source=lnms\u0026tbm=isch\u0026sa=X\u0026ved=0ahUKEwjpydTPkc_lAhUG8HMBHcyRA5cQ_AUIEigB\u0026biw=1340\u0026bih=722#imgrc=ERbtWs-JE4EhRM:\"\u003ehttps://www.google.com/search?q=george+cantor+rational+numbers\u0026sxsrf=ACYBGNRVSQwqht5aNwdOW_gz4u5v5be2Bg:1572821754264\u0026source=lnms\u0026tbm=isch\u0026sa=X\u0026ved=0ahUKEwjpydTPkc_lAhUG8HMBHcyRA5cQ_AUIEigB\u0026biw=1340\u0026bih=722#imgrc=ERbtWs-JE4EhRM:\u003c/a\u003e\u003c/p\u003e","function_template":"function y = cantor(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = [1,1];\r\nassert(isequal(cantor(x),y_correct))\r\n%%\r\nx = 3;\r\ny_correct = [2,1];\r\nassert(isequal(cantor(x),y_correct))\r\n%%\r\nx = 7;\r\ny_correct = [1,4];\r\nassert(isequal(cantor(x),y_correct))\r\n%%\r\nx = 12;\r\ny_correct = [4,2];\r\nassert(isequal(cantor(x),y_correct))\r\n%%\r\nx = 29;\r\ny_correct = [1,8];\r\nassert(isequal(cantor(x),y_correct))\r\n%%\r\nx = 100;\r\ny_correct = [9,6];\r\nassert(isequal(cantor(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-04T05:54:55.000Z","updated_at":"2026-01-29T15:10:31.000Z","published_at":"2019-11-04T05:55:48.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 cantor's rational number. the sequence is given below in the link. Sequence: 1/1,1/2,2/1,3/1,2/2,1/3,1/4... ... ... for n=5, out=[2,2].\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://www.google.com/search?q=george+cantor+rational+numbers\u0026amp;sxsrf=ACYBGNRVSQwqht5aNwdOW_gz4u5v5be2Bg:1572821754264\u0026amp;source=lnms\u0026amp;tbm=isch\u0026amp;sa=X\u0026amp;ved=0ahUKEwjpydTPkc_lAhUG8HMBHcyRA5cQ_AUIEigB\u0026amp;biw=1340\u0026amp;bih=722#imgrc=ERbtWs-JE4EhRM:\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.google.com/search?q=george+cantor+rational+numbers\u0026amp;sxsrf=ACYBGNRVSQwqht5aNwdOW_gz4u5v5be2Bg:1572821754264\u0026amp;source=lnms\u0026amp;tbm=isch\u0026amp;sa=X\u0026amp;ved=0ahUKEwjpydTPkc_lAhUG8HMBHcyRA5cQ_AUIEigB\u0026amp;biw=1340\u0026amp;bih=722#imgrc=ERbtWs-JE4EhRM\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":45192,"title":"check whether a number is a pentatope number","description":"\u003chttps://oeis.org/A000332\u003e","description_html":"\u003cp\u003e\u003ca href = \"https://oeis.org/A000332\"\u003ehttps://oeis.org/A000332\u003c/a\u003e\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 5;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 125;\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 5985;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 543243;\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 7555;\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 240027425;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 132423525;\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 5980;\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1324;\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx=467716275\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))","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":65,"test_suite_updated_at":"2020-01-12T14:43:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-02T18:20:28.000Z","updated_at":"2026-03-06T10:22:34.000Z","published_at":"2019-11-02T18:22:03.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:hyperlink w:docLocation=\\\"https://oeis.org/A000332\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://oeis.org/A000332\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":45191,"title":"generate nth pentatope number","description":"https://en.wikipedia.org/wiki/Pentatope_number","description_html":"\u003cp\u003ehttps://en.wikipedia.org/wiki/Pentatope_number\u003c/p\u003e","function_template":"function y = pentatope(x)\r\n  y = ;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(pentatope(x),y_correct))\r\n%%\r\nx = 4;\r\ny_correct = 35;\r\nassert(isequal(pentatope(x),y_correct))\r\n%%\r\nx = 12;\r\ny_correct = 1365;\r\nassert(isequal(pentatope(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":72,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-02T17:27:57.000Z","updated_at":"2026-03-05T11:53:55.000Z","published_at":"2019-11-02T17:28:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Pentatope_number\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":1804,"title":"Fangs of a vampire number","description":"A vampire number is a number v that is the product of two numbers x and y such that the following conditions are satisfied:\r\nat most one of x and y is divisible by 10;\r\nx and y have the same number of digits; and\r\nThe digits in v consist of the digits of x and y (including any repetitions).\r\nIf these conditions are met, x and y are known as \"fangs\" of v. For example, 1260 is a vampire number because 1260 = 21*60, so 21 and 60 are the fangs.\r\nWrite a function that determines whether two numbers are fangs of a vampire number.\r\nSee also: 1825. Find all vampire fangs and 1826. Find vampire numbers.","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: 214.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 107.15px; transform-origin: 407px 107.15px; 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: 4.5px 8px; transform-origin: 4.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/1804-fangs-of-a-vampire-number/edit#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003evampire number\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: 326.5px 8px; transform-origin: 326.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a number v that is the product of two numbers x and y such that the following conditions are satisfied:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30.65px; transform-origin: 391px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 125px 8px; transform-origin: 125px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eat most one of x and y is divisible by 10;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 139.5px 8px; transform-origin: 139.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ex and y have the same number of digits; and\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 224.5px 8px; transform-origin: 224.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe digits in v consist of the digits of x and y (including any repetitions).\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\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: 375px 8px; transform-origin: 375px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf these conditions are met, x and y are known as \"fangs\" of v. For example, 1260 is a vampire number because 1260 = 21*60, so 21 and 60 are the fangs.\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: 270px 8px; transform-origin: 270px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that determines whether two numbers are fangs of a vampire number.\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: 29.5px 8px; transform-origin: 29.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSee also:\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/1804-fangs-of-a-vampire-number/edit#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e1825. Find all vampire fangs\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: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/1804-fangs-of-a-vampire-number/edit#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e1826. Find vampire numbers\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = are_fangs(x)\r\n  tf = false;\r\nend","test_suite":"%%\r\nx = 1; y = 1;\r\nassert(~are_fangs(x,y))\r\n\r\n%%\r\nx = 21; y = 60;\r\nassert(are_fangs(x,y))\r\n\r\n%%\r\nx = randi(9,1); y = randi([10 99],1);\r\nassert(~are_fangs(x,y))\r\n\r\n%%\r\nx = 15; y = 93;\r\nassert(are_fangs(x,y))\r\n\r\n%%\r\nx = randi(9,1)*10; y = randi(9,1)*10;\r\nassert(~are_fangs(x,y))\r\n\r\n%%\r\nx = 1; y = 1;\r\nassert(~are_fangs(x,y))\r\n\r\n%%\r\nx = 35; y = 41;\r\nassert(are_fangs(x,y))\r\n\r\n%%\r\nx = 150; y=930;\r\nassert(~are_fangs(x,y))\r\n\r\n%%\r\nx = 300; y = 501;\r\nassert(are_fangs(x,y))","published":true,"deleted":false,"likes_count":5,"comments_count":4,"created_by":1011,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":105,"test_suite_updated_at":"2021-11-06T10:47:07.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-14T04:31:10.000Z","updated_at":"2026-03-02T17:11:58.000Z","published_at":"2013-08-14T04:37:10.000Z","restored_at":"2022-02-16T22:10:22.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"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\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003evampire number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a number v that is the product of two numbers x and y such that the following conditions are satisfied:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eat most one of x and y is divisible by 10;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex and y have the same number of digits; and\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe digits in v consist of the digits of x and y (including any repetitions).\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\u003eIf these conditions are met, x and y are known as \\\"fangs\\\" of v. For example, 1260 is a vampire number because 1260 = 21*60, so 21 and 60 are the fangs.\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 determines whether two numbers are fangs of a vampire 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1825. Find all vampire fangs\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:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1826. Find vampire numbers\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\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":1825,"title":"Find all vampire fangs","description":"A vampire number is a number v that is the product of two numbers x and y such that the following conditions are satisfied:\r\nat most one of x and y are divisible by 10;\r\nx and y have the same number of digits; and\r\nThe digits in v consist of the digits of x and y (including anyrepetitions).\r\nIf these conditions are met, x and y are known as \"fangs\" of v. For example, 1260 is a vampire number because 1260 = 21*60, so 21 and 60 are the fangs.\r\nWrite a function that returns all the pairs of fangs for a given number. The output is a matrix in which each row is a pair; the values in the first row should be in increasing order. If it is not a vampire number, it will return empty arrays.\r\nExample:\r\ndisp(vampire_factor(125460))\r\n\r\n   204   615\r\n   246   510\r\nSee also:  Problem 1804. Fangs of a vampire number and and 1826. Find vampire numbers.","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: 379.033px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 189.517px; transform-origin: 406.5px 189.517px; vertical-align: baseline; \"\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: 383.5px 21px; text-align: left; transform-origin: 383.5px 21px; white-space-collapse: preserve; 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: 5.025px 7.81667px; transform-origin: 5.025px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA\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: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003evampire number\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: 307.642px 7.81667px; transform-origin: 307.642px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a number v that is the product of two numbers x and y such that the following conditions are satisfied:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 390.5px 30.65px; transform-origin: 390.5px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 362.5px 10.2167px; text-align: left; transform-origin: 362.5px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 134.558px 7.81667px; transform-origin: 134.558px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eat most one of x and y are divisible by 10;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 362.5px 10.2167px; text-align: left; transform-origin: 362.5px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 142.933px 7.81667px; transform-origin: 142.933px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ex and y have the same number of digits; and\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 362.5px 10.2167px; text-align: left; transform-origin: 362.5px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 228.358px 7.81667px; transform-origin: 228.358px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe digits in v consist of the digits of x and y (including anyrepetitions).\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\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: 383.5px 21px; text-align: left; transform-origin: 383.5px 21px; white-space-collapse: preserve; 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: 383.5px 7.81667px; transform-origin: 383.5px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf these conditions are met, x and y are known as \"fangs\" of v. For example, 1260 is a vampire number because 1260 = 21*60, so 21 and 60 are the fangs.\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: 383.5px 21px; text-align: left; transform-origin: 383.5px 21px; white-space-collapse: preserve; 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: 383.5px 7.81667px; transform-origin: 383.5px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that returns all the pairs of fangs for a given number. The output is a matrix in which each row is a pair; the values in the first row should be in increasing order. If it is not a vampire number, it will return empty arrays.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space-collapse: preserve; 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: 30.7083px 7.81667px; transform-origin: 30.7083px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; 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: 403.5px 40.8667px; transform-origin: 403.5px 40.8667px; 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.4333px; 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: 1.11667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1.11667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1.11667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1.11667px; 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: 403.5px 10.2167px; text-wrap-mode: nowrap; transform-origin: 403.5px 10.2167px; \"\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: 109.433px 8.375px; tab-size: 4; transform-origin: 109.433px 8.375px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003edisp(vampire_factor(125460))\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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: 1.11667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1.11667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1.11667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1.11667px; 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: 403.5px 10.2167px; text-wrap-mode: nowrap; transform-origin: 403.5px 10.2167px; \"\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 8.375px; tab-size: 4; transform-origin: 0px 8.375px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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: 1.11667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1.11667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1.11667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1.11667px; 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: 403.5px 10.2167px; text-wrap-mode: nowrap; transform-origin: 403.5px 10.2167px; \"\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: 46.9px 8.375px; tab-size: 4; transform-origin: 46.9px 8.375px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   204   615\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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: 1.11667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1.11667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1.11667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1.11667px; 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: 403.5px 10.2167px; text-wrap-mode: nowrap; transform-origin: 403.5px 10.2167px; \"\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: 46.9px 8.375px; tab-size: 4; transform-origin: 46.9px 8.375px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   246   510\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; 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: 32.9417px 7.81667px; transform-origin: 32.9417px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSee also: \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: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 1804. Fangs of a vampire number\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: 27.9167px 7.81667px; transform-origin: 27.9167px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and and\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: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e1826. Find vampire numbers\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: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = vampire_factor(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 125460;\r\nfactors = vampire_factor(x);\r\ncorrect_factors = [204   615; 246   510];\r\nassert(isequal(factors,correct_factors))\r\n\r\n%%\r\nx = 1827;\r\nfactors = vampire_factor(x);\r\ncorrect_factors = [21 87];\r\nassert(isequal(factors,correct_factors))\r\n\r\n%%\r\nx = 100;\r\nfactors = vampire_factor(x);\r\ncorrect_factors = [];\r\nassert(isequal(factors,correct_factors))\r\n\r\n%%\r\nx = 13078260;\r\nfactors = vampire_factor(x);\r\ncorrect_factors = [1620 8073; 1863 7020; 2070 6318];\r\nassert(isequal(factors,correct_factors))\r\n\r\n%%\r\nx = randi([125460+1 125500-1],1);\r\nfactors = vampire_factor(x);\r\ncorrect_factors = [];\r\nassert(isequal(factors,correct_factors))","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":1011,"edited_by":223089,"edited_at":"2024-12-08T11:25:13.000Z","deleted_by":null,"deleted_at":null,"solvers_count":77,"test_suite_updated_at":"2024-12-08T11:25:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-14T22:05:51.000Z","updated_at":"2026-03-02T17:50:35.000Z","published_at":"2013-08-14T22:07:02.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\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003evampire number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a number v that is the product of two numbers x and y such that the following conditions are satisfied:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eat most one of x and y are divisible by 10;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex and y have the same number of digits; and\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe digits in v consist of the digits of x and y (including anyrepetitions).\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\u003eIf these conditions are met, x and y are known as \\\"fangs\\\" of v. For example, 1260 is a vampire number because 1260 = 21*60, so 21 and 60 are the fangs.\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 returns all the pairs of fangs for a given number. The output is a matrix in which each row is a pair; the values in the first row should be in increasing order. If it is not a vampire number, it will return empty arrays.\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\u003eExample:\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[disp(vampire_factor(125460))\\n\\n   204   615\\n   246   510]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also: \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 1804. Fangs of a vampire number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1826. Find vampire numbers\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\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":74,"title":"Balanced number","description":"Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to the second half. \r\n\r\nExamples: \r\n\r\n Input  n = 13722 \r\n Output tf is true\r\n\r\nbecause 1 + 3 = 2 + 2. \r\n\r\n Input  n = 23567414 \r\n Output tf = true\r\n\r\nAll palindrome numbers are balanced.\r\n\r\n_This is partly from Project Euler, Problem 217._","description_html":"\u003cp\u003eGiven a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to the second half.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cpre\u003e Input  n = 13722 \r\n Output tf is true\u003c/pre\u003e\u003cp\u003ebecause 1 + 3 = 2 + 2.\u003c/p\u003e\u003cpre\u003e Input  n = 23567414 \r\n Output tf = true\u003c/pre\u003e\u003cp\u003eAll palindrome numbers are balanced.\u003c/p\u003e\u003cp\u003e\u003ci\u003eThis is partly from Project Euler, Problem 217.\u003c/i\u003e\u003c/p\u003e","function_template":"function tf = isBalanced(n)\r\n  tf = false;\r\nend","test_suite":"%%\r\nn = 13722;\r\nassert(isequal(isBalanced(n),true))\r\n\r\n%%\r\nn = 23567414;\r\nassert(isequal(isBalanced(n),true))\r\n\r\n%%\r\nn = 20567410;\r\nassert(isequal(isBalanced(n),false))\r\n\r\n%%\r\nn = 1;\r\nassert(isequal(isBalanced(n),true))\r\n\r\n%%\r\nn = 11111111;\r\nassert(isequal(isBalanced(n),true))\r\n\r\n%%\r\nn = 12345678;\r\nassert(isequal(isBalanced(n),false))\r\n\r\n%%\r\nn = 12333;\r\nassert(isequal(isBalanced(n),false))\r\n\r\n%%\r\nn = 9898;\r\nassert(isequal(isBalanced(n),true))\r\n\r\n%%\r\nn = 469200;\r\nassert(isequal(isBalanced(n),false))\r\n\r\n%%\r\nn = 57666;\r\nassert(isequal(isBalanced(n),true))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":22,"comments_count":2,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3082,"test_suite_updated_at":"2013-01-21T15:04:32.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:27.000Z","updated_at":"2026-02-14T15:33:05.000Z","published_at":"2012-01-18T01:00:27.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\u003eGiven a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to the second half.\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:r\u003e\u003cw:t\u003eExamples:\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[ Input  n = 13722 \\n Output tf is true]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ebecause 1 + 3 = 2 + 2.\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[ Input  n = 23567414 \\n Output tf = true]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAll palindrome numbers are balanced.\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:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eThis is partly from Project Euler, Problem 217.\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":81,"title":"Mandelbrot Numbers","description":"The \u003chttp://en.wikipedia.org/wiki/Mandelbrot_set Mandelbrot Set\u003e is built around a simple iterative equation.\r\n\r\n z(1)   = c\r\n z(n+1) = z(n)^2 + c\r\n\r\nFor any complex c, we can continue this iteration until either\r\nabs(z(n+1)) \u003e 2 or n == lim, then return the iteration count n.\r\n\r\n* If c = 0   and lim = 3, then z = [0 0 0] and n = 3.\r\n* If c = 1   and lim = 5, then z = [1 2], and n = length(z) or 2.\r\n* If c = 0.5 and lim = 5, then z = [0.5000 0.7500 1.0625 1.6289] and n = 4.\r\n\r\nFor a matrix of complex numbers C, return a corresponding matrix N such\r\nthat each element of N is the iteration count n for each complex number c\r\nin the matrix C, subject to the iteration count limit of lim.\r\n\r\nIf C = [0 0.5; 1 4] and lim = 5, then N = [5 4; 2 1]\r\n\r\nCleve Moler has a whole chapter on the Mandelbrot set in his book Experiments\r\nwith MATLAB: \u003chttp://www.mathworks.com/moler/exm/chapters/mandelbrot.pdf \r\nChapter 10, Mandelbrot Set (PDF)\u003e","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: 296.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 148.083px; transform-origin: 407px 148.083px; 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: 12.5px 8px; transform-origin: 12.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://en.wikipedia.org/wiki/Mandelbrot_set\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMandelbrot Set\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: 133px 8px; transform-origin: 133px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is built around a simple iterative equation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; 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 20.4333px; transform-origin: 404px 20.4333px; 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.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 44px 8.5px; transform-origin: 44px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e z(1)   = c\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 80px 8.5px; transform-origin: 80px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e z(n+1) = z(n)^2 + c\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; 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: 379.5px 8px; transform-origin: 379.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor any complex c, we can continue this iteration until either abs(z(n+1)) \u0026gt; 2 or n == lim, then return the iteration count n.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30.65px; transform-origin: 391px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 142.5px 8px; transform-origin: 142.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf c = 0 and lim = 3, then z = [0 0 0] and n = 3.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 176.5px 8px; transform-origin: 176.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf c = 1 and lim = 5, then z = [1 2], and n = length(z) or 2.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 226.5px 8px; transform-origin: 226.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf c = 0.5 and lim = 5, then z = [0.5000 0.7500 1.0625 1.6289] and n = 4.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 377px 8px; transform-origin: 377px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor a matrix of complex numbers C, return a corresponding matrix N such that each element of N is the iteration count n for each complex number c in the matrix C, subject to the iteration count limit of lim.\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: 149.5px 8px; transform-origin: 149.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf C = [0 0.5; 1 4] and lim = 5, then N = [5 4; 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: 127px 8px; transform-origin: 127px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCleve Moler has a whole chapter on the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/moler/exm/chapters/mandelbrot.pdf\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMandelbrot set\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: 38px 8px; transform-origin: 38px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in his book \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/moler/exm/chapters.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eExperiments with MATLAB\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function N = mandelbrot(C,lim)\r\n  N = ones(size(C));\r\nend","test_suite":"%%\r\nC = 0;\r\nlim = 5;\r\nN_correct = 5;\r\nassert(isequal(mandelbrot(C,lim),N_correct))\r\n\r\n%%\r\nC = [0 0.5; 1 4];\r\nlim = 5;\r\nN_correct = [5 4; 2 1];\r\nassert(isequal(mandelbrot(C,lim),N_correct))\r\n\r\n%%\r\ni = sqrt(-1);\r\nC = [i 1 -2*i -2];\r\nlim = 10;\r\nN_correct = [10 2 1 10];\r\nassert(isequal(mandelbrot(C,lim),N_correct))","published":true,"deleted":false,"likes_count":17,"comments_count":9,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1777,"test_suite_updated_at":"2012-01-26T03:21:20.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:28.000Z","updated_at":"2026-01-24T11:35:38.000Z","published_at":"2012-01-18T01:00:28.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\u003eThe\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Mandelbrot_set\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMandelbrot Set\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is built around a simple iterative equation.\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[ z(1)   = c\\n z(n+1) = z(n)^2 + c]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor any complex c, we can continue this iteration until either abs(z(n+1)) \u0026gt; 2 or n == lim, then return the iteration count n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf c = 0 and lim = 3, then z = [0 0 0] and n = 3.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf c = 1 and lim = 5, then z = [1 2], and n = length(z) or 2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf c = 0.5 and lim = 5, then z = [0.5000 0.7500 1.0625 1.6289] and n = 4.\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 a matrix of complex numbers C, return a corresponding matrix N such that each element of N is the iteration count n for each complex number c in the matrix C, subject to the iteration count limit of lim.\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\u003eIf C = [0 0.5; 1 4] and lim = 5, then N = [5 4; 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\u003eCleve Moler has a whole chapter on the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/moler/exm/chapters/mandelbrot.pdf\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMandelbrot set\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in his book \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/moler/exm/chapters.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eExperiments with MATLAB\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\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":156,"title":"Parasitic numbers","description":"Test whether the first input x is an n-parasitic number: \u003chttp://en.wikipedia.org/wiki/Parasitic_number\u003e. ( _n_ is the second input.)\r\n\r\nExamples:\r\n\r\nparasitic(128205,4) ---\u003e true\r\n\r\nparasitic(179487,4) ---\u003e true\r\n\r\nparasitic(179487,3) ---\u003e false","description_html":"\u003cp\u003eTest whether the first input x is an n-parasitic number: \u003ca href=\"http://en.wikipedia.org/wiki/Parasitic_number\"\u003ehttp://en.wikipedia.org/wiki/Parasitic_number\u003c/a\u003e. ( \u003ci\u003en\u003c/i\u003e is the second input.)\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cp\u003eparasitic(128205,4) ---\u003e true\u003c/p\u003e\u003cp\u003eparasitic(179487,4) ---\u003e true\u003c/p\u003e\u003cp\u003eparasitic(179487,3) ---\u003e false\u003c/p\u003e","function_template":"function y = parasitic(x,n)\r\n  y = x*n;\r\nend","test_suite":"%%\r\nx = 128205;\r\nn = 4\r\ny_correct = true;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 179487;\r\nn = 4;\r\ny_correct = true;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 179487;\r\nn = 3;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 142857;\r\nn = 5;\r\ny_correct = true;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 142857;\r\nn = 4;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 142657;\r\nn = 5;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 142857;\r\nn = 4;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 1012658227848;\r\nn = 8;\r\ny_correct = true;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 1012658227848;\r\nn = 4;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 142857;\r\nn = 7;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n%%\r\nx = 12;\r\nn = 2;\r\ny_correct = false;\r\nassert(isequal(parasitic(x,n),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":5,"created_by":39,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":315,"test_suite_updated_at":"2016-09-30T20:15:58.000Z","rescore_all_solutions":true,"group_id":8,"created_at":"2012-01-29T03:38:27.000Z","updated_at":"2026-03-11T15:14:37.000Z","published_at":"2012-01-29T03:38:27.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\u003eTest whether the first input x is an n-parasitic number:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Parasitic_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Parasitic_number\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:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the second input.)\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:r\u003e\u003cw:t\u003eExamples:\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:r\u003e\u003cw:t\u003eparasitic(128205,4) ---\u0026gt; true\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:r\u003e\u003cw:t\u003eparasitic(179487,4) ---\u0026gt; true\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:r\u003e\u003cw:t\u003eparasitic(179487,3) ---\u0026gt; false\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":165,"title":"Woodall number","description":"Test whether the input is a Woodall number: \u003chttp://en.wikipedia.org/wiki/Woodall_number\u003e\r\n\r\n_Please do not cheat by simply checking directly against the several test cases!_","description_html":"\u003cp\u003eTest whether the input is a Woodall number: \u003ca href=\"http://en.wikipedia.org/wiki/Woodall_number\"\u003ehttp://en.wikipedia.org/wiki/Woodall_number\u003c/a\u003e\u003c/p\u003e\u003cp\u003e\u003ci\u003ePlease do not cheat by simply checking directly against the several test cases!\u003c/i\u003e\u003c/p\u003e","function_template":"function tf = woodall(x)\r\n  tf = false;\r\nend","test_suite":"%%\r\nx = 1;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 2;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 3;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 7;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 23;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 63;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 159;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 383;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 895;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 1000;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 2000;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 2047;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 3000;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 3001;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 4607;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 10239;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 22527;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 7516192767;\r\ntf_correct = true;\r\nassert(isequal(woodall(x),tf_correct))\r\n%%\r\nx = 7516192766;\r\ntf_correct = false;\r\nassert(isequal(woodall(x),tf_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":39,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":171,"test_suite_updated_at":"2013-03-09T13:03:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-29T15:30:43.000Z","updated_at":"2026-01-02T23:26:03.000Z","published_at":"2012-01-29T15:30:43.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\u003eTest whether the input is a Woodall number:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Woodall_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Woodall_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ePlease do not cheat by simply checking directly against the several test cases!\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":166,"title":"Kaprekar numbers","description":"Test if the input is a Kaprekar number: \u003chttp://mathworld.wolfram.com/KaprekarNumber.html\u003e. Return a logical true or false.\r\n\r\n\r\n","description_html":"\u003cp\u003eTest if the input is a Kaprekar number: \u003ca href=\"http://mathworld.wolfram.com/KaprekarNumber.html\"\u003ehttp://mathworld.wolfram.com/KaprekarNumber.html\u003c/a\u003e. Return a logical true or false.\u003c/p\u003e","function_template":"function tf = kap(x)\r\n  tf = maybe;\r\nend","test_suite":"%%\r\nx = 16;\r\ntf_correct = false;\r\nassert(isequal(kap(x),tf_correct))\r\n\r\n%%\r\nx = 704;\r\ntf_correct = false;\r\nassert(isequal(kap(x),tf_correct))\r\n\r\n%%\r\nx = 9\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 45\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 55\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 99\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 297\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 703\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 999\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 2223\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 2728\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 4950\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 5050\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 7272\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 7777\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 9999\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 17344\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 22222\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 77778\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 82656\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 95121\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 99999\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 142857\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 148149\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 181819\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 187110\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 208495\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 318682\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 329967\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 351352\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 356643\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 390313\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 461539\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 466830\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 499500\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 500500\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 533170\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 538461\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 609687\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 643357\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 648648\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 670033\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 681318\r\ntf_correct = true\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 681319\r\ntf_correct = false\r\nassert(isequal(kap(x),tf_correct))\r\n%%\r\nx = 681320\r\ntf_correct = false\r\nassert(isequal(kap(x),tf_correct))","published":true,"deleted":false,"likes_count":5,"comments_count":2,"created_by":39,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":294,"test_suite_updated_at":"2016-06-14T14:57:02.000Z","rescore_all_solutions":true,"group_id":8,"created_at":"2012-01-29T16:05:57.000Z","updated_at":"2026-02-16T10:34:39.000Z","published_at":"2012-01-29T16:05:57.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\u003eTest if the input is a Kaprekar number:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://mathworld.wolfram.com/KaprekarNumber.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://mathworld.wolfram.com/KaprekarNumber.html\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Return a logical true or false.\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":235,"title":"Project Euler: Problem 4, Palindromic numbers","description":"A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.\r\nFind the largest palindrome made from the product of numbers less than or equal to the input number.\r\nThank you to Project Euler Problem 4","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: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 51px; transform-origin: 407px 51px; vertical-align: baseline; \"\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: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.\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: 321px 8px; transform-origin: 321px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFind the largest palindrome made from the product of numbers less than or equal to the input number.\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: 41.5px 8px; transform-origin: 41.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThank you to\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProject Euler Problem 4\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = euler004(x)\r\n  y = rand;\r\nend","test_suite":"%%\r\nx = 12;\r\ny_correct = 121;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 25;\r\ny_correct = 575;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 999;\r\ny_correct = 906609;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 9999;\r\ny_correct = 99000099;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 100;\r\ny_correct = 9009;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 2500;\r\ny_correct = 6167616;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 36863;\r\nassert(isequal(euler004(x),y_correct))\r\n\r\n%%\r\nx = 1234;\r\ny_correct = 1503051;\r\nassert(isequal(euler004(x),y_correct))","published":true,"deleted":false,"likes_count":14,"comments_count":7,"created_by":240,"edited_by":223089,"edited_at":"2023-01-29T06:25:30.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1268,"test_suite_updated_at":"2023-01-29T06:25:30.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-02T15:46:47.000Z","updated_at":"2026-03-24T14:13:17.000Z","published_at":"2012-02-02T20:33: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\u003eA palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.\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\u003eFind the largest palindrome made from the product of numbers less than or equal to the input 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThank you to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProject Euler Problem 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":45274,"title":"Fangs of pseudo-vampire number","description":"given a number, find all the fangs of that number.\r\n\r\nA pseudo-vampire number can have multiple of fangs. The output should be a cell containing all the pairs of possible fangs.\r\n\r\nFor example, 126 is a pseudo-vampire number whose fangs are - { '6' , '21' }\r\n\r\n* 126 = 6*21\r\n* 6 and 21 contains the digits of the original number.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Vampire_number\u003e","description_html":"\u003cp\u003egiven a number, find all the fangs of that number.\u003c/p\u003e\u003cp\u003eA pseudo-vampire number can have multiple of fangs. The output should be a cell containing all the pairs of possible fangs.\u003c/p\u003e\u003cp\u003eFor example, 126 is a pseudo-vampire number whose fangs are - { '6' , '21' }\u003c/p\u003e\u003cul\u003e\u003cli\u003e126 = 6*21\u003c/li\u003e\u003cli\u003e6 and 21 contains the digits of the original number.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Vampire_number\"\u003ehttps://en.wikipedia.org/wiki/Vampire_number\u003c/a\u003e\u003c/p\u003e","function_template":"function y = pseudovampire_fangs(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 126;\r\ny_correct = { '6' , '21' };\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\nx = 153;\r\ny_correct = { '3' , '51' };\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\nx = 1395;\r\ny_correct = { {'15' , '93'},{'5','9','31'} };\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\nx = 12768;\r\ny_correct = { '8' , '21' ,'76'};\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\nx = 11439;\r\ny_correct = { '9' , '31','41' };\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\nx = 146137;\r\ny_correct = { '317' , '461' };\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\nx = 1206;\r\ny_correct = { '6' , '201' };\r\nassert(isequal(pseudovampire_fangs(x),y_correct))\r\n%%\r\n%x = 1260;\r\n%y_correct = { {'6' , '210'},{'21','60'} };\r\n%assert(isequal(pseudovampire_fangs(x),y_correct))","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":25,"test_suite_updated_at":"2020-01-21T17:14:07.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-21T13:45:52.000Z","updated_at":"2026-01-02T18:19:18.000Z","published_at":"2020-01-21T17:14:07.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\u003egiven a number, find all the fangs of that 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:r\u003e\u003cw:t\u003eA pseudo-vampire number can have multiple of fangs. The output should be a cell containing all the pairs of possible fangs.\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:r\u003e\u003cw:t\u003eFor example, 126 is a pseudo-vampire number whose fangs are - { '6' , '21' }\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e126 = 6*21\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 and 21 contains the digits of the original 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/Vampire_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Vampire_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":249,"title":"Project Euler: Problem 9, Pythagorean numbers","description":"A Pythagorean triplet is a set of three natural numbers, a b c, for which,\r\n a^2 + b^2 = c^2\r\nFor example,\r\n 3^2 + 4^2 = 9 + 16 = 5^2 = 25.\r\nThere exists exactly one Pythagorean triplet for which a + b + c = N (the input).\r\nFind the product abc.\r\nThank you to Project Euler Problem 9.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 199px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 99.5px; transform-origin: 408px 99.5px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\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: 220.525px 8px; transform-origin: 220.525px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA Pythagorean triplet is a set of three natural numbers, a b c, for which,\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 18px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 404px 9px; transform-origin: 404px 9px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; line-height: 18px; 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; padding-inline-start: 4px; padding-left: 4px; text-wrap-mode: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(33, 33, 33); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(33, 33, 33); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(33, 33, 33); border-left-style: none; border-left-width: 0px; border-right-color: rgb(33, 33, 33); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 61.6px 8.5px; tab-size: 4; transform-origin: 61.6px 8.5px; unicode-bidi: normal; white-space-collapse: preserve; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e a^2 + b^2 = c^2\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; \"\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: 40.8417px 8px; transform-origin: 40.8417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example,\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 18px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 404px 9px; transform-origin: 404px 9px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; line-height: 18px; 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; padding-inline-start: 4px; padding-left: 4px; text-wrap-mode: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(33, 33, 33); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(33, 33, 33); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(33, 33, 33); border-left-style: none; border-left-width: 0px; border-right-color: rgb(33, 33, 33); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 119.35px 8.5px; tab-size: 4; transform-origin: 119.35px 8.5px; unicode-bidi: normal; white-space-collapse: preserve; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 3^2 + 4^2 = 9 + 16 = 5^2 = 25.\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; \"\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: 243.692px 8px; transform-origin: 243.692px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThere exists exactly one Pythagorean triplet for which a + b + c = N (the input).\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\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: 65.7333px 8px; transform-origin: 65.7333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFind the product abc.\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\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: 40.45px 8px; transform-origin: 40.45px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThank you to\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: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"about:blank\u0026lt;\u0026gt;\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003eProject Euler Problem 9\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: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = euler009(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('euler009.m');\r\nassert(isempty(strfind(filetext, 'elseif')))\r\nassert(isempty(strfind(filetext, 'str2num')))\r\n\r\n%%\r\nx = 1000;\r\ny_correct =  31875000;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 12;\r\ny_correct =  60;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 2000;\r\ny_correct =  255000000;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 320;\r\ny_correct =  1044480;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 5000;\r\ny_correct = 3984375000;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 240;\r\ny_correct = 48e4;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 90;\r\ny_correct = 21060;\r\nassert(isequal(euler009(x),y_correct))\r\n\r\n%%\r\nx = 598;\r\ny_correct = 4825860;\r\nassert(isequal(euler009(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":8,"created_by":240,"edited_by":223089,"edited_at":"2026-01-18T07:05:22.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1385,"test_suite_updated_at":"2026-01-18T07:05:22.000Z","rescore_all_solutions":false,"group_id":44,"created_at":"2012-02-03T18:08:00.000Z","updated_at":"2026-04-03T04:11:38.000Z","published_at":"2012-03-13T15:41:02.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\u003eA Pythagorean triplet is a set of three natural numbers, a b c, for which,\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[ a^2 + b^2 = c^2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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[ 3^2 + 4^2 = 9 + 16 = 5^2 = 25.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere exists exactly one Pythagorean triplet for which a + b + c = N (the input).\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\u003eFind the product abc.\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\u003eThank you to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"about:blank\u0026lt;\u0026gt;\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProject Euler Problem 9\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\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":525,"title":"Mersenne Primes","description":"A Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number.  For example, 31 is a Mersenne prime because 31 = 2^5 - 1 and both 31 and 5 are prime numbers.\r\n\r\nImplement the function isMersenne(x) so that it returns true if x is a Mersenne prime and false otherwise.  Your solution should work for all positive integer values of x less than 1,000,000,000 (one billion).","description_html":"\u003cp\u003eA Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number.  For example, 31 is a Mersenne prime because 31 = 2^5 - 1 and both 31 and 5 are prime numbers.\u003c/p\u003e\u003cp\u003eImplement the function isMersenne(x) so that it returns true if x is a Mersenne prime and false otherwise.  Your solution should work for all positive integer values of x less than 1,000,000,000 (one billion).\u003c/p\u003e","function_template":"function y = isMersenne(x)\r\n  y = false;\r\nend","test_suite":"%%\r\nx = 3;\r\ny_correct = true;\r\nassert(isequal(isMersenne(x),y_correct))\r\n\r\n%%\r\nx = 127;\r\ny_correct = true;\r\nassert(isequal(isMersenne(x),y_correct))\r\n\r\n%%\r\nx = 157;\r\ny_correct = false;\r\nassert(isequal(isMersenne(x),y_correct))\r\n\r\n%%\r\nx = 2047;\r\ny_correct = false;\r\nassert(isequal(isMersenne(x),y_correct))\r\n\r\n%%\r\nx = 8191;\r\ny_correct = true;\r\nassert(isequal(isMersenne(x),y_correct))\r\n\r\n%%\r\nx = 524287;\r\ny_correct = true;\r\nassert(isequal(isMersenne(x),y_correct))\r\n\r\n%%\r\nx = 536870911;\r\ny_correct = false;\r\nassert(isequal(isMersenne(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":7,"comments_count":4,"created_by":1537,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":968,"test_suite_updated_at":"2012-03-24T15:03:26.000Z","rescore_all_solutions":false,"group_id":44,"created_at":"2012-03-24T14:32:54.000Z","updated_at":"2026-02-15T11:05:47.000Z","published_at":"2012-03-24T14:36:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number. For example, 31 is a Mersenne prime because 31 = 2^5 - 1 and both 31 and 5 are prime numbers.\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\u003eImplement the function isMersenne(x) so that it returns true if x is a Mersenne prime and false otherwise. Your solution should work for all positive integer values of x less than 1,000,000,000 (one billion).\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":896,"title":"Sophie Germain prime","description":"In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prime because it is a prime and 2 × 23 + 1 = 47, and 47 is also a prime number. These numbers are named after French mathematician Marie-Sophie Germain.\r\n\r\nSee \u003chttp://en.wikipedia.org/wiki/Sophie_Germain_prime Sophie Germain prime\u003e article on Wikipedia.\r\n\r\n\r\nIn this Problem , the input is a number and you must return true or false if this number is a Sophie Germain prime.","description_html":"\u003cp\u003eIn number theory, a prime number p is a \u003cb\u003eSophie Germain prime\u003c/b\u003e if 2p + 1 is also prime. For example, 23 is a Sophie Germain prime because it is a prime and 2 × 23 + 1 = 47, and 47 is also a prime number. These numbers are named after French mathematician Marie-Sophie Germain.\u003c/p\u003e\u003cp\u003eSee \u003ca href=\"http://en.wikipedia.org/wiki/Sophie_Germain_prime\"\u003eSophie Germain prime\u003c/a\u003e article on Wikipedia.\u003c/p\u003e\u003cp\u003eIn this Problem , the input is a number and you must return true or false if this number is a Sophie Germain prime.\u003c/p\u003e","function_template":"function tf = your_fcn_name(x)\r\n  tf = true;\r\nend","test_suite":"%%\r\np = 233;\r\ny_correct = true;\r\nassert(isequal(your_fcn_name(p),y_correct))\r\n\r\n%%\r\np = 23;\r\ny_correct14 = true;\r\nassert(isequal(your_fcn_name(p),y_correct14))\r\n\r\n%%\r\np = 22;\r\ny_correct14 = false;\r\nassert(isequal(your_fcn_name(p),y_correct14))\r\n\r\n%% \r\np = 1 % p must also be a prime number !!\r\ny_correct1t = false;\r\nassert(isequal(your_fcn_name(p),y_correct1t))\r\n\r\n%% \r\np = 14 % p must also be a prime number !!\r\ncorrect1t = false;\r\nassert(isequal(your_fcn_name(p),correct1t))\r\n\r\n%% \r\np = 29 \r\ncorrect1tp = true;\r\nassert(isequal(your_fcn_name(p),correct1tp))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":2,"created_by":639,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1065,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":44,"created_at":"2012-08-10T13:04:11.000Z","updated_at":"2026-02-15T10:55:16.000Z","published_at":"2012-08-10T13:04:11.000Z","restored_at":"2018-10-10T14:57:27.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"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\u003eIn number theory, a prime number p is a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSophie Germain prime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e if 2p + 1 is also prime. For example, 23 is a Sophie Germain prime because it is a prime and 2 × 23 + 1 = 47, and 47 is also a prime number. These numbers are named after French mathematician Marie-Sophie Germain.\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:r\u003e\u003cw:t\u003eSee\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Sophie_Germain_prime\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSophie Germain prime\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e article on Wikipedia.\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:r\u003e\u003cw:t\u003eIn this Problem , the input is a number and you must return true or false if this number is a Sophie Germain prime.\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":1008,"title":"Determine if input is a Narcissistic number","description":"\u003chttp://en.wikipedia.org/wiki/Narcissistic_number Narcissistic number\u003e is a number that is the sum of its own digits each raised to the power of the number of digits.\r\n\r\nfor example:\r\n\r\n153 = 1^3 + 5^3 + 3^3\r\n\r\nreturn true\r\n\r\n101 ~= 1^3 + 0 ^3 + 1^3\r\n\r\nreturn false","description_html":"\u003cp\u003e\u003ca href = \"http://en.wikipedia.org/wiki/Narcissistic_number\"\u003eNarcissistic number\u003c/a\u003e is a number that is the sum of its own digits each raised to the power of the number of digits.\u003c/p\u003e\u003cp\u003efor example:\u003c/p\u003e\u003cp\u003e153 = 1^3 + 5^3 + 3^3\u003c/p\u003e\u003cp\u003ereturn true\u003c/p\u003e\u003cp\u003e101 ~= 1^3 + 0 ^3 + 1^3\u003c/p\u003e\u003cp\u003ereturn false\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 123;\r\ny_correct = false;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 153;\r\ny_correct = true;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 881;\r\ny_correct = false;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 407;\r\ny_correct = true;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3668,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":218,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":44,"created_at":"2012-10-25T01:23:33.000Z","updated_at":"2026-03-25T04:49:57.000Z","published_at":"2012-10-25T01:23:33.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:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Narcissistic_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eNarcissistic number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a number that is the sum of its own digits each raised to the power of the number of digits.\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: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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e153 = 1^3 + 5^3 + 3^3\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:r\u003e\u003cw:t\u003ereturn true\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:r\u003e\u003cw:t\u003e101 ~= 1^3 + 0 ^3 + 1^3\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:r\u003e\u003cw:t\u003ereturn false\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":1012,"title":"Determine if input is a perfect number","description":"A perfect number occurs whent the sum of all divisors of a positive integer, except the number itself, equals the number.\r\nExample\r\n 28 = 1 + 2 + 4 + 7 + 14;\r\nso return true\r\n 10 ~= 1 + 2 + 5\r\nso return false","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: 173.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 86.9333px; transform-origin: 407px 86.9333px; 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: 4.5px 8px; transform-origin: 4.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eperfect number\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: 320.5px 8px; transform-origin: 320.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e occurs whent the sum of all divisors of a positive integer, except the number itself, equals the number.\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: 26.5px 8px; transform-origin: 26.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; 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 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; 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: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 28 = 1 + 2 + 4 + 7 + 14;\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; 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: 43px 8px; transform-origin: 43px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eso return true\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; 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 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; 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: 64px 8.5px; tab-size: 4; transform-origin: 64px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 10 ~= 1 + 2 + 5\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; 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: 45.5px 8px; transform-origin: 45.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eso return false\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct = false;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 28;\r\ny_correct = true;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 8128;\r\ny_correct = true;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 564;\r\ny_correct = false;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 6;\r\ny_correct = true;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = false;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 2^randi(10);\r\ny_correct = false;\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":3668,"edited_by":223089,"edited_at":"2022-11-29T16:06:50.000Z","deleted_by":null,"deleted_at":null,"solvers_count":264,"test_suite_updated_at":"2022-11-29T16:06:50.000Z","rescore_all_solutions":false,"group_id":44,"created_at":"2012-10-30T05:27:00.000Z","updated_at":"2026-04-03T04:10:05.000Z","published_at":"2012-10-30T05:27:00.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\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eperfect number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e occurs whent the sum of all divisors of a positive integer, except the number itself, equals the 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\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[ 28 = 1 + 2 + 4 + 7 + 14;]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso return true\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[ 10 ~= 1 + 2 + 5]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso return false\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":933,"title":"Ordinal numbers","description":"Given an integer n, return the corresponding ordinal number as a character string.  For example, \r\n\r\n   ord(1)='1st'\r\n   ord(2)='2nd'\r\n   ord(3)='3rd'\r\n   ord(4)='4th'\r\n\r\nThis is the dictionary definition of ordinal number, as opposed to the mathematical definition.","description_html":"\u003cp\u003eGiven an integer n, return the corresponding ordinal number as a character string.  For example,\u003c/p\u003e\u003cpre\u003e   ord(1)='1st'\r\n   ord(2)='2nd'\r\n   ord(3)='3rd'\r\n   ord(4)='4th'\u003c/pre\u003e\u003cp\u003eThis is the dictionary definition of ordinal number, as opposed to the mathematical definition.\u003c/p\u003e","function_template":"function s=ord(n)\r\ns='';\r\n","test_suite":"%%\r\nassert(isequal(ord(1),'1st'))\r\n%%\r\nassert(isequal(ord(2),'2nd'))\r\n%%\r\nassert(isequal(ord(3),'3rd'))\r\n%%\r\nassert(isequal(ord(4),'4th'))\r\n%%\r\nassert(isequal(ord(5),'5th'))\r\n%%\r\nassert(isequal(ord(10),'10th'))\r\n%%\r\nassert(isequal(ord(11),'11th'))\r\n%%\r\nassert(isequal(ord(12),'12th'))\r\n%%\r\nassert(isequal(ord(13),'13th'))\r\n%%\r\nassert(isequal(ord(14),'14th'))\r\n%%\r\nassert(isequal(ord(15),'15th'))\r\n%%\r\nassert(isequal(ord(82),'82nd'))\r\n%%\r\nassert(isequal(ord(126),'126th'))\r\n%%\r\nassert(isequal(ord(911),'911th'))\r\n%%\r\nassert(isequal(ord(2012),'2012th'))\r\n%%\r\nassert(isequal(ord(4077),'4077th'))\r\n%%\r\nassert(isequal(ord(0),'0th'))\r\n%%\r\nassert(isequal(ord(-101),'-101st'))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":245,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":271,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":14,"created_at":"2012-09-06T21:35:35.000Z","updated_at":"2026-03-22T17:17:42.000Z","published_at":"2012-09-06T21:37:01.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\u003eGiven an integer n, return the corresponding ordinal number as a character string. For 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[   ord(1)='1st'\\n   ord(2)='2nd'\\n   ord(3)='3rd'\\n   ord(4)='4th']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the dictionary definition of ordinal number, as opposed to the mathematical definition.\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":1082,"title":"Lychrel Number Test (Inspired by Project Euler Problem 55)","description":"The task for this problem is to create a function that takes a number _n_ and tests if it might be a Lychrel number. This is, return |true| if the number satisfies the criteria stated below.\r\n\r\n*From Project Euler:* \u003chttp://projecteuler.net/problem=55 Link\u003e\r\n\r\nIf we take 47, reverse and add, 47 + 74 = 121, which is palindromic.\r\n\r\nNot all numbers produce palindromes so quickly. For example,\r\n\r\n349 + 943 = 1292,\r\n1292 + 2921 = 4213\r\n4213 + 3124 = 7337\r\n\r\nThat is, 349 took three iterations to arrive at a palindrome.\r\n\r\nAlthough no one has proved it yet, it is thought that some numbers, like 196, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, 10677 is the first number to be shown to require over fifty iterations before producing a palindrome: 4668731596684224866951378664 (53 iterations, 28-digits).\r\n\r\nSurprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.","description_html":"\u003cp\u003eThe task for this problem is to create a function that takes a number \u003ci\u003en\u003c/i\u003e and tests if it might be a Lychrel number. This is, return \u003ctt\u003etrue\u003c/tt\u003e if the number satisfies the criteria stated below.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFrom Project Euler:\u003c/b\u003e \u003ca href=\"http://projecteuler.net/problem=55\"\u003eLink\u003c/a\u003e\u003c/p\u003e\u003cp\u003eIf we take 47, reverse and add, 47 + 74 = 121, which is palindromic.\u003c/p\u003e\u003cp\u003eNot all numbers produce palindromes so quickly. For example,\u003c/p\u003e\u003cp\u003e349 + 943 = 1292,\r\n1292 + 2921 = 4213\r\n4213 + 3124 = 7337\u003c/p\u003e\u003cp\u003eThat is, 349 took three iterations to arrive at a palindrome.\u003c/p\u003e\u003cp\u003eAlthough no one has proved it yet, it is thought that some numbers, like 196, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, 10677 is the first number to be shown to require over fifty iterations before producing a palindrome: 4668731596684224866951378664 (53 iterations, 28-digits).\u003c/p\u003e\u003cp\u003eSurprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.\u003c/p\u003e","function_template":"function tf = islychrel(n)\r\n  tf = false;\r\nend","test_suite":"%%\r\nassert(islychrel(3763));\r\n\r\n%%\r\nassert(islychrel(5943));\r\n\r\n%%\r\nassert(islychrel(4709));\r\n\r\n%%\r\nassert(~islychrel(3664));\r\n\r\n%%\r\nassert(~islychrel(3692));\r\n\r\n%%\r\nassert(islychrel(196));\r\n\r\n%%\r\nassert(islychrel(8619));\r\n\r\n%%\r\nassert(islychrel(9898));\r\n\r\n%%\r\nassert(islychrel(9344));\r\n\r\n%%\r\nassert(islychrel(9884));\r\n\r\n%%\r\nassert(islychrel(4852));\r\n\r\n%%\r\nassert(islychrel(7491));\r\n\r\n%%\r\nassert(~islychrel(5832));\r\n\r\n%%\r\nassert(~islychrel(7400));\r\n\r\n%%\r\nassert(~islychrel(2349));\r\n\r\n%%\r\nassert(~islychrel(7349));\r\n\r\n%%\r\nassert(~islychrel(9706));\r\n\r\n%%\r\nassert(~islychrel(8669));\r\n\r\n%%\r\nassert(~islychrel(863));\r\n\r\n%%\r\nassert(~islychrel(5979));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":111,"test_suite_updated_at":"2012-12-06T06:32:48.000Z","rescore_all_solutions":false,"group_id":44,"created_at":"2012-12-02T06:02:08.000Z","updated_at":"2026-02-07T16:07:23.000Z","published_at":"2012-12-04T20:00:30.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\u003eThe task for this problem is to create a function that takes a number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and tests if it might be a Lychrel number. This is, return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etrue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e if the number satisfies the criteria stated below.\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:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFrom Project Euler:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://projecteuler.net/problem=55\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLink\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf we take 47, reverse and add, 47 + 74 = 121, which is palindromic.\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:r\u003e\u003cw:t\u003eNot all numbers produce palindromes so quickly. For example,\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:r\u003e\u003cw:t\u003e349 + 943 = 1292, 1292 + 2921 = 4213 4213 + 3124 = 7337\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:r\u003e\u003cw:t\u003eThat is, 349 took three iterations to arrive at a palindrome.\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:r\u003e\u003cw:t\u003eAlthough no one has proved it yet, it is thought that some numbers, like 196, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, 10677 is the first number to be shown to require over fifty iterations before producing a palindrome: 4668731596684224866951378664 (53 iterations, 28-digits).\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:r\u003e\u003cw:t\u003eSurprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.\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":1095,"title":"Circular Primes (based on Project Euler, problem 35)","description":"The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.\r\n\r\nThere are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.\r\n\r\nGiven a number x, write a MATLAB script that will tell you the number of circular primes less than or equal to x as well as a sorted list of what the circular prime numbers are.","description_html":"\u003cp\u003eThe number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.\u003c/p\u003e\u003cp\u003eThere are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.\u003c/p\u003e\u003cp\u003eGiven a number x, write a MATLAB script that will tell you the number of circular primes less than or equal to x as well as a sorted list of what the circular prime numbers are.\u003c/p\u003e","function_template":"function [how_many what_numbers]=circular_prime(x)\r\n    how_many=3;\r\n    what_numbers=[2 3 5];\r\nend","test_suite":"%%\r\n[y numbers]=circular_prime(197)\r\nassert(isequal(y,16)\u0026\u0026isequal(numbers,[2 3 5 7 11 13 17 31 37 71 73 79 97 113 131 197]))\r\n%%\r\n[y numbers]=circular_prime(100)\r\nassert(isequal(y,13)\u0026\u0026isequal(numbers,[2 3 5 7 11 13 17 31 37 71 73 79 97]))\r\n%%\r\n[y numbers]=circular_prime(250)\r\nassert(isequal(y,17)\u0026\u0026isequal(numbers,[2 3 5 7 11 13 17 31 37 71 73 79 97 113 131 197 199]))\r\n%%\r\n[y numbers]=circular_prime(2000)\r\nassert(isequal(y,27)\u0026\u0026isequal(numbers,[2 3 5 7 11 13 17 31 37 71 73 79 97 113 131 197 199 311 337 373 719 733 919 971 991 1193 1931]))\r\n%%\r\n[y numbers]=circular_prime(10000)\r\nassert(isequal(y,33)\u0026\u0026isequal(numbers,[2 3 5 7 11 13 17 31 37 71 73 79 97 113 131 197 199 311 337 373 719 733 919 971 991 1193 1931 3119 3779 7793 7937 9311 9377]))\r\n%%\r\n[y numbers]=circular_prime(54321)\r\nassert(isequal(y,38)\u0026\u0026isequal(numbers,[2 3 5 7 11 13 17 31 37 71 73 79 97 113 131 197 199 311 337 373 719 733 919 971 991 1193 1931 3119 3779 7793 7937 9311 9377 11939 19391 19937 37199 39119]))\r\n","published":true,"deleted":false,"likes_count":10,"comments_count":6,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":651,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-12-05T18:02:09.000Z","updated_at":"2026-02-15T10:48:53.000Z","published_at":"2012-12-05T18:02:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.\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\u003eThere are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a number x, write a MATLAB script that will tell you the number of circular primes less than or equal to x as well as a sorted list of what the circular prime numbers are.\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":1096,"title":"Largest Twin Primes","description":"\u003chttp://en.wikipedia.org/wiki/Twin_prime Twin primes\u003e are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Given a positive integer N (\u003e=5) what are the largest twin primes (in order) \u003c= N. For example, if N = 20 then p1 = 17 and p2 = 19.","description_html":"\u003cp\u003e\u003ca href=\"http://en.wikipedia.org/wiki/Twin_prime\"\u003eTwin primes\u003c/a\u003e are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Given a positive integer N (\u003e=5) what are the largest twin primes (in order) \u0026lt;= N. For example, if N = 20 then p1 = 17 and p2 = 19.\u003c/p\u003e","function_template":"function [y] = your_fcn_name(N)\r\n  y = [N-2 N]; \r\nend","test_suite":"%%\r\nx = 1001;\r\ny_correct = [881 883];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 1964;\r\ny_correct = [1949 1951];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 123456789;\r\ny_correct = [123456209 123456211];\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":8873,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":988,"test_suite_updated_at":"2012-12-05T19:39:01.000Z","rescore_all_solutions":false,"group_id":44,"created_at":"2012-12-05T19:36:12.000Z","updated_at":"2026-02-15T11:07:16.000Z","published_at":"2012-12-05T19:37:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Twin_prime\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eTwin primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Given a positive integer N (\u0026gt;=5) what are the largest twin primes (in order) \u0026lt;= N. For example, if N = 20 then p1 = 17 and p2 = 19.\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":1190,"title":"Golomb's self-describing sequence (based on Euler 341)","description":"The Golomb's self-describing sequence {G(n)} is the only nondecreasing sequence of natural numbers such that n appears exactly G(n) times in the sequence. The values of G(n) for the first few n are\r\n\r\n* |n =\u0026nbsp;    1    2    3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t…|\r\n* |G(n) 1    2\t2\t3\t3\t4\t4\t4\t5\t5\t\u0026nbsp;5\t\u0026nbsp;6\t\u0026nbsp;6\t\u0026nbsp;6\t\u0026nbsp;6\t\u0026nbsp;…|\r\n\r\nWrite a MATLAB script that will give you G(n) when given n.\r\n\r\nEfficiency is key here, since some of the values in the test suite will take a while to calculate.","description_html":"\u003cp\u003eThe Golomb's self-describing sequence {G(n)} is the only nondecreasing sequence of natural numbers such that n appears exactly G(n) times in the sequence. The values of G(n) for the first few n are\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ctt\u003en =\u0026nbsp;    1    2    3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t…\u003c/tt\u003e\u003c/li\u003e\u003cli\u003e\u003ctt\u003eG(n) 1    2\t2\t3\t3\t4\t4\t4\t5\t5\t\u0026nbsp;5\t\u0026nbsp;6\t\u0026nbsp;6\t\u0026nbsp;6\t\u0026nbsp;6\t\u0026nbsp;…\u003c/tt\u003e\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWrite a MATLAB script that will give you G(n) when given n.\u003c/p\u003e\u003cp\u003eEfficiency is key here, since some of the values in the test suite will take a while to calculate.\u003c/p\u003e","function_template":"function y = euler341(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(euler341(1),1))\r\n%%\r\nassert(isequal(euler341(10),5))\r\n%%\r\nassert(isequal(euler341(310),42))\r\n%%\r\nassert(isequal(euler341(4242),210))\r\n%%\r\nassert(isequal(euler341(328509),3084))\r\n%%\r\nassert(isequal(euler341(551368),4247))\r\n%%\r\nassert(isequal(euler341(614125),4540))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":183,"test_suite_updated_at":"2013-10-01T17:43:23.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2013-01-09T15:55:47.000Z","updated_at":"2026-03-25T04:50:04.000Z","published_at":"2013-01-09T15:55:47.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\u003eThe Golomb's self-describing sequence {G(n)} is the only nondecreasing sequence of natural numbers such that n appears exactly G(n) times in the sequence. The values of G(n) for the first few n are\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eG(n) 1 2 2 3 3 4 4 4 5 5 5 6 6 6 6 …\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:r\u003e\u003cw:t\u003eWrite a MATLAB script that will give you G(n) when given n.\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:r\u003e\u003cw:t\u003eEfficiency is key here, since some of the values in the test suite will take a while to calculate.\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":1407,"title":"Is it an Armstrong number?","description":"An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 153 is an Armstrong number since 1^3 + 5^3 + 3^3 = 153.","description_html":"\u003cp\u003eAn Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 153 is an Armstrong number since 1^3 + 5^3 + 3^3 = 153.\u003c/p\u003e","function_template":"function y = armno(x)\r\n  y = x^3;\r\nend","test_suite":"%%\r\nx = 153;\r\ny_correct = 1;\r\nassert(isequal(armno(x),y_correct))\r\n\r\n%%\r\nx = 143;\r\ny_correct = 0;\r\nassert(isequal(armno(x),y_correct))\r\n\r\n%%\r\nx = 370;\r\ny_correct = 1;\r\nassert(isequal(armno(x),y_correct))\r\n\r\n%%\r\nx = 371;\r\ny_correct = 1;\r\nassert(isequal(armno(x),y_correct))\r\n\r\n%%\r\nx = 145;\r\ny_correct = 0;\r\nassert(isequal(armno(x),y_correct))\r\n\r\n%%\r\nx = 407;\r\ny_correct = 1;\r\nassert(isequal(armno(x),y_correct))\r\n\r\n%%\r\nx = 136;\r\ny_correct = 0;\r\nassert(isequal(armno(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":6975,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":353,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":44,"created_at":"2013-04-01T16:50:37.000Z","updated_at":"2026-03-26T10:24:08.000Z","published_at":"2013-04-01T16:50:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAn Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 153 is an Armstrong number since 1^3 + 5^3 + 3^3 = 153.\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":1477,"title":"Champernowne Constant","description":"The \u003chttp://en.wikipedia.org/wiki/Champernowne_constant Champernowne constant\u003e is a real number whose digits in decimal representation come from the concatenation of all consecutive positive integers starting from 1.\r\n\r\nThat is\r\n\r\n 0.1234567891011121314151617181920...\r\n\r\nThis constant is of interest because it can be understood to contain an encoding of any past, present or future information, because any given sequence of numbers can be shown to exist somewhere in the champernowne representation. \r\n\r\nReturn the nth digit of the champernowne constant. The function takes an array of position values and returns an array of digits corresponding to those positions. \r\n\r\nExamples:\r\n\r\n [1 2 3 4 5] returns [1 2 3 4 5]\r\n\r\n [10 11 12 13 14 15] returns [1 0 1 1 1 2]\r\n\r\n [188 289] returns [9 9] \r\n\r\nProblem 3)\r\nPrev: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1472 1472\u003e\r\nNext: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1478 1478\u003e","description_html":"\u003cp\u003eThe \u003ca href = \"http://en.wikipedia.org/wiki/Champernowne_constant\"\u003eChampernowne constant\u003c/a\u003e is a real number whose digits in decimal representation come from the concatenation of all consecutive positive integers starting from 1.\u003c/p\u003e\u003cp\u003eThat is\u003c/p\u003e\u003cpre\u003e 0.1234567891011121314151617181920...\u003c/pre\u003e\u003cp\u003eThis constant is of interest because it can be understood to contain an encoding of any past, present or future information, because any given sequence of numbers can be shown to exist somewhere in the champernowne representation.\u003c/p\u003e\u003cp\u003eReturn the nth digit of the champernowne constant. The function takes an array of position values and returns an array of digits corresponding to those positions.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cpre\u003e [1 2 3 4 5] returns [1 2 3 4 5]\u003c/pre\u003e\u003cpre\u003e [10 11 12 13 14 15] returns [1 0 1 1 1 2]\u003c/pre\u003e\u003cpre\u003e [188 289] returns [9 9] \u003c/pre\u003e\u003cp\u003eProblem 3)\r\nPrev: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1472\"\u003e1472\u003c/a\u003e\r\nNext: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1478\"\u003e1478\u003c/a\u003e\u003c/p\u003e","function_template":"function vy = gendigit_champernowne(vx)\r\n  vy = vx;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5];\r\ny_correct = [1 2 3 4 5];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx = [10 11 12 13 14 15];\r\ny_correct = [1 0 1 1 1 2];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx = [188 189];\r\ny_correct = [9 9];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx = 2887:3000;\r\ny_correct = '999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102';\r\nassert(isequal(sprintf('%d',gendigit_champernowne(2887:3000)),y_correct))\r\n\r\n%%\r\nx=[1000000 1000001 1000002];\r\ny_correct = [1 8 5];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[12000:12005];\r\ny_correct = [7     7     3     2     7     8];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[10000000 10000001 10000002];\r\ny_correct = [7 3 0];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[120000:120005];\r\ny_correct = [2     6     2     2     2     2];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[1200000:1200005];\r\ny_correct = [ 8     5     1     8     2     1];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[1200004:1200009];\r\ny_correct = [ 2     1     8     5     1     9];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[1200008:1200013];\r\ny_correct = [1     9      2     1     8     5];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[13000008:13000013];\r\ny_correct = [2     0     1     5     8     7];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n%%\r\nx=[14000008:14000013];\r\ny_correct = [ 1     5     8     7     3     1];\r\nassert(isequal(gendigit_champernowne(x),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":11275,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":94,"test_suite_updated_at":"2013-05-02T00:27:45.000Z","rescore_all_solutions":false,"group_id":44,"created_at":"2013-04-30T14:25:37.000Z","updated_at":"2026-02-11T20:30:17.000Z","published_at":"2013-04-30T14:25:36.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\u003eThe\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Champernowne_constant\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChampernowne constant\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a real number whose digits in decimal representation come from the concatenation of all consecutive positive integers starting from 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThat is\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[ 0.1234567891011121314151617181920...]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis constant is of interest because it can be understood to contain an encoding of any past, present or future information, because any given sequence of numbers can be shown to exist somewhere in the champernowne representation.\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:r\u003e\u003cw:t\u003eReturn the nth digit of the champernowne constant. The function takes an array of position values and returns an array of digits corresponding to those positions.\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:r\u003e\u003cw:t\u003eExamples:\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[ [1 2 3 4 5] returns [1 2 3 4 5]\\n\\n [10 11 12 13 14 15] returns [1 0 1 1 1 2]\\n\\n [188 289] returns [9 9]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3) Prev:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1472\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1472\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e Next:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1478\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1478\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":45251,"title":"Last non-zero digit","description":"Given a number n, find the last non-zero digit of the factorial of that number.\r\nYou need to take care of the large values of n.","description_html":"\u003cp\u003eGiven a number n, find the last non-zero digit of the factorial of that number.\r\nYou need to take care of the large values of n.\u003c/p\u003e","function_template":"function D = last_Factorial(n)\r\n  \r\nend","test_suite":"%%\r\nn = 66;\r\ny_correct = 6;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 52;\r\ny_correct = 4;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 8;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 109;\r\ny_correct = 2;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 425;\r\ny_correct = 4;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 14;\r\ny_correct = 2;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 719;\r\ny_correct = 8;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T05:19:45.000Z","updated_at":"2026-02-05T20:53:13.000Z","published_at":"2020-01-03T05:25:46.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a number n, find the last non-zero digit of the factorial of that number. You need to take care of the large values of n.\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":1742,"title":"Generate a Parasitic Number","description":"This problem is the next step up from Problem 156. Rather than determining if an input is a parasitic number, you will be asked to generate one. You will be given the last digit of the number (k), and the number you're using to multiply to shift the parasitic number one digit (n). Both n and k will always be between 1 and 9.\r\nFor example, if n=4 and k=7:\r\n    4x7=2*8*\r\n    4x87=3*48*\r\n    4x487=1*948*\r\n    4x9487=3*7948*\r\n    4x79487=3*17948*\r\n    4x179487=717948.\r\nSo 179487 is a 4-parasitic number with units digit 7.\r\nWe are looking for the smallest possible number that meets these criteria, so while 179487, 179487179487, and 179487179487179487 are all valid answers for n=4 and k=7, the correct output for this function is 179487.\r\nBecause some of the values that are generated by this function are very large, the output should be a string rather than an integer. Please bear in mind that some of these values will have leading zeros. This will occur when n\u003ek.","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: 358.6px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 179.3px; transform-origin: 407px 179.3px; 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: 116.5px 8px; transform-origin: 116.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is the next step up from\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://in.mathworks.com/matlabcentral/cody/problems/156\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 156\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: 126.5px 8px; transform-origin: 126.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Rather than determining if an input is a\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Parasitic_number\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eparasitic number\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: 38.5px 8px; transform-origin: 38.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, you will be asked to generate one. You will be given the last digit of the number (k), and the number you're using to multiply to shift the parasitic number one digit (n). Both n and k will always be between 1 and 9.\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: 90px 8px; transform-origin: 90px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, if n=4 and k=7:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.6px; 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.3px; transform-origin: 404px 61.3px; 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.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 48px 8.5px; tab-size: 4; transform-origin: 48px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    4x7=2*8*\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 56px 8.5px; tab-size: 4; transform-origin: 56px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    4x87=3*48*\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 64px 8.5px; tab-size: 4; transform-origin: 64px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    4x487=1*948*\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 72px 8.5px; tab-size: 4; transform-origin: 72px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    4x9487=3*7948*\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 80px 8.5px; tab-size: 4; transform-origin: 80px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    4x79487=3*17948*\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 80px 8.5px; tab-size: 4; transform-origin: 80px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    4x179487=717948.\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; 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: 162.5px 8px; transform-origin: 162.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo 179487 is a 4-parasitic number with units digit 7.\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: 354.5px 8px; transform-origin: 354.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWe are looking for the smallest possible number that meets these criteria, so while 179487, 179487179487, and 179487179487179487 are all valid answers for n=4 and k=7, the correct output for this function is 179487.\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: 379px 8px; transform-origin: 379px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBecause some of the values that are generated by this function are very large, the output should be a string rather than an integer. Please bear in mind that some of these values will have leading zeros. This will occur when n\u0026gt;k.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = generate_parasitic(k,n)\r\n  y = k+n;\r\nend","test_suite":"%%\r\nn=4;k=7;y_correct='179487';\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=7;k=4;y_correct='0579710144927536231884';\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=2;k=6;y_correct='315789473684210526';\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=5;k=7;y_correct='142857';\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=1;k=3;y_correct='3';\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=6;k=6;y_correct='1016949152542372881355932203389830508474576271186440677966'\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=9;k=6;y_correct='06741573033707865168539325842696629213483146'\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n%%\r\nn=1;k=8;y_correct='8';\r\nassert(isequal(generate_parasitic(k,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":1615,"edited_by":223089,"edited_at":"2023-04-25T10:06:06.000Z","deleted_by":null,"deleted_at":null,"solvers_count":96,"test_suite_updated_at":"2022-11-17T07:00:50.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2013-07-23T17:47:03.000Z","updated_at":"2026-02-16T10:18:40.000Z","published_at":"2013-07-23T17:48:27.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\u003eThis problem is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://in.mathworks.com/matlabcentral/cody/problems/156\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 156\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Rather than determining if an input is a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Parasitic_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eparasitic number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, you will be asked to generate one. You will be given the last digit of the number (k), and the number you're using to multiply to shift the parasitic number one digit (n). Both n and k will always be between 1 and 9.\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, if n=4 and k=7:\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[    4x7=2*8*\\n    4x87=3*48*\\n    4x487=1*948*\\n    4x9487=3*7948*\\n    4x79487=3*17948*\\n    4x179487=717948.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo 179487 is a 4-parasitic number with units digit 7.\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\u003eWe are looking for the smallest possible number that meets these criteria, so while 179487, 179487179487, and 179487179487179487 are all valid answers for n=4 and k=7, the correct output for this function is 179487.\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\u003eBecause some of the values that are generated by this function are very large, the output should be a string rather than an integer. Please bear in mind that some of these values will have leading zeros. This will occur when n\u0026gt;k.\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":1925,"title":"Smith numbers","description":"Return true if the input is a Smith number in base ten. Otherwise, return false. Read about Smith numbers at http://en.wikipedia.org/wiki/Smith_number.\r\nA Smith number must be positive and have more than one factor.","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: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 36px; transform-origin: 406.5px 36px; vertical-align: baseline; \"\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: 383.5px 21px; text-align: left; transform-origin: 383.5px 21px; white-space-collapse: preserve; 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: 348.958px 7.81667px; transform-origin: 348.958px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn true if the input is a Smith number in base ten. Otherwise, return false. Read about Smith numbers at\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: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Smith_number\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ehttp://en.wikipedia.org/wiki/Smith_number\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: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space-collapse: preserve; 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: 208.258px 7.81667px; transform-origin: 208.258px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA Smith number must be positive and have more than one factor.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isSmith(x)\r\n  tf = false;\r\nend","test_suite":"%%\r\nx = 4;\r\ntf_correct = true;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 265;\r\ntf_correct = true;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 588;\r\ntf_correct = true;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 1086;\r\ntf_correct = true;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 4937775;\r\ntf_correct = true;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 5;\r\ntf_correct = false;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 1000;\r\ntf_correct = false;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 94.1;\r\ntf_correct = false;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 202.689;\r\ntf_correct = false;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = pi;\r\ntf_correct = false;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = -4;\r\ntf_correct = false;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n%%\r\nx = 11^2;\r\ntf_correct = true;\r\nassert(isequal(isSmith(x),tf_correct ))\r\n\r\n\r\n%%\r\nx = 9^3;\r\ny = [-1 0 1];\r\ntf=true;\r\nfor k=1:numel(x)\r\n    tf=tf\u0026\u0026isequal(isSmith(x(k)+y(k)), y(k)\u003c1)\r\nend\r\nassert(isequal(tf, true))","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":10139,"edited_by":223089,"edited_at":"2024-08-04T06:35:24.000Z","deleted_by":null,"deleted_at":null,"solvers_count":776,"test_suite_updated_at":"2024-08-04T06:35:24.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2013-10-09T12:32:02.000Z","updated_at":"2026-01-12T18:27:18.000Z","published_at":"2013-10-09T12:32:07.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\u003eReturn true if the input is a Smith number in base ten. Otherwise, return false. Read about Smith numbers at\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Smith_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Smith_number\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\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\u003eA Smith number must be positive and have more than one factor.\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":2733,"title":"Evil Number","description":"Check if a given natural number is evil or not. \r\n\r\nRead more at \u003chttps://oeis.org/A001969 OEIS\u003e.","description_html":"\u003cp\u003eCheck if a given natural number is evil or not.\u003c/p\u003e\u003cp\u003eRead more at \u003ca href = \"https://oeis.org/A001969\"\u003eOEIS\u003c/a\u003e.\u003c/p\u003e","function_template":"function tf = isevil(n)\r\n  tf = ;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = false;\r\nassert(isequal(isevil(x),y_correct))\r\n%%\r\nx = 3;\r\ny_correct = true;\r\nassert(isequal(isevil(x),y_correct))\r\n%%\r\nx = [18, 20, 23, 24, 27, 45, 46, 48, 96, 99, 123,];\r\ny_correct = true;\r\nassert(isequal(all(arrayfun(@isevil,x)),y_correct))\r\n%%\r\nx = [14, 16, 19, 37, 38, 55, 56, 59, 62,  79, 82, 91, 93, 94, 97, 98, 117, 118, 121];\r\ny_correct = false;\r\nassert(isequal(any(arrayfun(@isevil,x)),y_correct))\r\n%%\r\nx = 2^randi([5 10])+1;\r\ny_correct = true;\r\nassert(isequal(isevil(x),y_correct))\r\n\r\n%%\r\n% more test cases may be introduced\r\n%%\r\n% DISABLED\r\n% ________'FAIR'_SCORING_SYSTEM______________\r\n%\r\n% This section scores for usage of ans\r\n% and strings, which are common methods \r\n% to reduce cody size of solution.\r\n% Here, strings are threated like vectors.\r\n% Please do not hack it, as this problem\r\n% is not mentioned to be a hacking problem.\r\n% \r\n  try\r\n% disable:\r\nassert(false) \r\n%\r\n  size_old = feval(@evalin,'caller','score');\r\n%\r\n  all_nodes = mtree('isevil.m','-file');\r\n  str_nodes = mtfind(all_nodes,'Kind','STRING');\r\n   eq_nodes = mtfind(all_nodes,'Kind','EQUALS');\r\nprint_nodes = mtfind(all_nodes,'Kind','PRINT');\r\n expr_nodes = mtfind(all_nodes,'Kind','EXPR');\r\n%\r\n       size = count(all_nodes)           ...\r\n              +sum(str_nodes.nodesize-1) ...\r\n              +2*(count(expr_nodes)      ...\r\n                  +count(print_nodes)    ...\r\n                  -count(eq_nodes));\r\n%\r\n  feval(@assignin,'caller','score',size);\r\n%\r\n  fprintf('Size in standard cody scoring is %i.\\n',size_old);\r\n  fprintf('Here it is %i.\\n',size);\r\n  end\r\n%\r\n%_________RESULT_____________________________","published":true,"deleted":false,"likes_count":3,"comments_count":6,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":274,"test_suite_updated_at":"2016-12-26T10:21:47.000Z","rescore_all_solutions":true,"group_id":8,"created_at":"2014-12-07T21:50:01.000Z","updated_at":"2026-03-11T15:15:47.000Z","published_at":"2015-01-19T12:47:58.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\u003eCheck if a given natural number is evil or not.\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:r\u003e\u003cw:t\u003eRead more at\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A001969\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOEIS\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\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":2690,"title":"Armstrong Number","description":"Determine whether the given input n-digit number is Armstrong Number or not.\r\nReturn True if it is an Armstrong Number. An n-Digit Armstrong number is an integer such that the sum of the power n of its digit is equal to the number itself.\r\nFor Example:\r\n 371 = 3^3 + 7^3 + 1^3  or \r\n 1741725 = 1^7 + 7^7 + 4^7 + 1^7 + 7^7 + 2^7 + 5^7","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: 152.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 76.4333px; transform-origin: 407px 76.4333px; 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: 246px 8px; transform-origin: 246px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eDetermine whether the given input n-digit number is Armstrong Number or not.\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: 378px 8px; transform-origin: 378px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn True if it is an Armstrong Number. An n-Digit Armstrong number is an integer such that the sum of the power n of its digit is equal to the number itself.\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: 41.5px 8px; transform-origin: 41.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor Example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; 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 20.4333px; transform-origin: 404px 20.4333px; 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.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 371 = 3^3 + 7^3 + 1^3  or \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; 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.2167px; transform-origin: 404px 10.2167px; 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: 200px 8.5px; tab-size: 4; transform-origin: 200px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 1741725 = 1^7 + 7^7 + 4^7 + 1^7 + 7^7 + 2^7 + 5^7\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = Armstrong(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 9;\r\ny_correct = 1;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 371;\r\ny_correct = 1;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 24;\r\ny_correct = 0;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 407;\r\ny_correct = 1;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 1634;\r\ny_correct = 1;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 68955;\r\ny_correct = 0;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 11;\r\ny_correct = 0;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 548834;\r\ny_correct = 1;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n%%\r\nx = 1741725;\r\ny_correct = 1;\r\nassert(isequal(Armstrong(x),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":8,"comments_count":2,"created_by":32100,"edited_by":223089,"edited_at":"2022-11-19T15:34:07.000Z","deleted_by":null,"deleted_at":null,"solvers_count":356,"test_suite_updated_at":"2022-11-19T15:34:07.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2014-11-25T09:16:05.000Z","updated_at":"2026-02-16T10:19:41.000Z","published_at":"2014-11-25T09:16:36.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\u003eDetermine whether the given input n-digit number is Armstrong Number or not.\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\u003eReturn True if it is an Armstrong Number. An n-Digit Armstrong number is an integer such that the sum of the power n of its digit is equal to the number itself.\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[ 371 = 3^3 + 7^3 + 1^3  or \\n 1741725 = 1^7 + 7^7 + 4^7 + 1^7 + 7^7 + 2^7 + 5^7]]\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":2595,"title":"Polite numbers. Politeness.","description":"A polite number is an integer that sums of two or more consecutive positive integers.\r\nPoliteness of a positive integer is a number of nontrivial ways to write n as a sum of two or more consecutive positive integers.\r\n\r\nFor example _9 = 4+5 = 2+3+4_  and politeness of 9 is 2.\r\n\r\nGiven _N_ return politeness of _N_.\r\n\r\nSee also \u003chttp://www.mathworks.co.uk/matlabcentral/cody/problems/2593 2593\u003e","description_html":"\u003cp\u003eA polite number is an integer that sums of two or more consecutive positive integers.\r\nPoliteness of a positive integer is a number of nontrivial ways to write n as a sum of two or more consecutive positive integers.\u003c/p\u003e\u003cp\u003eFor example \u003ci\u003e9 = 4+5 = 2+3+4\u003c/i\u003e  and politeness of 9 is 2.\u003c/p\u003e\u003cp\u003eGiven \u003ci\u003eN\u003c/i\u003e return politeness of \u003ci\u003eN\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eSee also \u003ca href = \"http://www.mathworks.co.uk/matlabcentral/cody/problems/2593\"\u003e2593\u003c/a\u003e\u003c/p\u003e","function_template":"function P = politeness(N)\r\n  P=N;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 2;\r\ny_correct = 0;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 3;\r\ny_correct = 1;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 7;\r\ny_correct = 1;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 9;\r\ny_correct = 2;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 15;\r\ny_correct = 3;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 18;\r\ny_correct = 2;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 21;\r\ny_correct = 3;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 1024;\r\ny_correct = 0;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 1025;\r\ny_correct = 5;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 25215;\r\ny_correct = 11;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 62;\r\ny_correct = 1;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 63;\r\ny_correct = 5;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nx = 65;\r\ny_correct = 3;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\n% anti-lookup \u0026 clue\r\nnums=primes(200);\r\npattern=[1 nums([false ~randi([0 25],1,45)])];\r\nx=prod(pattern)*2^randi([0 5]);\r\ny_correct=2^numel(pattern)/2-1;\r\nassert(isequal(politeness(x),y_correct))\r\n%%\r\nfor k=randi(2e4,1,20)\r\n  assert(isequal(politeness(k*(k-1))+1,(politeness(k)+1)*(politeness(k-1)+1)))\r\nend","published":true,"deleted":false,"likes_count":8,"comments_count":6,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":186,"test_suite_updated_at":"2014-09-17T15:38:21.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2014-09-16T22:47:12.000Z","updated_at":"2026-02-16T10:30:04.000Z","published_at":"2014-09-17T10:56:54.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\u003eA polite number is an integer that sums of two or more consecutive positive integers. Politeness of a positive integer is a number of nontrivial ways to write n as a sum of two or more consecutive positive integers.\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:r\u003e\u003cw:t\u003eFor example\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e9 = 4+5 = 2+3+4\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and politeness of 9 is 2.\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:r\u003e\u003cw:t\u003eGiven\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e return politeness of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.co.uk/matlabcentral/cody/problems/2593\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2593\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":2593,"title":"Polite numbers. N-th polite number.","description":"A polite number is an integer that sums of at least two consecutive positive integers.\r\n\r\nFor example _7 = 3+4_ so 7 is a polite number.\r\n\r\nGiven _N_ return N-th polite number.\r\n\r\nSee also \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2595 2595\u003e","description_html":"\u003cp\u003eA polite number is an integer that sums of at least two consecutive positive integers.\u003c/p\u003e\u003cp\u003eFor example \u003ci\u003e7 = 3+4\u003c/i\u003e so 7 is a polite number.\u003c/p\u003e\u003cp\u003eGiven \u003ci\u003eN\u003c/i\u003e return N-th polite number.\u003c/p\u003e\u003cp\u003eSee also \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2595\"\u003e2595\u003c/a\u003e\u003c/p\u003e","function_template":"function polite = Nth_polite(n)\r\n  polite = n;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 3;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 2;\r\ny_correct = 5;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 4;\r\ny_correct = 7;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 5;\r\ny_correct = 9;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 7;\r\ny_correct = 11;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 11;\r\ny_correct = 15;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 12;\r\ny_correct = 17;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 14;\r\ny_correct = 19;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 19;\r\ny_correct = 24;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 21;\r\ny_correct = 26;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 27;\r\ny_correct = 33;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 64;\r\ny_correct = 71;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 1e6;\r\ny_correct = x+20;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 1e7;\r\ny_correct = x+24;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n%%\r\nx = 999999999;\r\ny_correct = x+30;\r\nassert(isequal(Nth_polite(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":166,"test_suite_updated_at":"2014-09-17T10:56:47.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2014-09-16T22:44:09.000Z","updated_at":"2026-02-16T10:31:08.000Z","published_at":"2014-09-17T10:56:47.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\u003eA polite number is an integer that sums of at least two consecutive positive integers.\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:r\u003e\u003cw:t\u003eFor example\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e7 = 3+4\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e so 7 is a polite 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:r\u003e\u003cw:t\u003eGiven\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e return N-th polite 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:r\u003e\u003cw:t\u003eSee also\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/2595\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2595\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":2061,"title":"Narcissistic number ?","description":"Inspired by Problem 2056 created by Ted.\r\n\r\nIn recreational number theory, a narcissistic number is a number that is the sum of its own digits each raised to the power of the number of digits (Wikipedia).\r\n\r\nFor example : \r\n\r\n153 = 1^3+5^3+3^3 = 1 + 125 + 27 = 153\r\n\r\n1634 = 1^4+6^4+3^4+4^4 = 1 + 1296 + 81 + 256 = 1634 are narcissistic numbers.\r\n\r\n\r\nSimply return 1 (true) if a supplied number is narcissistic or 0 (false) if not.\r\n\r\nThe tips num2str(666)-'0' = [6 6 6] should be useful.\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eInspired by Problem 2056 created by Ted.\u003c/p\u003e\u003cp\u003eIn recreational number theory, a narcissistic number is a number that is the sum of its own digits each raised to the power of the number of digits (Wikipedia).\u003c/p\u003e\u003cp\u003eFor example :\u003c/p\u003e\u003cp\u003e153 = 1^3+5^3+3^3 = 1 + 125 + 27 = 153\u003c/p\u003e\u003cp\u003e1634 = 1^4+6^4+3^4+4^4 = 1 + 1296 + 81 + 256 = 1634 are narcissistic numbers.\u003c/p\u003e\u003cp\u003eSimply return 1 (true) if a supplied number is narcissistic or 0 (false) if not.\u003c/p\u003e\u003cp\u003eThe tips num2str(666)-'0' = [6 6 6] should be useful.\u003c/p\u003e","function_template":"function y = isnarcissistic(x)\r\n  y = sum(x);\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 9;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = false;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 99;\r\ny_correct = false;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 152;\r\ny_correct = false;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 153;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 154;\r\ny_correct = false;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 371;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 370;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 1634;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 8207;\r\ny_correct = false;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 9474;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 9926315;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 88593477;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 9800817;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 54748;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 4679307774;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 472335975;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 32164049650;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 32164049651;\r\ny_correct = true;\r\nassert(isequal(isnarcissistic(x),y_correct))\r\n%%\r\nx = 32164049652;\r\ny_correct = false;\r\nassert(isequal(isnarcissistic(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":5390,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":351,"test_suite_updated_at":"2013-12-17T21:28:58.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2013-12-17T21:10:54.000Z","updated_at":"2026-03-23T05:56:25.000Z","published_at":"2013-12-17T21:28:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInspired by Problem 2056 created by Ted.\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\u003eIn recreational number theory, a narcissistic number is a number that is the sum of its own digits each raised to the power of the number of digits (Wikipedia).\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=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e153 = 1^3+5^3+3^3 = 1 + 125 + 27 = 153\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\u003e1634 = 1^4+6^4+3^4+4^4 = 1 + 1296 + 81 + 256 = 1634 are narcissistic numbers.\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\u003eSimply return 1 (true) if a supplied number is narcissistic or 0 (false) if not.\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\u003eThe tips num2str(666)-'0' = [6 6 6] should be useful.\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":2056,"title":"Is this number Munchhausen?","description":"In this problem, simply return 1 if a supplied number is Munchhausen or 0 if not.\r\nExample\r\n153 is narcissistic but not a Munchhausen number\r\nNOTE: the convention is that 0^0=0","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: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 55.5px; transform-origin: 407px 55.5px; 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: 250px 8px; transform-origin: 250px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn this problem, simply return 1 if a supplied number is Munchhausen or 0 if not.\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: 26.5px 8px; transform-origin: 26.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample\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: 158px 8px; transform-origin: 158px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e153 is narcissistic but not a Munchhausen number\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: 111px 8px; transform-origin: 111px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNOTE: the convention is that 0^0=0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = ismunch(n)\r\n  tf='?';\r\nend","test_suite":"%%\r\nn=1;\r\ny_correct=1;\r\nassert(isequal(ismunch(n),y_correct))\r\n%%\r\nn=0;\r\ny_correct=1;\r\nassert(isequal(ismunch(n),y_correct))\r\n\r\n%%\r\nn=153;\r\ny_correct=0;\r\nassert(isequal(ismunch(n),y_correct))\r\n%%\r\nn=634;\r\ny_correct=0;\r\nassert(isequal(ismunch(n),y_correct))\r\n%%\r\nn=3435;\r\ny_correct=1;\r\nassert(isequal(ismunch(n),y_correct))\r\n%%\r\nn=3534;\r\ny_correct=0;\r\nassert(isequal(ismunch(n),y_correct))\r\n%%\r\nn=438579088;\r\ny_correct=1;\r\nassert(isequal(ismunch(n),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":9,"created_by":17471,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":211,"test_suite_updated_at":"2013-12-15T12:28:07.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2013-12-15T12:06:13.000Z","updated_at":"2026-02-16T10:17:09.000Z","published_at":"2013-12-15T12:28:07.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\u003eIn this problem, simply return 1 if a supplied number is Munchhausen or 0 if not.\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\u003eExample\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\u003e153 is narcissistic but not a Munchhausen 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNOTE: the convention is that 0^0=0\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":1298,"title":"P-smooth numbers","description":"This Challenge is to find \u003chttps://en.wikipedia.org/wiki/Smooth_number P-smooth number\u003e partial sets given P and a max series value.\r\n\r\nA P-smooth number set of N contains a subset of 1:N integers whose prime factors are all \u003c=P.\r\n\r\nFor P=3 and N=16: P-smooth subset is [1 2 3 4 6 8 9 12 16]. Values 5,7,10,13,14,and 15 are primes \u003e3 or values divisible by primes\u003e3.\r\n\r\nvs = find_psmooth(P,N)\r\n\r\n\r\nSample \u003chttps://oeis.org/A051038 OEIS 11-smooth numbers\u003e\r\n\r\nWhere are P-smooth numbers utilized or present themselves?\r\nUpcoming Challenge solved by P-smooth numbers.","description_html":"\u003cp\u003eThis Challenge is to find \u003ca href = \"https://en.wikipedia.org/wiki/Smooth_number\"\u003eP-smooth number\u003c/a\u003e partial sets given P and a max series value.\u003c/p\u003e\u003cp\u003eA P-smooth number set of N contains a subset of 1:N integers whose prime factors are all \u0026lt;=P.\u003c/p\u003e\u003cp\u003eFor P=3 and N=16: P-smooth subset is [1 2 3 4 6 8 9 12 16]. Values 5,7,10,13,14,and 15 are primes \u0026gt;3 or values divisible by primes\u0026gt;3.\u003c/p\u003e\u003cp\u003evs = find_psmooth(P,N)\u003c/p\u003e\u003cp\u003eSample \u003ca href = \"https://oeis.org/A051038\"\u003eOEIS 11-smooth numbers\u003c/a\u003e\u003c/p\u003e\u003cp\u003eWhere are P-smooth numbers utilized or present themselves?\r\nUpcoming Challenge solved by P-smooth numbers.\u003c/p\u003e","function_template":"function vs = find_psmooth(pmax,vmax)\r\n% pmax is prime max\r\n% vmax is max value of set 1:vmax\r\n  vs=1;\r\nend","test_suite":"%%\r\nvs = find_psmooth(2,16);\r\nassert(isequal(vs,[1 2 4 8 16]))\r\n%%\r\nvs = find_psmooth(3,128);\r\nassert(isequal(vs,[1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 81, 96, 108, 128]))\r\n%%\r\nvs = find_psmooth(11,73);\r\nassert(isequal(vs,[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 27, 28, 30, 32, 33, 35, 36, 40, 42, 44, 45, 48, 49, 50, 54, 55, 56, 60, 63, 64, 66, 70, 72]))\r\n%%\r\npmax=7; vmax=120;\r\nvs = find_psmooth(pmax,vmax);\r\nvs=unique(vs); % Validity checks\r\nvs(vs\u003evmax)=[];\r\nvs(vs\u003c1)=[];\r\nvs=floor(vs);\r\nlength(vs)\r\nif length(vs)==50 % Known length\r\n pass=true;\r\nelse\r\n pass=false;\r\nend\r\npv=primes(vmax);\r\npv(pv\u003c=pmax)=[];\r\nfor i=pv\r\n if any(mod(vs,i)==0) % check for prime divisors \u003epmax\r\n  pass=false;\r\n  break;\r\n end\r\nend\r\nassert(pass)\r\n%%\r\npmax=11; vmax=300;\r\nvs = find_psmooth(pmax,vmax);\r\nvs=unique(vs); % Validity checks\r\nvs(vs\u003evmax)=[];\r\nvs(vs\u003c1)=[];\r\nvs=floor(vs);\r\nlength(vs)\r\nif length(vs)==104 % Known length\r\n pass=true;\r\nelse\r\n pass=false;\r\nend\r\npv=primes(vmax);\r\npv(pv\u003c=pmax)=[];\r\nfor i=pv\r\n if any(mod(vs,i)==0) % check for prime divisors \u003epmax\r\n  pass=false;\r\n  break;\r\n end\r\nend\r\nassert(pass)\r\n%%\r\npmax=13; vmax=900;\r\nvs = find_psmooth(pmax,vmax);\r\nvs=unique(vs); % Validity checks\r\nvs(vs\u003evmax)=[];\r\nvs(vs\u003c1)=[];\r\nvs=floor(vs);\r\nlength(vs)\r\nif length(vs)==231% Known length\r\n pass=true;\r\nelse\r\n pass=false;\r\nend\r\npv=primes(vmax);\r\npv(pv\u003c=pmax)=[];\r\nfor i=pv\r\n if any(mod(vs,i)==0) % check for prime divisors \u003epmax\r\n  pass=false;\r\n  break;\r\n end\r\nend\r\nassert(pass)\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":44,"created_at":"2013-02-23T23:06:45.000Z","updated_at":"2026-02-07T16:12:25.000Z","published_at":"2016-02-21T23:06:03.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\u003eThis Challenge is to find\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Smooth_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eP-smooth number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e partial sets given P and a max series value.\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:r\u003e\u003cw:t\u003eA P-smooth number set of N contains a subset of 1:N integers whose prime factors are all \u0026lt;=P.\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:r\u003e\u003cw:t\u003eFor P=3 and N=16: P-smooth subset is [1 2 3 4 6 8 9 12 16]. Values 5,7,10,13,14,and 15 are primes \u0026gt;3 or values divisible by primes\u0026gt;3.\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:r\u003e\u003cw:t\u003evs = find_psmooth(P,N)\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:r\u003e\u003cw:t\u003eSample\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A051038\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOEIS 11-smooth numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhere are P-smooth numbers utilized or present themselves? Upcoming Challenge solved by P-smooth numbers.\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":44836,"title":"Iccanobif numbers 1","description":"There are a lot of problems in Cody that deal with Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21 etc...) so let's turn things around a bit.  Literally.  This problem deals with the Iccanobif sequence.  Instead of adding the previous two numbers in the sequence, reverse the digits of the previous two numbers and add those together to get the next number in the sequence.\r\n\r\nIt starts out exactly the same as the Fibonacci (1, 1, 2, 3, 5, 8, 13) as all of the one digit numbers equal themselves when reversed.  However, instead of 8+13=21 for the next term, reverse the digits in 13 to get 31. The next term is now 8+31, or 39.  The next term after that is 31+93 (13 and 39 reversed) to get 124, and so on.  Unlike the starndard Fibonacci sequence, the Iccanobif sequence can actually decrease in value between terms.\r\n\r\nYou will be given a number, and you will be asked to calculate that term in the Iccanobif sequence.\r\n\r\n!Kcul doog","description_html":"\u003cp\u003eThere are a lot of problems in Cody that deal with Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21 etc...) so let's turn things around a bit.  Literally.  This problem deals with the Iccanobif sequence.  Instead of adding the previous two numbers in the sequence, reverse the digits of the previous two numbers and add those together to get the next number in the sequence.\u003c/p\u003e\u003cp\u003eIt starts out exactly the same as the Fibonacci (1, 1, 2, 3, 5, 8, 13) as all of the one digit numbers equal themselves when reversed.  However, instead of 8+13=21 for the next term, reverse the digits in 13 to get 31. The next term is now 8+31, or 39.  The next term after that is 31+93 (13 and 39 reversed) to get 124, and so on.  Unlike the starndard Fibonacci sequence, the Iccanobif sequence can actually decrease in value between terms.\u003c/p\u003e\u003cp\u003eYou will be given a number, and you will be asked to calculate that term in the Iccanobif sequence.\u003c/p\u003e\u003cp\u003e!Kcul doog\u003c/p\u003e","function_template":"function y = iccanobif(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;y_correct = 1;\r\nassert(isequal(iccanobif(x),y_correct))\r\n%%\r\nx = 9;y_correct = 124;\r\nassert(isequal(iccanobif(x),y_correct))\r\n%%\r\nx = 43;y_correct=36181429034;\r\nassert(isequal(iccanobif(x),y_correct))\r\n%%\r\nfor flag=1:50\r\n    y(flag)=iccanobif(flag);\r\nend\r\ndy=diff(y);\r\nassert(isequal(max(dy(1:25))+min(dy(1:25)),250750))\r\nassert(isequal(max(dy)+min(dy),19910139546138))\r\nsdy=sign(dy);\r\nassert(isequal(sum(sdy==-1),8))\r\n[m1,w1]=min(y(1:10));\r\n[m2,w2]=min(y(11:20));\r\n[m3,w3]=min(y(21:30));\r\n[m4,w4]=min(y(31:40));\r\n[m5,w5]=min(y(41:50));\r\nassert(isequal([m1 m2 m3 m4 m5],[1 836 113815 106496242 21807674140]))\r\nassert(isequal(w1*w2*w3*w4*w5,15))","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":66,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":61,"created_at":"2019-01-18T13:40:37.000Z","updated_at":"2026-04-01T15:09:11.000Z","published_at":"2019-01-18T13:40:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are a lot of problems in Cody that deal with Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21 etc...) so let's turn things around a bit. Literally. This problem deals with the Iccanobif sequence. Instead of adding the previous two numbers in the sequence, reverse the digits of the previous two numbers and add those together to get the next number in the sequence.\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\u003eIt starts out exactly the same as the Fibonacci (1, 1, 2, 3, 5, 8, 13) as all of the one digit numbers equal themselves when reversed. However, instead of 8+13=21 for the next term, reverse the digits in 13 to get 31. The next term is now 8+31, or 39. The next term after that is 31+93 (13 and 39 reversed) to get 124, and so on. Unlike the starndard Fibonacci sequence, the Iccanobif sequence can actually decrease in value between terms.\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\u003eYou will be given a number, and you will be asked to calculate that term in the Iccanobif sequence.\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\u003e!Kcul doog\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":44748,"title":"Amicable numbers","description":"Test whether two numbers are \u003chttps://en.wikipedia.org/wiki/Amicable_numbers amicable\u003e, meaning that the sum of the proper divisors of each number is equal to the other number.\r\n\r\n\r\nExample: 220 and 284 are amicable numbers because the proper divisors of 220 are 1,2,4,5,10,11,20,22,44,55,110 and their sum is 284, while the proper divisors of 284 are 1,2,4,71,142 and their sum is 220.","description_html":"\u003cp\u003eTest whether two numbers are \u003ca href = \"https://en.wikipedia.org/wiki/Amicable_numbers\"\u003eamicable\u003c/a\u003e, meaning that the sum of the proper divisors of each number is equal to the other number.\u003c/p\u003e\u003cp\u003eExample: 220 and 284 are amicable numbers because the proper divisors of 220 are 1,2,4,5,10,11,20,22,44,55,110 and their sum is 284, while the proper divisors of 284 are 1,2,4,71,142 and their sum is 220.\u003c/p\u003e","function_template":"function y = amicable(m,n)\r\n  y = false;\r\nend","test_suite":"%%\r\nm = 220; n = 284;\r\ny_correct = true;\r\nassert(isequal(amicable(m,n),y_correct))\r\n\r\n%%\r\nm = 220; n = 504;\r\ny_correct = false;\r\nassert(isequal(amicable(m,n),y_correct))\r\n\r\n%%\r\nm = 2620; n = 2924;\r\ny_correct = true;\r\nassert(isequal(amicable(m,n),y_correct))\r\n\r\n%%\r\nm = 5020; n = 5564;\r\ny_correct = true;\r\nassert(isequal(amicable(m,n),y_correct))\r\n\r\n%%\r\nm = 2924; n = 5020;\r\ny_correct = false;\r\nassert(isequal(amicable(m,n),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":4,"created_by":254267,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":78,"test_suite_updated_at":"2018-10-22T18:10:27.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-10-22T17:57:52.000Z","updated_at":"2026-03-16T15:34:17.000Z","published_at":"2018-10-22T18:02:09.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\u003eTest whether two numbers are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Amicable_numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eamicable\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, meaning that the sum of the proper divisors of each number is equal to the other 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:r\u003e\u003cw:t\u003eExample: 220 and 284 are amicable numbers because the proper divisors of 220 are 1,2,4,5,10,11,20,22,44,55,110 and their sum is 284, while the proper divisors of 284 are 1,2,4,71,142 and their sum is 220.\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":44385,"title":"Extra safe primes","description":"Did you know that the number 5 is the first safe prime? A safe prime is a prime number that can be expressed as 2p+1, where p is also a prime.\r\n\r\nTo celebrate Cody's Five-Year Anniversary, write a function to determine if a positive integer n is a safe prime in which the prime p (such that n=2p+1) is *also a safe prime*.\r\n\r\n*Examples*\r\n\r\n  isextrasafe(5) = false % because 5=2*2+1 and 2 is not a safe prime\r\n  isextrasafe(23) = true % because 23=2*11+1 and 11 is also a safe prime (11=2*5+1)\r\n","description_html":"\u003cp\u003eDid you know that the number 5 is the first safe prime? A safe prime is a prime number that can be expressed as 2p+1, where p is also a prime.\u003c/p\u003e\u003cp\u003eTo celebrate Cody's Five-Year Anniversary, write a function to determine if a positive integer n is a safe prime in which the prime p (such that n=2p+1) is \u003cb\u003ealso a safe prime\u003c/b\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eisextrasafe(5) = false % because 5=2*2+1 and 2 is not a safe prime\r\nisextrasafe(23) = true % because 23=2*11+1 and 11 is also a safe prime (11=2*5+1)\r\n\u003c/pre\u003e","function_template":"function tf = isextrasafe(x)\r\n    tf = false;\r\nend","test_suite":"%%\r\nx = 0;\r\nassert(isequal(isextrasafe(x),false))\r\n\r\n%%\r\nx = 5;\r\nassert(isequal(isextrasafe(x),false))\r\n\r\n%%\r\nx = 7;\r\nassert(isequal(isextrasafe(x),false))\r\n\r\n%%\r\nx = 11;\r\nassert(isequal(isextrasafe(x),true))\r\n\r\n%%\r\nx = 15;\r\nassert(isequal(isextrasafe(x),false))\r\n\r\n%%\r\nx = 23;\r\nassert(isequal(isextrasafe(x),true))\r\n\r\n%%\r\nx = 71;\r\nassert(isequal(isextrasafe(x),false))\r\n\r\n%%\r\nx = 719;\r\nassert(isequal(isextrasafe(x),true))\r\n\r\n%%\r\nx = 2039;\r\nassert(isequal(isextrasafe(x),true))\r\n\r\n%%\r\nx = 2040;\r\nassert(isequal(isextrasafe(x),false))\r\n\r\n%%\r\nx = 5807;\r\nassert(isequal(isextrasafe(x),true))","published":true,"deleted":false,"likes_count":13,"comments_count":4,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":756,"test_suite_updated_at":"2017-10-19T17:09:19.000Z","rescore_all_solutions":true,"group_id":34,"created_at":"2017-10-13T20:02:13.000Z","updated_at":"2026-03-25T08:22:41.000Z","published_at":"2017-10-16T01:45:10.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\u003eDid you know that the number 5 is the first safe prime? A safe prime is a prime number that can be expressed as 2p+1, where p is also a prime.\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:r\u003e\u003cw:t\u003eTo celebrate Cody's Five-Year Anniversary, write a function to determine if a positive integer n is a safe prime in which the prime p (such that n=2p+1) is\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ealso a safe prime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\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[isextrasafe(5) = false % because 5=2*2+1 and 2 is not a safe prime\\nisextrasafe(23) = true % because 23=2*11+1 and 11 is also a safe prime (11=2*5+1)]]\u003e\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":44360,"title":"Pentagonal Numbers","description":"Your function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\r\n\r\n [p,d] = pentagonal_numbers(10,40)\r\n\r\nshould return\r\n\r\n p = [12,22,35]\r\n d = [ 0, 0, 1]","description_html":"\u003cp\u003eYour function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\u003c/p\u003e\u003cpre\u003e [p,d] = pentagonal_numbers(10,40)\u003c/pre\u003e\u003cp\u003eshould return\u003c/p\u003e\u003cpre\u003e p = [12,22,35]\r\n d = [ 0, 0, 1]\u003c/pre\u003e","function_template":"function [p,d] = pentagonal_numbers(10,40)\r\n p = [5];\r\n d = [1];\r\nend","test_suite":"%%\r\nx1 = 1; x2 = 25;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1,5,12,22]))\r\nassert(isequal(d,[0,1,0,0]))\r\n\r\n%%\r\nx1 = 1; x2 = 4;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,1))\r\nassert(isequal(d,0))\r\n\r\n%%\r\nx1 = 10; x2 = 40;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[12,22,35]))\r\nassert(isequal(d,[0,0,1]))\r\n\r\n%%\r\nx1 = 10; x2 = 99;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[12,22,35,51,70,92]))\r\nassert(isequal(d,[0,0,1,0,1,0]))\r\n\r\n%%\r\nx1 = 100; x2 = 999;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925]))\r\nassert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1]))\r\n\r\n%%\r\nx1 = 40; x2 = 50;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isempty(p))\r\nassert(isempty(d))\r\n\r\n%%\r\nx1 = 1000; x2 = 1500;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1001,1080,1162,1247,1335,1426]))\r\nassert(isequal(d,[0,1,0,0,1,0]))\r\n\r\n%%\r\nx1 = 1500; x2 = 3000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882]))\r\nassert(isequal(d,[1,0,0,1,0,1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 1; x2 = 3000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882]))\r\nassert(isequal(d,[0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 10000; x2 = 12000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[10045,10292,10542,10795,11051,11310,11572,11837]))\r\nassert(isequal(d,[1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 100000; x2 = 110000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[100492,101270,102051,102835,103622,104412,105205,106001,106800,107602,108407,109215]))\r\nassert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1]))\r\n\r\n%%\r\nx1 = 1000000; x2 = 1010101;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1000825,1003277,1005732,1008190]))\r\nassert(isequal(d,[1,0,0,1]))","published":true,"deleted":false,"likes_count":12,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":677,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-05T17:43:36.000Z","updated_at":"2026-03-18T12:42:40.000Z","published_at":"2017-10-16T01:45:09.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\u003eYour function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For 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[ [p,d] = pentagonal_numbers(10,40)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eshould return\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[ p = [12,22,35]\\n d = [ 0, 0, 1]]]\u003e\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\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}