{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":50933,"title":"Find pairs of primes with the same digit sum","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: 135px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 67.5px; transform-origin: 407px 67.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: 86px 8px; transform-origin: 86px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe activities in the paper “\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A007513/a007513.pdf\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eA New Function from a Table of 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: 176.5px 8px; transform-origin: 176.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e” involve listing sets of consecutive primes such that the first and last numbers in the set have the same digit sum. For example, if the set size is 7, the first set that qualifies is 5, 7, 11, 13, 17, 19, 23 because the digit sums of 5 and 23 are both 5. \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: 126.5px 8px; transform-origin: 126.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes two numbers \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: 16px 8px; transform-origin: 16px 8px; 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);\"\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: 89px 8px; transform-origin: 89px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e as input and all sets of size \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: 63.5px 8px; transform-origin: 63.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of primes less than \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: 58.5px 8px; transform-origin: 58.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e such that the first and last numbers in the set have the same digit sum. Return a two-column matrix with the first prime in the set in the first column and the last prime in the set in the second column. Sort the matrix with the first column in increasing order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primesEqDigSum1(m,n)\r\n   y = f(m,n)\r\nend","test_suite":"%%\r\nm = 2;\r\nn = 100;\r\nassert(isempty(primesEqDigSum1(m,n)))\r\n\r\n%%\r\nm = 2;\r\nn = 2000;\r\ny_correct = [523 541; 1069 1087; 1259 1277; 1759 1777; 1913 1931];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 3;\r\nn = 1000;\r\ny_correct = [109 127; 113 131; 313 331; 503 521; 691 709; 709 727; 769 787; 839 857; 859 877; 863 881; 919 937; 953 971];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 4;\r\nn = 500;\r\ny_correct = [79 97; 139 157; 173 191; 233 251; 239 257; 349 367; 379 397; 439 457; 443 461];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 5;\r\nn = 500;\r\ny_correct = [2 11; 19 37; 23 41; 43 61; 53 71; 149 167; 163 181; 179 197; 263 281; 449 467];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 7;\r\nn = 500;\r\ny_correct = [5 23; 191 227; 193 229; 281 317; 337 373; 373 409];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 10;\r\nn = 500;\r\ny_correct = [17 53; 37 73; 109 163; 173 227];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 19;\r\nn = 5000;\r\ny = primesEqDigSum1(m,n);\r\nassert(isequal(size(y,1),46) \u0026\u0026 isequal(sum(y),[110158 116332]) \u0026\u0026 isequal(y(31:37,1)',[3319 3491 3547 3583 3931 4057 4139]))\r\n\r\n%%\r\nm = 23;\r\nn = 50000;\r\ny = primesEqDigSum1(m,n);\r\nassert(isequal(size(y,1),415) \u0026\u0026 isequal(sum(y),[8631611 8718173]) \u0026\u0026 isequal(y(53,:),[3671  3851]))\r\n\r\n%%\r\nm = 53;\r\nn = 1e6;\r\ny = primesEqDigSum1(m,n);\r\nassert(isequal(size(y,1),5697) \u0026\u0026 isequal(sum(y),[2788369873 2792164201]) \u0026\u0026 isequal(y(3121,:),[538777 539479]))","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":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-14T05:04:14.000Z","updated_at":"2025-08-01T21:24:16.000Z","published_at":"2021-03-14T05:11:11.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 activities in the paper “\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A007513/a007513.pdf\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eA New Function from a Table of Primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e” involve listing sets of consecutive primes such that the first and last numbers in the set have the same digit sum. For example, if the set size is 7, the first set that qualifies is 5, 7, 11, 13, 17, 19, 23 because the digit sums of 5 and 23 are both 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 that takes two numbers \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 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=\\\"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 all sets of size \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 of primes less 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=\\\"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 such that the first and last numbers in the set have the same digit sum. Return a two-column matrix with the first prime in the set in the first column and the last prime in the set in the second column. Sort the matrix with the first column in increasing order.\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":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":58013,"title":"Find a number m such that 2m and the square of m have the same digit sum","description":"The number  has the property that  and  have the same digit sum. It is the seventh number, including zero, in the sequence of numbers with that property. \r\nWrite a function to find the th term in the sequence, where  can be a vector. \r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 51px; transform-origin: 407px 51px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.675px 8px; transform-origin: 39.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF8AAAAkCAYAAADvqeb3AAAEXklEQVRoQ+2ZuatUSRTG+/0Fo46RoUswkQYu4AYKM4qCiYGKiSC4wgSC+2TODLhE4o6BgaCi4iQjaqCBJi4MGoiBOuFErvgH6Pd7UweO1VW3u189uhu6Cj667606tXzn1Dmn6o61ahkYA2MDG7kO3KrkD9AIKvmV/AEyMMChq+VX8gfIQPvQS8OrL/p90ePMepKtlv8/uz8KR4SdEdkf9XxQON+gBGT3CBuEC6HdtvB7vEm2kt9qzRRBz4SpDQT/qbrDiXpkrwXZRfp979pcDQq5q9/NUd14s0p+q3VHPMwWfhMgjDJX2C74nbBWz7cjBTzV83xhv3AsqmNHvA6KSdWPPPlrRM5lYYWQ8u/79P5oIBUL3+gI5v+V8DwvI3/GKXC6/vudMfLkY+kPhJxPx3rfBYLx/9Mc+eZW4vd+A3gFtVn/qLsdLPOE8G/kMvwjbmmVEJP8IbiUJvLJfh5mdk5Xlo/2fxIeuRkRaGYI/yUm3lTXsMahrTLyCZyr3Sy/ZnaEXwhcvM21S1k+2losrBQWBu3alkERpwXSKgpaJ+BgOZZyHQp1ZBC0a7KqeKIotLS8Ugff+dbCDt9IfpawQ/Duycin+zZ/7sbMKinndmKSl6kzFoUV3BM+CxaIyAIehzoWfT+qizOEHBc+uJXwlQt+E+nTLBfr/SUyJNsR9JvKhGy8nslH0AeUOYHci0H7ZAl/h96xCjKBVF0vRBCctkyEoUhmV0RSSZdmELHV0yep6LnQeZwJ2Zg9ux0TtO1Gx1OEW4F46m1SWAT1FDuE/KH/uJ6mQFRCSL9kLU9/ogG9r7fxqWfHY3yUlPX7VBM3vMBPPud2vMYINPhtLMqKbTk6pPhO7eBxNpLpF2mTNQ47H2IhPhdDOIzddAqAK9zuDwIHNFy0xcc2PnLk+/wU646Pzj7YMEELqj4v3qT3dmKcLEL61Q8uZa+wXuh0ucaafxaWCxjtJ+Ef4YawVbAEpG1n5Mg3f89iYyHv7+M7jzgWdJvpMI6lqKUEl2Y7GN7vXRLfNFd/vZAy4GyebwcIhLj38MV8Ou/iFMvqUnKdSB2GbGeyiGetfj1JL5CyfG+9qShvPj0V4a0udwvYpIBBZzus+2QHi8fHc8/faUfT7nlYbC4TSlq+t2zvz8012Ikt1qb39z73bwpYnXZDv+ohizuedYI/yfvxWR+JRqeDo8+CstfJdJyyfEsx4+M07X1uG7scf49BHSfhv4RhD7pGPEZ1vUHbfCCBm1TaaWI++8HidwvZ03ZMvk8xUy7HAnFbzhr5OBbS+BWnXybdYRwjvulDiu+i6SSLjz8QGnf6+jXeLCYfv/dr6CD19YVtR7mUsGgWwpUDqdYpIbd9h4T38WlgTBwguymsy1sy7oUUfIlATs9hjIMoKWZXd0ujfqXcDem5NngJ8vuXwoTS20p+Cf2FspX8QgJLxCv5JewVylbyCwksEa/kl7BXKFvJLySwRLySX8JeoWwlv5DAEvFvpEL6Ja1GM2MAAAAASUVORK5CYII=\" alt=\"m = 29\" style=\"width: 47.5px; height: 18px;\" width=\"47.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.0583px 8px; transform-origin: 68.0583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e has the property that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAAAkCAYAAABomA/xAAAFJklEQVRoQ+2Zy8tWVRTG9Q+w1Bo1krSBIxt0gaxBDjIURDDoOmgQZQpBUUa3UZmlNRG7UtAgqCjIiVEGOVAErUGNHHShkaOu9AfU84vzxHK79373eePlO8fvHHj4vvfsffZZez17rfXsfVaumK5RemDlKK2ejF4xETfSRTARNxE3Ug+M1Owp4i5x4m7u5veX/n430rku2uxNesGqwkvu0f1XhJ8qRsTnz6nfrzWDaxF3hR58Xng4GeB3/X5KeGvRnhjR+Pjqe2FNweYvdP/2TNvVuve4cJfwUte+rvt9Vn/3lMguEceA31QM4R0vCs+MyLmLNHWfBn+58oJb1HYqaSfCTggQdK8QI8xtPHJdjrwScZ+r8wbhWeHD7oUM9pAQI3C7fn+2SI+MYGxHW98s9IPmtl4o+RBfvym8IRB5F1w54rapx/vCrUKunsXV9ZH6EObL+cLBB0qRUXAMQfBt13Ztwc/oipMCpWltC3FEGCFcqmGssF+6gbKDLjMWiRz88KgwU1R0vjEp/CxFnPv8qD5kvwuuXMS9rh6zFBCpdGtpNSwj4sg2HyTzRRu8KnwplJRhXPz0R7ikfffr3tNCVkvMu48zcSW15Llg4EYhFmaEz1XCeSGVx7W2Ia4H16mcbUThjmTusR8BYr2AH6NAsTj5Tfdvy/hp7rNKG7xbg8aUSnjfJGwRbhCQx08KBwVIfE24s7OeiVkx0fZYt8JoZhXSr7bviU4w4f+X3NZUF9/DnC8TNnc2IzjiVUqFzJkAwAdcJpqx0BiUrOeEbNTOE3E4ibwLcqshJQgpjEMw8rjwp2DpzKTOdG0Y+FXS1qpYZ8nxVkJLQqH1efqRPokm7+kg5JoCASl5JvA+/VOd+zzE2UlptMXJsVqIGBsNae8IRCeq9VjXmdWJMs219XEizrq/j3cLfYsb3p5jp4Q46+SGKZFXUvX/jtGXOO9Z2DTmTgJsmFMppKwWPu1Io93EE7G0c3kj74J8KajVeIhR0wL2ByKEmhdPX4r75L7EEUlESU4FmTSnUn5jMHUqbiAtbKhjXNeHZfi1/ifnZzedod9Y/rUAKS1Et5sgfMc9FLuv3KlLr4hjo/mEsEuoHTRHiUxU3SjEAvt3MIpFYAESJfLduu8Tm7GQlLPTZSFHnCMtd4gRFWfzPi5nAGS80EAaz7q+8X8a6rG+pfuTtPa1Kkres5SqsrawaptopD5psZQOox8virqWVNmHNCZhg3IrxTWMflcmkei27AqbEXZDUpXRVC/GNPXHk5OSCIvHYhcJwVnE8eLDMyKNF/CdjgiJUZNTna5hufTgtnm+OgxNVZq8tIb5fgtx9HVZ6UWcd++13b+lrDfLMaJi/XI6I5q40hoW61vc29VE0IwgXHizT4VyJ0BxviVF6cxUqufRJ6kvi+LEpOHojysueFBtSH9vDbwNyBnrzxS5NBlXICmUE5ajwpAFih3PfNinvRtSvxc0bQ8Ita8spbNK+yv7BSaXKk1a6WtuymOUso6oXJp0scXQuAVgvFijGOOQMPQv7N7W2B/Y/bZwucB+rHpk1T3kDIVPIsH+VMRJ096wIP7zfY44XsimueX6IwxMfXukeyj9osttJsr1XjepOD6LhWMwxjsipF+LW2xZij7U1p3BX9T5n4VPhFZVjCK+Q+B81xdHf6drfpglTpbCGdM7GzwwEdfgpCF2mYgbIisNNk3ENThpiF0m4obISoNNE3ENThpil4m4IbLSYNNEXIOThthlIm6IrDTY9A+yBDw0Vscc/gAAAABJRU5ErkJggg==\" alt=\"2m = 58\" style=\"width: 55px; height: 18px;\" width=\"55\" 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 8px; transform-origin: 15.5583px 8px; 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,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAmCAYAAAAP4F9VAAAFR0lEQVR4Xu1aOYsVQRDe/QOKR6aIeASiouAFooGBN4igoKLBgoEngoiKGokHaih4orCJF2roGWigCB6BgmLggYmZJ/4A/T7oD8qmZ6bnvdnXs29noJh5r3t6quqrq2umt6c5uloDvV0tXSNcTwNwlxtBA3ADcKUaGIXV5oGmuVVv4fy50ic0i/2ngU568Aw8+THoE2gEaKLjZD/OpxpcBkYDnQKYnvsc1Ad66kRZj/M1d73Q/D8wkg7RVTsFMMGcDjrk6fk6fq8DHQ+MDVFIqhW7UwAvANvvQd899vfh98lBCDDlmQoa7uR56yKUL18MWkxdS0Fl6xE6zQtQbg3TKYCzBBXAKzHhbow2Es9ZgeefBn0EHXW8jMV5D4g1xaaScjB1fQCxJpkJehMhH4Hls/m8wntSA3wfTM4FjYwQLPUU1QznwMh2jxkCRVlmg8rUE0pRXK4ILEaNfgesHl90T9JGxwRwyYp6sHjvD+dpWQDKAB5g3rIIa9yCOefNvDywGDl4sFA9A2LdEmMUSQGm9VJpvjdE6KbjU+g9TwqUqjk/Ma8oIjHvvgZxi8gaJAosN09pLeqeVCGa1r4axPNgOCzAW8HwhQDT9LI7oFegOTlCKZw/xJx7EYbjL1V7gGm9t0HsaLVSdaYyCIVoppU1IL8gOov/toGyDEB8H8PFLNBG0JTUABOMMaBhIIZUHrTAxaBxIG4P/OqXXsmxZyA1NSQc17sEYo6y4KqFWedK2noOQe4z8in/3sB/OzzZJDvP8nJWwNzexIR+ez+v2/ZgPnQ56KBZWVYp71ObkVNUHAg8VpI8mIsWgWTputcqhvMI7hHQVaMwXyj7m/zNz5sQOVZ238ll5aV6BHMo98L0XNYScoIQC9oS2XlJABZzDCUCmSDyYGjd5a6Zb3iwCv7qxi7iTK+2Y/RKtSqtYVgl0CMmRQJjLTjyluC0wi1GxuI+yDTkmP0vt1G/QLbuSAowGWKHRTmH4PaBGHZtH5mgsWDIGmMoYmjSG6SQ3kLhPAu8qjz4Mh7Qag3wEvcqUonPvNzLLdFekF93JAVYRQXzCkHc7cClQPJuVoxUUj9I4UkWXsYrs8Cs2/+MRFdAbM7Qaw97QId66toShfbPyQAWU1QwN+6PQPaVniyYINJ77V6WbTwaRLe9QLDdKhVJ1I+fMqwn656bnv5kuMkAtl0Wf19Hpr85Dpl/Jjsv5l/qTvF6sHSoYqOEIlPIcG3KsjphpGMBdiLjIePdOIe57m83L68AbLuK5jOUf3ntFyNWGD/v2LHRBvhYJcbMqyoHl6mirVFntSqt4mXcVo8xsmlOXgHYNsBWmFBfVZYcaslpLLYfW0ZozU1RRceEUhu9ZPjqCWTJaT2YLzG+uIl5BWDbAFsv3IAH+ns75djQWxWN6TMcCl31N1dVeXCZKtrWJHne9dcBFNJbCOQYw/Hvaxtg66E2v/JBVlA/VFkL5tgfUKhr1YrX1uEe33h9nqz8sekpCcB2e+S/DJD1+MUVhVUbTnmbb0n4YtpvV9YBrFZ4kHxZvWhtHct8RNgKwH4DKvcjAf9tkvXQUJjR9iiUY23ooAGs6iJwZRD6ooOvAw+A3rmBnTgvcf+F3jRlGVQZgPUOgBGWX4DwYI+C3cbMNOgDbPNb6FNWgsgj1HkiA5tBLPVZobbaJWrFuzp9j18HUB+hb86K+GJYX+sm5dUEdl5oTeo8aFip3gcXCd6MV6SBBuCKFFnXZRqA64pMRXw1AFekyLou0wBcV2Qq4qsBuCJF1nWZBuC6IlMRXw3AFSmyrss0ANcVmYr4+gejaVQ2Tyn6vwAAAABJRU5ErkJggg==\" alt=\"m^2 = 841\" 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: 159.842px 8px; transform-origin: 159.842px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e have the same digit sum. It is the seventh number, including zero, in the sequence of numbers with that property. \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: 83.1px 8px; transform-origin: 83.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to find 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: 98.0167px 8px; transform-origin: 98.0167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term in the sequence, where \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: 53.275px 8px; transform-origin: 53.275px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e can be a vector. \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\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sameDigSumDoubleSquare(n)\r\n  y = sum(n^2) == sum(2*n);\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 7;\r\ny_correct = 29;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 73;\r\ny_correct = 1496;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 167;\r\ny_correct = 4509;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 597;\r\ny_correct = 32265;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 997;\r\ny_correct = 47889;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 3007;\r\ny_correct = 249950;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 28537;\r\ny_correct = 3889332;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = [11369 7027 15527 9437 16901 20807 27241];\r\ny_correct = [1435349 649935 2052389 1143297 2349495 3197988 3759696];\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 89;\r\nyy_correct = 173297;\r\nassert(isequal(sameDigSumDoubleSquare(sameDigSumDoubleSquare(n)),yy_correct))\r\n\r\n%%\r\nn = 561;\r\nyy_correct = 4049847;\r\nassert(isequal(sameDigSumDoubleSquare(sameDigSumDoubleSquare(n)),yy_correct))\r\n\r\n%%\r\nfiletext = fileread('sameDigSumDoubleSquare.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'persistent'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":46909,"edited_by":46909,"edited_at":"2023-04-23T13:56:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-04-22T22:04:54.000Z","updated_at":"2025-07-28T18:56:43.000Z","published_at":"2023-04-22T22:06:01.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 \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 = 29\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em = 29\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e has the property 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=\\\"2m = 58\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2m = 58\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^2 = 841\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em^2 = 841\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e have the same digit sum. It is the seventh number, including zero, in the sequence of numbers with that property. \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 find 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 term in the sequence, where \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 can be a vector. \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":52664,"title":"List the Moran numbers","description":"The quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 and 481/(4+8+1) = 37, and both 13 and 37 are prime. \r\nWrite a function to list the Moran numbers 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: 363px 8px; transform-origin: 363px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 and 481/(4+8+1) = 37, and both 13 and 37 are 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: 257px 8px; transform-origin: 257px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the Moran numbers 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 = Moran(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 500;\r\ny = Moran(n);\r\ny_correct = [18 21 27 42 45 63 84 111 114 117 133 152 153 156 171 190 195 198 201 207 209 222 228 247 261 266 285 333 370 372 399 402 407 423 444 465 481];\r\nassert(isequal(y,y_correct))\r\n\r\n%% \r\nn = 40332;\r\ny = Moran(n);\r\ny23_correct = [207 1679 3749 4577 8717 14099 18653 19067 22793 24449 25691 26519 26933 29417 29831 32729 33557 35627 37283];\r\nassert(isequal(y(mod(y,23)==0),y23_correct) \u0026\u0026 isequal(y(end),n))\r\n\r\n%%\r\nn = [100000 400000 700000 1e6 4e6 7e6 1e7];\r\ns = [383 1193 1870 2451 8080 12913 17271];\r\nlen_correct = [1915 5967 9352 12259 40403 64567 86356];\r\nsum_correct = [79699686 1044807776 2880495403 5339917218 73480226594 205122929098 389309242207];\r\nsd_correct  = [2.925215086021406e+04 1.171076738381341e+05 2.065163622127620e+05 2.944277010513903e+05 1.177431499460555e+06 2.057551640570258e+06 2.933705654924581e+06];\r\nys_correct  = [11354 28489 48992 71660 99972; 51489 125203 210051 300165 399477; 96325 220734 364473 524186 699739; 129627 308214 513837 741778 999219; 579189 1331117 2176042 3062214 3999644; 1046322 2330397 3782883 5322552 6999255; 1440693 3292137 5341677 7565613 9999882];\r\nfor k = 1:length(n)\r\n    disp(['Test 3.' num2str(k)])\r\n    y = Moran(n(k));\r\n    assert(isequal(length(y),len_correct(k)) \u0026\u0026 isequal(sum(y),sum_correct(k)) \u0026\u0026 abs(std(y)-sd_correct(k))\u003c1e-7 \u0026\u0026 isequal(y(s(k):s(k):end),ys_correct(k,:)));\r\nend\r\n\r\n%%\r\nfiletext = fileread('Moran.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'oeis') || contains(filetext, 'persistent'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":22,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-09-05T13:52:35.000Z","updated_at":"2025-12-15T19:21:34.000Z","published_at":"2021-09-05T14:10: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 quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 and 481/(4+8+1) = 37, and both 13 and 37 are 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 Moran numbers 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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":50933,"title":"Find pairs of primes with the same digit sum","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: 135px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 67.5px; transform-origin: 407px 67.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: 86px 8px; transform-origin: 86px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe activities in the paper “\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A007513/a007513.pdf\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eA New Function from a Table of 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: 176.5px 8px; transform-origin: 176.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e” involve listing sets of consecutive primes such that the first and last numbers in the set have the same digit sum. For example, if the set size is 7, the first set that qualifies is 5, 7, 11, 13, 17, 19, 23 because the digit sums of 5 and 23 are both 5. \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: 126.5px 8px; transform-origin: 126.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes two numbers \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: 16px 8px; transform-origin: 16px 8px; 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);\"\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: 89px 8px; transform-origin: 89px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e as input and all sets of size \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: 63.5px 8px; transform-origin: 63.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of primes less than \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: 58.5px 8px; transform-origin: 58.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e such that the first and last numbers in the set have the same digit sum. Return a two-column matrix with the first prime in the set in the first column and the last prime in the set in the second column. Sort the matrix with the first column in increasing order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primesEqDigSum1(m,n)\r\n   y = f(m,n)\r\nend","test_suite":"%%\r\nm = 2;\r\nn = 100;\r\nassert(isempty(primesEqDigSum1(m,n)))\r\n\r\n%%\r\nm = 2;\r\nn = 2000;\r\ny_correct = [523 541; 1069 1087; 1259 1277; 1759 1777; 1913 1931];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 3;\r\nn = 1000;\r\ny_correct = [109 127; 113 131; 313 331; 503 521; 691 709; 709 727; 769 787; 839 857; 859 877; 863 881; 919 937; 953 971];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 4;\r\nn = 500;\r\ny_correct = [79 97; 139 157; 173 191; 233 251; 239 257; 349 367; 379 397; 439 457; 443 461];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 5;\r\nn = 500;\r\ny_correct = [2 11; 19 37; 23 41; 43 61; 53 71; 149 167; 163 181; 179 197; 263 281; 449 467];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 7;\r\nn = 500;\r\ny_correct = [5 23; 191 227; 193 229; 281 317; 337 373; 373 409];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 10;\r\nn = 500;\r\ny_correct = [17 53; 37 73; 109 163; 173 227];\r\nassert(isequal(primesEqDigSum1(m,n),y_correct))\r\n\r\n%%\r\nm = 19;\r\nn = 5000;\r\ny = primesEqDigSum1(m,n);\r\nassert(isequal(size(y,1),46) \u0026\u0026 isequal(sum(y),[110158 116332]) \u0026\u0026 isequal(y(31:37,1)',[3319 3491 3547 3583 3931 4057 4139]))\r\n\r\n%%\r\nm = 23;\r\nn = 50000;\r\ny = primesEqDigSum1(m,n);\r\nassert(isequal(size(y,1),415) \u0026\u0026 isequal(sum(y),[8631611 8718173]) \u0026\u0026 isequal(y(53,:),[3671  3851]))\r\n\r\n%%\r\nm = 53;\r\nn = 1e6;\r\ny = primesEqDigSum1(m,n);\r\nassert(isequal(size(y,1),5697) \u0026\u0026 isequal(sum(y),[2788369873 2792164201]) \u0026\u0026 isequal(y(3121,:),[538777 539479]))","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":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-14T05:04:14.000Z","updated_at":"2025-08-01T21:24:16.000Z","published_at":"2021-03-14T05:11:11.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 activities in the paper “\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A007513/a007513.pdf\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eA New Function from a Table of Primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e” involve listing sets of consecutive primes such that the first and last numbers in the set have the same digit sum. For example, if the set size is 7, the first set that qualifies is 5, 7, 11, 13, 17, 19, 23 because the digit sums of 5 and 23 are both 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 that takes two numbers \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 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=\\\"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 all sets of size \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 of primes less 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=\\\"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 such that the first and last numbers in the set have the same digit sum. Return a two-column matrix with the first prime in the set in the first column and the last prime in the set in the second column. Sort the matrix with the first column in increasing order.\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":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":58013,"title":"Find a number m such that 2m and the square of m have the same digit sum","description":"The number  has the property that  and  have the same digit sum. It is the seventh number, including zero, in the sequence of numbers with that property. \r\nWrite a function to find the th term in the sequence, where  can be a vector. \r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 51px; transform-origin: 407px 51px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.675px 8px; transform-origin: 39.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF8AAAAkCAYAAADvqeb3AAAEXklEQVRoQ+2ZuatUSRTG+/0Fo46RoUswkQYu4AYKM4qCiYGKiSC4wgSC+2TODLhE4o6BgaCi4iQjaqCBJi4MGoiBOuFErvgH6Pd7UweO1VW3u189uhu6Cj667606tXzn1Dmn6o61ahkYA2MDG7kO3KrkD9AIKvmV/AEyMMChq+VX8gfIQPvQS8OrL/p90ePMepKtlv8/uz8KR4SdEdkf9XxQON+gBGT3CBuEC6HdtvB7vEm2kt9qzRRBz4SpDQT/qbrDiXpkrwXZRfp979pcDQq5q9/NUd14s0p+q3VHPMwWfhMgjDJX2C74nbBWz7cjBTzV83xhv3AsqmNHvA6KSdWPPPlrRM5lYYWQ8u/79P5oIBUL3+gI5v+V8DwvI3/GKXC6/vudMfLkY+kPhJxPx3rfBYLx/9Mc+eZW4vd+A3gFtVn/qLsdLPOE8G/kMvwjbmmVEJP8IbiUJvLJfh5mdk5Xlo/2fxIeuRkRaGYI/yUm3lTXsMahrTLyCZyr3Sy/ZnaEXwhcvM21S1k+2losrBQWBu3alkERpwXSKgpaJ+BgOZZyHQp1ZBC0a7KqeKIotLS8Ugff+dbCDt9IfpawQ/Duycin+zZ/7sbMKinndmKSl6kzFoUV3BM+CxaIyAIehzoWfT+qizOEHBc+uJXwlQt+E+nTLBfr/SUyJNsR9JvKhGy8nslH0AeUOYHci0H7ZAl/h96xCjKBVF0vRBCctkyEoUhmV0RSSZdmELHV0yep6LnQeZwJ2Zg9ux0TtO1Gx1OEW4F46m1SWAT1FDuE/KH/uJ6mQFRCSL9kLU9/ogG9r7fxqWfHY3yUlPX7VBM3vMBPPud2vMYINPhtLMqKbTk6pPhO7eBxNpLpF2mTNQ47H2IhPhdDOIzddAqAK9zuDwIHNFy0xcc2PnLk+/wU646Pzj7YMEELqj4v3qT3dmKcLEL61Q8uZa+wXuh0ucaafxaWCxjtJ+Ef4YawVbAEpG1n5Mg3f89iYyHv7+M7jzgWdJvpMI6lqKUEl2Y7GN7vXRLfNFd/vZAy4GyebwcIhLj38MV8Ou/iFMvqUnKdSB2GbGeyiGetfj1JL5CyfG+9qShvPj0V4a0udwvYpIBBZzus+2QHi8fHc8/faUfT7nlYbC4TSlq+t2zvz8012Ikt1qb39z73bwpYnXZDv+ohizuedYI/yfvxWR+JRqeDo8+CstfJdJyyfEsx4+M07X1uG7scf49BHSfhv4RhD7pGPEZ1vUHbfCCBm1TaaWI++8HidwvZ03ZMvk8xUy7HAnFbzhr5OBbS+BWnXybdYRwjvulDiu+i6SSLjz8QGnf6+jXeLCYfv/dr6CD19YVtR7mUsGgWwpUDqdYpIbd9h4T38WlgTBwguymsy1sy7oUUfIlATs9hjIMoKWZXd0ujfqXcDem5NngJ8vuXwoTS20p+Cf2FspX8QgJLxCv5JewVylbyCwksEa/kl7BXKFvJLySwRLySX8JeoWwlv5DAEvFvpEL6Ja1GM2MAAAAASUVORK5CYII=\" alt=\"m = 29\" style=\"width: 47.5px; height: 18px;\" width=\"47.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.0583px 8px; transform-origin: 68.0583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e has the property that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAAAkCAYAAABomA/xAAAFJklEQVRoQ+2Zy8tWVRTG9Q+w1Bo1krSBIxt0gaxBDjIURDDoOmgQZQpBUUa3UZmlNRG7UtAgqCjIiVEGOVAErUGNHHShkaOu9AfU84vzxHK79373eePlO8fvHHj4vvfsffZZez17rfXsfVaumK5RemDlKK2ejF4xETfSRTARNxE3Ug+M1Owp4i5x4m7u5veX/n430rku2uxNesGqwkvu0f1XhJ8qRsTnz6nfrzWDaxF3hR58Xng4GeB3/X5KeGvRnhjR+Pjqe2FNweYvdP/2TNvVuve4cJfwUte+rvt9Vn/3lMguEceA31QM4R0vCs+MyLmLNHWfBn+58oJb1HYqaSfCTggQdK8QI8xtPHJdjrwScZ+r8wbhWeHD7oUM9pAQI3C7fn+2SI+MYGxHW98s9IPmtl4o+RBfvym8IRB5F1w54rapx/vCrUKunsXV9ZH6EObL+cLBB0qRUXAMQfBt13Ztwc/oipMCpWltC3FEGCFcqmGssF+6gbKDLjMWiRz88KgwU1R0vjEp/CxFnPv8qD5kvwuuXMS9rh6zFBCpdGtpNSwj4sg2HyTzRRu8KnwplJRhXPz0R7ikfffr3tNCVkvMu48zcSW15Llg4EYhFmaEz1XCeSGVx7W2Ia4H16mcbUThjmTusR8BYr2AH6NAsTj5Tfdvy/hp7rNKG7xbg8aUSnjfJGwRbhCQx08KBwVIfE24s7OeiVkx0fZYt8JoZhXSr7bviU4w4f+X3NZUF9/DnC8TNnc2IzjiVUqFzJkAwAdcJpqx0BiUrOeEbNTOE3E4ibwLcqshJQgpjEMw8rjwp2DpzKTOdG0Y+FXS1qpYZ8nxVkJLQqH1efqRPokm7+kg5JoCASl5JvA+/VOd+zzE2UlptMXJsVqIGBsNae8IRCeq9VjXmdWJMs219XEizrq/j3cLfYsb3p5jp4Q46+SGKZFXUvX/jtGXOO9Z2DTmTgJsmFMppKwWPu1Io93EE7G0c3kj74J8KajVeIhR0wL2ByKEmhdPX4r75L7EEUlESU4FmTSnUn5jMHUqbiAtbKhjXNeHZfi1/ifnZzedod9Y/rUAKS1Et5sgfMc9FLuv3KlLr4hjo/mEsEuoHTRHiUxU3SjEAvt3MIpFYAESJfLduu8Tm7GQlLPTZSFHnCMtd4gRFWfzPi5nAGS80EAaz7q+8X8a6rG+pfuTtPa1Kkres5SqsrawaptopD5psZQOox8virqWVNmHNCZhg3IrxTWMflcmkei27AqbEXZDUpXRVC/GNPXHk5OSCIvHYhcJwVnE8eLDMyKNF/CdjgiJUZNTna5hufTgtnm+OgxNVZq8tIb5fgtx9HVZ6UWcd++13b+lrDfLMaJi/XI6I5q40hoW61vc29VE0IwgXHizT4VyJ0BxviVF6cxUqufRJ6kvi+LEpOHojysueFBtSH9vDbwNyBnrzxS5NBlXICmUE5ajwpAFih3PfNinvRtSvxc0bQ8Ita8spbNK+yv7BSaXKk1a6WtuymOUso6oXJp0scXQuAVgvFijGOOQMPQv7N7W2B/Y/bZwucB+rHpk1T3kDIVPIsH+VMRJ096wIP7zfY44XsimueX6IwxMfXukeyj9osttJsr1XjepOD6LhWMwxjsipF+LW2xZij7U1p3BX9T5n4VPhFZVjCK+Q+B81xdHf6drfpglTpbCGdM7GzwwEdfgpCF2mYgbIisNNk3ENThpiF0m4obISoNNE3ENThpil4m4IbLSYNNEXIOThthlIm6IrDTY9A+yBDw0Vscc/gAAAABJRU5ErkJggg==\" alt=\"2m = 58\" style=\"width: 55px; height: 18px;\" width=\"55\" 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 8px; transform-origin: 15.5583px 8px; 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,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAmCAYAAAAP4F9VAAAFR0lEQVR4Xu1aOYsVQRDe/QOKR6aIeASiouAFooGBN4igoKLBgoEngoiKGokHaih4orCJF2roGWigCB6BgmLggYmZJ/4A/T7oD8qmZ6bnvdnXs29noJh5r3t6quqrq2umt6c5uloDvV0tXSNcTwNwlxtBA3ADcKUaGIXV5oGmuVVv4fy50ic0i/2ngU568Aw8+THoE2gEaKLjZD/OpxpcBkYDnQKYnvsc1Ad66kRZj/M1d73Q/D8wkg7RVTsFMMGcDjrk6fk6fq8DHQ+MDVFIqhW7UwAvANvvQd899vfh98lBCDDlmQoa7uR56yKUL18MWkxdS0Fl6xE6zQtQbg3TKYCzBBXAKzHhbow2Es9ZgeefBn0EHXW8jMV5D4g1xaaScjB1fQCxJpkJehMhH4Hls/m8wntSA3wfTM4FjYwQLPUU1QznwMh2jxkCRVlmg8rUE0pRXK4ILEaNfgesHl90T9JGxwRwyYp6sHjvD+dpWQDKAB5g3rIIa9yCOefNvDywGDl4sFA9A2LdEmMUSQGm9VJpvjdE6KbjU+g9TwqUqjk/Ma8oIjHvvgZxi8gaJAosN09pLeqeVCGa1r4axPNgOCzAW8HwhQDT9LI7oFegOTlCKZw/xJx7EYbjL1V7gGm9t0HsaLVSdaYyCIVoppU1IL8gOov/toGyDEB8H8PFLNBG0JTUABOMMaBhIIZUHrTAxaBxIG4P/OqXXsmxZyA1NSQc17sEYo6y4KqFWedK2noOQe4z8in/3sB/OzzZJDvP8nJWwNzexIR+ez+v2/ZgPnQ56KBZWVYp71ObkVNUHAg8VpI8mIsWgWTputcqhvMI7hHQVaMwXyj7m/zNz5sQOVZ238ll5aV6BHMo98L0XNYScoIQC9oS2XlJABZzDCUCmSDyYGjd5a6Zb3iwCv7qxi7iTK+2Y/RKtSqtYVgl0CMmRQJjLTjyluC0wi1GxuI+yDTkmP0vt1G/QLbuSAowGWKHRTmH4PaBGHZtH5mgsWDIGmMoYmjSG6SQ3kLhPAu8qjz4Mh7Qag3wEvcqUonPvNzLLdFekF93JAVYRQXzCkHc7cClQPJuVoxUUj9I4UkWXsYrs8Cs2/+MRFdAbM7Qaw97QId66toShfbPyQAWU1QwN+6PQPaVniyYINJ77V6WbTwaRLe9QLDdKhVJ1I+fMqwn656bnv5kuMkAtl0Wf19Hpr85Dpl/Jjsv5l/qTvF6sHSoYqOEIlPIcG3KsjphpGMBdiLjIePdOIe57m83L68AbLuK5jOUf3ntFyNWGD/v2LHRBvhYJcbMqyoHl6mirVFntSqt4mXcVo8xsmlOXgHYNsBWmFBfVZYcaslpLLYfW0ZozU1RRceEUhu9ZPjqCWTJaT2YLzG+uIl5BWDbAFsv3IAH+ns75djQWxWN6TMcCl31N1dVeXCZKtrWJHne9dcBFNJbCOQYw/Hvaxtg66E2v/JBVlA/VFkL5tgfUKhr1YrX1uEe33h9nqz8sekpCcB2e+S/DJD1+MUVhVUbTnmbb0n4YtpvV9YBrFZ4kHxZvWhtHct8RNgKwH4DKvcjAf9tkvXQUJjR9iiUY23ooAGs6iJwZRD6ooOvAw+A3rmBnTgvcf+F3jRlGVQZgPUOgBGWX4DwYI+C3cbMNOgDbPNb6FNWgsgj1HkiA5tBLPVZobbaJWrFuzp9j18HUB+hb86K+GJYX+sm5dUEdl5oTeo8aFip3gcXCd6MV6SBBuCKFFnXZRqA64pMRXw1AFekyLou0wBcV2Qq4qsBuCJF1nWZBuC6IlMRXw3AFSmyrss0ANcVmYr4+gejaVQ2Tyn6vwAAAABJRU5ErkJggg==\" alt=\"m^2 = 841\" 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: 159.842px 8px; transform-origin: 159.842px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e have the same digit sum. It is the seventh number, including zero, in the sequence of numbers with that property. \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: 83.1px 8px; transform-origin: 83.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to find 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: 98.0167px 8px; transform-origin: 98.0167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term in the sequence, where \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: 53.275px 8px; transform-origin: 53.275px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e can be a vector. \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\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sameDigSumDoubleSquare(n)\r\n  y = sum(n^2) == sum(2*n);\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 7;\r\ny_correct = 29;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 73;\r\ny_correct = 1496;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 167;\r\ny_correct = 4509;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 597;\r\ny_correct = 32265;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 997;\r\ny_correct = 47889;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 3007;\r\ny_correct = 249950;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 28537;\r\ny_correct = 3889332;\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = [11369 7027 15527 9437 16901 20807 27241];\r\ny_correct = [1435349 649935 2052389 1143297 2349495 3197988 3759696];\r\nassert(isequal(sameDigSumDoubleSquare(n),y_correct))\r\n\r\n%%\r\nn = 89;\r\nyy_correct = 173297;\r\nassert(isequal(sameDigSumDoubleSquare(sameDigSumDoubleSquare(n)),yy_correct))\r\n\r\n%%\r\nn = 561;\r\nyy_correct = 4049847;\r\nassert(isequal(sameDigSumDoubleSquare(sameDigSumDoubleSquare(n)),yy_correct))\r\n\r\n%%\r\nfiletext = fileread('sameDigSumDoubleSquare.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'persistent'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":46909,"edited_by":46909,"edited_at":"2023-04-23T13:56:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-04-22T22:04:54.000Z","updated_at":"2025-07-28T18:56:43.000Z","published_at":"2023-04-22T22:06:01.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 \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 = 29\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em = 29\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e has the property 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=\\\"2m = 58\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2m = 58\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^2 = 841\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003em^2 = 841\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e have the same digit sum. It is the seventh number, including zero, in the sequence of numbers with that property. \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 find 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 term in the sequence, where \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 can be a vector. \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":52664,"title":"List the Moran numbers","description":"The quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 and 481/(4+8+1) = 37, and both 13 and 37 are prime. \r\nWrite a function to list the Moran numbers 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: 363px 8px; transform-origin: 363px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 and 481/(4+8+1) = 37, and both 13 and 37 are 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: 257px 8px; transform-origin: 257px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the Moran numbers 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 = Moran(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 500;\r\ny = Moran(n);\r\ny_correct = [18 21 27 42 45 63 84 111 114 117 133 152 153 156 171 190 195 198 201 207 209 222 228 247 261 266 285 333 370 372 399 402 407 423 444 465 481];\r\nassert(isequal(y,y_correct))\r\n\r\n%% \r\nn = 40332;\r\ny = Moran(n);\r\ny23_correct = [207 1679 3749 4577 8717 14099 18653 19067 22793 24449 25691 26519 26933 29417 29831 32729 33557 35627 37283];\r\nassert(isequal(y(mod(y,23)==0),y23_correct) \u0026\u0026 isequal(y(end),n))\r\n\r\n%%\r\nn = [100000 400000 700000 1e6 4e6 7e6 1e7];\r\ns = [383 1193 1870 2451 8080 12913 17271];\r\nlen_correct = [1915 5967 9352 12259 40403 64567 86356];\r\nsum_correct = [79699686 1044807776 2880495403 5339917218 73480226594 205122929098 389309242207];\r\nsd_correct  = [2.925215086021406e+04 1.171076738381341e+05 2.065163622127620e+05 2.944277010513903e+05 1.177431499460555e+06 2.057551640570258e+06 2.933705654924581e+06];\r\nys_correct  = [11354 28489 48992 71660 99972; 51489 125203 210051 300165 399477; 96325 220734 364473 524186 699739; 129627 308214 513837 741778 999219; 579189 1331117 2176042 3062214 3999644; 1046322 2330397 3782883 5322552 6999255; 1440693 3292137 5341677 7565613 9999882];\r\nfor k = 1:length(n)\r\n    disp(['Test 3.' num2str(k)])\r\n    y = Moran(n(k));\r\n    assert(isequal(length(y),len_correct(k)) \u0026\u0026 isequal(sum(y),sum_correct(k)) \u0026\u0026 abs(std(y)-sd_correct(k))\u003c1e-7 \u0026\u0026 isequal(y(s(k):s(k):end),ys_correct(k,:)));\r\nend\r\n\r\n%%\r\nfiletext = fileread('Moran.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'oeis') || contains(filetext, 'persistent'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":22,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-09-05T13:52:35.000Z","updated_at":"2025-12-15T19:21:34.000Z","published_at":"2021-09-05T14:10: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 quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 and 481/(4+8+1) = 37, and both 13 and 37 are 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 Moran numbers 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\"}]}"}],"term":"tag:\"digit sum\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"digit sum\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"digit sum\"","","\"","digit sum","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f2349a37fa0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f2349a37f00\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f2349a37640\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f2349a38220\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f2349a38180\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f2349a380e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f2349a38040\u003e":"tag:\"digit sum\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f2349a38040\u003e":"tag:\"digit sum\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"digit sum\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"digit sum\"","","\"","digit sum","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f2349a37fa0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f2349a37f00\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f2349a37640\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f2349a38220\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f2349a38180\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f2349a380e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f2349a38040\u003e":"tag:\"digit sum\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f2349a38040\u003e":"tag:\"digit sum\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":50933,"difficulty_rating":"easy-medium"},{"id":52288,"difficulty_rating":"easy-medium"},{"id":51198,"difficulty_rating":"easy-medium"},{"id":58013,"difficulty_rating":"medium"},{"id":52664,"difficulty_rating":"medium"}]}}