{"group":{"group":{"id":28289,"name":"Prime Numbers II","lockable":false,"created_at":"2021-09-06T04:25:06.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Euclid proved that the number of primes is infinite. How about the number of Cody Problems involving primes?","is_default":false,"created_by":46909,"badge_id":62,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":2294,"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\u003eEuclid proved that the number of primes is infinite. How about the number of Cody Problems involving primes?\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: 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: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 290px 21px; transform-origin: 290px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 267px 21px; text-align: left; transform-origin: 267px 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: 255.942px 8.05px; transform-origin: 255.942px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEuclid proved that the number of primes is infinite. How about the number of Cody Problems involving primes?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2021-09-06T04:49:43.000Z"},"current_player":null},"problems":[{"id":47833,"title":"List the delete-a-digit primes","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; 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: 331.267px 7.91667px; transform-origin: 331.267px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe sequence starting 23, 37, 53, 73, 113, 131, 137, 173, 179, 197… is interesting because each term 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: 42.4083px 7.91667px; transform-origin: 42.4083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003edelete-a-digit prime\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: 361.342px 7.91667px; transform-origin: 361.342px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e—that is, a prime number of two or more digits such that deleting any one digit leaves a prime number. For example, deleting the 1 from 137 leaves 37, deleting the 3 leaves 17, and deleting the 7 leaves 13. \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: 268.258px 7.91667px; transform-origin: 268.258px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that lists the delete-a-digit primes less than or equal the input number. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = deleteADigitPrimes(n)\r\n  y = primes(n);\r\nend","test_suite":"%%\r\nn = 20;\r\ny_correct = [];\r\nassert(isequal(deleteADigitPrimes(n),y_correct))\r\n\r\n%%\r\nn = 100;\r\ny_correct = [23 37 53 73];\r\nassert(isequal(deleteADigitPrimes(n),y_correct))\r\n\r\n%%\r\nn = 400;\r\ny_correct = [23 37 53 73 113 131 137 173 179 197 311 317];\r\nassert(isequal(deleteADigitPrimes(n),y_correct))\r\n\r\n%%\r\nn = 10000;\r\ny_correct = [23 37 53 73 113 131 137 173 179 197 311 317 431 617 719 1013 1031 1097 1499 1997 2239 2293 3137 4019 4919 6173 7019 7433 9677];\r\nassert(isequal(deleteADigitPrimes(n),y_correct))\r\n\r\n%%\r\nn = 100000;\r\ny = deleteADigitPrimes(n);\r\nyp_correct = [30011 37019 40013 47933 73331 74177 90011 91733 93491 94397];\r\nlen_correct = 45;\r\nassert(isequal(y(end-9:end),yp_correct) \u0026\u0026 isequal(length(y),len_correct))\r\n\r\n%%\r\nn = 2e6;\r\ny = deleteADigitPrimes(n);\r\nyp_correct = [746099 779699 901499 901997 944777 962233 991733 1367777 1440731 1799999];\r\nlen_correct = 66;\r\nsum_correct = 16944054;\r\nassert(isequal(y(end-9:end),yp_correct) \u0026\u0026 isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nfiletext = fileread('deleteADigitPrimes.m');\r\ncheating = ~isempty(strfind(filetext, 'urlread')) || ~isempty(strfind(filetext, 'oeis')); \r\nassert(~cheating)","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-06T02:18:24.000Z","updated_at":"2025-11-29T22:19:33.000Z","published_at":"2020-12-06T02:49:51.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 sequence starting 23, 37, 53, 73, 113, 131, 137, 173, 179, 197… is interesting because each term is a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edelete-a-digit prime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e—that is, a prime number of two or more digits such that deleting any one digit leaves a prime number. For example, deleting the 1 from 137 leaves 37, deleting the 3 leaves 17, and deleting the 7 leaves 13. \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 lists the delete-a-digit primes less than or equal the input 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":47895,"title":"List the dihedral primes","description":"The number 1880111 is a dihedral prime (or dihedral calculator prime) because on a seven-segment display it is prime (a) forward, (b) upside-down, (c) in a mirror, and (d) in a mirror upside-down. The number 120121 is the smallest dihedral prime that forms four different numbers read in those four ways. \r\nWrite a function to list the dihedral primes less than or equal to the input 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: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; 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: 267.5px 8px; transform-origin: 267.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 1880111 is a dihedral prime (or dihedral calculator prime) because on a \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Seven-segment_display\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eseven-segment display\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: 44px 8px; transform-origin: 44px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e it is prime (a) forward, (b) upside-down, (c) in a mirror, and (d) in a mirror upside-down. The number 120121 is the smallest dihedral prime that forms four different numbers read in those four ways. \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: 256px 8px; transform-origin: 256px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the dihedral primes less than or equal to the input number. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = dihedralPrimes(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 10;\r\ny_correct = [2 5];\r\nassert(isequal(dihedralPrimes(n),y_correct))\r\n\r\n%%\r\nn = 100;\r\ny_correct = [2 5 11];\r\nassert(isequal(dihedralPrimes(n),y_correct))\r\n\r\n%%\r\nn = 1000;\r\ny_correct = [2 5 11 101 181];\r\nassert(isequal(dihedralPrimes(n),y_correct))\r\n\r\n%%\r\nn = 10000;\r\ny_correct = [2 5 11 101 181 1181 1811];\r\nassert(isequal(dihedralPrimes(n),y_correct))\r\n\r\n%%\r\nn = 100000;\r\ny_correct = [2 5 11 101 181 1181 1811 18181];\r\nassert(isequal(dihedralPrimes(n),y_correct))\r\n\r\n%%\r\nn = 1000000;\r\ny_correct = [2 5 11 101 181 1181 1811 18181 108881 110881 118081 120121 121021 121151 150151 151051 151121 180181 180811 181081 188011 188801];\r\nassert(isequal(dihedralPrimes(n),y_correct))\r\n\r\n%%\r\nn = 1e8;\r\ny = dihedralPrimes(n);\r\nyp_correct = [12552251 12585121 12815581 15128251 15225521 15282151 15525221 15812281 18001811 18010001 18011101 18088801 18110101 18111881 18188801 18201011 18221851 18288581 18501011 18551821 18588281 18811181 18881011 18888011];\r\nassert(isequal(y(91:114),yp_correct))\r\n\r\n%%\r\nfiletext = fileread('dihedralPrimes.m');\r\ncheating = ~isempty(strfind(filetext, 'urlread')) || ~isempty(strfind(filetext, 'oeis')) || ...\r\n    ~isempty(strfind(filetext, \"110881\")); %Added by Dyuman Joshi to disallow and prevent hard coded solutions\r\nassert(~cheating)","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":46909,"edited_by":223089,"edited_at":"2023-04-19T07:44:32.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2023-04-19T07:44:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-11T14:07:22.000Z","updated_at":"2025-10-01T07:01:22.000Z","published_at":"2020-12-11T14:18:24.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe number 1880111 is a dihedral prime (or dihedral calculator prime) because on a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Seven-segment_display\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eseven-segment display\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e it is prime (a) forward, (b) upside-down, (c) in a mirror, and (d) in a mirror upside-down. The number 120121 is the smallest dihedral prime that forms four different numbers read in those four ways. \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 to list the dihedral primes less than or equal to the input 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":49783,"title":"List the good primes","description":"The th prime  is classified as “good” if  for . For example, 5 is a good prime because  is greater than  and , but 7 is not because . \r\nWrite a function to list the first  good primes. ","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: 75px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 37.5px; transform-origin: 407.5px 37.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 45px; 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: 384.5px 22.5px; text-align: left; transform-origin: 384.5px 22.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: 14px 7.66667px; transform-origin: 14px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003em\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: 27.225px 7.66667px; transform-origin: 27.225px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAoCAYAAACWwljjAAABc0lEQVRYhe1WUbGDMBBcD3GAgRpAQRXgAAc4wAIakIAHLKABC30fuW2WNgSGKfl52ZlMZ7hMdnPZuytQUFBQUFBQkA0OQA2gAdDK9yeAzladQ0hlZAuAl63ByBcAcyTmcgirhXQ0EZXEVVSWTLVCOOM7C53EuxyCRiF8ROIqqM8hiGTTTlwFNXeLUf+0O3smpDP4U/RCVkXiDlt/3Y4Z6edSwz/vFqO3j1WPQyj58W4xgL9xqr8MFluQqSGS8BUhbA7EdPBZmxE6OM9bbU+F0FKWM4K0A9PQDsHoR02QZA28B/m7wmd/QhhDe0XzRoVt/+lNwGAHn3mi2cgnBMOvJmCEbxEPnMyQVs+V+aQFwe6tl6RA8gxHB+q4uAIWhM4++k4rUp81iRXp/nMEGli7O8k146f8o+Pi6vRe4C+lRPQPM8Yn5LeoNRy2s+mKIBJpdmle9QqfsIfP3pcg/kOMrWRKP0Cj6nOxVTSRfVqFBQUF/xd/fT6a/H0B+xYAAAAASUVORK5CYII=\" alt=\"p_m\" style=\"width: 18px; height: 20px;\" width=\"18\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 76.625px 7.66667px; transform-origin: 76.625px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is classified as “good” if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-8px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALkAAAAsCAYAAAA5BhmsAAAFtUlEQVR4nO2cwZGzOBCFXw7OgARIwBE4AmfgDMhgzntzDITAdc8+7d0xOAXvQbzSc48wAgTGU/1VUX8VtkEtPbW6W5ofcBzHcRzHcRzHcZwvpgbQAngAeAK4Azh9tEWOU5AaQdQXAEcAPwhCfwJoPtguxylGi99e+4Ig8sf2zXGc8nQADubeAdGb288c58/A2NxF7vxJKgSRtwufc4BPEmennBHi8Xrhc479cy5wsTs7444ylZUaMbZ3sTtFOCB4zzOCoMgJQbRN//k7GgBXlBNj1T9Pxd7099ekQrD1glg9OiD0TdPfX7pSfYoawbYG0YYKwaYGwca1+3dzKgTj7ohiuiJ0xB3ALfFZSsQnpKstpdqoYn8i1ORLDwZr/dzYeiJO+geCffrZJf2YXXLG7z6sEe3t8OpMxhzaV3JENLJFELaKSIVuO6BG6KQtPOwWYm/w2hct4uSt8CqGbwuhKGY6MA0tz4i2dds3bX24ifNEMN4Ong68dgx3PVNCKxm6KGuLvUUUcapKpF7v2zweVyLmOZZvnsCjcGC5jFlU5D/9vQpxqWvM1cn31mItsasQUqjIv+mcjibzQyVe7cs/J/KxZUpFfkbogBteO8VeWyVnFLvGy+3M92vYNlQlUpF/U5KmYzi0AvHz+1aN2god2KFkSgd2j5WFI34nT3MSQxXCkJ36jj2gFZN3qyf7Z6jdNi/bA0fECt+iRF9PD6Y8k55HuS150QpYcd8QV5o5cHUa8mQnedfa4VguNeLkHBKnjuF14Duqg72EYUfEUHqRyDmwQ6GKJqV7MZ4lSyvuJagQhkIVzV32FLNyjIaEoJNzKFRhuLe2I+M+RC7s89kRxNjAHhDLh3tYws54LWeWEDcZE4ImbnurkY8JQb10CnVka4ejXHVyncQDCw/8jQ0sqxefPlVoxd2hnLjJOyFoor2HyW6hEIZ4t1rXiF58i8k7ReR0LEMhVhZagrMv5ebAJwVuxd1ivdo035NartlPKYFz17jrn3FG3CDT3xwRxbZo0AxWCJqo1XjdwLJ5hE7elMC5C8zd3qp//t385iL3xpzPFJFzhWGexaMVk44fqID4owOiV/vUn7FV2E7cfJ+GQLrDyQEey0ce8r0OsVrBkKqVeyVLdCoEICZrDDt0J1Mnlx7deBeicBKpHXzmT/9MTqqcCTxF5AzDqE1WkLKdrg4sN294yGpJhaIEFMPa4iZWCD9y5STbzG3uiAKjODrEowG5QpgCVwwmdFYEulpTJBRmTvzNkDZlR4u4OlCQJT25OgR68UlosrG37empGfhStGoyB81tOCk03KOYUkLQ+nTOZScdvewF6bIm4+2551G4qqsdnDh6KI/v0TBCK2BTbWO/XPtrVmVv6cA2/TNuiOdUaDw3HCp5z5530UoJQT00+0Jj3ZQQeMw599Lf2gli268VobmhJ2N2nZgMJSl6vseOMTeq9GK/jNmmG3Oz2790YIFXz9TJvzY2ZafscRu8hBDsoAOx4kGbGR6WnOycXJqgax8vXa21zfTYGoYRrlo5YVhuuHJD1NGsfss5o5EDG9IhLiccXBub7tWT55zpeAeFoFUZ2qzVGBUCqx5LYf+zwqNCY9K8ZLXWBJOkNp7onc8YDytyRM4ch31KO7iajPbdAa/GzxW5biTpyUQbX62RbJWCJymXiJxC0H60FQ/gVQglzt9bIRwQbakB/Ito19Bx6DE0tCC24oH++fyPpsb2EXJETu9NXWlV6oiRIxWc8alraiewIVpy44CroblZ99bwUFPqmkJqt5FxbJX43hVldhWtEID4h+T/AfgHv+2aOgZ2t1GrSPZ7D+SV93JEzjDslLi31t8pJEklVhxInfl7jsed7aFz2dPZn0HuiPEgsTPfJi57K1U6ziAUr2bYqXMGmrhstbHjOEVIZdhazrLf0+qL4ziO4ziO4ziO4ziO4ziO42zF/2VFtddM8GagAAAAAElFTkSuQmCC\" alt=\"p_m^2 \u003e p_{m-k}p_{m+k}\" style=\"width: 92.5px; height: 22px;\" width=\"92.5\" height=\"22\"\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: 12.05px 7.66667px; transform-origin: 12.05px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAkCAYAAAAgqxBxAAADeklEQVR4nO2bfZGzMBDGHw84wAAGUICCOsBBHdRCNSChHs4CGs5C3z/CM122oVNIQpJ79zeTubnmSr6e7G42HGAYhmEYhmEYhmEYhvE/0gJocncikA7AAOAGYMzcF+N7upgPawHcATxjP/hEBgAPAL9w43gunxll0+O1bsE0eAmZJbegB4R5CTme3N6mQ/75LJUOTshcq2BBDwCuy88f5Bf0BcAcoQ+cpEeMTh2EVucJC3t8jHhpjx41ioUmV+QTtBTyE8AEFwIdhc+5hndtN1LITzhD0WfoR01wvqoXtE/IoYvfi+edKSSfkC8ntl8z1Qs6hZCJHMcZmJDDqVLQzdJGKiETngVSx88XrM8dKYXcY324bZbPfOv0qa5UqhI0hSxTaSmEzLbYBg9irWr/B2FZFO1dYguZ/Z1EO3JzynXSackR6wNWLbF7FYI+U8hkgH8MzdKPkENiaiFr5Hqw33e4xZfjvIm6eemTriud4gUtLQUtzBnW4ob3iWngxHd0TD3WQqZoUjNivR53OIMArD3RBW7cvrpa0oXFC1reOkprEZKK+wYKj4vbIjwF6PM0D6SPUTl/9CyTqJOZnBFuw5ItL/UJxt0hJca9QbGCJj4xpBJ2i/Ui07LGvCnUYUdKYcv4eVZ1XKsZbm7lGG+i7lvkBjlaprenfk81giZnCFvGjnLBU1x9pxa23Jy+w51ME+rwh5mX+472eAUdUkLOJ9UJmmwJO0Z7E9YiOCOO9Ak7xllBxs/6YCdj5J8PdTXlwqsVNPHlpEOtHEX8wHph+XtKdE56RthbfnJzai8mY2TdxvDheyVTvaAlMdx3h3fLJA+lZ+Vj9a3hEWHLzeiLS32ZHF2nLXfp/ClBEy3sPX2QLpqWSYp8Un+bWuBa2HvCHmllfWED58gXI9NLyNx0De+D/0lBEwp7Tx84IdoySVENyzP3nP5DobD3CFp6Fo3cpD6hyroR+w6GOYku6BZr65jjtUvNnhhw6wDVYn0V/Is8m3XPWHQuXSI9kT4XyNTbvPH9EtEpwyDv2cKJwJeGuaOOmyaZcvKJtYNb3GmjviRavMbiW1iule9Ku4Eb4wN1ZDh6vK7ydbmhsFCpQ/jNU+5/nSItwsdSU8bB8CBj16OlFGuq3247UmrwdMYHtsKYPaUUq3ZB+FiKcp+GYRiGYRiGYRiGYRhGCfwDVg8cDxGTmBkAAAAASUVORK5CYII=\" alt=\"1 \u003c= k \u003c= m-1\" style=\"width: 90px; height: 18px;\" width=\"90\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 130.692px 7.66667px; transform-origin: 130.692px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For example, 5 is a good prime because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGIAAAAmCAYAAAA/bE50AAACkElEQVRoge2ZXZWzMBCGXw84qAEMVEEV4KAOcFAL0YAEPNQCGrDwfRfpu5ntTkoS0gK785yTm0LzM3+ZGQDDMAzD+Dznx2i23shf5QbgnxgzgCtMIR/lBmAAcIIX/BVBId2G+/r1tPBCB7zgZ+Udesj4qU3tnAY+ZGfj4IWojUm81wK4KP8/wyviXrL4RtCbB4Sz9ghGt8QVr2XW5m6IQoyNW8YcLnfxjbjAe7Z23hnLIZaRISazIoMcH3/sIyMF3hOat+yNFkHgN/gzOnwX7IzXZ+kf78RklupVX9CSi+KZgC55BO7QLbaBV8iSVdMbUo00CfdiwVSozCOkrmd4Icb2KkPODN2yO1Q+70ksOMK7aW5oaVB4MW0EQ9ErpFdo55oQMkQHr5hVSpELyjElbJaMOFbtkGIwPYIsnj2iQ/yCdyhUSI9wUWuTjwsTO/hL+pmjeEcMKmJSnnUI6W7MiFedv3ksQrfjGCLvO+ipahv5XaNFPA/PGbU9kkJOiQoX/FTKhEr3h3RNLSXlc00osbiqsVS/pA7NK0tpEEJNDs91SUrtlYTsH0kLX7LinIKObYC1o2a2RiMr8TLWJ7GwVgzvjqqT7pgTQpFXCntuMyrelfSKXDc9KnesL0qlV1RTBGP4X1BEjcKWvE0R72pd7CVrqqkEICiiGgxNVXsqgj1kTbWVwNBU1XhZU7yrh7R11nTFciJyRp4hsluR3CpiVe2gN7boDTVz9D3RId7UI2wQMtazeBugd6vpDbEiWEUWHxOCwBusy6WPQKxftPSBZxC/M81txJzsN2Vxwc92hizgsj9sHIQcJTwbI5OLWF9u1TedFiHW/lbhS+R5U4bGSTw/eoPTMAzDMAzDMAzDSOE/99ZeLZKotvwAAAAASUVORK5CYII=\" alt=\"5^2 = 25\" style=\"width: 49px; height: 19px;\" width=\"49\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 48.6167px 7.66667px; transform-origin: 48.6167px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is greater than \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAAAkCAYAAABbj9K9AAAB+0lEQVR4nO2a4a2CMBSFzw5swAIs4ARM4AZu4AZvBWZgBHdwBWZwBd+P0shT5FHOLb0J50saE2NPSr+rpRVACCGEEEIIIUQ6p7E1pQcyQw2gKtDXE4wfM7cVgA7A8609AFzYcANqvMaXerFMXy8wfszd1mPn98Bp+9kSbMDcxa6VzvT1BOMni9sbgAHAefJeg8/JblODSVoA1/H1jjTpTF9vMH7M3bYIFfhtIq+T0H5taAam40iVzvQtDeMni9sey+tYNQl9rA3NwFELhvGTxW2HsM4tcUsNzcBRC4bxU8xtDL1ZhiZy1IJZA+Mni9thDC25vfZQMBVe5xhM++9bnwrjx9xtPQYOsL/QFDwUzGmSwzTLLx7jJ4vbONmlD+88FEyD8NPNNsvjCcaPudsK4WZo6/oWD8568BXsoWC8wfhh3c7SIxx6bf3/ZXo4dCfHooL5hPHDuv3ggrC2MROsgskH48fC7R/ORoFxSeoMsjwUjJddEuPHym2+QCM8FIyHXZKrYmlXBDYos732UDCld0mMH3O3DcJd82nhMxXCvchRC6YkjB9ztzHwjjC539qAcn8PHLlgGD/mbmPg2vV372digFD18Qj7iXCBe/T1AOMni9se69feHvs+E1sjPA02N5YOyzePTF9PMH48uxVCCCGEEEIIIYQQQmzlF7FPsoiW2bFeAAAAAElFTkSuQmCC\" alt=\"2x11 = 22\" style=\"width: 70px; height: 18px;\" width=\"70\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5583px 7.66667px; transform-origin: 15.5583px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAAkCAYAAACkATUaAAACjklEQVR4nO2aUZGDMBCGPw84wAAGqgAFdVAHdVALaEACHmqhGmrh7iHskOGaEJIQ0pv9ZvLSgbDNz252N4CiKIqiKIqiKP+LDrgAbQU2hIzuJBtTyGF7CzQpRjTAALyBH2u8ZuNK81rZ4RuPE+yLQdZ4bf8buO2Yp7XmiX5pGuA5P/wB3IFxZVhJ4XvCBS9tWywtfx1q78v76aWJFn2aJ1uHis4ydIqdPNKeCf/20rBEom9gwth6tX7r+Cti77i/xzhjj3HQJNEvGK92IUa9YyaPoMUsztZedeV7QnuPWT+XQHcWEX1afLo+SvQev0fJA54xk0fQEhauZfv5htA+4t+zJWqFOley6FuIp+9JNI5GFulNYvZaiIHtSmiiEtGb2YiJuhZXQvtwtiEZEdFDcqfDRJeMfqQuwWEJ7a6kx0dDeP3vG7l7GFKihkTU7KI3GE+yy4utTLokqaH9wr5y0DVybnctSyUSss5ZRZdMXkLNuoFQg/Cpob1jKQlTRkyUcSEihr5Ih+7pa48PKSdspJkwku+FSQntNWLnTaEcnr3bnaS9IdVuPOQo+b4taw9hxKzNnv9zuOhgGiAxD8kt+n/L2m+YfXyvcEVEt5OfPQ+R8D7svM+F5Bopob2W7P1KnOBQWPRSrdhPSIabGtpryN5TBIdCotfQ576RJ7Sfnb33bAveEdYaP1R0OSE682MFOVm6bl1YMXJq6TsvkKbYoaJLkub6WEKSsTNLJDu019AriEEEf2JEc40X2+Vbsujr89zJMkDasGd/jiShveSZfk7s7xJChs/B5OhZrr3HGNRgFtXerx7zb7V41YP8XbCSSJczZLjOOlqWdViPgbpOQRVFURRFURRFURRFURThFwTuYRZudjHVAAAAAElFTkSuQmCC\" alt=\"3x7 = 21\" style=\"width: 62.5px; height: 18px;\" width=\"62.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 68.45px 7.66667px; transform-origin: 68.45px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, but 7 is not because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIcAAAAmCAYAAADup4hBAAACpElEQVR4nO2bUZXCMBBFn4c6qIEaQAEK6gAHOKgFNCChHrCABiywH+nbhtKmSRM6w+7cc/KxnE06SV5nJhMADMMwDMMwvpvD0CppQww9dACeXnsAOMFE8u/pAFwB1HBiOGEUSStolyFMBeclptCT9Pua81EquJD5L+ngNjOmdUOfBsBxZqwDnDhunzW5OCcsz/kON18pagCXjTbk9EWN15xhra2FC4rjssUYIegFl+YsJXRuLO1I2eCcvr+cMW7mOdD4kLVEk3nHnFfRyhlOHEtzr3e2pxqee8OrSGM2OKfvGw+sb2SD+DyCrvhboNc4Sxvi4ZcE/NNgzAbn9H0bKMb98yGxIWXvY2xOXG0hY3MsvtdOnV9O32juwwNC7rXC/olbibjKufXDWC10CUW1OBhS1pKyHvvVNqai2BoW6DWm7TGMr0EkqsXBkBJa/AtcIjqltEGlREFauCJej3mRSB9hAeXiWAspF8znLc3C51s4wG1iKVEsccS7UO6Q9SBqxbEWUvjwucJRCYMOeN2svU4VR7zWPbrwv38UteIIhZQG4UpqjteQEoUPXwx6j1RqlNkQteKIOaWURIMofPhyPJC2uEeMc8i1X6U4Yk8ppfBziufwtzS+90hZ3KnAc1ApjphTSklY9vVj/RXyt6FbFvfPew5uktS9ghaR0IZUapRZO3XioPIlr901iCTlTulTqBMHC00aLqP4DTMmx3uKhOsgecOsThx8W6Xj/ZQW5UTCgtfSGPQa0omxKnEwpGw52+9FCZFMK64dxkpoi/F+RRr/uiB1jjl9gwNKVgVjmYok5e1gEW/uTqWHrNes4F5Sf3OZA7YI25bTd5UG3/f7ExbPtn7Hkr+5kb5kI/xC81IL2ZnT1zAMwzAMwzAMwzAMwzD+Nj9mz3WWwAh7PQAAAABJRU5ErkJggg==\" alt=\"7^2 \u003c 5x11\" style=\"width: 67.5px; height: 19px;\" width=\"67.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.66667px; transform-origin: 3.88333px 7.66667px; 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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 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: 93.5917px 7.66667px; transform-origin: 93.5917px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the first \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 44.3417px 7.66667px; transform-origin: 44.3417px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e good primes. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = goodPrimes(m)\r\n  y = f(m);\r\nend","test_suite":"%%\r\nn = 10;\r\ny_correct = [5 11 17 29 37 41 53 59 67 71];\r\nassert(isequal(goodPrimes(n),y_correct))\r\n\r\n%%\r\nn = 100;\r\ny_correct = [5 11 17 29 37 41 53 59 67 71 97 101 127 149 179 191 223 227 251 257 269 307 311 331 347 419 431 541 557 563 569 587 593 599 641 727 733 739 809 821 853 929 937 967 1009 1031 1087 1151 1213 1277 1367 1399 1423 1427 1543 1597 1847 1861 1867 1871 1973 1987 1993 1997 2063 2203 2237 2267 2333 2339 2521 2531 2539 2609 2647 2657 2677 2683 2687 2999 3163 3167 3251 3299 3433 3449 3457 3461 3511 3527 3821 3847 3907 3989 4001 4201 4211 4217 4229 4441];\r\nassert(isequal(goodPrimes(n),y_correct))\r\n\r\n%%\r\nn = 1000;\r\ny = goodPrimes(n);\r\nsum_correct = 72975230;\r\nyp_correct = [12239 17783 22697 28597 38167 43577 48757 56431 66359 74047 84053 92173 101267 110419 120539 132589 145391 159013 169483 181667 194681];\r\nassert(isequal(sum(y),sum_correct) \u0026 isequal(y(200:40:1000),yp_correct))\r\n\r\n%%\r\nn = 2000;\r\ny = goodPrimes(n);\r\nsum_correct = 471148590;\r\nyp_correct = [207433 227989 241291 254699 267373 293983 302959 318179 340577 361211 374029 391679 422749 448853 485819 503543 540061 556601 579407 599231 611951 643453];\r\nassert(isequal(sum(y),sum_correct) \u0026 isequal(y(1050:45:2000),yp_correct))\r\n\r\n%%\r\nn = 2500;\r\ny = goodPrimes(n);\r\nsum_correct = 856906930;\r\nyp_correct = [657929 672779 691631 718331 745471 757993 776057 789959 816817 842041 860309 875317 904633];\r\nassert(isequal(sum(y),sum_correct) \u0026 isequal(y(2020:40:2500),yp_correct))\r\n\r\n%%\r\nfiletext = fileread('goodPrimes.m');\r\ncheating = contains(filetext, 'urlread') || contains(filetext, 'oeis'); \r\nassert(~cheating)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-01-07T00:23:36.000Z","updated_at":"2025-11-29T23:35:37.000Z","published_at":"2021-01-07T00:25:10.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:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_m\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_m\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is classified as “good” if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_m^2 \u0026gt; p_{m-k}p_{m+k}\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_m^2 \u0026gt; p_{m-k}p_{m+k}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"1 \u0026lt;= k \u0026lt;= m-1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 \\\\le k \\\\le m-1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, 5 is a good prime because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"5^2 = 25\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e5^2 = 25\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is greater than \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"2x11 = 22\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2\\\\cdot 11 = 22\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"3x7 = 21\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e3\\\\cdot 7 = 21\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, but 7 is not because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"7^2 \u0026lt; 5x11\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e7^2 \u0026lt; 5\\\\cdot 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to list the first \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e good primes. \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":49778,"title":"Determine whether a number is a prime self number","description":"Integers can be classified as generated numbers or self numbers. A generated number is one that can be expressed as the sum of another number and its digit sum. For example, 15 can be written as 12+(1+2); in other words, 15’s generator is 12. A self number cannot be expressed in this way. \r\nWrite a function to determine whether a number is a prime self 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: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; 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: 90.2417px 8.05px; transform-origin: 90.2417px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIntegers can be classified as \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: 31.5167px 8.05px; transform-origin: 31.5167px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003egenerated\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: 39.2833px 8.05px; transform-origin: 39.2833px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e numbers or \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: 12.8333px 8.05px; transform-origin: 12.8333px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eself \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: 209.267px 8.05px; transform-origin: 209.267px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003enumbers. A generated number is one that can be expressed as the sum of another number and its digit sum. For example, 15 can be written as 12+(1+2); in other words, 15’s generator is 12. A self number cannot be expressed in this way. \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: 162.458px 8.05px; transform-origin: 162.458px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine whether a number 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: 17.5083px 8.05px; transform-origin: 17.5083px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprime\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: 42px 8.05px; transform-origin: 42px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e self number. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isPrimeSelf(n)\r\n  tf = false;\r\nend","test_suite":"%%\r\nassert(isPrimeSelf(5))\r\n\r\n%%\r\nassert(~isPrimeSelf(13))\r\n\r\n%%\r\nassert(~isPrimeSelf(19))\r\n\r\n%%\r\nassert(~isPrimeSelf(23))\r\n\r\n%%\r\nassert(isPrimeSelf(31))\r\n\r\n%%\r\nassert(isPrimeSelf(53))\r\n\r\n%%\r\nassert(~isPrimeSelf(75))\r\n\r\n%%\r\nassert(~isPrimeSelf(143))\r\n\r\n%%\r\nassert(isPrimeSelf(211))\r\n\r\n%%\r\nassert(isPrimeSelf(613))\r\n\r\n%%\r\nassert(~isPrimeSelf(1043))\r\n\r\n%%\r\nassert(isPrimeSelf(8623))\r\n\r\n%%\r\nassert(~isPrimeSelf(12719))\r\n\r\n%%\r\nassert(~isPrimeSelf(55601))\r\n\r\n%%\r\nassert(isPrimeSelf(93581))\r\n\r\n%%\r\nassert(~isPrimeSelf(98821))\r\n\r\n%%\r\nassert(isPrimeSelf(425233))\r\n\r\n%%\r\nassert(isPrimeSelf(515929))\r\n\r\n%%\r\nassert(~isPrimeSelf(611111))\r\n\r\n%%\r\nassert(isPrimeSelf(700319))\r\n\r\n%%\r\nassert(isPrimeSelf(888997))\r\n\r\n%%\r\nassert(~isPrimeSelf(919191))\r\n\r\n%%\r\nassert(isPrimeSelf(1048189))\r\n\r\n%%\r\nassert(isPrimeSelf(1330093))\r\n\r\n%%\r\nassert(~isPrimeSelf(1450061))\r\n\r\n%%\r\nassert(isPrimeSelf(1486711))\r\n\r\n%%\r\nn = [53039 53129 53173 53307 53353 53419 53421 53507 53509 53611 53623 53711 53773 53891 53959];\r\na = arrayfun(@isPrimeSelf,n);\r\nassert(isequal(sum(a),7) \u0026\u0026 isequal(prod(bin2dec(reshape(regexprep(num2str(a),' ',''),5,3))),240))\r\n\r\n%%\r\nfiletext = fileread('isPrimeSelf.m');\r\ncheating = contains(filetext, 'urlread') || contains(filetext, 'oeis'); \r\nassert(~cheating)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2021-08-28T18:43:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-01-05T15:16:27.000Z","updated_at":"2025-11-29T22:21:32.000Z","published_at":"2021-01-05T15:17: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\u003eIntegers can be classified as \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003egenerated\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e numbers or \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eself \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003enumbers. A generated number is one that can be expressed as the sum of another number and its digit sum. For example, 15 can be written as 12+(1+2); in other words, 15’s generator is 12. A self number cannot be expressed in this way. \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 to determine whether a number is a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e self 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":51241,"title":"Compute home primes in a given base","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 309.6px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 154.8px; transform-origin: 407px 154.8px; 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: 364.067px 7.91667px; transform-origin: 364.067px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA home prime for a particular number is determined by factoring the number, concatenating the factors of the number (written in increasing order), and stopping when the resulting number is prime. The number 35149 is the home prime of 60 in base 10\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: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; 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: 157.85px 7.91667px; transform-origin: 157.85px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e2, 2, 3, 5 --\u0026gt; 2235 --\u0026gt; 35, 149 --\u0026gt; 35149\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; 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: 62.4917px 7.91667px; transform-origin: 62.4917px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor a different base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eb\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: 152.075px 7.91667px; transform-origin: 152.075px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, write the factors of the base-10 number in base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eb\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: 149.733px 7.91667px; transform-origin: 149.733px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, concatenate the factors, and convert the result from base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eb\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: 208.092px 7.91667px; transform-origin: 208.092px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e to base 10. For example, the home prime of 60 in base 4 is 32183:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 102.167px; 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 51.0833px; transform-origin: 404px 51.0833px; 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: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; 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: 269.5px 7.91667px; transform-origin: 269.5px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 30.8px 7.91667px; transform-origin: 30.8px 7.91667px; \"\u003eFactors \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 38.5px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 38.5px 7.91667px; \"\u003ein base 10\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 11.55px 7.91667px; transform-origin: 11.55px 7.91667px; \"\u003e   \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 65.45px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 65.45px 7.91667px; \"\u003eFactors in base 4\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 11.55px 7.91667px; transform-origin: 11.55px 7.91667px; \"\u003e   \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 50.05px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 50.05px 7.91667px; \"\u003eBase 4 number\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 7.7px 7.91667px; transform-origin: 7.7px 7.91667px; \"\u003e  \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 53.9px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 53.9px 7.91667px; \"\u003eBase 10 number\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: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; 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: 246.4px 7.91667px; transform-origin: 246.4px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    2, 2, 3, 5          2, 2, 3, 11          22311           693\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: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; 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: 250.25px 7.91667px; transform-origin: 250.25px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   3, 3, 7, 11         3, 3, 13, 23         331323          3963 \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: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; 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: 246.4px 7.91667px; transform-origin: 246.4px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e       3, 1321            3, 110221        3110221         13609\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: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; 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: 246.4px 7.91667px; transform-origin: 246.4px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e       31, 439            133, 1231        1331231         32183\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; 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: 370.517px 7.91667px; transform-origin: 370.517px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that computes the home prime in the specified base. If the base is not specified, take it to be 10. If your code can pass the four optional tests (removed with comments in the test suite), please leave a note in the comments. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = homePrime(varargin)\r\n  y = f(varargin)\r\nend","test_suite":"%%\r\nn = 60;\r\ny_correct = 35149;\r\nassert(isequal(homePrime(n),y_correct))\r\n\r\n%%\r\nn = 60;\r\nb = 4;\r\ny_correct = 32183;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 6;\r\ny_correct = [11 71 11 13 23 17 19 179 23];\r\nfor b = 2:10\r\n    y(b-1) = homePrime(n,b);\r\nend\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 24;\r\ny_correct = [499 973411 193351243 313 821 700854439 1171 14489 331319];\r\nfor b = 2:10\r\n    y(b-1) = homePrime(n,b);\r\nend\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 52;\r\ny_correct = [173 229 173 313 2423 797 16339];\r\nfor b = 2:8\r\n    y(b-1) = homePrime(n,b);\r\nend\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 100;\r\nb = 2;\r\ny_correct = 256901;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 243;\r\nb = 2;\r\ny_correct = 17320726789571;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 327;\r\nb = 2;\r\ny_correct = 401278664296369;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 1238;\r\nb = 2;\r\ny_correct = 17586947437963;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 72;\r\nb = 3;\r\ny_correct = 203717098982039;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 722;\r\nb = 3;\r\ny_correct = 1593467;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 7220;\r\nb = 3;\r\ny_correct = 115343;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 4444;\r\nb = 4;\r\ny_correct = 3659009;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 555;\r\nb = 5;\r\ny_correct = 10037;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 6666;\r\nb = 6;\r\ny_correct = 5415709860084253;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 7777;\r\nb = 7;\r\ny_correct = 121523;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 888;\r\nb = 8;\r\ny_correct = 48471880537;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 999;\r\nb = 9;\r\ny_correct = 154991;\r\nassert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\nn = 101010;\r\ny_correct = 67351811;\r\nassert(isequal(homePrime(n),y_correct))\r\n\r\n%%\r\nm = 20;\r\np = primes(1e5);\r\nindx = randi(length(p),1,m);\r\nassert(isequal(homePrime(p(indx),randi(10,1,m)),p(indx)))\r\n\r\n%%\r\n%n = 8;\r\n%y_correct = 3331113965338635107;\r\n%assert(isequal(homePrime(n),y_correct))\r\n\r\n%%\r\n%n = 65;\r\n%y_correct = 1381321118321175157763339900357651;\r\n%assert(isequal(homePrime(n),y_correct))\r\n\r\n%%\r\n%n = 922;\r\n%b = 2;\r\n%y_correct = 37246812772043701411753149215934377;\r\n%assert(isequal(homePrime(n,b),y_correct))\r\n\r\n%%\r\n%n = 1345;\r\n%b = 2;\r\n%y_correct = 3690727229000499480592573891534356177653018575120050845976045596834749951228879;\r\n%assert(isequal(homePrime(n,b),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-27T02:44:18.000Z","updated_at":"2025-11-29T22:21:25.000Z","published_at":"2021-03-27T02:51:14.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 home prime for a particular number is determined by factoring the number, concatenating the factors of the number (written in increasing order), and stopping when the resulting number is prime. The number 35149 is the home prime of 60 in base 10\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[2, 2, 3, 5 --\u003e 2235 --\u003e 35, 149 --\u003e 35149]]\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 a different base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"b\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, write the factors of the base-10 number in base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"b\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, concatenate the factors, and convert the result from base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"b\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e to base 10. For example, the home prime of 60 in base 4 is 32183:\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[Factors in base 10   Factors in base 4   Base 4 number  Base 10 number\\n    2, 2, 3, 5          2, 2, 3, 11          22311           693\\n   3, 3, 7, 11         3, 3, 13, 23         331323          3963 \\n       3, 1321            3, 110221        3110221         13609\\n       31, 439            133, 1231        1331231         32183]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that computes the home prime in the specified base. If the base is not specified, take it to be 10. If your code can pass the four optional tests (removed with comments in the test suite), please leave a note in the comments. \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":51758,"title":"List Proth primes","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 165px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.5px; transform-origin: 407px 82.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; 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: 111.625px 7.91667px; transform-origin: 111.625px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAs of datenum 738289, three of the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Largest_known_prime_number#The_twenty_largest_known_prime_numbers\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003etwenty largest known prime 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: 141.567px 7.91667px; transform-origin: 141.567px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are Proth primes, prime numbers of the form \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAnCAYAAADEvIzwAAACr0lEQVR4nO2a4ZGrMAyEtwc6oAEaoIJUQAfpgA7SAjWkBHpIC6khLdz9sHdYeE4mFwsMefpmmJsxRCO0tizkAxzHcRzHcRzHcRzHWVID6OJf50voAYwAfuQqKXAVfbqJP3cAQ7z37DctgDMm37top5FnlmN7p0XQ5mxh7I4QzBueB3JtGvEjdT3w7+RrAVzkmQrhHThph2hXxy4rv0cuFJbvZCIwjQ0Wxj7khiBwj/CSFO+BuchL2njvGm20AE5xrI82mRk4tkfo44B5BssWuBFjp1xjH3JGECKVPivMV3aX+C1TOe/1MkabDFpr4O8FYZVZxqvClD05aU0EZoCY4kqg4qTo8DzLXDGtYMIUx+BU8nsLlvatMRWYAbrlGvqQGkHgV6hA18U9pvA68SxhwMZcZyOHEpgB2nvxwRdWP1PCnRLPWe+/hxFYDbUyxj1mREiJFvtWDroqdd+jcBoEVtXqMwU5wSZTHUZgBuiB+f5bY5rxpfZlhatymcpZOKmPLMgU/naEzWQ9jMB0VFNcBfsKMZcB6Sq/x7w4qxJjQAjSGXaT9RACa9rrZSwnJVfRIcvJwWyyLK5KcgiBmfa4XzUIjue0Ks07MJhqgS23Cm5dudenbVETgVmM3DF9C+d2srTrZNEVYydq6/7xVwj8rO+bs1I6BJFvyBelQxlx32H3KZr7GleadrPWcvov7Flc4AACa+uvQVi1TK+phv6WvCNu6U+33QvMzw6etADzYzetgl/1iK3hkeGrKp5HgiVF3r3AXK1aCGnaZkOBZ5NbBLOJfvEzLXWxE1W6rbprgfV4cLk6tXocsd0+SHHfqUwfKN86XVtg1eHPk1kLqtQ3r34+bRHIGu+L+4Nyp17KWgIv/11JF9te2sb/BTyM2bI+cRzHcRzHcRzHcRzH+X5+Aal3acsyxw0dAAAAAElFTkSuQmCC\" alt=\"k 2^m+1\" style=\"width: 60px; height: 19.5px;\" width=\"60\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 16.3333px 7.91667px; transform-origin: 16.3333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAnCAYAAAB66tStAAACjklEQVRoge2ZfZHDIBDFn4c4iIEaQEEUxME5iIOzEA2REA9noRpioffH8oY9yjWFENqb298M0zYNhTz2CwoYhmEYhmEYxv+lBzD6V6MCE4AVwE21vyyuA7AA2BCeZwUwPOhz8d+P/nMP0eUjuie+9jRXP5EvAF3JD1SkdPxP/DSSuH0m+kyQZ7759yNEC+rR+34rZME2FBgfJzDndqxI78e/QSwlh8H3W/x7BxEq9sqU5fEeejEggm/+2gRZcHpDFhc1+CP3OQst6g1iNbnibkhbJiCC6t9O9d0gghLeu/jPXLwVmejBW4aElKi0khxG7IczunmcU7RhcUGd/7yp+xhypsy5YUGIty2oJSqZEZLRb+h4rL2ChjUn7tVCMnS43MkxlvzmVrVwqCtqDhOCNWrLTYnGBKfnxTlnQRfQAziEDLlCBMlesWgMnVhaikpojbF3xu7f4T62OnVtREZo0CuqH7ZHcI1SEd5BVEJr1OGDSUp77Ij7kECNFoQE9xR8eL1SHfYL70e8k6hAMJTYah1kXjpMDIlr3EBkeS9dQK9Uh+NhYMDP7HzFa0o8MkM888gzZUO3YLy9QCyu1vZ3wL0FtxbZQYTdqyaqwyB/RbokqUUqTLQQmbuqs6ugJNp1dTsrNrYUuYPE2JcIyyBPa9W7tKKTnwxikbmHr8VLhQVCycEdiz6Y2B70q0m8U6sh8rPCnlq58KGuaiC9RdTuenYySIlcmlRn7NeiH6jrKXfQSnUC06GCp0d04RY16pEjRyCUXDxyTLUJxxZvF30SFFvlpL5bUXb8d5S+YExt+Xsta5eVi05eqRXUJVrTwruQvX8g4vbKDY3xzsR/rZS01qHoz2DiGoZhGIZhGC34BiDYQbDFFJGyAAAAAElFTkSuQmCC\" alt=\"k \u003c= 2^m\" style=\"width: 43.5px; height: 19.5px;\" width=\"43.5\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 67.2833px 7.91667px; transform-origin: 67.2833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For example, taking \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAkCAYAAAAq23xmAAABcUlEQVRoge2YYa2DMBSFPw84qAEMoAAFOJgDHMwCGiZhHrAwDbOw96NtuCPjLezepNDcL2kWyjiUA5xbCo7jOI5TIy3QASMwAY+0XQsdyuvpiea8UnsCjX5cxemAO/GaLhaCjyR2txArSGAxJje1QY2lWEECcfz51+yaeiHWasUOQoehQVeW/KkFU4PmJHTTCh0IM4PCB6HAUh5lOxNmBg1CKKS+wJJLz50nCMRpg7Zpb4iZQVMSeaz6L8RXb++cSA5M07S5YWZQnv9Mom/g9zyyeoK01dTEoFaIDKlv1AgeCBOD5GSqJT41079HnAcTg24s+ZNL/WwxugNgYpD8QJ3FtqaCVFPFpMDAex5pJozVVDG5xJFLufwKDhvHfaOaKpZfKbm8ISeN19TX8Nt8qDQqg+Tyxrjat86i6cN/zoBcodhtkDx4HYYtMbQt8qgUPe83emZn6Oc16K0nI+fIsLH/yHzLtrNFheM4juM4jlOSP3ic0uxUzyx9AAAAAElFTkSuQmCC\" alt=\"k = 1\" style=\"width: 36px; height: 18px;\" width=\"36\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5583px 7.91667px; transform-origin: 15.5583px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAkCAYAAAAeor16AAABnUlEQVRoge2YYbGDMBCE1wMOMBADKEABDnCAg1p4Gp4EPGABDVjo+0FucqQ3A2kyBfr2m8mPslMIy2VzABBCCCGEXIkKQH/2JO5IBWAAsPhBEuixmvb0gwYm0ANosFbgDBqYxQgamAUNzKSogQ5AC6BTxyr/e/BajGhNiQmcQLaBDYAHwm70ROiJHELIynBKm7DdxRyO02A1PnfUabf7QrEK1CY6BPNaP0RrlTYY2lEGbB/MuyPloVkUM1BONCMYJMuyQ5hwvaMdpVQFVqk3GlHMQGkqf7EuTZ1pUp2Tv6DOyB8E4+9IEQMdQhWNWJ+sRrJuxmqYRjLykTOBEyliYI9g4BRpldIWbJdMrbSU/LsSRQyUk1ihrDMu/mKhtdQs+ppdWFfYaOiScdYFRLP+t8fX7MK6ijpDl4yLs09rkpn/chfWFRZPRm8u8ZtGHWnSWOfe0KfJNlC3LzGyzCxzdQPt/ETu+DonHcZbBuoKs5avnNzKOJ1hC+5nXo3XHE6OBJ1DFqJZ5sjn8D71ohdgL3/v2pIRQgghhBByTf4A9P3xNsgeZjsAAAAASUVORK5CYII=\" alt=\"m = 1\" style=\"width: 40px; height: 18px;\" width=\"40\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 127.175px 7.91667px; transform-origin: 127.175px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e gives 3, the first Proth prime, and taking \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAkCAYAAAAq23xmAAAByklEQVRoge2YYdGDMAyGHw84qIEZmIIpwAEO5mAW0IAEPGABDVjY96PNNXQbB+2+A3Z57voDbmRNSN6EgmEYhmH8IhfgCtyBFhjD9ZlxQI33qcH7mM0tGHqGNQFV4Qb3ogJ6oi96dRT6NQZDfdked6MCBrwfNb4KauYB60qMi5GmdKc70QIP3mdJR6wOl2P8RgxQUb3uhGM584v9exAjfEYcy5lxpVBfBwpr9OA0eP8eOQ87XvXH4aOerjNS4YW7JzN7amKAJE0dsW4ntgm3w48NpesbL8QRO1uWOINX/2cwommC8a1Rl3ovXSXd1OHLaUps3nOMyfzTqns1+Xr0rQzK7ab6/zsKg3RRD9bhnoznv0JF7NKbZyFRd5kPOuaZ9EvIsPjE6+umh0Ziqx/+Y3cHQFfL6grRaTeo65IOcqQulpLKySK629TMI1wyMB6hi30iHWcW0Ucc0sr1l2/u3LB3F/uEJMDq0wopKf2AHhplLJdjhKOfEV1ZDqro7aoXr4830rkg1aL2zW+Ohu7GHa9BaPE6u7p76c//VAwvzIerM3zAvtO9PqwRXw2bJEPOoD9lhujIKrU/CA6fSeKXnCoahmEYhmEYRj5/BZDhZgTMEtEAAAAASUVORK5CYII=\" alt=\"k = 3\" style=\"width: 36px; height: 18px;\" width=\"36\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5583px 7.91667px; transform-origin: 15.5583px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAkCAYAAAAeor16AAAB50lEQVRoge2YXbGDMBCFjwccYCAGUFAFdYADHNRCNVQCHmoBDbFw70OywyE3UJJLJ8nMfjN5aM8Ay2b/CKAoiqIoytfpSxvQAtPBmgva1QR3AD8H617OtDZY/Joj6wmgK2da/Uj0qZMyeQN4lTaiVQa46JvhmsVQ1pz2mPG3YVgAD1wwuhgAN2w7UOd/T14LEa2Fnezh0nev81rE3/GQAc77fKPRawauU7FmSGNjLGlnn3s0h51duVHTw21+LCKzgoGdaLA67+aXaDfSpoh2lilieM5K2bQ9BmwDZUFGh5adWLA6SHaCh87+g5Zi9BUReNUo0mGbUcmpbP2FL38jDmOJzjeco7lGPrE6vnUMVgc+ci+U9s7IzixwDmMk9JMeWDHyrklz4ojVge9A60iz2KZMj3+EfKVIbU5yIHeisChzjRsPtNRaVLoL7yEOPJ1RHGGxIxypcfZAyzn6qakLM/JOpzOKoyh2hCM1Lqx9rEnNbLkLw9/LInGM4QgLL+LmEg6XfaDJYF3zCcenrybJiqSzQB5f9m4Ycy4P0AYujWv+nJNDBFnhmZ800rDOH8IRFvO6tPRYjeMaZlG384Tws836/xa4d02up1yHYogWc07ntRF1p22IwbaGyqepoiiKoiiKoijf4heEDAgKEaRAeAAAAABJRU5ErkJggg==\" alt=\"m = 5\" style=\"width: 40px; height: 18px;\" width=\"40\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e gives 97, the sixth Proth prime. The number 199 is prime but not a Proth prime because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM4AAAAnCAYAAABHVHeOAAAER0lEQVR4nO2c65GrOhCEOwdn4AScABE4AjLYDJzBpkAMDsE5OAXHQAp7f4guBlk8xGAjzu2vijq7XoZCj54ZaeQDCCGEEEIIIYQQQgghhBBCiCNzBlB3/wohJrgBeAD4M9eRhXMB0CC06QGgBXAHcP2wbYlUCO/foh/bB6bbc+n+Xne/nxHmyE90T/xZ6dQYznOO7cX74Ff3wCeAk/dhO/GD0AY7oCcEMXDSfMK2RH4xdIbx9ZuwuSGM/1/3c40wLzg3zp0dnUqL8p3sCe+BIb5cjpEPaVyvuR81euHHnNAPfqp9HtsSuSK8L6NlhXePGzsJwnuYiQChX9rusxtCnzCKlc4vwrs2CP1QIbSbY8prVeS5YCP17YQdyNvIPYwocSd5bEulRTqiAMO2vEZsWwydCO+9d79TmKVH4QtCW+qRv9/hDBi2M4+YpjFi/CF4lBTWOdhO8tgu4Y5xQX6CGvPptvW2NtWy7aSDqNCvCQjTwG+2aw0NpsfrjGknMguVl0pVjgDXIXMRwS4Mt7BdAlMfpjqfpsG4hyV2/WPbTAfaJO617842jTmaUnhiPkPgmi53XAH0qcpYeC8dm7tPdZTdXaKn9dgu4YyhOCmgPSP7zbyLbUtKEJxY9n3Zln8Btjk7aDAU2w6r0O+ePNAvrErFTv6p90yJxGObQywgevY9BMQoEk+W2POe8L6WqcxnNcpP1+agY8gOGtb72EFk/pfrHa0QPVdOjcCmHlMDmZr8Hts1lCAgThab0nHBbycQ13+2Xzhf7ug3C5ZAO++15eYMHUO75rmcENarcO97zQ7bHsLhoM+F3CfeB8Bj62EvAdEhxm2tECa3Td2uic9Y/MzNQEoUDh1DdrSh4qxXYdGv5NQshZ3YqcWx3TGKPYzH1su3BdQgtOFo4/sJWNzN7mvrbSuECfFA+dXgFNyzt5OPBa8GQ3HEOyge260YE9CWIq0wXdf4P3FDEM2q/mV+/0J6K/JonBDaZCf6A31qYSfklrZbcsVQxC9sEx1Y6D3qzumWuB1IfOyA1xGLoHNYb567dvPYLqXCcAPiieDMthiLU/c8iSZEmBccorFV0wbD0wOeU697bA7MYduae0zEY7uElGC2TKVKEU0JmwNu0QDDoyYXDM9sefL4EoVjq/e5He+xnYInjz8lGGC5aL6RYewtnCWiWdQPTD/sroKtadiU5MiLSVunym2Hx3aMbwiGNJivtfzg+EXMOehA5pzxHQvWk4wudrGbOvTGVOKI656SRBMLZtEgOeC2M79WkLpuOMZ3ajxQNE+M9wO/8Dd77MbWJeJJYUPqA44tux05Y3hwNef9PbYprviuYID3be2pK6f6fzQoms2WB3YjIOVt7Db1kQplrLu06M9SfcN2Cq6RviEYYP6bn/F1xO9fLSVHNP965B2FNZc1/9mIx3aONcdThBBCCCGEEEIIIYQQQgghhBBCiG35D29QvfiypAyqAAAAAElFTkSuQmCC\" alt=\"k = 99 \u003e 2^m = 2\" style=\"width: 103px; height: 19.5px;\" width=\"103\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 59.075px 7.91667px; transform-origin: 59.075px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The number 49 is a Proth number (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAkCAYAAAAq23xmAAAByklEQVRoge2YYdGDMAyGHw84qIEZmIIpwAEO5mAW0IAEPGABDVjY96PNNXQbB+2+A3Z57voDbmRNSN6EgmEYhmH8IhfgCtyBFhjD9ZlxQI33qcH7mM0tGHqGNQFV4Qb3ogJ6oi96dRT6NQZDfdked6MCBrwfNb4KauYB60qMi5GmdKc70QIP3mdJR6wOl2P8RgxQUb3uhGM584v9exAjfEYcy5lxpVBfBwpr9OA0eP8eOQ87XvXH4aOerjNS4YW7JzN7amKAJE0dsW4ntgm3w48NpesbL8QRO1uWOINX/2cwommC8a1Rl3ovXSXd1OHLaUps3nOMyfzTqns1+Xr0rQzK7ab6/zsKg3RRD9bhnoznv0JF7NKbZyFRd5kPOuaZ9EvIsPjE6+umh0Ziqx/+Y3cHQFfL6grRaTeo65IOcqQulpLKySK629TMI1wyMB6hi30iHWcW0Ucc0sr1l2/u3LB3F/uEJMDq0wopKf2AHhplLJdjhKOfEV1ZDqro7aoXr4830rkg1aL2zW+Ohu7GHa9BaPE6u7p76c//VAwvzIerM3zAvtO9PqwRXw2bJEPOoD9lhujIKrU/CA6fSeKXnCoahmEYhmEYRj5/BZDhZgTMEtEAAAAASUVORK5CYII=\" alt=\"k = 3\" style=\"width: 36px; height: 18px;\" width=\"36\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAkCAYAAAAeor16AAAB0ElEQVRoge2Ya5GEMBCE2wMOMBADKEDBOsABDrBwGpCAByygAQu7P5K5zM2FJQ+KR9V8VfmxdBGyzaQnu4CiKIqiKModaQH0Vy/iqTQA3gDWqxfyRCoAC9TAbEZY89TADDpY0waogckYWMOoeaiBicywlQccZKCBfRsvdq1yn3unSUhrSh58AQOsgZX7nG1gA7//aXROM/DdiYZh2oy/4WsQT+MWXTrqtK/7++y3uLe4ArmJBt681g3SWqb1AS0WWnDpSHlpgK24Fb5I5HqyDZzcBAu8QbQtX/ALrne0WI6qwEpOvMPohqTYwNVNMMJuTZ5pVJ0zrNE8I3/gjb87dGQJmV5koIGvogn/fw9S1i2whnEoIwfcGzqybDW7IgM7eANnoVVMk2+vZlpK/l3B7MZWFFCEreJ6FHRzKJR5xsng5VpqFp3dhXMaVFQ18gqbAjplXGgy0kL37XF2F957EbyI6JosmCC8il4BnTJOZh/XqNSf0IW3yM5AXmFyMby5yPCthUYH66O+0NlkG8iPL98mlcbwA7SB3QJP+znHyTKQV1ho+9LxJZRxPMO+HQ+eQpaBPIe2Jt36o6CCD9qnblsOeRHVOBRFURRFURRFSeADotMK0ijitkkAAAAASUVORK5CYII=\" alt=\"m = 4\" style=\"width: 40px; height: 18px;\" width=\"40\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 47.0583px 7.91667px; transform-origin: 47.0583px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) but not prime.\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: 181.117px 7.91667px; transform-origin: 181.117px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the Proth primes between two limits \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ea\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: 15.5583px 7.91667px; transform-origin: 15.5583px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eb\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: 85.9583px 7.91667px; transform-origin: 85.9583px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Also provide the values of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ek\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: 15.5583px 7.91667px; transform-origin: 15.5583px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003em\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 60.55px 7.91667px; transform-origin: 60.55px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOptional: Values of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ek\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: 71.5667px 7.91667px; transform-origin: 71.5667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for which no values of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAnCAYAAADEvIzwAAACr0lEQVR4nO2a4ZGrMAyEtwc6oAEaoIJUQAfpgA7SAjWkBHpIC6khLdz9sHdYeE4mFwsMefpmmJsxRCO0tizkAxzHcRzHcRzHcRzHWVID6OJf50voAYwAfuQqKXAVfbqJP3cAQ7z37DctgDMm37top5FnlmN7p0XQ5mxh7I4QzBueB3JtGvEjdT3w7+RrAVzkmQrhHThph2hXxy4rv0cuFJbvZCIwjQ0Wxj7khiBwj/CSFO+BuchL2njvGm20AE5xrI82mRk4tkfo44B5BssWuBFjp1xjH3JGECKVPivMV3aX+C1TOe/1MkabDFpr4O8FYZVZxqvClD05aU0EZoCY4kqg4qTo8DzLXDGtYMIUx+BU8nsLlvatMRWYAbrlGvqQGkHgV6hA18U9pvA68SxhwMZcZyOHEpgB2nvxwRdWP1PCnRLPWe+/hxFYDbUyxj1mREiJFvtWDroqdd+jcBoEVtXqMwU5wSZTHUZgBuiB+f5bY5rxpfZlhatymcpZOKmPLMgU/naEzWQ9jMB0VFNcBfsKMZcB6Sq/x7w4qxJjQAjSGXaT9RACa9rrZSwnJVfRIcvJwWyyLK5KcgiBmfa4XzUIjue0Ks07MJhqgS23Cm5dudenbVETgVmM3DF9C+d2srTrZNEVYydq6/7xVwj8rO+bs1I6BJFvyBelQxlx32H3KZr7GleadrPWcvov7Flc4AACa+uvQVi1TK+phv6WvCNu6U+33QvMzw6etADzYzetgl/1iK3hkeGrKp5HgiVF3r3AXK1aCGnaZkOBZ5NbBLOJfvEzLXWxE1W6rbprgfV4cLk6tXocsd0+SHHfqUwfKN86XVtg1eHPk1kLqtQ3r34+bRHIGu+L+4Nyp17KWgIv/11JF9te2sb/BTyM2bI+cRzHcRzHcRzHcRzH+X5+Aal3acsyxw0dAAAAAElFTkSuQmCC\" alt=\"k 2^m + 1\" style=\"width: 60px; height: 19.5px;\" width=\"60\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 204.217px 7.91667px; transform-origin: 204.217px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are prime are called Sierpinski numbers. Show that 78,557 is the smallest Sierpinski number. For more, see \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Sierpi%C5%84ski_number#Sierpi%C5%84ski_problem\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003ethis page\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [P,K,M] = ProthPrimes(a,b)\r\n%  a = lower limit of requested range\r\n%  b = upper limit of requested range\r\n%  P = Proth primes in [a,b]\r\n%  K = values of the coefficient k\r\n%  M = values of the exponent m\r\n  P = f1(a,b);\r\n  K = f2(a,b);\r\n  M = f3(a,b);\r\nend","test_suite":"%%\r\na = 1; b = 100;\r\n[P,K,M] = ProthPrimes(a,b);\r\nP_correct = [3 5 13 17 41 97];\r\nK_correct = [1 1 3 1 5 3];\r\nM_correct = [1 2 2 4 3 5];\r\nassert(isequal(P,P_correct) \u0026\u0026 isequal(K,K_correct) \u0026\u0026 isequal(M,M_correct))\r\n\r\n%%\r\na = 100; b = 1000;\r\n[P,K,M] = ProthPrimes(a,b);\r\nP_correct = [113 193 241 257 353 449 577 641 673 769 929];\r\nK_correct = [7 3 15 1 11 7 9 5 21 3 29];\r\nM_correct = [4 6 4 8 5 6 6 7 5 8 5];\r\nassert(isequal(P,P_correct) \u0026\u0026 isequal(K,K_correct) \u0026\u0026 isequal(M,M_correct))\r\n\r\n%%\r\na = 60000; b = 70000;\r\n[P,K,M] = ProthPrimes(a,b);\r\nP_correct = [60161 61441 64513 65537 67073];\r\nK_correct = [235 15 63 1 131];\r\nM_correct = [8 12 10 16 9];\r\nassert(isequal(P,P_correct) \u0026\u0026 isequal(K,K_correct) \u0026\u0026 isequal(M,M_correct))\r\n\r\n%%\r\na = 345678; b = 456789;\r\n[P,K,M] = ProthPrimes(a,b);\r\nP_correct = [357377 365569 366593 380929 384001 394241 414721 417793 424961 428033 430081 455681];\r\nK_correct = [349 357 179 93 375 385 405 51 415 209 105 445];\r\nM_correct = [10 10 11 12 10 10 10 13 10 11 12 10];\r\nassert(isequal(P,P_correct) \u0026\u0026 isequal(K,K_correct) \u0026\u0026 isequal(M,M_correct))\r\n\r\n%%\r\na = 8675309; b = 9130567;\r\n[P,K,M] = ProthPrimes(a,b);\r\nP_correct = [8716289 8753153 8814593 8851457 8876033 8949761 9011201 9019393 9023489 9031681 9035777 9080833 9093121 9117697];\r\nK_correct = [133 2137 269 2161 2167 2185 275 1101 2203 2205 1103 2217 555 1113];\r\nM_correct = [16 12 15 12 12 12 15 13 12 12 13 12 14 13];\r\nassert(isequal(P,P_correct) \u0026\u0026 isequal(K,K_correct) \u0026\u0026 isequal(M,M_correct))\r\n\r\n%%\r\na = 33000000; b = 34000000;\r\n[P,K,M] = ProthPrimes(a,b);\r\nP_correct = [33005569 33120257 33128449 33177601 33292289 33349633 33538049 33710081 33832961 33939457];\r\nK_correct = [4029 4043 1011 2025 127 4071 2047 4115 2065 4143];\r\nM_correct = [13 13 15 14 18 13 14 13 14 13];\r\nassert(isequal(P,P_correct) \u0026\u0026 isequal(K,K_correct) \u0026\u0026 isequal(M,M_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-05-13T23:31:36.000Z","updated_at":"2025-11-29T22:23:01.000Z","published_at":"2021-05-13T23:35:20.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\u003eAs of datenum 738289, three of the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Largest_known_prime_number#The_twenty_largest_known_prime_numbers\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etwenty largest known prime numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are Proth primes, prime numbers of the form \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k 2^m+1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek\\\\cdot 2^m + 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k \u0026lt;= 2^m\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek \\\\le 2^m\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, taking \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k = 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m = 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e gives 3, the first Proth prime, and taking \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k = 3\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek = 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m = 5\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em = 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e gives 97, the sixth Proth prime. The number 199 is prime but not a Proth prime because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k = 99 \u0026gt; 2^m = 2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek = 99 \u0026gt; 2^m = 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The number 49 is a Proth number (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k = 3\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek = 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m = 4\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em = 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e) but not 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\u003eWrite a function to list the Proth primes between two limits \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"a\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"b\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Also provide the values of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOptional: Values of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e for which no values of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k 2^m + 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek\\\\cdot 2^m + 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e are prime are called Sierpinski numbers. Show that 78,557 is the smallest Sierpinski number. For more, see \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Sierpi%C5%84ski_number#Sierpi%C5%84ski_problem\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ethis page\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":51798,"title":"Label primes with the Erdos-Selfridge classification","description":"","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: 144px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 72px; transform-origin: 407px 72px; 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: 225.233px 7.91667px; transform-origin: 225.233px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eErdos and Selfridge developed a scheme for classifying a prime number \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\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: 66.875px 7.91667px; transform-origin: 66.875px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e: If the only factors of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABjUlEQVRoge2ZbRGDMAyGXw91gIEZQEEV4GAO5gALaEACHrAwDVjYfqS95XrA+EhhYXnucre7QkrfS9K0AwzDMAzDuBYVgOLsj/hVKgBPAC8At5O/5eco8REnmlqRymBO0KcP5gC0uIBIuRfwOGCO7JhIC1AlkgPVBh8cN8EA2jprAF2wB+RqiEqReKGrwyTP8LthYz1khFIlUqRkTjuQaJyOjXuB+VSKxJ2mAqXjtcB8KkXqg8MB4238WpGq8M6Upak9ZVsRF8lhPooAWsyadOPpudWGTashxEXyzGE18UzPnllyYFwaSc3MM/dNqyHERYq714DxnavA90hbi7qaFA+ES1JNalGqROJRMhbeBSjCXthXSFNUiVR9cRZrkVSaRVSJxDvttB7FWtWkLwmQWyTREhFTiW/tHhRBPagTz0EukRwoO/i6Wuy4wr0xRzU+2/YR98I5RCow33ZsainOvHPJcTOZhdgV7+lsL82So8jfw48ie9r/S+JAAvG/XVooqQ9HEW8ix8xEMgwjN2+nbdxCK/6HXQAAAABJRU5ErkJggg==\" alt=\"p+1\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 67.6083px 7.91667px; transform-origin: 67.6083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are 2 and 3, then put \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\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: 136.125px 7.91667px; transform-origin: 136.125px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in class 1. Otherwise, find the largest class \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003er\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 52.1px 7.91667px; transform-origin: 52.1px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of the factors of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABjUlEQVRoge2ZbRGDMAyGXw91gIEZQEEV4GAO5gALaEACHrAwDVjYfqS95XrA+EhhYXnucre7QkrfS9K0AwzDMAzDuBYVgOLsj/hVKgBPAC8At5O/5eco8REnmlqRymBO0KcP5gC0uIBIuRfwOGCO7JhIC1AlkgPVBh8cN8EA2jprAF2wB+RqiEqReKGrwyTP8LthYz1khFIlUqRkTjuQaJyOjXuB+VSKxJ2mAqXjtcB8KkXqg8MB4238WpGq8M6Upak9ZVsRF8lhPooAWsyadOPpudWGTashxEXyzGE18UzPnllyYFwaSc3MM/dNqyHERYq714DxnavA90hbi7qaFA+ES1JNalGqROJRMhbeBSjCXthXSFNUiVR9cRZrkVSaRVSJxDvttB7FWtWkLwmQWyTREhFTiW/tHhRBPagTz0EukRwoO/i6Wuy4wr0xRzU+2/YR98I5RCow33ZsainOvHPJcTOZhdgV7+lsL82So8jfw48ie9r/S+JAAvG/XVooqQ9HEW8ix8xEMgwjN2+nbdxCK/6HXQAAAABJRU5ErkJggg==\" alt=\"p+1\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.225px 7.91667px; transform-origin: 27.225px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and put \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\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: 27.225px 7.91667px; transform-origin: 27.225px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in class \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAkCAYAAAAw55zoAAABPUlEQVRoge2YYc3CMBCGHw9zMAMYmAIUzMEczAEW0DAJeMDCNMzCx4+22UHCgPb6jQv3JJeQZbleX9p724HjOI7jOOX0QLt3Ed9AD8zAH3DYuZZd6ViFSGFCkC5Go5jzGKMBJowJUrvY8R/GUMUFecCUIC1hf4+sltUAQ3ymse9NCDIAF5FoIUz+EH+n56fCYsGIIIkkyiUmm4GzGGAsHQBjgiQfH4Er4ZADwdIGfmjLQOgZKdFEWBk59LGoZyG339Z7uagJ0otEM/n3ANmLcmPJnQSKgsgTXknzfHeFnDfeGQrGVxMkuclC3VuiiR7Scf/P1cSEICeNJG9iQpArazOtzdcLIu1W4+D1itqCFK92abedXl1PqSVIQ5iLvGpMZBjEkfLD0CfUEKRl2+pLbLw6Nb6YOY7jOI7jmOMG9q+tsmHOoW8AAAAASUVORK5CYII=\" alt=\"r+1\" style=\"width: 34px; height: 18px;\" width=\"34\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 379.108px 7.91667px; transform-origin: 379.108px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, 11 is in class 1 because 12 has prime factors 2, 2, and 3. The number 43 is in class 2 because 44 has prime factors 2, 2, and 11, and all of those are in class 1. All \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/525-mersenne-primes\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMersenne primes\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: 69.625px 7.91667px; transform-origin: 69.625px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are in class 1, and all \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45296\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eugly 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: 50.7833px 7.91667px; transform-origin: 50.7833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are in classes 1 or 2. \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: 189.683px 7.91667px; transform-origin: 189.683px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to classify prime numbers using this scheme.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = classifyES(p)\r\n  y = f(p);\r\nend","test_suite":"%%\r\nassert(isequal(classifyES(5),1))\r\n \r\n%%\r\nassert(isequal(classifyES(11),1))\r\n \r\n%%\r\nassert(isequal(classifyES(13),2))\r\n \r\n%%\r\nassert(isequal(classifyES(19),2))\r\n \r\n%%\r\nassert(isequal(classifyES(29),2))\r\n \r\n%%\r\nassert(isequal(classifyES(37),3))\r\n \r\n%%\r\nassert(isequal(classifyES(103),3))\r\n \r\n%%\r\nassert(isequal(classifyES(113),3))\r\n \r\n%%\r\nassert(isequal(classifyES(73),4))\r\n \r\n%%\r\nassert(isequal(classifyES(313),4))\r\n \r\n%%\r\nassert(isequal(classifyES(443),4))\r\n \r\n%%\r\nassert(isequal(classifyES(1021),5))\r\n \r\n%%\r\nassert(isequal(classifyES(1321),5))\r\n \r\n%%\r\nassert(isequal(classifyES(1381),5))\r\n \r\n%%\r\nassert(isequal(classifyES(2917),6))\r\n \r\n%%\r\nassert(isequal(classifyES(4933),6))\r\n \r\n%%\r\nassert(isequal(classifyES(5413),6))\r\n \r\n%%\r\nassert(isequal(classifyES(15013),7))\r\n \r\n%%\r\nassert(isequal(classifyES(16333),7))\r\n \r\n%%\r\nassert(isequal(classifyES(22093),7))\r\n \r\n%%\r\nassert(isequal(classifyES(49681),8))\r\n \r\n%%\r\nassert(isequal(classifyES(109441),8))\r\n \r\n%%\r\nassert(isequal(classifyES(120103),8))\r\n \r\n%%\r\nassert(isequal(classifyES(532801),9))\r\n \r\n%%\r\nassert(isequal(classifyES(710341),9))\r\n \r\n%%\r\nassert(isequal(classifyES(720617),9))\r\n \r\n%%\r\nassert(isequal(classifyES(995327),1))\r\n \r\n%%\r\nassert(isequal(classifyES(999809),2))\r\n \r\n%%\r\nassert(isequal(classifyES(999983),3))\r\n \r\n%%\r\nassert(isequal(classifyES(999917),4))\r\n \r\n%%\r\nassert(isequal(classifyES(999961),5))\r\n \r\n%%\r\nassert(isequal(classifyES(999521),6))\r\n \r\n%%\r\nassert(isequal(classifyES(999653),7))\r\n \r\n%%\r\nassert(isequal(classifyES(987463),8))\r\n\r\n%%\r\nOK = false;\r\nwhile ~OK\r\n    p = 2^randi(15)*3^randi(15)-1;\r\n    OK = isprime(p);\r\nend\r\nassert(isequal(classifyES(p),1))\r\n\r\n%%\r\nOK = false;\r\nwhile ~OK\r\n    p = 2^randi(5)*13^randi(5)*73^randi(4)-1;\r\n    OK = isprime(p);\r\nend\r\nassert(isequal(classifyES(p),5))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-05-18T22:59:07.000Z","updated_at":"2025-11-29T22:12:03.000Z","published_at":"2021-05-18T23:02:15.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\u003eErdos and Selfridge developed a scheme for classifying a prime number \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e: If the only factors of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p+1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep+1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e are 2 and 3, then put \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e in class 1. Otherwise, find the largest class \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003er\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e of the factors of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p+1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep+1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and put \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e in class \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"r+1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003er+1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, 11 is in class 1 because 12 has prime factors 2, 2, and 3. The number 43 is in class 2 because 44 has prime factors 2, 2, and 11, and all of those are in class 1. All \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/525-mersenne-primes\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMersenne primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are in class 1, and all \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45296\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eugly numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are in classes 1 or 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to classify prime numbers using this scheme.\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":52288,"title":"List Honaker primes","description":"The number 131 is the 32nd prime number. It is a Honaker prime because the sum of its digits (1+3+1) equals the sum of the digits of the index in the list of primes (3+2). \r\nWrite a function to list Honaker primes less than or equal to the input 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: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 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: 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: 79.7417px 7.79167px; transform-origin: 79.7417px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 131 is the 32\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: 7.78333px 7.79167px; transform-origin: 7.78333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003end\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: 289px 7.79167px; transform-origin: 289px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e prime number. It is a Honaker prime because the sum of its digits (1+3+1) equals the sum of the digits of the index in the list of primes (3+2). \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: 239.083px 7.79167px; transform-origin: 239.083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list Honaker primes less than or equal to the input number.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = HonakerPrimes(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 1000;\r\ny_correct = [131 263 457];\r\nassert(isequal(HonakerPrimes(n),y_correct))\r\n\r\n%%\r\nn = 6500;\r\ny = HonakerPrimes(n);\r\ny40_45_correct = [5741 5801 5843 5927 6301 6311];\r\nassert(isequal(y(40:45),y40_45_correct))\r\n\r\n%%\r\nn = 100000;\r\ns = sum(HonakerPrimes(n));\r\nsum_correct = 18350014;\r\nassert(isequal(s,sum_correct))\r\n\r\n%%\r\nn = 250000;\r\ny = HonakerPrimes(n);\r\nz_correct = 62.432176393547657;\r\nz = prod(y(2:2:end)./y(1:2:end));\r\nassert(abs(z-z_correct)\u003c1e-13)\r\n\r\n%%\r\nn = 1.5e6;\r\ny = HonakerPrimes(n);\r\nz_correct = 147.5463941840111;\r\nz = prod(y(2:2:end)./y(1:2:end));\r\nassert(abs(z-z_correct)\u003c1e-12)\r\n\r\n%%\r\nn = 5e6;\r\ny = HonakerPrimes(n);\r\nylast5_correct = [4991453 4991473 4991771 4993403 4998001];\r\nz_correct = 276.8019673660703;\r\nz = prod(y(2:2:end)./y(1:2:end-1));\r\nassert(isequal(y(end-4:end),ylast5_correct) \u0026\u0026 abs(z-z_correct)\u003c1e-12)\r\n\r\n%%\r\nfiletext = fileread('HonakerPrimes.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'oeis'); \r\nassert(~illegal)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-07-14T03:41:59.000Z","updated_at":"2025-11-29T20:37:54.000Z","published_at":"2021-07-14T03:43:57.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 number 131 is the 32\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003end\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e prime number. It is a Honaker prime because the sum of its digits (1+3+1) equals the sum of the digits of the index in the list of primes (3+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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to list Honaker primes less than or equal to the input 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":52183,"title":"List the nth prime quartet prefix","description":"Prime numbers larger than 5 can end only in 1, 3, 7, or 9, but of course not all numbers ending in these four digits are prime. Let’s call a group of four prime numbers between  and  (with  an integer and ) a prime quartet. The first one is 11, 13, 17, and 19, and the second is 101, 103, 107, and 109. Therefore, the prefix (or the number excluding the last digit) of the first prime quartet is 1, and the prefix of the second prime quartet is 10.\r\nWrite a function that returns the th prime quartet prefix. \r\nOptional: Prove that the sequence of prime quartet prefixes is infinite. Just drop your proof in the comments below. ","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: 144px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 72px; transform-origin: 407.5px 72px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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: 384.5px 42px; text-align: left; transform-origin: 384.5px 42px; 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: 384.5px 7.66667px; transform-origin: 384.5px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePrime numbers larger than 5 can end only in 1, 3, 7, or 9, but of course not all numbers ending in these four digits are prime. Let’s call a group of four prime numbers between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAkCAYAAADLsGk3AAAC30lEQVRYR+1XTUtVURT1/QNLR9EgNGeCgYkNVCgQU0eBYNZEcGA1cCRFRYPwA2osouBYDZwWpgMHNitEwZnVL+jDfoGtJXvH7nTuPec+75XX415YnMe95+yz19kfZ71KQ508lTrh0VASqbVIlhH53yPSAgK/gO8ZiHDNJZn/IcO6Hsy9DPQBq0Dq2tjUojPTwEPgGnAQ4dBdzJkFPgF7wBWA754CGymH8RjfbgEDZo/m0OGFiDTBwIwQULsxRBZlzTzG58ahSfxeAt4D9wPOfcb3VjmIrtDBpREZwuJ24BB4CVwXYyEi6uwXzO/2OLspp+2SdH09kRdPML4+CxG7luF+FUGEETwCLgBJjjK91gK2WB+7MqcXY7C2QqmlZGKJaDS4bhh45zlJ1hujxSeJrN0vyseoSdgwlshHk4LM768JKfFDokZCVz1zNP1YS7dDacXveRPRvP4J2xdTHFBHOcUlzPT8Jmuj6iNvIh0wuC8OZCHipiCbzFuxo42FNTMIPJP3bzAuAH9qJ8+I2ALNQuQBHFo20ZsTh10bat9b/EUR4YmxOyU9tuZcIlpn1gajvSL14lUVRREJFameOolaIraj6XtG4h7wAkiURkURqTa13DvmBpy/I5FICXBtdC2rFFTasC1vAdR2oTQ9JZhnRGhP9VFsRDiP0kfvG71faIvfqBD4hGRR7kT0REOb631DZayC0LZv3h/UeNqGQ7osdyK2BY/BkXVPYluHbaFbeaOXpI1w23kVu/ockhfasVx1TNKjgJUtlpwlzcj/1cXyrhGSYQtlyjC/3dy26ti92DTdbBrZ+VpP/bDLqD6y0Y4hQsfYQRhuPjH6hxvtyPybGPmPknbYgVjcriyxKZkmWVQ1//M/J40IN54AOj15zi5D56y0cKfxNEcAEmkEjoXcNkZXFfP+GBcDPrVL/TUl67wXY0xEPDxq71VJpNZiUkakjEhBJ1CmVkEHW7XZuonIbwfmyCU0f/i1AAAAAElFTkSuQmCC\" alt=\"10k\" style=\"width: 25px; height: 18px;\" width=\"25\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5583px 7.66667px; transform-origin: 15.5583px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAAAlCAYAAACNgf3GAAAFSUlEQVR4Xu2aTetXRRTH9RWk1aqVWC1CwSAfQCrIRT6BuBB6WgZZCW2KpFpFFim4ESp9BRYouCl6gIJqZSUG7UyRFq16fAX5/cicGC7zcO793xtz+90Lh9/DPTNz5nzPOXPmzKxftzwroYH1KzHLZZLrFqBXxAgWoBegV0QDKzLNuXj0k8LjUdGLK4JLbZpvi+Fv0akao73vC/TmMMDv3gHER5t7Av+3PdoZqwfku8T8gGiL6DHRMVEfGQeINWmTber9x8oIr+r9Jq/xe4EGrFdEL4gedAiBjAB0QvS96EoQiv9eE11wAgH/y6IdmUkD8Fvh/fbAw3g5/knRGaHzWGd8rz3vi+GmqOrZNaBNkQBsjwdoBKDNO6I3orZH9f2s6DPRMxWwseqvRHhozboxxOthnO6YNWW18P6AhDgjujcI85E+PUCDzzXRIVExWpaAZvCtop9Eb4rMY2pAG5goflcCzE/1396EEXQVDt8NkWddflh834QOHqlNugVkIxlYb38Jv3ECHi/Q8FoUSOn632FqHm2MrAcnw48S0GZhGwtAItj5Sl8GHBYO2LUnls87p1qf3fc2Rh8Q+o7xzwCgafKH6F1RNoR7leIF2ryZwQ+KPknM1BNm8ea/grV6lGVRgiVhn6fBAJ6WgSYqPCG6LzevsYH+TgNZiC95IxaI1xPeu8KZITyvd+ecgJgnHC9ZtbOvHFvLQFsEzDmXuwTq9WhT+J/S1p0FxZoHwtI1CIsKtVzAuieX+Dj8mHJ9bhlopo/us4nomB5Nlnw1KLwP0F0r/DCEIa9shK3XRfGY5AGHQz+IhKcT1mvZe8npWweaaErtILl0eZXp8eg48+0DdDdEIzBhPbvedNCw5aKbJCHzc6LHRZ6ErhbZWwfaomQS06mArmWmseF0gSYEeZMqsvzfAkJxP+bRnr1oDWB73zrQVrv4T4GuAWXhFiWuBejUVo01/g5RtVrUQdjKqDngn9YLikDMjYpf7vl1DRFk6PYKWcwQk3nKVB69ltDdx6PNihnvfhHl0JsDQEZR8dLj9fIUX5/dQrf9LIBG6CFZdze77gP0zxqTrJ2lgk+2dkMVTTJpRaEUgOQMjIFRXS5YAqXMVP3AYzxjAJ3crYzp0UzEFO/1aPgAJ06WvEDHWT5j05ftzYvlQI/GEzytr9HF3crYQFsoRU+lfbBZbuqkiewR76ll3XEVjnVpv4htFk+2cDAQZJq1DjR62ylK1i/GBjpe557SoFhZ94k9MRVmi9lj1JlZsFXX4tJqLRkcgnfrQBNNocn30aa8Wt3ZMu7c6ZZl0rUql5VRP9DAdsJl4McRxY5aPadgJQNoGWjbZmZLwGN7NIrCswjJrJfd8B2fbuWANKFLSVUcOeIwHf9vZ97vSY5LmejSx7NbBtqcI7tceoAGuM9FdijuOTiwSwMo0i4O0A/ZMclXbQ3FMxkvd1MkLrjcLb742lC8RydqYHRjFE6mBjqeE3L3qeix3KGr7M2aEtAA86zooYTZkyVTNy6dLuGZRwLQG/TJsSM3Rr4Q1UqS5pk5CwVM5PpBFN9gMVFR2h7Rl6K+hZPEdG//NRXQVsVDR90H+Ws1eouAuZzodp8ej85NfOr/LZEbwxvHkBXj2y3iNkgqyRxjjCF9mFEXz+FbBtp9H2qIdv4nbdz36loGGiyYyEXRFAWQuWONI7DDOe2JMK0DDRhcLHhJVLs1Onfg+spPAva1B+TW1+h44ng2lbC17oX7KrNVftZlbue6a+pz8OhWlT0ruRagZwXXcGEXoIfrblYtF6BnBddwYRegh+tuVi1vARvldDXusPf8AAAAAElFTkSuQmCC\" alt=\"10(k+1)\" style=\"width: 61px; height: 18.5px;\" width=\"61\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 18.6667px 7.66667px; transform-origin: 18.6667px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (with \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ek\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: 48.625px 7.66667px; transform-origin: 48.625px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e an integer and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAAAkCAYAAAAq23xmAAAC70lEQVRoQ+2YO2tWQRCGzQ+QYGKZKmptwISkiBaCxEtllWAaIUVuYOkVO40YsPMK2iaaKo2S2JouiRgSUPDyC7z9A31fmJHleC7fOTNnSbEfDHv42J2deXZ2dna7DqRfKYGuxKecQAJUESEJUAJkSyIpghwiaBQ6+iCnIEuQDdua7JvRvbCkG/KtzKKyCLqKgachY4GCw/j+sW9cbGYIwUxBrkNuQJ41BaTjvuDjCGQLMtTMpn+jzuPrU9WqGecoG85FJ5hD0mnGA9AfUXYN7aLR+DWJyAW0LyKC6peo2UXLVDHrBYj5550oO4nWmn+moeNesIKxQdGV0CdzBDEk7wsgrxMvzAEa6jFBuQLSLbEOSGeN2ys7PA/UE8kJO85zhercANGB7475p8jnPFBcEOa8NkC5AeKJ81q8GhBjqfwc5Kb8/wrtQ4fcRHWxQLkBuisgfqHtCZZfJ/BI2nlR1TYoN0CbsH4QwiiZEE+Oo30u+ajtglFB6SFBE7j1JiGWuV0AsW74KlD0KKTiS5DbRgOLclH2fy7KHQiLVP5YqD6AvOxUQUE/F0A0blkmYP4ZgVyUyDHaVzk8C4YRvOoARid2AfQY2lhtMoreyne41Sq9bNAhD4zXARCa4wLoJzRqEcckrd96mjXwv3BILDBuEcRE/EG0sRbZg+hxz4r3lhOd2GDcAPG+9FS0MUHyvURv9IymYxDLKZIFQ+grkDaKwry1NG8xnhLjkn+OygwhtPCCx1xV51RT3VQb8/7lmoP0eSPcTqxJPksuYhSxPjoD4Xacq7HleLfbhsR86siaZ4qgcPAFaH4TaA+vHlojDdfcbqyvSp84a8Bu0pUL/Uh2CMfzZJ4v8yH7hMH8cFlmzru9E9IVcbLO1mrijPcYfULO6v2NP95LVP+XW73eeDp1hlvyYKedC/p9rBm1puliA9L3JYvRbdRihfbEBsQXghMWOhjLQyFaHosNyMgm/vAEqIJ5ApQA2bZliqAUQbYI+gu+Aqwl2MMIjQAAAABJRU5ErkJggg==\" alt=\"k \u003e= 1\" style=\"width: 36px; height: 18px;\" width=\"36\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 10.1083px 7.66667px; transform-origin: 10.1083px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) 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: 41.2333px 7.66667px; transform-origin: 41.2333px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprime quartet\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: 30.7583px 7.66667px; transform-origin: 30.7583px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The first one is 11, 13, 17, and 19, and the second is 101, 103, 107, and 109. Therefore, the prefix (or the number excluding the last digit) of the first prime quartet is 1, and the prefix of the second prime quartet is 10.\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 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: 99.4333px 7.66667px; transform-origin: 99.4333px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that returns the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 71.95px 7.66667px; transform-origin: 71.95px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime quartet prefix. \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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 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: 355.5px 7.66667px; transform-origin: 355.5px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOptional: Prove that the sequence of prime quartet prefixes is infinite. Just drop your proof in the comments below. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = PQPrefix(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 1;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 2;\r\ny_correct = 10;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 4;\r\ny_correct = 82;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 8;\r\ny_correct = 325;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 16;\r\ny_correct = 1804;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 32;\r\ny_correct = 7969;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 64;\r\ny_correct = 27604;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 128;\r\ny_correct = 66466;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 256;\r\ny_correct = 167056;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 512;\r\ny_correct = 454324;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 1024;\r\ny_correct = 1221643;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 2048;\r\ny_correct = 3229894;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 4096;\r\ny_correct = 8166751;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 8192;\r\ny_correct = 20302084;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn = 10001;\r\ny_correct = 26538121;\r\nassert(isequal(PQPrefix(n),y_correct))\r\n\r\n%%\r\nn1 = 3;\r\nyyy_correct = 3350308;\r\nassert(isequal(PQPrefix(PQPrefix(PQPrefix(n1))),yyy_correct))\r\n\r\n%%\r\nfiletext = fileread('PQPrefix.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2022-01-29T15:41:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-07-02T13:04:42.000Z","updated_at":"2025-11-29T23:51:09.000Z","published_at":"2021-07-02T13:11:31.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\u003ePrime numbers larger than 5 can end only in 1, 3, 7, or 9, but of course not all numbers ending in these four digits are prime. Let’s call a group of four prime numbers between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"10k\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e10k\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"10(k+1)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e10(k+1)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e (with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e an integer and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"k \u0026gt;= 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ek\\\\ge 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e) a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprime quartet\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The first one is 11, 13, 17, and 19, and the second is 101, 103, 107, and 109. Therefore, the prefix (or the number excluding the last digit) of the first prime quartet is 1, and the prefix of the second prime quartet is 10.\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 the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime quartet prefix. \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\u003eOptional: Prove that the sequence of prime quartet prefixes is infinite. Just drop your proof in the comments below. \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":47793,"title":"Find the smallest prime with n inside","description":"Consider the sequence that begins 101, 113, 127, 131, 149, 151, 163,... Not only is every term prime, the th term is the smallest prime with  in the interior digits. \r\nWrite a function that takes an integer and returns the smallest prime with that integer in its interior. \r\nAlthough it's not part of the problem, you might think about these questions and others: Which terms are formed by adding 1s to the beginning and end? Which value of  results in a prime that requires more than one digit added to beginning and end? Does the sequence include any terms starting and ending with 9? ","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: 144px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 72px; transform-origin: 407px 72px; 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: 333.5px 8px; transform-origin: 333.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eConsider the sequence that begins 101, 113, 127, 131, 149, 151, 163,... Not only is every term prime, the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 43px 8px; transform-origin: 43px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term is the smallest prime with \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 66px 8px; transform-origin: 66px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in the interior digits. \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: 310px 8px; transform-origin: 310px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes an integer and returns the smallest prime with that integer in its interior. \u003c/span\u003e\u003c/span\u003e\u003c/div\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: 363px 8px; transform-origin: 363px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAlthough it's not part of the problem, you might think about these questions and others: Which terms are formed by adding 1s to the beginning and end? Which value of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 193px 8px; transform-origin: 193px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e results in a prime that requires more than one digit added to beginning and end? Does the sequence include any terms starting and ending with 9? \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = nInsidePrime(n)\r\n  y = str2num(['1' num2str(n) '1']);\r\nend","test_suite":"tic\r\n%%\r\nn = 0;\r\ny_correct = 101;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 5;\r\ny_correct = 151;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 10;\r\ny_correct = 1103;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 13;\r\ny_correct = 2131;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 120;\r\ny_correct = 41201;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 2436;\r\ny_correct = 124363;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 2437;\r\ny_correct = 1024379;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 2438;\r\ny_correct = 524387;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\n\r\n%%\r\nn = 88888;\r\ny_correct = 2888887;\r\nassert(isequal(nInsidePrime(n),y_correct))\r\ntoc","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":46909,"edited_by":427930,"edited_at":"2022-06-02T20:11:58.000Z","deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-04T03:28:46.000Z","updated_at":"2025-12-04T14:31:41.000Z","published_at":"2022-06-02T20:11: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\u003eConsider the sequence that begins 101, 113, 127, 131, 149, 151, 163,... Not only is every term prime, the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth term is the smallest prime with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e in the interior 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes an integer and returns the smallest prime with that integer in its interior. \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\u003eAlthough it's not part of the problem, you might think about these questions and others: Which terms are formed by adding 1s to the beginning and end? Which value of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e results in a prime that requires more than one digit added to beginning and end? Does the sequence include any terms starting and ending with 9? \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":51466,"title":"List prime anagrams of a number","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 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: 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: 380.667px 7.91667px; transform-origin: 380.667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 172 is not prime, but its anagrams 127 and 271 are. Write a function that lists the unique prime anagrams of a number in increasing order. Leading zeros are allowed; for example, a prime anagram of 902 is 29. \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 7.91667px; transform-origin: 1.94167px 7.91667px; 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: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primeAnagrams(n)\r\n  y = primes(n);\r\nend","test_suite":"%%\r\nn = 712;\r\ny = primeAnagrams(n);\r\ny_correct = [127 271];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 137;\r\ny = primeAnagrams(n);\r\ny_correct = [137 173 317];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 209;\r\ny = primeAnagrams(n);\r\ny_correct = 29;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 237;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 500;\r\ny = primeAnagrams(n);\r\ny_correct = 5;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 911;\r\ny = primeAnagrams(n);\r\ny_correct = [191 911];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1203;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 1913;\r\ny = primeAnagrams(n);\r\ny_correct = [1193 1319 1913 1931 3119 3191 3911 9311];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1973;\r\ny = primeAnagrams(n);\r\ny_correct = [1973 3719 3917 7193 9137 9173 9371];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 2648;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 5738;\r\ny = primeAnagrams(n);\r\ny_correct = [5387 5783 7583 7853 8537 8573 8753];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 11379;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 13379;\r\ny = primeAnagrams(n);\r\ny_correct = [13397 17393 19373 31379 31397 31793 31973 33179 33791 37139 39317 39371 71339 71933 79133 91373 91733 93371];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 13579;\r\ny = primeAnagrams(n);\r\ny_correct = [13597 13759 15739 15937 15973 17359 17539 19753 31957 37159 37591 37951 39157 51973 53197 53719 53791 53917 57139 57193 71359 71593 73951 75193 75391 75913 75931 79153 79531 91573 91753 95317 95713 95731];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 13779;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 13799;\r\ny = primeAnagrams(n);\r\ny_correct = [13799 13997 17939 19379 19739 19793 19937 19973 31799 37199 37991 39719 39791 39971 71399 71993 79139 79193 79319 91397 93179 93719 93971 97931 99137 99173 99317 99371 99713];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 54321;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 113377;\r\ny = primeAnagrams(n);\r\ny_correct = [117373 133717 137713 171733 173137 173713 311737 313717 317371 317731 373171 717133 717331 731173 731713 737131];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 113399;\r\ny = primeAnagrams(n);\r\ny_correct = [131939 133919 191339 193139 199313 313991 319391 319931 393191 399131 913139 919313 931193 931319 931913 991313];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 246803;\r\ny = primeAnagrams(n);\r\ny_correct = [24683 28463 28643 42683 42863 48623 62483 64283 82463 84263 86243 86423 206483 208463 246803 248063 260483 264083 268043 268403 280463 286043 402863 408263 408623 420683 486023 486203 604823 608423 624803 802463 802643 820643 824063 826403 842063 860423 864203];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1234567;\r\ny = primeAnagrams(n);\r\nlen_correct = 534;\r\nsum_correct = 2405142318;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 3139793;\r\ny = primeAnagrams(n);\r\nlen_correct = 103;\r\nsum_correct = 544898129;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 3917458;\r\ny = primeAnagrams(n);\r\nlen_correct = 708;\r\nsum_correct = 4185941334;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 13456789;\r\ny = primeAnagrams(n);\r\nlen_correct = 4192;\r\nsum_correct = 249146788612;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct) \u0026\u0026 isequal(y(2096),59468713))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-04-18T14:18:17.000Z","updated_at":"2025-11-29T20:34:18.000Z","published_at":"2021-04-18T14:21: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\u003eThe number 172 is not prime, but its anagrams 127 and 271 are. Write a function that lists the unique prime anagrams of a number in increasing order. Leading zeros are allowed; for example, a prime anagram of 902 is 29. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw: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":52639,"title":"Determine whether a number is unprimeable","description":"The number 204 is unprimeable because no single digit can be changed to make it prime. In contrast, the number 207 is not unprimeable because changing the first digit to 0, 1, 3, 6, or 9 or the second digit to 2, 5, or 7 would make it prime. \r\nWrite a function to determine whether the input number is unprimeable. ","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: 407px 36px; transform-origin: 407px 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: 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 8.05px; transform-origin: 384px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 204 is unprimeable because no single digit can be changed to make it prime. In contrast, the number 207 is not unprimeable because changing the first digit to 0, 1, 3, 6, or 9 or the second digit to 2, 5, or 7 would make it prime. \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: 221.983px 8.05px; transform-origin: 221.983px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine whether the input number is unprimeable. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isUnprimeable(n)\r\n   tf = f(n)\r\nend","test_suite":"%%\r\nn = randi(199);\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 200;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 202;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 207;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 322;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 845;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 848;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 3505;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 5454;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 6002;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 14610;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 14617;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 28725;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 28735;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 39998;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 40005;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\ndn = [0 2 4 5 6 8];\r\nn = 47000+dn(randi(6));\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nn = 55545;\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = 55555;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nk = randi(100000);\r\nn = 2310*k+510;\r\nassert(isUnprimeable(n))\r\n\r\n%%\r\nd = [1 3 7 9];\r\nk = randi(21214);\r\nn = 10*k+d(randi(4));\r\nassert(~isUnprimeable(n))\r\n\r\n%%\r\nn = [595631 1203623 872897 212159];\r\nassert(all(arrayfun(@isUnprimeable,n)))\r\n\r\n%%\r\nfiletext = fileread('isUnprimeable.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":16,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-08-29T15:22:09.000Z","updated_at":"2025-11-29T20:38:34.000Z","published_at":"2021-08-29T15:24:50.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 number 204 is unprimeable because no single digit can be changed to make it prime. In contrast, the number 207 is not unprimeable because changing the first digit to 0, 1, 3, 6, or 9 or the second digit to 2, 5, or 7 would make it 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\u003eWrite a function to determine whether the input number is unprimeable. \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":52669,"title":"Count the primes in Collatz sequences","description":"Several Cody problems (21, 69, 42937, 44448, 44784, 52422) involve Collatz sequences. These start with a seed . If  is odd, the next element is , and if  is even, the next element is . For example, if the seed is 3, then the sequence is 3, 10, 5, 16, 8, 4, 2, 1. The Collatz conjecture is that all of these sequences terminate at the value 1; that is, all seeds lead to terminating sequences. \r\nThis problem deals with the number of primes in the sequence. With a seed of 3, the number of primes is 3 (2, 3, 5). \r\nWrite a function to determine the numbers of primes in the sequences with seeds of 1 to the input number. See the test suite for banned terms and commands. ","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: 165px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.5px; transform-origin: 407px 82.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; 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: 78px 8px; transform-origin: 78px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSeveral Cody problems (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/21\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003e21\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, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/69\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003e69\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, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/42937\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003e42937\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, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44448\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003e44448\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, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44784\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003e44784\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, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/52422\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003e52422\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: 165.5px 8px; transform-origin: 165.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) involve Collatz sequences. These start with a seed \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 9.5px 8px; transform-origin: 9.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. If \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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 is odd, the next element is \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFUAAAAkCAYAAAD4i3Y+AAACDklEQVRoge2ZUZWDMBBFrwccYAADKEABDnCAg1pAQyXgAQvVsBa6H2EOQ5rQbYBtKXPP4adJM8nry2RCwTAMwzAMI0QBlED+7om8mWLtABnQAT/AXT03nMBnogR6nBbJZMAwDnIBWuDKXNwzCFvgxJQ1rxK1x7k0CwQR5/ZrAhyABmemimnNyaKWOFfG6NYG2AFx0uqcF0HcmrzmiuUDqR0DDKkBduDjRX2GOLXZK0AChxY1Gwfuecy3sf7+QnO2L88OK6pUBFfigla49CDlh3Z0zuNJupUIhxM1A2rm9WpP2GniwpvqmzNVDS1TTr7jyrUtOJSoUgloh2mnxbbwwFx87cpSjVFvMUkOJqqP79hQ6ZWp9gYnsBavUe1/ycswXZNjj/6RlvqlsvvpL86TIL4wFfM00XntnWr7K6Gd8uqzRpDdRQWXC2NbrlNtt8B35QdpX4zXLzwSb1jos3Sheca/iKq3nC+qPqQqr61Y+N4aDp1TBRHVD6JFCzlD8unWk/sKUWvCJZE+hHyX6sn5eXYtXyFqj9vm/iKWguuqQKqBa2CMFD5eVDmEYi+j5SAKOVEWF3JirdrlBfhpin99ekvpIzchuaaGJq9LqZDgOjXIOFuxp6j6UL6TWO9mOAF0OXIZP1t6CVKr/rFx5Xa21U1K2EPUEmewUHl2IWycr0J20tn/mDQMwzAMwzCMKL/9cBTuzEvrTwAAAABJRU5ErkJggg==\" alt=\"3n+1\" style=\"width: 42.5px; height: 18px;\" width=\"42.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 23.5px 8px; transform-origin: 23.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 89.5px 8px; transform-origin: 89.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is even, the next element is \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAlCAYAAADvLtGsAAAB/0lEQVRYhe2YUbGDMBBFjwccYAADVYACHNQBDmoBDUjAAxbQgIW+j7DDUpIQCC08hjOTL1q4m+zeXYCbm0tTAMnRIvYgBd5AdrSQPXgC7dEi9qLFBLTEY1inPcEMk2Kp43oCVMNv9OoJ24Cf8gIax7UUI/ozEL1eP9AYTIdxMhuN5XrG/KTybwoM5YERY7PkHHMqrvooGYOpv6JuJdWwbNT4ayJhWj+H0+NOkQq3KQgNkcEkzI8+xaTM0sM1RYyIAQnGZSAzckx+NozOIsefqhvKDoX2gJp4J+o+9Cwiuy5/lJ6QYcSXTIsxRKDke0zzkxGoY11GAKZLy5GK/4sYcaU3bpvVPAcRMcgGrm6c2jlkjtKin+p6yOQbOr749PSsqBVNzii2YW6nFeGFKOmxOjUUNWZDNr0y6I5rSw8xhjLgXr7xJQRJ0c31pov/sy9k6lrIA3zjyxIFkYFosbaxQeolpGf4xpclogOBaXHburX0GddYoqnYNkflLAeSEVCHvpFBu5ykTu15qG988YnsMafqIsEYwmIwIta28wVTS65wN02ZgtcggbSMzdm2OgJMRVuybUd1Crb4U6gmLBUFCcT3YrbqnabAROyKOhlENvgdasv4IvcNWTU//EwlTnQJJOf/PXuML6eh5EIf+GLGl1Mho9BlPoif4pvWzc2X+APNAsLGctE5qwAAAABJRU5ErkJggg==\" alt=\"n/2\" style=\"width: 25.5px; height: 18.5px;\" width=\"25.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 125px 8px; transform-origin: 125px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For example, if the seed is 3, then the sequence is 3, 10, 5, 16, 8, 4, 2, 1. The Collatz conjecture is that all of these sequences terminate at the value 1; that is, all seeds lead to terminating sequences. \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: 366px 8px; transform-origin: 366px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals with the number of primes in the sequence. With a seed of 3, the number of primes is 3 (2, 3, 5). \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: 375.5px 8px; transform-origin: 375.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine the numbers of primes in the sequences with seeds of 1 to the input number. See the test suite for banned terms and commands. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = CollatzPrimes(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 20;\r\ny = CollatzPrimes(n);\r\ny_correct = [0 1 3 1 2 3 6 1 6 2 5 3 3 6 4 1 4 6 7 2];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1000;\r\ny = CollatzPrimes(n);\r\nindx = [171 231 257 342 347 411 457 462 463 487 514 521 543 609 617 649 684 685 694 703 731 763 811 815 822 823 859 865 871 913 914 915 919 924 925 926 937 967 974];\r\nyi_correct = [28 29 28 28 29 29 28 29 28 30 28 28 29 28 29 30 28 28 29 28 29 32 30 29 29 28 32 30 30 28 28 28 28 29 29 28 29 30 30];\r\nassert(isequal(y(indx),yi_correct))\r\n\r\n%%\r\nn = 10000;\r\ny = CollatzPrimes(n);\r\nsum_correct = 163462;\r\nindx_correct = [1263 1895 2411 2526 2843 2857 3567 3790 3809 4822 4927 5052 5053 5351 5686 5714 6429 6771 7134 7391 7423 7580 7581 7618 8455 8983 9644 9854 9897]; \r\nassert(isequal(sum(y),sum_correct) \u0026\u0026 isequal(find(y==35),indx_correct))\r\n\r\n%%\r\nn = 30000;\r\ny = CollatzPrimes(n);\r\nsum_correct = 521564;\r\nstd_correct = 8.757947181665990;\r\nassert(isequal(sum(y),sum_correct) \u0026\u0026 abs(std(y)-std_correct)\u003c1e-12)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-09-06T04:13:28.000Z","updated_at":"2025-12-21T18:14:55.000Z","published_at":"2021-09-06T04:18:39.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\u003eSeveral Cody problems (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/21\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e21\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/69\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e69\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/42937\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e42937\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44448\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e44448\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44784\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e44784\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/52422\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e52422\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) involve Collatz sequences. These start with a seed \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. If \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is odd, the next element is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"3n+1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e3n+1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, and if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is even, the next element is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n/2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en/2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, if the seed is 3, then the sequence is 3, 10, 5, 16, 8, 4, 2, 1. The Collatz conjecture is that all of these sequences terminate at the value 1; that is, all seeds lead to terminating sequences. \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\u003eThis problem deals with the number of primes in the sequence. With a seed of 3, the number of primes is 3 (2, 3, 5). \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 to determine the numbers of primes in the sequences with seeds of 1 to the input number. See the test suite for banned terms and commands. \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":47518,"title":"Play Outside In with primes","description":"In the word game Outside In,* you start with a word, take the first and last letters, try to think of a word in which the two letters appear together in the interior, and repeat. For example, starting with ‘MATLAB’, you might proceed as follows:\r\nsombrero, dissolution, kidnap, pickpocket, helicopter, birthright, debtor, tawdry, katydid, backdrop, subpoena, anniversary, payback, napkin, mannequin, solemnity, psychosis, lopsided, balderdash, etc. \r\nYou can play alone or with others, and you could add other rules or objectives—e.g., all words must have six or more letters, a person who cannot think of a word is eliminated, players try to generate a list that uses all letters in the alphabet, etc.   \r\nThis game has one problem: without a convenient and stable word list, it does not translate easily to Cody. So instead of words, let’s use prime numbers. In particular, start with a two-digit seed, find the smallest prime for which the two digits appear together in the interior, create a new two-digit number from the first and last digits of the prime, and repeat. \r\nFor example, if the seed is 11, then the list would start 1117, 1171, 2111, 1213, 2131, 1217,… Because the last digits of primes are constrained, you will notice similarities in lists generated from different seeds. Solvers able to plot the numbers might enjoy seeing the patterns for longer lists graphically. \r\nWrite a function to play Outside In with primes: given a two-digit seed , generate a list of  primes following the rules above. \r\n\r\n*I devised the game and the name, but I would be surprised if someone had not already thought of it.","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: 420px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 210px; transform-origin: 407px 210px; 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: 368.683px 8px; transform-origin: 368.683px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn the word game Outside In,* you start with a word, take the first and last letters, try to think of a word in which the two letters appear together in the interior, and repeat. For example, starting with ‘MATLAB’, you might proceed as follows:\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: 7.39167px 8px; transform-origin: 7.39167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eso\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: 10.5px 8px; transform-origin: 10.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003emb\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: 25.2833px 8px; transform-origin: 25.2833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003erero, dis\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: 8.16667px 8px; transform-origin: 8.16667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eso\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: 25.675px 8px; transform-origin: 25.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003elution, ki\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: 8.55px 8px; transform-origin: 8.55px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003edn\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: 20.6167px 8px; transform-origin: 20.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eap, pic\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: 8.16667px 8px; transform-origin: 8.16667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ekp\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: 38.9px 8px; transform-origin: 38.9px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eocket, helico\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: 6.60833px 8px; transform-origin: 6.60833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ept\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: 19.4417px 8px; transform-origin: 19.4417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eer, birt\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: 7px 8px; transform-origin: 7px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ehr\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: 22.95px 8px; transform-origin: 22.95px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eight, de\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: 6.60833px 8px; transform-origin: 6.60833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ebt\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: 20.6083px 8px; transform-origin: 20.6083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eor, taw\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: 7px 8px; transform-origin: 7px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003edr\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: 14.2583px 8px; transform-origin: 14.2583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ey, ka\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: 6.225px 8px; transform-origin: 6.225px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ety\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: 24.5083px 8px; transform-origin: 24.5083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003edid, bac\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: 8.16667px 8px; transform-origin: 8.16667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ekd\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: 21.3917px 8px; transform-origin: 21.3917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003erop, su\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: 8.55px 8px; transform-origin: 8.55px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ebp\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: 19.45px 8px; transform-origin: 19.45px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eoena, anniver\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: 7.78333px 8px; transform-origin: 7.78333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003esa\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: 13.0917px 8px; transform-origin: 13.0917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ery, p\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: 7.78333px 8px; transform-origin: 7.78333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eay\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: 26.45px 8px; transform-origin: 26.45px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eback, na\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: 8.16667px 8px; transform-origin: 8.16667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003epk\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: 19.0583px 8px; transform-origin: 19.0583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ein, ma\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: 8.55px 8px; transform-origin: 8.55px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enn\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: 33.85px 8px; transform-origin: 33.85px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eequin, sole\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: 10.5px 8px; transform-origin: 10.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003emn\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: 14.2583px 8px; transform-origin: 14.2583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eity, p\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: 7.78333px 8px; transform-origin: 7.78333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003esy\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: 29.175px 8px; transform-origin: 29.175px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003echosis, lo\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: 8.16667px 8px; transform-origin: 8.16667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eps\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: 24.9px 8px; transform-origin: 24.9px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eided, ba\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: 6.21667px 8px; transform-origin: 6.21667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eld\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: 38.5px 8px; transform-origin: 38.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eerdash, etc. \u003c/span\u003e\u003c/span\u003e\u003c/div\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: 363.05px 8px; transform-origin: 363.05px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou can play alone or with others, and you could add other rules or objectives—e.g., all words must have six or more letters, a person who cannot think of a word is eliminated, players try to generate a list that uses all letters in the alphabet, etc. \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\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\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: 373.283px 8px; transform-origin: 373.283px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis game has one problem: without a convenient and stable word list, it does not translate easily to Cody. So instead of words, let’s use prime numbers. In particular, start with a two-digit seed, find the smallest prime for which the two digits appear together in the interior, create a new two-digit number from the first and last digits of the prime, and repeat. \u003c/span\u003e\u003c/span\u003e\u003c/div\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: 318.958px 8px; transform-origin: 318.958px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, if the seed is 11, then the list would start 1117, 1171, 2111, 1213, 2131, 1217,… Because \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45994-investigate-the-frequency-of-last-digits-of-prime-numbers\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ethe last digits of primes are constrained\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: 306.775px 8px; transform-origin: 306.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, you will notice similarities in lists generated from different seeds. Solvers able to plot the numbers might enjoy seeing the patterns for longer lists graphically. \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: 215.742px 8px; transform-origin: 215.742px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to play Outside In with primes: given a two-digit seed \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 57.5583px 8px; transform-origin: 57.5583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, generate a list of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 82.8583px 8px; transform-origin: 82.8583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e primes following the rules above. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; 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: 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: 311.567px 8px; transform-origin: 311.567px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e*I devised the game and the name, but I would be surprised if someone had not already thought of it.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = OutsideInPrimes(x,n)\r\n%  x = two-digit seed\r\n%  n = number of primes in the list\r\n\r\n  y = f(x,n);\r\nend","test_suite":"%%\r\nx = 11;\r\nn = 6;\r\ny_correct = [1117 1171 2111 1213 2131 1217];\r\nassert(isequal(OutsideInPrimes(x,n),y_correct))\r\n\r\n%%\r\nx = 52;\r\nn = 10;\r\ny_correct = [1523 2131 1213 2137 1277 1171 1117 2179 1291 2111];\r\nassert(isequal(OutsideInPrimes(x,n),y_correct))\r\n\r\n%%\r\nx = 88;\r\nn = 10;\r\ny_correct = [1889 1193 2131 1213 2137 1277 1171 1117 2179 1291];\r\nassert(isequal(OutsideInPrimes(x,n),y_correct))\r\n\r\n%%\r\nx = 66;\r\nn = 200;\r\ny = OutsideInPrimes(x,n);\r\nsum_correct = 1167614;\r\ny_correct_p = [10177 11171 11159 11903 11329 11909 11923 11351 11161 11173 11353 11369 11927 11177 11701 12113 11383 11393 11399];\r\nassert(isequal(sum(y),sum_correct))\r\nassert(isequal(y(149:167),y_correct_p))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2023-09-16T16:09:02.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-15T14:32:53.000Z","updated_at":"2025-11-29T23:35:09.000Z","published_at":"2020-11-15T15:09:15.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\u003eIn the word game Outside In,* you start with a word, take the first and last letters, try to think of a word in which the two letters appear together in the interior, and repeat. For example, starting with ‘MATLAB’, you might proceed as follows:\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\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003erero, dis\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eso\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003elution, ki\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eap, pic\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ekp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eocket, helico\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ept\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eer, birt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehr\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eight, de\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ebt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eor, taw\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edr\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ey, ka\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ety\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003edid, bac\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ekd\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003erop, su\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ebp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eoena, anniver\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esa\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ery, p\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eay\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eback, na\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003epk\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ein, ma\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eequin, sole\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eity, p\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esy\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003echosis, lo\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eps\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eided, ba\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eld\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eerdash, etc. \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 can play alone or with others, and you could add other rules or objectives—e.g., all words must have six or more letters, a person who cannot think of a word is eliminated, players try to generate a list that uses all letters in the alphabet, etc. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis game has one problem: without a convenient and stable word list, it does not translate easily to Cody. So instead of words, let’s use prime numbers. In particular, start with a two-digit seed, find the smallest prime for which the two digits appear together in the interior, create a new two-digit number from the first and last digits of the prime, and repeat. \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 the seed is 11, then the list would start 1117, 1171, 2111, 1213, 2131, 1217,… Because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45994-investigate-the-frequency-of-last-digits-of-prime-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethe last digits of primes are constrained\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, you will notice similarities in lists generated from different seeds. Solvers able to plot the numbers might enjoy seeing the patterns for longer lists graphically. \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 to play Outside In with primes: given a two-digit seed \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, generate a list of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e primes following the rules above. \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\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*I devised the game and the name, but I would be surprised if someone had not already thought of it.\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":50948,"title":"Identify prime words","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 114px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 57px; transform-origin: 407px 57px; 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: 13.6083px 7.91667px; transform-origin: 13.6083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn a \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=9CcI5M1LfRs\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eNumberphile video on evil primes\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: 236.375px 7.91667px; transform-origin: 236.375px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, Tony Padilla introduced the “Jesus prime” 105,192,119, which is formed by concatenating the positions of the letters of ‘Jesus’ in the English alphabet: 10, 5, 19, 21, 19. In general, 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: 34.625px 7.91667px; transform-origin: 34.625px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprime word\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: 20.6167px 7.91667px; transform-origin: 20.6167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e could be defined as a word such that the number formed by concatenating the positions of the letters in the alphabet is prime. \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: 368.425px 7.91667px; transform-origin: 368.425px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a string and identifies prime words. It should delete apostrophes and hyphens (e.g. “don’t” = “dont”, “un-ionized” = “unionized”) and treat other punctuation as spaces. The function should return an array of 0’s and 1’s.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isPrimeWord(s)\r\n  tf = isprime(s);\r\nend","test_suite":"%%\r\nassert(isPrimeWord('Croatia'))\r\n\r\n%%\r\nassert(~isPrimeWord('Serbia'))\r\n\r\n%%\r\nassert(isPrimeWord('frenetic'))\r\n\r\n%%\r\nassert(~isPrimeWord('frantic'))\r\n\r\n%%\r\nassert(isPrimeWord('smiling'))\r\n\r\n%%\r\nassert(~isPrimeWord('frowning'))\r\n\r\n%%\r\nassert(isPrimeWord('ziti'))\r\n\r\n%%\r\nassert(~isPrimeWord('spaghetti'))\r\n\r\n%%\r\nassert(isPrimeWord('tick'))\r\n\r\n%%\r\nassert(~isPrimeWord('tock'))\r\n\r\n%%\r\nassert(isPrimeWord('madam'))\r\n\r\n%%\r\nassert(~isPrimeWord('Adam'))  \r\n\r\n%%\r\nassert(isPrimeWord('RFQ'))\r\n\r\n%%\r\nassert(~isPrimeWord('FAQ'))\r\n\r\n%%\r\nassert(isPrimeWord('Jesus'))\r\n\r\n%%\r\nassert(~isPrimeWord('Moses'))  \r\n\r\n%%\r\nassert(isPrimeWord('adieu'))\r\n\r\n%%\r\nassert(~isPrimeWord('milieu'))\r\n\r\n%%\r\nassert(isPrimeWord('wallow'))\r\n\r\n%%\r\nassert(~isPrimeWord('swallow'))  \r\n\r\n%%\r\ns = 'slim pickings';\r\nassert(all(isPrimeWord(s)))\r\n\r\n%%\r\ns = 'mellow fellow';\r\nassert(all(isPrimeWord(s)))\r\n\r\n%%\r\ns = 'Ms. Zadora stuck a cornucopia full of Bing cherries into her knapsack.';\r\ntf_correct = [1 1 1 0 1 0 0 1 0 0 0 1];\r\nassert(isequal(isPrimeWord(s),tf_correct))\r\n\r\n%%\r\ns = 'The dog and pig are going to India.';\r\ntf_correct = [0 1 0 1 0 1 0 1];\r\nassert(isequal(isPrimeWord(s),tf_correct))\r\n\r\n%%\r\ns = 'Liam, is Mauritius in Africa? I know that Mali and Libya are.';\r\ntf_correct = [1 1 1 0 1 0 0 0 1 0 1 0];\r\nassert(isequal(isPrimeWord(s),tf_correct))\r\n\r\n%% Maria Bamford\r\nq = char(39);\r\ns = ['I was in a lot of plays. We had a weird drama teacher in that he was incredibly enthusiastic about a high school drama program and would talk to all the kids for hours. He ended up marrying one of the kids, but that' q 's neither here nor there.'];\r\ntf = isPrimeWord(s);\r\nassert(isequal(find(tf),[28 32 42]))\r\n\r\n%% Maria Bamford\r\nq = char(39);\r\ns = ['I do wanna get married. It just sounds great. You get to go grocery shopping together, rent videos, and the kissing and the hugging and the kissing and the hugging under the cozy covers. Mmmm! But sometimes I worry that I don' q 't wanna get married as much as I want to get dipped in a vat of warm, rising bread dough. That might feel pretty good, too.'];\r\ntf = isPrimeWord(s);\r\nassert(isequal(find(tf),[3 15 34 43]))\r\n\r\n%% Monty Python\r\ns = 'I cut down trees, I eat my lunch, I go to the lavatory. On Wednesday I go shopping and have buttered scones for tea.';\r\ntf = isPrimeWord(s);\r\nassert(isequal(find(tf),[4 18]))\r\n\r\n%% Monty Python\r\ns = 'Strange women lying in ponds, distributing swords, is no basis for a system of government!';\r\ntf = isPrimeWord(s);\r\nassert(isequal(find(tf),[8 10]))\r\n\r\n%% Monty Python\r\ns = 'My hovercraft is full of eels.';\r\ntf_correct = [0 0 1 0 0 1];\r\nassert(isequal(isPrimeWord(s),tf_correct))\r\n    \r\n%% Basil Fawlty\r\ns = 'Well may I ask what you expected to see out of a Torquay hotel bedroom window? Sydney Opera House perhaps? The Hanging Gardens of Babylon? Herds of wildebeest sweeping majestically';\r\ntf = isPrimeWord(s);\r\nassert(isequal(find(tf),[18 23]))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2021-03-14T22:44:36.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-14T16:24:34.000Z","updated_at":"2026-01-20T19:15:07.000Z","published_at":"2021-03-14T16:29:59.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 a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=9CcI5M1LfRs\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNumberphile video on evil primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, Tony Padilla introduced the “Jesus prime” 105,192,119, which is formed by concatenating the positions of the letters of ‘Jesus’ in the English alphabet: 10, 5, 19, 21, 19. In general, a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprime word\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e could be defined as a word such that the number formed by concatenating the positions of the letters in the alphabet is 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\u003eWrite a function that takes a string and identifies prime words. It should delete apostrophes and hyphens (e.g. “don’t” = “dont”, “un-ionized” = “unionized”) and treat other punctuation as spaces. The function should return an array of 0’s and 1’s.\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":51198,"title":"Find pairs of primes with the same digit sum and a specified separation","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; 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: 114.217px 7.91667px; transform-origin: 114.217px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a number \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 102.667px 7.91667px; transform-origin: 102.667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e as input and finds the first set of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\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: 154.4px 7.91667px; transform-origin: 154.4px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e primes such that the first and last have the same digit sum. For example, if the function is given \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABrUlEQVRoge2YUa2EMBBFj4d1gIE1gIJV8BzgAAfPwtOABDxgAQ1YYD+GCbO8NmmBDSWZk/SroduZvdzbAo7jOI5zc6qrN1ACNdBGRge8rttaOYzAHBnjhfsqhh+kGX1kuIoQpfxevYmSeSEqel69kZLpkSa1yGvnKbahJmzUPdKwQzwRmVpDeywLt9zH6FpgIp5qHVJXMg2rNHVot1+BH8tpVEX8jJIz6pyCNtSIeW/r6PcsNiwPT6zqGZcfUROcyUuLmOxzR7OnoA2PZe+H1tVDV4cUN7JK0hab86+epaQzE0rPTjMijGQqPrurClJaPlV2dzrWepJTz3Z35L8MddHunD1ejrWPZJVqE2KGdqY3lEJ2k9T5p8BD1o9yD2QlpFsMrSnJPmwT/gLzmgh7bswlpZtFPTjZuG0shqSnRwON/hw1lZhusAZRcvO1CSGl2NSrEWn2lH1p1D+mIfwqPRBbGSLzwQe0CW1gvjHz1bLw4bvPl7G3h5HPG4LWMLAz+kPmaOfvkm6hq9SANG9CxJB11rPff2M0y/ydPjXYS7m+emoXjuM4juM4jvM93sUE4zJ5SjgfAAAAAElFTkSuQmCC\" alt=\"n = 5\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 205.642px 7.91667px; transform-origin: 205.642px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, it should return [2 11] because those numbers begin and end the string of 5 primes—2, 3, 5, 7, 11. \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.175px 7.91667px; transform-origin: 29.175px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSee also \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/50933-find-pairs-of-primes-with-the-same-digit-sum\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 50933\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primesEqDigSum2(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(primesEqDigSum2(1),[2 2]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(2),[523 541]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(5),[2 11]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(15),[7 61]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(33),[7 151]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(45),[7 223]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(50),[7 241]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(64),[7 331]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(79),[7 421]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(107),[7 601]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(174),[7 1051]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(185),[7 1123]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(195),[7 1213]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(199),[7 1231]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(213),[7 1321]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(318),[7 2131]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(325),[7 2203]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(328),[7 2221]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(341),[7 2311]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(442),[7 3121]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(461),[7 3301]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(553),[7 4021]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(563),[7 4111]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(572),[7 4201]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(669),[7 5011]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(679),[7 5101]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(2503),[47 22511]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(4129),[457 40129]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(5721),[1567 59023]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(5849),[647 59021]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(7621),[967 79411]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(9433),[599 99401]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(43210),[59 522113]))\r\n\r\n%%\r\nassert(isequal(primesEqDigSum2(50014),[79 612331]))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-25T01:17:42.000Z","updated_at":"2025-11-29T20:53:37.000Z","published_at":"2021-03-25T01:25:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a number \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e as input and finds the first set of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e primes such that the first and last have the same digit sum. For example, if the function is given \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n = 5\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, it should return [2 11] because those numbers begin and end the string of 5 primes—2, 3, 5, 7, 11. \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:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/50933-find-pairs-of-primes-with-the-same-digit-sum\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 50933\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":51077,"title":"List composite numbers that cannot be written as the sum of two primes","description":"","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: 144px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 72px; transform-origin: 332px 72px; 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: 309px 31.5px; text-align: left; transform-origin: 309px 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: 300.65px 7.91667px; transform-origin: 300.65px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 32 is a composite number that can be written as the sum of two primes in two ways: 3+29 and 13+19. The number 33 can be written as the sum of two primes in one way: 2+31. The number 35 cannot be written as the sum of two primes at all.\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: 309px 21px; text-align: left; transform-origin: 309px 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: 307.533px 7.91667px; transform-origin: 307.533px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the composite numbers less than or equal the input that cannot be written as the sum of two primes. Remember that 1 is neither prime nor composite.\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: 309px 10.5px; text-align: left; transform-origin: 309px 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: 121.367px 7.91667px; transform-origin: 121.367px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eProblems that might be related include \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 60 \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: 13.6167px 7.91667px; transform-origin: 13.6167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46582-find-jumping-medalists\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 46582\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 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = compNotSum2Primes(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 100;\r\ny = compNotSum2Primes(n);\r\ny2_correct = [27 51 65 87 95];\r\nassert(isequal(y(1:2:end),y2_correct))\r\n\r\n%%\r\nn = 299;\r\ny = compNotSum2Primes(n);\r\ny2_correct = [35 57 77 93 117 121 125 143 147 161 177 187 203 207 215 219 237 247 255 267 287 291 299];\r\nassert(isequal(y(2:2:end),y2_correct))\r\n\r\n%%\r\nn = 1000;\r\ny = compNotSum2Primes(n);\r\ny7_correct = [27 93 135 177 209 247 289 321 343 387 417 455 495 527 545 581 623 651 687 713 747 781 803 835 867 895 917 951 981];\r\nassert(isequal(y(1:7:end),y7_correct))\r\n\r\n%%\r\nn = 10000;\r\ny = compNotSum2Primes(n);\r\nlen_correct = 2748;\r\ny229_correct = [27 1133 2009 2877 3695 4491 5289 6097 6887 7661 8435 9225];\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(y(1:229:end),y229_correct))\r\n\r\n%%\r\nn = 100000;\r\ny = compNotSum2Primes(n);\r\nlen_correct = 179^2;\r\ny3200_correct = [27 11477 21867 31925 41901 51727 61481 71117 80795 90345 99889];\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(y(1:3200:end),y3200_correct))\r\n\r\n%%\r\nn = 1e6;\r\ny = compNotSum2Primes(n);\r\ny123456_correct = 364117;\r\nlen_correct = 351174;\r\nsum_correct = 178611230456;\r\nassert(isequal(y(123456),y123456_correct) \u0026\u0026 isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 1e7;\r\ny = compNotSum2Primes(n);\r\ny1234567_correct = 3395473;\r\nlen_correct = 3729823;\r\nsum_correct = 18866188039411;\r\nassert(isequal(y(1234567),y1234567_correct) \u0026\u0026 isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":46909,"edited_by":46909,"edited_at":"2024-01-04T14:45:43.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-20T03:22:47.000Z","updated_at":"2025-07-28T13:25:00.000Z","published_at":"2021-03-20T03:27:34.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 number 32 is a composite number that can be written as the sum of two primes in two ways: 3+29 and 13+19. The number 33 can be written as the sum of two primes in one way: 2+31. The number 35 cannot be written as the sum of two primes at all.\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 to list the composite numbers less than or equal the input that cannot be written as the sum of two primes. Remember that 1 is neither prime nor composite.\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\u003eProblems that might be related include \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 60 \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003eand \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46582-find-jumping-medalists\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 46582\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":47843,"title":"Compute the arithmetic derivative of integers","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 153px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 76.5px; transform-origin: 407px 76.5px; 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: 42.7917px 7.91667px; transform-origin: 42.7917px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Lagarias \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Arithmetic_derivative\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003earithmetic derivative\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 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAmCAYAAAB9Lz3jAAACt0lEQVRoge2YbZGrMBSGXw84wAAGUFAFOKgDHNRCNSChHrCABix0fyTvcsjk4wQCd+5OnpnOdiFNzvdJAlQqlUrlT9IAeNu/JXgAeBaaa0cPYFR++oNrNAA+ALqzwjqMMEYuDr33FZ8FmyFeAGb7fLX/txlzzzhuzBRvK09xeuwN4vPmA8YgNIxGyQkXCSxYYGQryoh9dIToxLiUUQY7plTdCNFfsc4Hm6KpvJTpNUfGMe3uYEbheiLTJRV+Mkq+8EfJYN9dHR2XrPfAXkHNpHK8r0bMMFF3F42VpUgrfmFTTquETDH3N619npMuPYyXZTFvYRQcoWvZxZzAlpqjhDSIW0cYvqku9HbW/mJr56PzfEW61bO2nYKhFqsHPuRvXINQGY1X5fr07tt+b7GP3lRty1k3CL1JL2hwjehWd0aPBqYX83+E2bsQKqlpq0/kOdWLbKFTYixxi7BbyHIMIh0ywLRqqTjn0tQGbi5PFdYFYcVCuNt8N7dzDMK5ViuL613ujDWy0SCH9z4yXH2K+WiwCRmKqhyDyLlcReRxQlMXThuEOZfarktk9V/hF1RrELnB860/Rt750Ha3IJMQSHMAa7H3aCiM2RlSRVAad/C8Z0vWbsk532GDSOVSLY3HeE0B1lZ7eaXgW8+VLZXSdMQh3ON+zJst8jZvTIVYIZQK+yKA4c922yF+kARMqqbGBJEbnlCPb2CUZyTl3DssiIe6bN2+SGI6zzDGWBAvrDTwobsX3lPICJmwvy50zyq+HI/xQnyjJ9utzxmytWsuo2hg7U3eLwN096eDQogYbOkhQ1KO0HtG5xO60/eEe0/Xh3jhHiFp/NKX2MVpYHI/N91y+eD6e9tisCBm57aSJ050ln/FA8aLpa8T2YrvuqYsSoeyRulgCul/aQxSUvirUrBSqVQqWn4AXE8rANNQbGkAAAAASUVORK5CYII=\" alt=\"D(n)\" style=\"width: 34px; height: 19px;\" width=\"34\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 218.2px 7.91667px; transform-origin: 218.2px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is defined for integers such that the derivative of a prime number is 1: \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAAmCAYAAADk1+RWAAADS0lEQVR4nO2afZGDMBDFnwccYKAGUFAFOKiDOsBCNSChHrBQDVjo/ZHsdMnla0NogdnfDHPTK00Cj928TQAURVEURVEUJUAD4GH/1qYFMGzU9qnoANwzj66wjwbAE8Bl7WAjdAAmnE/wBsCtdoMPAG92vPAReYC5kW8As/3cCtqeUP6gSOhtX2eggbn3sz2q0mEpti8Kr7ZjEj1HwBHm4fgWjy/3twU3fO4z3euq3LGM6hAXZxAxwXt7zjdTa4P8B3GP3GDG3sDosInYT3xEfCTO5Sk/ljZpKvg2A+IP7FEgTaqLzVP4NXEuj+43/FHU2+9+YZha5F3H3tlE7CuW4uUIxM/3zZETzGB/xQTjF47MJmIP+AiXKxBP++5vKLIkKbyFyRC9/d2IT8nRwUwdT+f/MeiajswmYlNZJRGIi+3O25TCJSaphckwfCw9jLiTHZfEV5SMgZCsPcSO3PI0RHWxG6TnXx/8N67Y5OxLFlHot7Ntl0cxOe2c6YZKyZIFCV6ZrDnWLiJVF5siQNKo+4C4UUaDLIFHr08o/n3MgJGJLKkGakX2WnNaXWxeRuUaGtfQuaKUis0folBJlys2ILumPVJdbCrcJSnPXVp156ZSsflDFBoLn9NTkSMxnHukqtjkmkOi+XDnTV/klIrNqwLfWHjk5yyaqNiMG2Q3D1ialxl+E1IqNmWZkEDcX6SyUEn5R5zSjY+IL4y4tFhGdeiGU4RKDArPMqkUnnPx5MZLxD6lG+fCpcwObVXmmDnKGJIal0dtaMdNUh7S+b+ss3fjxt0tzdjAWsgWXqjskdS4ZPp8F8YzSm6bFJ1HfpmhmtjcDIW2IfkGOs3ruZsLL6RXuTjUh1tyUUaZIXt4Jk9bR0MybQWhfWYe2SOWKchd++6FfQyCQfJdtJf93LBxjpCZHXLt0jHvhRb/fUPRtEAbDamjx7oXAMhw5dxwXhX09vMdJouUpGF60+OIKTzlF3a7bTsgr86tvVL0QuWX9JQ09GpNKrqly7Ux7jj+XH1YLjCCh+bcnCVSSV9zpC/lC1xhUrVvDuVVwZpFCHLtW76brmRywVLwFsuFFHKcJaawgZkCVOgdwSObXkPyHSXtHtF5K4qiKIqiKGfmD4buuZD1TTX+AAAAAElFTkSuQmCC\" alt=\"D(p) = 1\" style=\"width: 61.5px; height: 19px;\" width=\"61.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 9.70833px 7.91667px; transform-origin: 9.70833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. It also satisfies the Leibniz formula, which resembles the product rule of calculus:\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=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAAAmCAYAAAC8oeIjAAAI4ElEQVR4nO2da5XrOgyFN4cyKIESCIIiKIMyKINSCIaBMByGQjEMhbk/kn27o3FsObXT5Iy/tbrOw83DkizJtpICjUaj0Wg0Go1Go9FoNBqNRqPRaDQajV1xANCPf26ZG4Du3TfRAABcxk8pegDHgudr/OYO4LTCdY7jtYr7kw6DE/B8ljqKA4BPrCOoVzkA+EDZgfiv4bWXC5Y7oAsGB1aSI4Av7MMOS7OGznqsO246DPos7hSZvf3I54GnkO7jhX8AfI//9grtMB67p6yL93x+941smA6DLajN9HjazIe0fyJvoFzGY2pwwmDbfzFTrKkznmdtLhjGanE6TAUViqJnPAX2DZ+T+8DgQPfGEUMf/+LA8fKJp718BNqZbce+YzmhvtyrDaIdUENnV7xXnj0q+JgbptnhHCf5XsopXsbvbH3dcI4b6mUq/wIaQGPZRM4A48ykNp8Vr9ONny3afWmdHcfvvHMGeIA/QXOjkSO1dqPT61hkWMu4a3FA2nD+KnZGEcvojua7c0sRawbQM9L3vZTYLOud1NBZj20kDXfEE7lsPJ0nmiXORYfL2LbFKJlDj787vYqhMwqPfDTjmBtAD6y7vFLrelt1iKV1Rqe5hbX2ovfCaMmPx4np90NG9YVtRI5XoWy2Ztzvhptsc/q36GAM2RjlvObU644hIy3NVh1iaZ3dx//fCl/wrXkmYcdi0duiU2x7DL11znS5w5BV6oA4YliwveG3cR2kbS71P4znu2KqzBOeO2sp589p8x6n/keE+3/G0J9r4BiWYcWWCSiT2AwhdN7YMVyG8aJ9U2J9s9RywrUc4gnDPWsWdMCgqxvi2VENnT2Ql/TUskdSzEFr5PAOfHWINv3mdDkl9AumabkaEdeTdKOHQjybNq1FYs3jwxzLNns9z9QhV/GKt/4rVRvm5Tgeo/Jh1KRstP9XabOymbuuzii8a352cNnB65FxN35H+8b17hOmduzJgpYEbg8lHeIVv3VGvdhxEJsyltaZV3Zr2CPx+p0oSyIHzDHWqTDV9hqE1jgCQ8dYK6bZ60HazoE2RQ2AmeAXntXtX5FjLRyES/gp8FkyDdD+MyJ/4SkLdRps45McKYeyZEZhp1924Ob0U6/f4VlbyH7mBLul8k2ds3SGqGNEx0GHqa7X0hmdpScTB+ra49J7CkKvqg4phXWidleaXt+LnoeKppPiVIrF3aG20O6S9us03pMKivfoMQ5GqiWUyBCXLBSrMTN7Yv/VyM6Yykbb5iKyZt9e49MB+YPpMgcN2ZupUe90DnQMRANhim+UX+uu4RAp8w/8Hgeayc0lNKV1RvvyJlA17ZFws/eljF9LaLyR0m7CWAHnOETdsebWuWZsjIz92KZG9pA2izpLVuErOYMmN+PdAnTij/HvqiObUaj8NJCE1mZtOUbuLCAUeHMdourdBjqPc1CWZP9cs5v7qGxj3/OiMr/idwDgNeemwjV0lusQa9mj5eWMf0nksI/52RvNcYhXPAVuH/HTTPSBaYSwUcXykOOsk1Un7DGOXOVvAX0Ey2ZAjPyUjaIZeYglMwo7IG0Ay3GIei4OLkXtyUPubEaPeeWT44RV5lwaUOhs5hxBDZ3ljola9mjhNRZhO+3xwKwKj2WVOUamC6d2jUAjh+2kKtlGxVSdpEZUD3tziPZpIqtXjfyhncOQLogGw1QBP7FrUTYI5ThEOry5jIi2580SljhEb4bYR76Ts86VqgdMJTQ1dJYzJmrao+Ulh6jG5a3yVkF9I5xh5RhZLHKpIu11YpFD+xUygM9IW4jckhBl7V1mXnNukGgQtE4jlXUD02DouS8bQEMyz3GI6hxC18+5N+C1CoI5cmYfHvT9AXPBJJbQ1NBZjkOsaY+h7y9eQ4xlZ3MXVEHNRSSmwKndW7sTbNGF5Lm20HE6pbFGotNw76BZkkWQ0HQp95O7JmJ3JBW72RRqm1uLspm3p3RDF+bt0gWhTjw2GAvgak/eR/Jeyigi5yzlENXhhRyTTjdD1NIZZe1xVLXs0ZK7Fv0LdW6pjtlSldggZYaWih6aAVoDju0uaVsn/8f7jN2jDhoKOTV4XnnqZu1dZpVNarNpro19PWBqiJp5e9Z07NpVzB48u722dMPCgcx7s/dvqVV0X9IhqnMKnY9jksHE2nItnXl3dGvao+WlQntbdBm7EF+sGcvmFAortU7CLC80EHRxfC6qaE0WnZ8OmlAGaIXseRGpN3vZAmrQIcNgEIxl5Dc8i2b1HJp5p+Rhl2NSQYfv4ouhziF0Pjtr6BGfBXAMlH4Wt6RD5LgLOQybGIRexFxTZ99Iz15q2qOFU/NF709Q45pLSQ+YVpmzINrDA3FHo6l8yHHG6gQ1E+gwfVKFbXN9Yl/ueNY8xsiZGmwBLoOEnEusJMUuJfSY6sXWns4FRT5NolmBx0A5cGKDkM4hZBNqT+fxuqlA513ayaWUQ1SZh+StDoxJiwaA2jrrkR4/tewxxBcWvojFPhbH6aVO0+yzyrkL+6kH560ylZQh6L3ZNY5Y1qntoWNDFH+tUGWo19h6UyhY2BmDGt8Rvx+j+sbUXjg4KNceea/Wos7njF6zoZBN2IoJz7orn4YoTSmHmMqutP0dOvO8+KSGPYZY/Kq+VMmA7my+UmZCA527Qd5HqJ3PP94QVhBfzhA6lsfF1j5ydm5pRHsgJbeYzIHwyzL0nKlPN3NdL7GMI9U34PmSgJxSkBqlVKUcYod0Efe7dRabCdawxzmu2MHLqO/Y9yvA7GOEjbqwimGNes8e5Z9hJh22+8bs0vAFE+/ua6hgfXPwOdPsNHYDsBZrL2uH/wp8NK0mHdrv5ZTkA3WWHrzcsKOXOO/1V872+uNY/wI96smeQboFunK881cq1/hRsuLwDRbvTqu9XPHeiNdYtpHnof3mdh3e8ZvXdMR7eunK//AVXFt3ihe0zHArpOoIc2GpVaMOoTrImtf6WOla1di6MwR2lnr/AUraTNPtOqwxzlNPrTQajUaj0Wg0Go1Go9FoNBqNRqPRaDSW8h+H9WG6PZ+uegAAAABJRU5ErkJggg==\" alt=\"D(mn) = mD(n)+nD(m)\" style=\"width: 162px; height: 19px;\" width=\"162\" height=\"19\"\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: 143.133px 7.91667px; transform-origin: 143.133px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, the arithmetic derivative of 15 is \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAAAmCAYAAACLQ+9SAAAJQklEQVR4nO2da5HjOhCFD4cwCIEQCIIgGAZhMAyGQjAEQjiEQjAMhbk/4lPuaPVoyS3Hyu2vyrW1NY5tWf3Ww4DjOI7jOI7jOI7jOI7jOI7jOI7jOI7jOI7TjR2Ay/RvC/vg/ycA50VPtH3CNr+LHwAHw+tdsJ22OWPi8rNhDnga528AX6jrrOP0O81xbHy+HYAbykYtd+9b4vxL4zNtgdy7v+LpdFPsM78NjxPaA4ELnjKVYz+d842nHJb6eQ/grjhvFJbo3xps8Zk01NqDNdnhMwLiI2bZXWorcADwAPAXOb4rrsPsRf7+IR7yB08D8gfgd/q/VsB3029Lzuwr0Q4eKaN4mZ5nRFJ9x/ev4Rz8jv0jFZd/u6AuqLggL0cMNGLPf0VesCm7IxpKYqV/vfjC/HyjOf9We9CbHZ59+zsdo3LCUzZueNqEI57v9I5nu3LBcJTD9MPb9GN6OqkgNR78iNcOjwnwabonDZ/GuF2hcxgPzC8oPEqlvgcaXuCbocLF2ss+1SL7LdbnB8wBhVYuztNvUjDQeODZFgq0dFDXwj2oACNirX+WHPGvoxzNIS2xB704Y7Z/tIEjQtsTqy5Rr/9QWRGjIYhdkMJYo+zf0EXnB7x2SO6hv6ZzSsLDF9QqZEflfVrYT9e3VugHbDK7MJBIZRxSLkrGco+yQDIzjb3zK2b5KGVAN2wjm6jFWv+sOGEuu7AfejokRteWurfUHvTgjLmd7N9RHRKdakq/ZbCsgvX6FD+of2FhaSeHLO/llI5lvxJ3lKNpzTV6jCfRUS99PskJdkZCG0gAr2WQnLO4IC+M+8Lf2T5NG3nuSKW7HvrXAykbvRxSj+tb2IOe0Fa+u39bkAFsqs94jrp9B+SjBwpizcCfjLJL5SKZJaU8rTbKYeMZKbdOnOgVVfVwSBRoi0FwGUhoMi5ZcogZVWZHpQkVuWeWAq3pD6tscS166F8PRnRIVvagJ5/ikFJVEgaJZhk+U3XtOISMaLVGXZ4fMyZ36BQyNiheO3ECeD5zj7q9tUMKS2w8bqgfqGWbtYEE8Pq+YwLH6H4JnGihdTI/GFO5U9TqXy9GdEhW9qAnIzskYA5KH4j3GytgJraU2UtNxEkjVBPVScEJf8Mou1Su4/TfmIFmh9cotdYJ1mDtkDhDJ9Xm0uw0iQwktNmINFKx33AguRXW2G/K5wHmdmwxGq6lRf96MZpDsrYHvRjdIYVlfql3rDTV2KEkHNyvvZgUAu0Acy7SZqNqDAzXssQiJO116Nkt6VGyI0fM2UGYLWloCSSkMIbZsDaQSEGDUjude8l9a9Zj9VhjJ2nVv16M5pAkFvagF1YOqWYNaO5oyRzDZT5c3vMLgyn1x8gNtNFEWPbRdrb8TeiQqAitQhpOW32gLvq3VI6eDons8OpctOny0kAidEgsJ9am6nvEHWuNg2l9x6kSaO2xpDyxRP96MrJDkrTag15YOaQwOGw9Wt99F5mVXrYlmghnXmkInVg4u43PsQQ5H/4PuhfFsQvLCGoNh0RkX5QGFPdoE0r5TsNZeWxrbWYrd5dodUpc01OLVYa0JHhaon89+RSHBLTZg15sLUNa4pxjJVLTcXhOydUaNukltUY3nAQRNsDCIQGvs/k0NfmWCL9k0NiWe+E8K8OjXcNjEUiE/d3ikGL3kNmeZi0S8HzPo9bkJbX6F8LdHyyiVQuHxCnuqUPqZ+48C2rtgYRrIi22rBp9DAmYd1mhnIWOyXQMNFy8lTMILSvLw1QvvL6VQwLmF6VxlnRINQqwhZKPRLuGpyWQCLdjCWvFFg6JyEWZNbP/PoEa/QuR7027fVQKC4eU2hqq5rA03DX2QCIz97CiU8voDklmm1I2wxKiaaYk9zhLCWNY9tEozg6vnRsTDEvjUlMya3FI2gzpUTjPsmShMSIykNAOQkrjElMmS4cko1mNYH+SQwJ0+hdDGoWlZeI1M6RL5hxLw9ZaQpeyv/R5RndIDGZjWVBYeTEbq5ORf8rRSKXRRmNSCH8RF/QeDkmTQrbM7tPef82V43y/KWEIFyZrAokwE4w5MUuHhMK9Qlqnm29plp1Eo38pvqZjqTH4pDEkUmMPJNyd22LsaWtjSC3rNXN6LuXGbKyOCpFzNLI8oOngPV6zo1SkwTEEC+9Kb655MdYGVV5zLYfErDU39iADCe0YhawRp9rCcqGVENYY5D+0OaStlVzD51padlvCJzqkGnvQi5Fn2Wm2DpKVMzO9oNHKla+kcyl1cDjLJWegrWa7sTyoneZpsctAyNoOiffLCUJtICHHm3LvkpmXxSA0r6VxMozaWu777ll2KTT615tPc0i19qAXW8uQat6FrK7k+qymuoHd1JjSzs53pB82jCxzjQpXUJeUjI0ueVfWp0upY80YifUOy5YOicbzjPj7psLl+g147bdcIBF+50qzYJMLO0uUdkCn06wpJ7573Y4WC/1bg9EckrU96MXoY0gcf07ZcZkhqeRXRsihh5TfqckZg3BqbspAfuN17yOt0XggP5sldIiX4BkYYWpTRkbZ1lu2WDokObAavks6/Tvy/RZOuc9tIS9nemkj9QvKZSZZMrxGnveCumnLliXeNbDQvzWQOr51h2RtD3oiP1Y6IrQhqb3sKDfq7D6sPXJR4W26SSoCJ5yTL69xxWsaGO5VVxuVaDbMDKeUsh2MLmuEvNdnDCwdkvzAIQ/uv0enkeu3I/5dLxCuj5KLU/m3GkOv+TRGbNxGyl/tRpi9Ph3Si6X615sd/tXxWOBggaXDs7QHPWCFQz5jrX5tBX4x9hfzt56OmO1HteM/4NUQnaDrsNI0Th5fWDYGxLSv5Mha2xFyRZ/t/q3HkGgs2F754a8c2nqz9no5Stkt8OzfM5bLC8u7796frBYrubWmNKZmnWFYZ2Bbfa8l/Rul3BwStsv6Y4ub4gfrfBOGzq+H4Pb6YuyWYSa3hmBesO2PsTl5GFl/rBFzPgcO7vYehLxhG9v9fxJX9C+jcXfsd4+1OI7zP4F7c/UyOmfYz6xz5sH5XqUIBiujljocxxmUE+o+2KblgPdPrf1kOPOvR7nyivdP33Uc53/KAbZO6YDtfAjtk+GuwJZO6QfujBzHeTOWzsPHHdbF+85xHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxnG3yH8B/fjed3a5zAAAAAElFTkSuQmCC\" alt=\"3D(5) + 5D(3) = 3x1 + 5x1 = 8\" style=\"width: 210px; height: 19px;\" width=\"210\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 119.417px 7.91667px; transform-origin: 119.417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The Leibniz formula also implies that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAmCAYAAAAP4F9VAAADO0lEQVR4nO2abZGDMBCGXw84wAAGqqAKcICDOqiF04AEPNQCGmqh94PssGSAbDYpNMw+M0znbiBZ8mY/kgAYhmEYhmEYl6YC8Od+c3AH0GVq69LcADyE103ZRwVgANBE3C8R74Fp0lyFBtN7P9xvnath8q4Pu0bMwj4BvNz/3+5vaeeVe1YyOSrX39tdEv6cPSXTYHKAN6bIRE73wfRuWaLeDUuB17zt7owgoSWi9ZAJ0LG2qX0po7OtRBrM7+07DYk8IIPI1Bh5755BXIQ9kVt3T8i4zrVTub5jBb4J+/lFKDJuOQGNR3K9MWAWLpTXeDh/7dxHYV5jR4zAcHaUlo9bzOO45ShPzOORlJN5eA6FO+7FW8aR8bFepRVY29+Z8Lpmy+475nFutR3xRqSDxO9fCy8vTGLFohW4QqZQdhA1ZFGQ39drO6MwQAldAg/p/jNkVGx45u3GCgzoJ9UZ8KI2JJym8FxAoSJGFC6wPwMpXGrWzSkCU22goYV8P2DvksKLWqnAa5V2EAptoWS/16kvMBkv3djgpAico9+UK8ZmLnCoOOTLx+h345Wc1EB/UvgG0mBpSBG4gz5y5PDgmPzPBQ49xydftMB8ySNN4n5R5ht4lsCU10ootLjAoY2gEQkC84elA+Nva/p54WyBNcXd0VC0+WoO5iW49OEKy5ywZpwJHOaQKprPor3tSQ4PLW+sh4yzBE6p3o+uonkds7e0k963Ss8elhwI1Fh671ZIp3W1ZlcpRxWdsjw7qooGljtZW3BPj45MXKzQ9iQd+0nCSko1myIwTSwNR1fR1Gdoeco3oaIcxj8e3Hu4RtxmCO1Va6rZFIEH7G/7/SLS06Ro7+UzY2uzmx/AU56WnruO0J3uSMLWGpSrSjv8p/PgtXqGImH0eTCd03IP7rEMN/5ec+xJxhNxItVYFnA0a6UvRmvzbJ+5HEiDySFGTOPMv+jooRBXkk+oIy20BJNMjNB3YZKo0aOcg4Yt+Di0KGCyPnHMoNNk0uxBGwnQJzjqg2ohA8rLvZeB8su3wk2H8irny3FHpi8DPRpM4pb0mc5loW9/c4nRQFFhGt8lpxg/X2EahmEYhmEYhfIPnUvDeXKmK2EAAAAASUVORK5CYII=\" alt=\"D(1) = 0\" style=\"width: 60px; height: 19px;\" width=\"60\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.91667px; transform-origin: 3.88333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 227.017px 7.91667px; transform-origin: 227.017px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to compute the arithmetic derivative of a natural number. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function Dn = arithmeticDerivative(n)\r\n  Dn = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\nDn_correct = 0;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 2;\r\nDn_correct = 1;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 4;\r\nDn_correct = 4;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 8;\r\nDn_correct = 12;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 10;\r\nDn_correct = 7;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 23;\r\nDn_correct = 1;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 30;\r\nDn_correct = 31;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 72;\r\nDn_correct = 156;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 512;\r\nDn_correct = 2304;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 960;\r\nDn_correct = 3392;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 1024;\r\nDn_correct = 5120;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 8191;\r\nDn_correct = 1;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\nn = 8192;\r\nDn_correct = 53248;\r\nassert(isequal(arithmeticDerivative(n),Dn_correct))\r\n\r\n%%\r\np = primes(1e4);\r\nindx = randi(length(p));\r\nDn_correct = 2*p(indx);\r\nassert(isequal(arithmeticDerivative(p(indx)^2),Dn_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-08T02:09:18.000Z","updated_at":"2025-11-29T22:16:17.000Z","published_at":"2020-12-08T02:34:58.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 Lagarias \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Arithmetic_derivative\\\"\u003e\u003cw:r\u003e\u003cw:t\u003earithmetic derivative\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:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is defined for integers such that the derivative of a prime number is 1: \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(p) = 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(p) = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. It also satisfies the Leibniz formula, which resembles the product rule of calculus:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(mn) = mD(n)+nD(m)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(mn) = mD(n)+nD(m)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, the arithmetic derivative of 15 is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"3D(5) + 5D(3) = 3x1 + 5x1 = 8\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e3D(5) + 5D(3) = 3\\\\cdot1 + 5\\\\cdot1 = 8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The Leibniz formula also implies that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(1) = 0\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(1) = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to compute the arithmetic derivative of a natural 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":49733,"title":"Solve the arithmetic differential equation D(n) = n","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 165px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.5px; transform-origin: 407px 82.5px; 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\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/47843-compute-the-arithmetic-derivative-of-integers\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 47843\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: 182.033px 7.79167px; transform-origin: 182.033px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e involved the arithmetic derivative of integers. In particular, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAAlCAYAAABiQ5b4AAADRUlEQVR4nO2abZWzMBCFr4c4wEANoKAKcFAHdVAL1YCEeqiF1YCFvj/IHIa8+ZiEhBbOPOfwY3chZHOTmTsJgKIoiqIoSj4XAKZBuwZA16BdpZABwLNR2wbAaN+hROgB3IVXX/iOlkJz3jif4AbArXaDTwAfdv1hEfmBeSA/ACb7szRsXm1bLcK3i7HvuuzwrtYYzGM/2asqPdZi+wbsal9MoqdWeie8ryZ7Tq5W3LCMM411Ve5Yr+oQF6cTMSGfAF61OpjBC3P0OSI3zGNKUaqJ2C8sIqbyKw/578A9nf37nquaGOy7j+7QSZPqYvMQfk3cy1d3SNAn4hGiNRPmaHVkmoh9xVo8Sb7j9/tC5oR9HHiIEd+dbDVoIvYDi3DSHMvDvvsMmb2cMqizzw2YV+SIpeToseR//vsY5EGOHMqbiE1l1Qfy0MfFdvM2DXROvu4wRxjelwGzuG/bZo6voAmXSkmhZ6V7D7Fr60SrLrZBOv/64M+4YpOBKyl/aKJMtl2+ig3WJUmsfRK7JG/zymTLtbXery42OdecRt0J4q4y6mQJfPX6wjX/e2zVUh9LSrBaK3trrV9dbF5GjcJnXEPnilIqNp9EoZJOKjaQ50F+kepiU+EeWkk+3K1VNzeVis0nUagvPKenVo6KzaCNj5BoPty86YsGpWLzqsDXF77yJWWVxMj9MlXFviFv8IC1eZngNyEjysSmKBNajdxfpKLQFoN2SjdOokiNDB1spAacJkSOG+VRJhXCJf98Sa1PnNKNc+FSZsdgnS9jZo5yb06Ny1dt6MQtpzykqFUy4Kdz4+6RZqxjHfI2XozwPg6ZPt8/xiNKjomsfoCwM9XE5mZogl9sfoBOeV26WmnnSwq9w32GIsqEvC82vr03X4OctBVkwDqEU1jmIcjd+87NfTnHjPwUjb40Mayfo7AdgqLWUb9Y6fC/byhKC3TQkLoGbD+L/oPM+PGqYLA/3zFHkZK8962PJmqQ8gsle/270GNemalVWdN1UpQ48mnXYXkgvQ2bu10bwz08UXYmdgYt2SKV8sDxTdnhoU+VfSaPVwVbDNVe36YrQrij7LDeSCHHWWIKO2jo/mnoMyTfpSiKoiiKclr+AefGuUN+CB0PAAAAAElFTkSuQmCC\" alt=\"D(p) = 1\" style=\"width: 61.5px; height: 18.5px;\" width=\"61.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.38333px 7.79167px; transform-origin: 7.38333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\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: 42.0083px 7.79167px; transform-origin: 42.0083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is prime and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAAAlCAYAAAA6NZCNAAAIcUlEQVR4nO1dW5HjMBBsDmYQAiFgBEGwDMIgDEIhGAIhHEIhGEJh78Oecnuix8iRbGtPXeWq25Mf0qjnodHYARoaGhoaGhoaGhoaGhoaGhoaGhoa6sERQLd1JyI4bt2B/xD9Ss9pc7stcup/B+CQ6V6b4AfAbetOGPAD4I79G+6/ghsGma+B63g0rI/c+t9h0NPs3OkBXIzHUk9eizEUnAA88X8bxR/YOHHG8shrTWMouKIuLpZG7fr/RAEOdRg6/EvHC5MgruODfwG8x7+t4eppvFdtxuWMwQP9zzhgmnc5Hph4ccMwt8wXK67YTr53DPPbMKBm/e/G+2dPh/SYC8T1gBMGgYhgYh7jYDxvr3iiKc4FEyfehnOeiCuL8GgrJym8bDnFCTXrfxGjy6R+Bc47Yq4gocHeMEQUtaLHMMaqk7df4oFpvkPLnjPsRjE1miyBC4Z+lkA/HjWtimrX/wcy54etxAfm4bWPVIexvdboUPDC/51z4qghlqt50bk+cv5g2+hQIPwskcMMRVl7Re36/zM+L1vwwsQ/Rc5lL+EbtOSXascZ+1DgLaCXUTEZcJTok9meHMwdZSKYGg3iX9D/NzKtPE5IIz7U+a5o4I39EP8byOSvvRu6B1wRjwQY2oBqxdqbLMWA506J1GYQ/4r+35HJCDPxrR6TQ2x9jShGCvH78Xz2NgcMpL3gk1wdtfkI3Y33O2M+yUdMO2jWya/RuB8wjZ9xwlQyEwLvMFs9LyuKvkbyVCkGqAQv+N4lDHQpg3jEMHfc3w5TiZQrspO20NJ1D/ovY+MxxMamsYRfTiwhPgtERw/SsVj+QIqgXbtbkmviRK8Yr5Nq45rBbuzbS10rbfp5lsjnYTzPBWuNV+hIdSwPzOUjxvyIzzIaX66vU+dZc0GhewtnYijBi1B/cxdr5zSIPeYG6xeTIztiznN+pp7r0K76Vvp/VvdhI6rn0rKU743nBZGD+FogknS15t24xgkYhPLCYOmZDB21nRxtDF4GSCT4HK+Rf1uXCFZFduE3w7GkXo9l02NSHomWYw6B5WfNoeolszY0r8DzXCjBC42UqMiKEhEij+mIaT4lqmKjIW0XR5vG3vSf57JX/Y85LuHfV3lE2Z1h4sWghaiXk6kGhO8jwhBhinCfGAbsanPlDXhcx7FPvESUPlqUQci4ZGMlR4S4xOOJbIRkQjBBLCLgnUSrQda5KB3ZphqfErzQeCJ/+U0Jgyh8lSJknk/m+iHSprEH/Zco947PuWQnGzPW0q+vIv4cxNe5qBSB8I7VFZ8FluI9ZNeKSfaCe0KAuVJc8Dm2mEFgWJcAewLLRjsDC8l4KWYtTtdLO20QUgxiKV5oLIn+Y681cr9D56VAlo93TE5AIHJ/juNhRxRzDlvrv5TnyH204xZ5WlcpX0f8S4ivX/PRnidFILLT98bnRLMnemE+0SxIVwTFr5RpZWJls3jx2gwiy+aFT6KzzGPXp0Q6rrwtI4WspXihscQg6rzXksMajQFzvsqrkwxxDq6SJpkTX9S0tf5zhCopHYbkkq3G+iuDqIlv2Z3pME92ujqaIhBOnutJY0+kB8mC1J4jVifFXseCbLtXKyFWDyjz4yOZJqkFOn/oUq4UspbghQuyAZcCa4R4C5yT8kqofguIwc5Bz3XMOexN/13cSDXW1pWBEyxoKyl4wn07VzJIC0Iekz2Rfg7nkDR4XC7hPAJtLnyzqbL2LjMwJ5nr2lCbvj5VRiEuvWE3iCV44XvO3jdVWLb6nuwAtNGIOYc96D+/G63vxU7WYqy/3lQJeWEX5GXtmNUWocUIoXeCNTjZ6mtzXccE0oJkj2o1NEuiCIFruZR6pO4yh0jOMveRjOfYsuzUO9K+1IKUA6XcLycvXPgqogjcM5dBZL66DDdvnvnafAZ/a/1ng+eaA8mNpq5SFteVphBfl6qElFQIHbsne3qtnBzO6wFyW0//J/0M9ZGVTbxmzPu8PfeyYO1dZh6fi7CcgAcGGfjyq77IgnGETUn42bF7luCFr++xPi9BToPIUZ5L0UMbSNo5aFlsrf+6lEhDnifGOqanEvEuknvKe6r6u3gx79sZz5MJc3kwTqrrvv2oNinkBeYGwUUg7TVjH68UJavlM2BMMheBtJJISYuAl0SxZWeP+ZInpgAyN7HNqRK8cEHOz/1GSU6DqMunGOy8tEy1c5BCbVc5y1b6z5tBrmdy/+WFi5BMb0jbrJqBFce3pd1hGJSQXgpBLZDyAB94Ml3GJlQnyFFOj/lES5tvTDKWK6bathBKve9aCkIyl9xY5icMBNLOgInvW2od8PnFE6t85AOjPpTihQvZ3n1VyGkQudxGI1SSwoGB1OG6SnW20n9eybkMJ+c3xSDHlsKL35/Wrz+JwHmZpt9VTF2Xi/f1KYoeMCMmLJ3A58kMRRfc7rrWhQfq+XI2e1WX3PSuIo9LyP+rDq6l019OlkLaFEjdoA+leKEhu6UlIv9cBpGdg0v/Qs5Pb37wPO1B/zkV4OIQt1tWaBLxJss8VjLAO5vf1t29EP4unm8H9UD9cAlUPs7gulau8/U9dK2rH5Yl3l4QkxswfdjBVYpkzWd+o+giU1+kUYoXrueU+qxbLoPYI1zEHeK6ODj9YZO96H9sbID9Ix1AJR+jlhxTLctNjTvq/MrN3nFBua9VWyCvMi7ejYygR31fzC6BtfRfIukq7MyWPyb0DWr9caxasOXv1dTKyRqxhqyr++2j2n7lTF6Qr+UDnzWi2K+lRdB+YnZ9lNT/Kn9WVn7msNQSJScs2/sNeXDAurKW3dZmDNdFKf2PlcztHhfsn4xnVJKL+COQ5P8aqIF/fxk55S9fTW9oaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGjIjX98m2HjhsI+6wAAAABJRU5ErkJggg==\" alt=\"D(mn) = n D(m) + m D(n)\" style=\"width: 162px; height: 18.5px;\" width=\"162\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 296.208px 7.79167px; transform-origin: 296.208px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Therefore, the arithmetic derivatives of 1, 2, 3, 4, 5, and 6 are 0, 1, 1, 4, 1, and 5, respectively. \u003c/span\u003e\u003c/span\u003e\u003c/div\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: 382.108px 7.79167px; transform-origin: 382.108px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOne might then ask about solving arithmetic differential equations (ADEs). Because the study of differential equations often starts with solving \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAAlCAYAAACOGjGrAAADvUlEQVR4nO2bfZGDMBDFnwcc1AAGUFAFOKiDOqgFNFRCPdQCGrDQ+yN5x4aGfJCkLUN+M525KRwJ7zabtwsHVCqVSqWya04Amm9PovJ9HgCu355Exc3pA9d/ZRqnQc0s2WgAdAB6qFX6KDzeBcAz4fc7AGfMcy0duIfhCuAOtUpfAG6FxxuhgmELPdT8ONeUgKpY6DCLey44Tos828KngvZw9FDCTii7596gsk8K9BgvqACuZGSAEra0Pxihgi6FTwXtIZmgxC1Z0p2R549HP1M6aA8H9+3SqXbQn1Q+EbSHoIVy7Vf98xVzqiUsKVmm2cwdj7UBYzb6+rFG9IS5rD3DNLW2ceW9Len093vwFbn1N+ig0inLt7P+eYQS9i7OY43ucuc8NsKf7nt9XignqOwx6bE7qFLxifegBeYSmMdfMEvUAWbJGbI9UYfUT2yFVEL/fy6wi8BssBSOcDK2vT3GtN0RXup1+poTzGiX2WCt8mDmkR6Cop7174VuKVKblE/0ihXk0h/A3ICxRY682bX0w+M2tx/SiWS5FyIIx5vwnsJlILgqD5rJEXPW22JQc2WEFHOcQ38Ac9SsGUGmTFfa5gqzGb0B/i5haEu5hdsIyntxpduLOG9E2or8BVL1N9LkWloePcc5mC2jNPo73x74DJks5jS4FjSD5ziRVVCOKuXbpOpvGCTbybJD53Lza1nlCv++H9pSlmOspf2QoCW+BbAnUvS3mqYl9A4+syEDhis7NBpDW8ouUwSYe6Wv/JNbTEylsuRbVcOSFP0NY2Xbb0MCRbIsMW8IW22hLWXOdW0uvkAhDcwyM+UB1y9UDWSr/sZN2NK+fOzMQHEJJvdnrjifG+Yq9p0ng9Z2c9L8MVDWXkgZoO5N+oStzzZ+oWogW/QH4A4ENndkqm2gRF6LXrlPPREmbmhL2RUILczVzaAdLHNYNq2WbpvX2iNb9Adgrgg2kRoooUeYL3dQINfF5fVCH/bEtJT5R5NNpIueqwzqHnOAtXougz5ngpnVZD+BQbLXUnKL/v/I9C8v0sBMtxPC9/Flt2+NHu9tYBdyPsseQLv4nllDBoitAdV7ju+NGP3f4IOJ5cMJBkOP8D1MulYfMS1lwgdgfMAk6fXYcsXzHlzOvPcc3xMx+hfjgvA3ixrkc8sVRYz+xegQ16/n3l7JQ6z+RWgRb7JCW8oVP1v0zwKriQdmpx1jsnL+88oRSdU/G7LS2BKJN9R3CVNI1T8bsprYQo63lI9Mqv4/wx31FfNKpVKpVH6JPxg13ByqmkTvAAAAAElFTkSuQmCC\" alt=\"dy/dx = y\" style=\"width: 65px; height: 18.5px;\" width=\"65\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 108.783px 7.79167px; transform-origin: 108.783px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, let’s consider the analogous ADE \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAlCAYAAACJdC37AAADGklEQVR4nO2aYZWDMAzH/x5wgAEMoGAKcIADHMzCNCBhHmYBDVjYfYAcobQ0dGG83uX3Hu/ebSxtSJomKYBhGIZhGAZQASiUZJWKsgwFGgAPRXkVgOf819ihBtAJrzpxDG3jEiWAAWbkKAUmA7zZNWAx7B3Aa/58nP8vhbJvs6yzwml1svw/Q421gX2r4obJwGTo2Iouhfd9yh1Af/IY2dNhvXpDVOy+mPEemPbJsynmudy+MFa2PLEYLrZf8nD+CtxTzt+fvXr5nPYc89/Dw3NsJfBVHDLitx84zelbDpUVN6wNJklY+P13z/cjzsmc97hizCy4YzGWdM/kId39DSVszYE51PP9PLkrAbSY8gNJKfREvmFaQ/8gVAK9Z2ESuIHdfZgStli4fDhjv7GUX53z+Yh4aUa/SSmZGsj7AXvXEbT191I4gqR7GP+Na2BKwiQPmo9PkYCy7xLr6BLLDaSO5YM7bOo1Joyrqb+XJmGCrlO4+x49LAmUbb+xhCNe05LRRsQdhnKJlAehsYLbhHE19ffCSx5ps8BNylzFjhiYO1iDbVeKZElyA9r7j4bKK9HU38uAsKFCuG1Nd284YmCSNc5zccMrdc4kc8vRwJr6b+DhwWcoH9Q12lv1RwzMZbmG4e1TSRaZkr1fjab+G1omQFpe8OxuDAzcQ2Zg3jDxjd/tfLc3t5Qk64osWlv/DWSIULPChQ4PYiGdJhbzOu4svlVHJYS0eUHyUsqJK7Jobf03cGPFMs8C65ptLyGTZrP8CNI3nju3mOH6gCwJV2TR2vqvcI8H91LwEseaIYXgPq6Az0Mpu6TyoEL4YIMYkM+x4Rn6r+AFdKjGKjAZiVb6AHmN2UcmxEst355J28cLy6H+Xsin/SyXBEtb/xUN1uGZQi4PN26v+eiDIw8MhRVeHvici5dikpcGyBFzQVv/X6R7TXNEaIAB4eSN5hFyHIoeLWQdHHrFKBe09b+EGh80yQ/QIt9TpOw5+30pKt3szcoL6ZHYahPwQj6J1Z+FXsvVNsQZMo0P6KCXMNxg718ZhmEYhmEYZ/ADvv+88sPQFvgAAAAASUVORK5CYII=\" alt=\"D(n) = n\" style=\"width: 60px; height: 18.5px;\" width=\"60\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 153.25px 7.79167px; transform-origin: 153.25px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The definition of the arithmetic derivative shows that no prime can solve this equation, but the sample calculations above show that the first (i.e., \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAkCAYAAAAeor16AAABnUlEQVRoge2YYbGDMBCE1wMOMBADKEABDnCAg1p4Gp4EPGABDVjo+0FucqQ3A2kyBfr2m8mPslMIy2VzABBCCCGEXIkKQH/2JO5IBWAAsPhBEuixmvb0gwYm0ANosFbgDBqYxQgamAUNzKSogQ5AC6BTxyr/e/BajGhNiQmcQLaBDYAHwm70ROiJHELIynBKm7DdxRyO02A1PnfUabf7QrEK1CY6BPNaP0RrlTYY2lEGbB/MuyPloVkUM1BONCMYJMuyQ5hwvaMdpVQFVqk3GlHMQGkqf7EuTZ1pUp2Tv6DOyB8E4+9IEQMdQhWNWJ+sRrJuxmqYRjLykTOBEyliYI9g4BRpldIWbJdMrbSU/LsSRQyUk1ihrDMu/mKhtdQs+ppdWFfYaOiScdYFRLP+t8fX7MK6ijpDl4yLs09rkpn/chfWFRZPRm8u8ZtGHWnSWOfe0KfJNlC3LzGyzCxzdQPt/ETu+DonHcZbBuoKs5avnNzKOJ1hC+5nXo3XHE6OBJ1DFqJZ5sjn8D71ohdgL3/v2pIRQgghhBByTf4A9P3xNsgeZjsAAAAASUVORK5CYII=\" alt=\"m = 1\" style=\"width: 40px; height: 18px;\" width=\"40\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 45.1167px 7.79167px; transform-origin: 45.1167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) solution is 4. \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: 98.6583px 7.79167px; transform-origin: 98.6583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to compute the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003em\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: 244.142px 7.79167px; transform-origin: 244.142px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth solution to this ADE. Because the solutions become large quickly, return the \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: 28.7917px 7.79167px; transform-origin: 28.7917px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003elogarithm\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 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of the solution. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function logn = ADEsolve1(m)\r\n  logn = log(mth solution of the ADE);\r\nend","test_suite":"%%\r\nm = 1;\r\nlogn_correct = 1.386294361119891;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 2;\r\nlogn_correct = 3.295836866004329;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 3;\r\nlogn_correct = 8.047189562170502;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 5;\r\nlogn_correct = 26.376848000782076;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 11;\r\nlogn_correct = 1.064536033390395e+02;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 23;\r\nlogn_correct = 3.667637704471177e+02;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 41;\r\nlogn_correct = 9.285420592454951e+02;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 113;\r\nlogn_correct = 3.964144187749625e+03;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 499;\r\nlogn_correct = 2.910277895753078e+04;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 5987;\r\nlogn_correct = 6.506375665711029e+05;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 224711;\r\nlogn_correct = 4.662381803051508e+07;\r\nassert(abs(ADEsolve1(m)-logn_correct) \u003c 1e-10)\r\n\r\n%%\r\nm = 22045;\r\ns = num2str(uint32(floor(1000*ADEsolve1(m))));\r\nlogn_correct = 8.982107413615188e+07;\r\nassert(abs(ADEsolve1(str2num(s(end-5:end)))-logn_correct) \u003c 1e-10)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-01-01T19:29:09.000Z","updated_at":"2025-11-29T22:18:41.000Z","published_at":"2021-01-01T19:43:50.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:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/47843-compute-the-arithmetic-derivative-of-integers\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 47843\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e involved the arithmetic derivative of integers. In particular, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(p) = 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(p) = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is prime and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(mn) = n D(m) + m D(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(mn) = n D(m) + m D(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Therefore, the arithmetic derivatives of 1, 2, 3, 4, 5, and 6 are 0, 1, 1, 4, 1, and 5, respectively. \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\u003eOne might then ask about solving arithmetic differential equations (ADEs). Because the study of differential equations often starts with solving \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"dy/dx = y\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003edy/dx = y\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, let’s consider the analogous ADE \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"D(n) = n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eD(n) = n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The definition of the arithmetic derivative shows that no prime can solve this equation, but the sample calculations above show that the first (i.e., \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m = 1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e) solution is 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\u003eWrite a function to compute the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"m\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth solution to this ADE. Because the solutions become large quickly, return the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003elogarithm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of the solution. \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\"}]}"}],"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}}