{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-26T00:14:02.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-26T00: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":51466,"title":"List prime anagrams of a number","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 380.667px 7.91667px; transform-origin: 380.667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 172 is not prime, but its anagrams 127 and 271 are. Write a function that lists the unique prime anagrams of a number in increasing order. Leading zeros are allowed; for example, a prime anagram of 902 is 29. \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primeAnagrams(n)\r\n  y = primes(n);\r\nend","test_suite":"%%\r\nn = 712;\r\ny = primeAnagrams(n);\r\ny_correct = [127 271];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 137;\r\ny = primeAnagrams(n);\r\ny_correct = [137 173 317];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 209;\r\ny = primeAnagrams(n);\r\ny_correct = 29;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 237;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 500;\r\ny = primeAnagrams(n);\r\ny_correct = 5;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 911;\r\ny = primeAnagrams(n);\r\ny_correct = [191 911];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1203;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 1913;\r\ny = primeAnagrams(n);\r\ny_correct = [1193 1319 1913 1931 3119 3191 3911 9311];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1973;\r\ny = primeAnagrams(n);\r\ny_correct = [1973 3719 3917 7193 9137 9173 9371];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 2648;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 5738;\r\ny = primeAnagrams(n);\r\ny_correct = [5387 5783 7583 7853 8537 8573 8753];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 11379;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 13379;\r\ny = primeAnagrams(n);\r\ny_correct = [13397 17393 19373 31379 31397 31793 31973 33179 33791 37139 39317 39371 71339 71933 79133 91373 91733 93371];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 13579;\r\ny = primeAnagrams(n);\r\ny_correct = [13597 13759 15739 15937 15973 17359 17539 19753 31957 37159 37591 37951 39157 51973 53197 53719 53791 53917 57139 57193 71359 71593 73951 75193 75391 75913 75931 79153 79531 91573 91753 95317 95713 95731];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 13779;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 13799;\r\ny = primeAnagrams(n);\r\ny_correct = [13799 13997 17939 19379 19739 19793 19937 19973 31799 37199 37991 39719 39791 39971 71399 71993 79139 79193 79319 91397 93179 93719 93971 97931 99137 99173 99317 99371 99713];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 54321;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 113377;\r\ny = primeAnagrams(n);\r\ny_correct = [117373 133717 137713 171733 173137 173713 311737 313717 317371 317731 373171 717133 717331 731173 731713 737131];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 113399;\r\ny = primeAnagrams(n);\r\ny_correct = [131939 133919 191339 193139 199313 313991 319391 319931 393191 399131 913139 919313 931193 931319 931913 991313];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 246803;\r\ny = primeAnagrams(n);\r\ny_correct = [24683 28463 28643 42683 42863 48623 62483 64283 82463 84263 86243 86423 206483 208463 246803 248063 260483 264083 268043 268403 280463 286043 402863 408263 408623 420683 486023 486203 604823 608423 624803 802463 802643 820643 824063 826403 842063 860423 864203];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1234567;\r\ny = primeAnagrams(n);\r\nlen_correct = 534;\r\nsum_correct = 2405142318;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 3139793;\r\ny = primeAnagrams(n);\r\nlen_correct = 103;\r\nsum_correct = 544898129;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 3917458;\r\ny = primeAnagrams(n);\r\nlen_correct = 708;\r\nsum_correct = 4185941334;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 13456789;\r\ny = primeAnagrams(n);\r\nlen_correct = 4192;\r\nsum_correct = 249146788612;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct) \u0026\u0026 isequal(y(2096),59468713))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-04-18T14:18:17.000Z","updated_at":"2025-11-29T20:34:18.000Z","published_at":"2021-04-18T14:21:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe number 172 is not prime, but its anagrams 127 and 271 are. Write a function that lists the unique prime anagrams of a number in increasing order. Leading zeros are allowed; for example, a prime anagram of 902 is 29. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45387,"title":"Anagram","description":"Given two strings, check whether they're anagrams to each other or not.","description_html":"\u003cp\u003eGiven two strings, check whether they're anagrams to each other or not.\u003c/p\u003e","function_template":"function tf = anagram(x,y)","test_suite":"%%\r\nassert(isequal(anagram(\"rail safety\",\"fairy tales\"),1))\r\n%%\r\nassert(isequal(anagram(\"McDonald's restaurants\",\"Uncle Sam's standard rot\"),1))\r\n%%\r\nassert(isequal(anagram(\"aaabbccd\",\"abbccddd\"),0))\r\n%%\r\nassert(isequal(anagram(\"2343636\",\"42343636\"),0))\r\n%%\r\nassert(isequal(anagram(\"New York Times\",\"Men's write coy\"),0))\r\n%%\r\nassert(isequal(anagram(\"Justin Timberlake\",\"I'm a jerk but listen\"),1))\r\n%%\r\nassert(isequal(anagram(\"222233344441\",\"122223334444\"),1))\r\n%%\r\nassert(isequal(anagram(\"Tom Marvolo Riddle\",\"I'm Lord Voldemort\"),0))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2020-03-24T22:05:58.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-24T22:03:55.000Z","updated_at":"2025-06-23T23:49:34.000Z","published_at":"2020-03-24T22:03:55.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two strings, check whether they're anagrams to each other or not.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":61167,"title":"Gather primes","description":"A book titled Gather that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER, using each letter at most once. A list of words could include A, AH, AT, EH, HA, HE, ARE, AGE, ARE, ART, ATE, EAR, EAT, ERA, ERG, ETA, GAR, GAT, GET, HAT, HER, RAG, RAH, RAT, TAG, TAR, TEA, THE, GATE, HART, HATE, HEAT, RATE, RHEA, TARE, TEAR, EARTH, GRATE, GREAT, HEART, and possibly others, depending on the dictionary one uses. \r\nLess subjective would be to play this game with prime numbers. That is, take an n-digit number and—using each digit at most once—make as many prime numbers of 1 digit, 2 digits, 3 digits, etc. up to n digits. For example, starting with 13 would lead to 3, 13, and 31, and starting with 7103 would lead to 3, 7, 13, 17, 31, 37, 71, 73, 103, 107, 137, 173, 307, 317, 701, 1307, 3701, 7013, and 7103.\r\nWrite a function to list the primes (in increasing order) that can be made from the digits of a number. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 228px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 114px; transform-origin: 408px 114px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA book titled \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eGather\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER, using each letter at most once. A list of words could include A, AH, AT, EH, HA, HE, ARE, AGE, ARE, ART, ATE, EAR, EAT, ERA, ERG, ETA, GAR, GAT, GET, HAT, HER, RAG, RAH, RAT, TAG, TAR, TEA, THE, GATE, HART, HATE, HEAT, RATE, RHEA, TARE, TEAR, EARTH, GRATE, GREAT, HEART, and possibly others, depending on the dictionary one uses. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eLess subjective would be to play this game with prime numbers. That is, take an n-digit number and—using each digit at most once—make as many prime numbers of 1 digit, 2 digits, 3 digits, etc. up to n digits. For example, starting with 13 would lead to 3, 13, and 31, and starting with 7103 would lead to 3, 7, 13, 17, 31, 37, 71, 73, 103, 107, 137, 173, 307, 317, 701, 1307, 3701, 7013, and 7103.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the primes (in increasing order) that can be made from the digits of a number. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = gatherPrimes(x)\r\n  y = primes(x);\r\nend","test_suite":"%%\r\nv = [2 3 5 7 1 4 6 8 9];\r\nk = randi(9);\r\ny = gatherPrimes(v(k));\r\nif k \u003c 5\r\n    assert(isequal(y,v(k)))\r\nelse\r\n    assert(isempty(y))\r\nend\r\n\r\n%%\r\nx = 13;\r\ny = gatherPrimes(x);\r\ny_correct = [3 13 31];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 37;\r\ny = gatherPrimes(x);\r\ny_correct = [3 7 37 73];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 45;\r\ny = gatherPrimes(x);\r\ny_correct = 5;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 129;\r\ny = gatherPrimes(x);\r\ny_correct = [2 19 29];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 513;\r\ny = gatherPrimes(x);\r\ny_correct = [3 5 13 31 53];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 691;\r\ny = gatherPrimes(x);\r\ny_correct = [19 61 619 691];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 3498;\r\ny = gatherPrimes(x);\r\ny_correct = [3 43 83 89 349 389 439 839 983];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 7103;\r\ny = gatherPrimes(x);\r\ny_correct = [3 7 13 17 31 37 71 73 103 107 137 173 307 317 701 1307 3701 7013 7103];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 11110;\r\ny = gatherPrimes(x);\r\ny_correct = [11 101 10111];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 82939;\r\ny = gatherPrimes(x);\r\ny_correct = [2 3 23 29 83 89 239 283 293 389 823 829 839 929 983 2389 2399 2939 3299 3929 3989 8293 8329 8923 8929 9239 9283 9293 9829 9839 9923 23899 29389 29983 38299 39829 82939 83299 89293 89329 89923 92893 99823];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 725346;\r\ny = gatherPrimes(x);\r\ny_correct = [2 3 5 7 23 37 43 47 53 67 73 257 263 347 367 457 463 467 523 547 563 643 647 653 673 743 2347 2357 2437 2467 2473 2543 2647 2657 2753 3257 3457 3467 3527 3547 4253 4273 4327 4357 4523 4567 4637 4657 4673 4723 5237 5273 5347 5437 5623 5647 5743 6247 6257 6427 6473 6547 7243 7253 7523 7643 23567 24763 25367 25463 25643 25673 25763 26347 26357 26437 26573 27653 32467 32647 34267 35267 36457 36527 43627 45263 45673 45763 46237 46273 46327 46523 46573 46723 47563 47623 47653 52673 53267 54367 54623 54673 56237 56437 56473 62347 62473 62743 62753 63247 63527 64237 64327 65327 65423 65437 67453 67523 72643 74623 74653 76243 76253 76423 76543];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 841112;\r\ny = gatherPrimes(x);\r\ny_correct = [2 11 41 181 211 241 281 421 811 821 1181 1481 1811 2111 2141 2411 4111 4211 8111 11821 12841 14281 14821 18121 18211 21481 21841 24181 28111 28411 41281 42181 48121 81421 82141 84121 84211 112481 114281 124181 128411 142811 181421 182141 184211 214811 241811 284111 411821 421181 481211 811241 814211 821411 842111];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nv = 0:2:8;\r\nx = polyval(v(randi(5,[1 6])),10);\r\ny = gatherPrimes(x);\r\nassert(isempty(y) || y==2)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2026-01-18T17:24:42.000Z","deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2026-01-18T17:20:03.000Z","updated_at":"2026-04-09T10:42:43.000Z","published_at":"2026-01-18T17:20:03.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA book titled \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGather\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER, using each letter at most once. A list of words could include A, AH, AT, EH, HA, HE, ARE, AGE, ARE, ART, ATE, EAR, EAT, ERA, ERG, ETA, GAR, GAT, GET, HAT, HER, RAG, RAH, RAT, TAG, TAR, TEA, THE, GATE, HART, HATE, HEAT, RATE, RHEA, TARE, TEAR, EARTH, GRATE, GREAT, HEART, and possibly others, depending on the dictionary one uses. \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\u003eLess subjective would be to play this game with prime numbers. That is, take an n-digit number and—using each digit at most once—make as many prime numbers of 1 digit, 2 digits, 3 digits, etc. up to n digits. For example, starting with 13 would lead to 3, 13, and 31, and starting with 7103 would lead to 3, 7, 13, 17, 31, 37, 71, 73, 103, 107, 137, 173, 307, 317, 701, 1307, 3701, 7013, and 7103.\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 primes (in increasing order) that can be made from the digits of a 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":54645,"title":"Determine whether the input is an anagram number","description":"In Cody Problem 44293, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “seventy-six”. Notice that the spelled-out versions are anagrams of each other. \r\nWrite a function to determine whether a number is an anagram number. The input number will be 1000 or smaller, and the function should also return a vector of numbers corresponding to the anagrams or an empty vector if there are none. One change from CP 44293 is to omit “and” in writing numbers larger than 100 (e.g., “one hundred seven” instead of “one hundred and seven”). ","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: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.775px 8px; transform-origin: 7.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration-line: underline; \"\u003eCody Problem 44293\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 306.1px 8px; transform-origin: 306.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “seventy-six”. Notice that the spelled-out versions are anagrams of each other. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 378.35px 8px; transform-origin: 378.35px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine whether a number is an anagram number. The input number will be 1000 or smaller, and the function should also return a vector of numbers corresponding to the anagrams or an empty vector if there are none. One change from \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration-line: underline; \"\u003eCP 44293\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: 290.567px 8px; transform-origin: 290.567px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is to omit “and” in writing numbers larger than 100 (e.g., “one hundred seven” instead of “one hundred and seven”). \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [tf,m] = anagramNumber(n)\r\n%  tf = true if n is an anagram number and false otherwise\r\n%  m  = vector of numbers corresponding to the anagrams (empty if none)\r\nm = randperm(num2str(n));\r\nend","test_suite":"%%\r\nn = 15;\r\n[tf,m] = anagramNumber(n);\r\nassert(~tf \u0026\u0026 isempty(m))\r\n\r\n%%\r\nn = 67;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,76))\r\n\r\n%%\r\nn = randi(66);\r\nassert(~anagramNumber(n))\r\n\r\n%%\r\nn = 102;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,201))\r\n\r\n%%\r\nn = 222+randi(7);\r\nassert(anagramNumber(n))\r\n\r\n%%\r\nn = 10*randi(66,[1 5]);\r\nassert(all(~arrayfun(@(k) anagramNumber(k),n)))\r\n\r\n%%\r\nn = 364;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,463))\r\n\r\n%%\r\ntf = arrayfun(@(k) anagramNumber(10*k+1),10:99);\r\nindx_correct = [10:19 31:10:91];\r\nassert(isequal(find(~tf)+9,indx_correct))\r\n\r\n%%\r\nn = 679;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,[697 769 796 967 976]))\r\n\r\n%%\r\nn = 896;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,[698 869 968]))\r\n\r\n%%\r\nfiletext = fileread('anagramNumber.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'import') || contains(filetext, 'read'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":46909,"edited_at":"2022-05-20T13:59:21.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2022-05-20T13:59:21.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-11T03:12:41.000Z","updated_at":"2026-04-17T14:39:19.000Z","published_at":"2022-05-11T03:13:00.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 44293\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “seventy-six”. Notice that the spelled-out versions are anagrams of each other. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine whether a number is an anagram number. The input number will be 1000 or smaller, and the function should also return a vector of numbers corresponding to the anagrams or an empty vector if there are none. One change from \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCP 44293\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is to omit “and” in writing numbers larger than 100 (e.g., “one hundred seven” instead of “one hundred and seven”). \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":60746,"title":"List Ormiston prime pairs","description":"The numbers 1913 and 1931 form the first Ormiston prime pair. The numbers are consecutive primes, and they are anagrams of each other—that is, the digits of one number can be arranged to give the second number. 347 and 743 are not an Ormiston prime pair: they are anagrams of each other, but they are not consecutive primes. \r\nWrite a function that produces the nth Ormiston prime pair.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe numbers 1913 and 1931 form the first Ormiston prime pair. The numbers are consecutive primes, and they are anagrams of each other—that is, the digits of one number can be arranged to give the second number. 347 and 743 are not an Ormiston prime pair: they are anagrams of each other, but they are not consecutive primes. \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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that produces the nth Ormiston prime pair.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = OrmistonPrimePair(n)\r\n  p = primes(n); \r\n  y = isequal(sort(p(n)),sort(p(n+1)));\r\nend","test_suite":"%%\r\nn = 1;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [1913 1931];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 18;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [55313 55331];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 54;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [131413 131431];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 126;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [343337 343373];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 180;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [481513 481531];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1080;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [2744279 2744297];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1818;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [4696613 4696631];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 5436;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [14589013 14589031];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 7290;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [19592813 19592831];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 10800;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [29470879 29470897];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 17496;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [48654979 48654997];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 11111;\r\ny = OrmistonPrimePair(n);\r\nsmf_correct = 81182;\r\nsmf = sum([max(factor(y(1)+1)) max(factor(y(2)+1))]);\r\nassert(isequal(smf,smf_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":46909,"edited_by":46909,"edited_at":"2024-10-09T05:13:23.000Z","deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-10-09T05:13:08.000Z","updated_at":"2026-04-27T08:12:57.000Z","published_at":"2024-10-09T05:13:23.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 numbers 1913 and 1931 form the first Ormiston prime pair. The numbers are consecutive primes, and they are anagrams of each other—that is, the digits of one number can be arranged to give the second number. 347 and 743 are not an Ormiston prime pair: they are anagrams of each other, but they are not consecutive primes. \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 produces the nth Ormiston prime pair.\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":51466,"title":"List prime anagrams of a number","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 380.667px 7.91667px; transform-origin: 380.667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe number 172 is not prime, but its anagrams 127 and 271 are. Write a function that lists the unique prime anagrams of a number in increasing order. Leading zeros are allowed; for example, a prime anagram of 902 is 29. \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primeAnagrams(n)\r\n  y = primes(n);\r\nend","test_suite":"%%\r\nn = 712;\r\ny = primeAnagrams(n);\r\ny_correct = [127 271];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 137;\r\ny = primeAnagrams(n);\r\ny_correct = [137 173 317];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 209;\r\ny = primeAnagrams(n);\r\ny_correct = 29;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 237;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 500;\r\ny = primeAnagrams(n);\r\ny_correct = 5;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 911;\r\ny = primeAnagrams(n);\r\ny_correct = [191 911];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1203;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 1913;\r\ny = primeAnagrams(n);\r\ny_correct = [1193 1319 1913 1931 3119 3191 3911 9311];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1973;\r\ny = primeAnagrams(n);\r\ny_correct = [1973 3719 3917 7193 9137 9173 9371];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 2648;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 5738;\r\ny = primeAnagrams(n);\r\ny_correct = [5387 5783 7583 7853 8537 8573 8753];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 11379;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 13379;\r\ny = primeAnagrams(n);\r\ny_correct = [13397 17393 19373 31379 31397 31793 31973 33179 33791 37139 39317 39371 71339 71933 79133 91373 91733 93371];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 13579;\r\ny = primeAnagrams(n);\r\ny_correct = [13597 13759 15739 15937 15973 17359 17539 19753 31957 37159 37591 37951 39157 51973 53197 53719 53791 53917 57139 57193 71359 71593 73951 75193 75391 75913 75931 79153 79531 91573 91753 95317 95713 95731];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 13779;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 13799;\r\ny = primeAnagrams(n);\r\ny_correct = [13799 13997 17939 19379 19739 19793 19937 19973 31799 37199 37991 39719 39791 39971 71399 71993 79139 79193 79319 91397 93179 93719 93971 97931 99137 99173 99317 99371 99713];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 54321;\r\ny = primeAnagrams(n);\r\nassert(isempty(y))\r\n\r\n%%\r\nn = 113377;\r\ny = primeAnagrams(n);\r\ny_correct = [117373 133717 137713 171733 173137 173713 311737 313717 317371 317731 373171 717133 717331 731173 731713 737131];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 113399;\r\ny = primeAnagrams(n);\r\ny_correct = [131939 133919 191339 193139 199313 313991 319391 319931 393191 399131 913139 919313 931193 931319 931913 991313];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 246803;\r\ny = primeAnagrams(n);\r\ny_correct = [24683 28463 28643 42683 42863 48623 62483 64283 82463 84263 86243 86423 206483 208463 246803 248063 260483 264083 268043 268403 280463 286043 402863 408263 408623 420683 486023 486203 604823 608423 624803 802463 802643 820643 824063 826403 842063 860423 864203];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1234567;\r\ny = primeAnagrams(n);\r\nlen_correct = 534;\r\nsum_correct = 2405142318;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 3139793;\r\ny = primeAnagrams(n);\r\nlen_correct = 103;\r\nsum_correct = 544898129;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 3917458;\r\ny = primeAnagrams(n);\r\nlen_correct = 708;\r\nsum_correct = 4185941334;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nn = 13456789;\r\ny = primeAnagrams(n);\r\nlen_correct = 4192;\r\nsum_correct = 249146788612;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct) \u0026\u0026 isequal(y(2096),59468713))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-04-18T14:18:17.000Z","updated_at":"2025-11-29T20:34:18.000Z","published_at":"2021-04-18T14:21:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe number 172 is not prime, but its anagrams 127 and 271 are. Write a function that lists the unique prime anagrams of a number in increasing order. Leading zeros are allowed; for example, a prime anagram of 902 is 29. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45387,"title":"Anagram","description":"Given two strings, check whether they're anagrams to each other or not.","description_html":"\u003cp\u003eGiven two strings, check whether they're anagrams to each other or not.\u003c/p\u003e","function_template":"function tf = anagram(x,y)","test_suite":"%%\r\nassert(isequal(anagram(\"rail safety\",\"fairy tales\"),1))\r\n%%\r\nassert(isequal(anagram(\"McDonald's restaurants\",\"Uncle Sam's standard rot\"),1))\r\n%%\r\nassert(isequal(anagram(\"aaabbccd\",\"abbccddd\"),0))\r\n%%\r\nassert(isequal(anagram(\"2343636\",\"42343636\"),0))\r\n%%\r\nassert(isequal(anagram(\"New York Times\",\"Men's write coy\"),0))\r\n%%\r\nassert(isequal(anagram(\"Justin Timberlake\",\"I'm a jerk but listen\"),1))\r\n%%\r\nassert(isequal(anagram(\"222233344441\",\"122223334444\"),1))\r\n%%\r\nassert(isequal(anagram(\"Tom Marvolo Riddle\",\"I'm Lord Voldemort\"),0))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2020-03-24T22:05:58.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-24T22:03:55.000Z","updated_at":"2025-06-23T23:49:34.000Z","published_at":"2020-03-24T22:03:55.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two strings, check whether they're anagrams to each other or not.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":61167,"title":"Gather primes","description":"A book titled Gather that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER, using each letter at most once. A list of words could include A, AH, AT, EH, HA, HE, ARE, AGE, ARE, ART, ATE, EAR, EAT, ERA, ERG, ETA, GAR, GAT, GET, HAT, HER, RAG, RAH, RAT, TAG, TAR, TEA, THE, GATE, HART, HATE, HEAT, RATE, RHEA, TARE, TEAR, EARTH, GRATE, GREAT, HEART, and possibly others, depending on the dictionary one uses. \r\nLess subjective would be to play this game with prime numbers. That is, take an n-digit number and—using each digit at most once—make as many prime numbers of 1 digit, 2 digits, 3 digits, etc. up to n digits. For example, starting with 13 would lead to 3, 13, and 31, and starting with 7103 would lead to 3, 7, 13, 17, 31, 37, 71, 73, 103, 107, 137, 173, 307, 317, 701, 1307, 3701, 7013, and 7103.\r\nWrite a function to list the primes (in increasing order) that can be made from the digits of a number. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 228px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 114px; transform-origin: 408px 114px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA book titled \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eGather\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER, using each letter at most once. A list of words could include A, AH, AT, EH, HA, HE, ARE, AGE, ARE, ART, ATE, EAR, EAT, ERA, ERG, ETA, GAR, GAT, GET, HAT, HER, RAG, RAH, RAT, TAG, TAR, TEA, THE, GATE, HART, HATE, HEAT, RATE, RHEA, TARE, TEAR, EARTH, GRATE, GREAT, HEART, and possibly others, depending on the dictionary one uses. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eLess subjective would be to play this game with prime numbers. That is, take an n-digit number and—using each digit at most once—make as many prime numbers of 1 digit, 2 digits, 3 digits, etc. up to n digits. For example, starting with 13 would lead to 3, 13, and 31, and starting with 7103 would lead to 3, 7, 13, 17, 31, 37, 71, 73, 103, 107, 137, 173, 307, 317, 701, 1307, 3701, 7013, and 7103.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to list the primes (in increasing order) that can be made from the digits of a number. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = gatherPrimes(x)\r\n  y = primes(x);\r\nend","test_suite":"%%\r\nv = [2 3 5 7 1 4 6 8 9];\r\nk = randi(9);\r\ny = gatherPrimes(v(k));\r\nif k \u003c 5\r\n    assert(isequal(y,v(k)))\r\nelse\r\n    assert(isempty(y))\r\nend\r\n\r\n%%\r\nx = 13;\r\ny = gatherPrimes(x);\r\ny_correct = [3 13 31];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 37;\r\ny = gatherPrimes(x);\r\ny_correct = [3 7 37 73];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 45;\r\ny = gatherPrimes(x);\r\ny_correct = 5;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 129;\r\ny = gatherPrimes(x);\r\ny_correct = [2 19 29];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 513;\r\ny = gatherPrimes(x);\r\ny_correct = [3 5 13 31 53];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 691;\r\ny = gatherPrimes(x);\r\ny_correct = [19 61 619 691];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 3498;\r\ny = gatherPrimes(x);\r\ny_correct = [3 43 83 89 349 389 439 839 983];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 7103;\r\ny = gatherPrimes(x);\r\ny_correct = [3 7 13 17 31 37 71 73 103 107 137 173 307 317 701 1307 3701 7013 7103];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 11110;\r\ny = gatherPrimes(x);\r\ny_correct = [11 101 10111];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 82939;\r\ny = gatherPrimes(x);\r\ny_correct = [2 3 23 29 83 89 239 283 293 389 823 829 839 929 983 2389 2399 2939 3299 3929 3989 8293 8329 8923 8929 9239 9283 9293 9829 9839 9923 23899 29389 29983 38299 39829 82939 83299 89293 89329 89923 92893 99823];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 725346;\r\ny = gatherPrimes(x);\r\ny_correct = [2 3 5 7 23 37 43 47 53 67 73 257 263 347 367 457 463 467 523 547 563 643 647 653 673 743 2347 2357 2437 2467 2473 2543 2647 2657 2753 3257 3457 3467 3527 3547 4253 4273 4327 4357 4523 4567 4637 4657 4673 4723 5237 5273 5347 5437 5623 5647 5743 6247 6257 6427 6473 6547 7243 7253 7523 7643 23567 24763 25367 25463 25643 25673 25763 26347 26357 26437 26573 27653 32467 32647 34267 35267 36457 36527 43627 45263 45673 45763 46237 46273 46327 46523 46573 46723 47563 47623 47653 52673 53267 54367 54623 54673 56237 56437 56473 62347 62473 62743 62753 63247 63527 64237 64327 65327 65423 65437 67453 67523 72643 74623 74653 76243 76253 76423 76543];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nx = 841112;\r\ny = gatherPrimes(x);\r\ny_correct = [2 11 41 181 211 241 281 421 811 821 1181 1481 1811 2111 2141 2411 4111 4211 8111 11821 12841 14281 14821 18121 18211 21481 21841 24181 28111 28411 41281 42181 48121 81421 82141 84121 84211 112481 114281 124181 128411 142811 181421 182141 184211 214811 241811 284111 411821 421181 481211 811241 814211 821411 842111];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nv = 0:2:8;\r\nx = polyval(v(randi(5,[1 6])),10);\r\ny = gatherPrimes(x);\r\nassert(isempty(y) || y==2)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2026-01-18T17:24:42.000Z","deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2026-01-18T17:20:03.000Z","updated_at":"2026-04-09T10:42:43.000Z","published_at":"2026-01-18T17:20:03.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA book titled \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGather\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER, using each letter at most once. A list of words could include A, AH, AT, EH, HA, HE, ARE, AGE, ARE, ART, ATE, EAR, EAT, ERA, ERG, ETA, GAR, GAT, GET, HAT, HER, RAG, RAH, RAT, TAG, TAR, TEA, THE, GATE, HART, HATE, HEAT, RATE, RHEA, TARE, TEAR, EARTH, GRATE, GREAT, HEART, and possibly others, depending on the dictionary one uses. \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\u003eLess subjective would be to play this game with prime numbers. That is, take an n-digit number and—using each digit at most once—make as many prime numbers of 1 digit, 2 digits, 3 digits, etc. up to n digits. For example, starting with 13 would lead to 3, 13, and 31, and starting with 7103 would lead to 3, 7, 13, 17, 31, 37, 71, 73, 103, 107, 137, 173, 307, 317, 701, 1307, 3701, 7013, and 7103.\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 primes (in increasing order) that can be made from the digits of a 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":54645,"title":"Determine whether the input is an anagram number","description":"In Cody Problem 44293, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “seventy-six”. Notice that the spelled-out versions are anagrams of each other. \r\nWrite a function to determine whether a number is an anagram number. The input number will be 1000 or smaller, and the function should also return a vector of numbers corresponding to the anagrams or an empty vector if there are none. One change from CP 44293 is to omit “and” in writing numbers larger than 100 (e.g., “one hundred seven” instead of “one hundred and seven”). ","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: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.775px 8px; transform-origin: 7.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration-line: underline; \"\u003eCody Problem 44293\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 306.1px 8px; transform-origin: 306.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “seventy-six”. Notice that the spelled-out versions are anagrams of each other. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 378.35px 8px; transform-origin: 378.35px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine whether a number is an anagram number. The input number will be 1000 or smaller, and the function should also return a vector of numbers corresponding to the anagrams or an empty vector if there are none. One change from \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration-line: underline; \"\u003eCP 44293\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: 290.567px 8px; transform-origin: 290.567px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is to omit “and” in writing numbers larger than 100 (e.g., “one hundred seven” instead of “one hundred and seven”). \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [tf,m] = anagramNumber(n)\r\n%  tf = true if n is an anagram number and false otherwise\r\n%  m  = vector of numbers corresponding to the anagrams (empty if none)\r\nm = randperm(num2str(n));\r\nend","test_suite":"%%\r\nn = 15;\r\n[tf,m] = anagramNumber(n);\r\nassert(~tf \u0026\u0026 isempty(m))\r\n\r\n%%\r\nn = 67;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,76))\r\n\r\n%%\r\nn = randi(66);\r\nassert(~anagramNumber(n))\r\n\r\n%%\r\nn = 102;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,201))\r\n\r\n%%\r\nn = 222+randi(7);\r\nassert(anagramNumber(n))\r\n\r\n%%\r\nn = 10*randi(66,[1 5]);\r\nassert(all(~arrayfun(@(k) anagramNumber(k),n)))\r\n\r\n%%\r\nn = 364;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,463))\r\n\r\n%%\r\ntf = arrayfun(@(k) anagramNumber(10*k+1),10:99);\r\nindx_correct = [10:19 31:10:91];\r\nassert(isequal(find(~tf)+9,indx_correct))\r\n\r\n%%\r\nn = 679;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,[697 769 796 967 976]))\r\n\r\n%%\r\nn = 896;\r\n[tf,m] = anagramNumber(n);\r\nassert(tf \u0026\u0026 isequal(m,[698 869 968]))\r\n\r\n%%\r\nfiletext = fileread('anagramNumber.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'import') || contains(filetext, 'read'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":46909,"edited_at":"2022-05-20T13:59:21.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2022-05-20T13:59:21.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-11T03:12:41.000Z","updated_at":"2026-04-17T14:39:19.000Z","published_at":"2022-05-11T03:13:00.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 44293\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “seventy-six”. Notice that the spelled-out versions are anagrams of each other. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine whether a number is an anagram number. The input number will be 1000 or smaller, and the function should also return a vector of numbers corresponding to the anagrams or an empty vector if there are none. One change from \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCP 44293\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is to omit “and” in writing numbers larger than 100 (e.g., “one hundred seven” instead of “one hundred and seven”). \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":60746,"title":"List Ormiston prime pairs","description":"The numbers 1913 and 1931 form the first Ormiston prime pair. The numbers are consecutive primes, and they are anagrams of each other—that is, the digits of one number can be arranged to give the second number. 347 and 743 are not an Ormiston prime pair: they are anagrams of each other, but they are not consecutive primes. \r\nWrite a function that produces the nth Ormiston prime pair.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe numbers 1913 and 1931 form the first Ormiston prime pair. The numbers are consecutive primes, and they are anagrams of each other—that is, the digits of one number can be arranged to give the second number. 347 and 743 are not an Ormiston prime pair: they are anagrams of each other, but they are not consecutive primes. \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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that produces the nth Ormiston prime pair.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = OrmistonPrimePair(n)\r\n  p = primes(n); \r\n  y = isequal(sort(p(n)),sort(p(n+1)));\r\nend","test_suite":"%%\r\nn = 1;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [1913 1931];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 18;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [55313 55331];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 54;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [131413 131431];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 126;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [343337 343373];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 180;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [481513 481531];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1080;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [2744279 2744297];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 1818;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [4696613 4696631];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 5436;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [14589013 14589031];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 7290;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [19592813 19592831];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 10800;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [29470879 29470897];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 17496;\r\ny = OrmistonPrimePair(n);\r\ny_correct = [48654979 48654997];\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 11111;\r\ny = OrmistonPrimePair(n);\r\nsmf_correct = 81182;\r\nsmf = sum([max(factor(y(1)+1)) max(factor(y(2)+1))]);\r\nassert(isequal(smf,smf_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":46909,"edited_by":46909,"edited_at":"2024-10-09T05:13:23.000Z","deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-10-09T05:13:08.000Z","updated_at":"2026-04-27T08:12:57.000Z","published_at":"2024-10-09T05:13:23.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 numbers 1913 and 1931 form the first Ormiston prime pair. The numbers are consecutive primes, and they are anagrams of each other—that is, the digits of one number can be arranged to give the second number. 347 and 743 are not an Ormiston prime pair: they are anagrams of each other, but they are not consecutive primes. \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 produces the nth Ormiston prime pair.\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:\"anagram\"","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:\"anagram\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"anagram\"","","\"","anagram","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f4774e17bd0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f4774e17b30\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f4774e17270\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f4774e17e50\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f4774e17db0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f4774e17d10\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f4774e17c70\u003e":"tag:\"anagram\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f4774e17c70\u003e":"tag:\"anagram\""},"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:\"anagram\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"anagram\"","","\"","anagram","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f4774e17bd0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f4774e17b30\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f4774e17270\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f4774e17e50\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f4774e17db0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f4774e17d10\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f4774e17c70\u003e":"tag:\"anagram\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f4774e17c70\u003e":"tag:\"anagram\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":51466,"difficulty_rating":"easy-medium"},{"id":45387,"difficulty_rating":"medium"},{"id":61167,"difficulty_rating":"medium"},{"id":54645,"difficulty_rating":"medium"},{"id":60746,"difficulty_rating":"medium-hard"}]}}