{"group":{"group":{"id":16426,"name":"Prime Numbers I","lockable":false,"created_at":"2021-03-06T15:45:19.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Prime numbers, sequences, patterns, and other facts. See also The Prime Directive. ","is_default":false,"created_by":46909,"badge_id":62,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":3640,"published":true,"community_created":true,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrime numbers, sequences, patterns, and other facts. See also The Prime Directive. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 289.5px 10.5px; transform-origin: 289.5px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 266.5px 10.5px; text-align: left; transform-origin: 266.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrime numbers, sequences, patterns, and other facts. See also The Prime Directive. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2021-03-06T16:43:56.000Z"},"current_player":null},"problems":[{"id":45964,"title":"Compute the nth Pythagorean prime","description":"Pythagorean primes have the form p = 4n+1, where n is an integer, and they can be written as the sum of squares of two integers. More information is available at \u003chttps://en.wikipedia.org/wiki/Pythagorean_prime Wikipedia\u003e, \u003chttps://www.youtube.com/watch?v=yu_aqA7mw7E Numberphile\u003e, and the \u003chttps://oeis.org/A002144 Online Encyclopedia of Integer Sequences\u003e. \r\n\r\nCompute the nth Pythagorean prime p and two integers a and b such that p = a^2+b^2","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: 109.3px 7.8px; transform-origin: 109.3px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePythagorean primes have the form \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAAAkCAYAAABbj9K9AAAC5UlEQVR4nO2a4XGDMAyF3w5swAJZgAmYIBtkg2zACpmhI7BDVmCGrJD+MCqvrgHbGGIXfXdcewEcWzzJkgKgKIqiKIqiKIqiKHNUAO4Amk9P5AM0OOe6N9EDeAO4fXoiB9LgnOvezA3GaGcxXI1JKGdadxIuyNdwF5goUCccs4ZZo/zNcd3ZUgEYYHKXHA2393bRIM91Z8sD5qFUyNNwKpiMaAG8MIX7HA1XlGCqccAWJmQ/xgMwRu5gFtSP56utX3ggNYxYrvSZr+FqGLvY14mdUj7cIgXzRYN2MEYZxv8fdO6JMNHcExzXP6P60WMSv7BkOCk/X3Sd3H+BWTsnzl3kvFzzLEYwrkF7GAExXJ61AeO+Exz2XHwQwdvi9jFcR9c1MGIZxns4D3pGzMtFkYLhCsL1gPh8iGeliDAhAgWmEvriOOdjOImoL0wVFndIZYx74LzmKFIwEm45QWRiBXM0XEK78DHcgGk76q1r2fi+bfYGyw4h3/e1cl1snya5YDjMzoV/DtOhHn8k8pDnWDNcTdcM+GsPaYK9AubEzrblcEVMH5ILpqUB5xJMTvhSdiRTIuuQpN11sGPIZxwpuCsqWxLT0/2++EaYfuW62Ao1uWDsPduGvS40AT2ySor1ZDYiV4uu711zrBiKy2F4D3XB21FoWDyySlrzZBYUezOvibcjG47EKaNsUYLh6OEaTJpfsVXBJ6qkJZbW2q6cF8eRcrpCmkZmUYK50mCu6CG5S0wvJEd8BDEXQSQSi+M8kGZrKkowvGfb3iK5jd0tLZklw4lzuKosfj2ixe+fULayt2DWImcQ3AaX0N/CGO+J//dK35zheGt2bb18PnXE3VMw8ixl3pueKXtNBxNepSrJtXTeiivRBcx61xpk8sNjaifaSzBruWFw/sVVQ2xTSNnOHm/c7YIoO6RrqZwUn58DFOWHpJmz8n+pYMQiPQWJMA3KeptOOQh5w851qGAURVEURcmFb9CcwO8DtVOzAAAAAElFTkSuQmCC\" alt=\"p = 4n+1\" style=\"width: 70px; height: 18px;\" width=\"70\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 24.9px 7.8px; transform-origin: 24.9px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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: 209.25px 7.8px; transform-origin: 209.25px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is an integer, and they can be written as the sum of squares of two integers. More information is available at\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Pythagorean_prime\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eWikipedia\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=yu_aqA7mw7E\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eNumberphile\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.2333px 7.8px; transform-origin: 27.2333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A002144\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eOnline Encyclopedia of Integer Sequences\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 42.0167px 7.8px; transform-origin: 42.0167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCompute 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: 68.85px 7.8px; transform-origin: 68.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth Pythagorean prime \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 55.2333px 7.8px; transform-origin: 55.2333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and two integers \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ea\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5667px 7.8px; transform-origin: 15.5667px 7.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);\"\u003eb\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.2833px 7.8px; transform-origin: 32.2833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e such that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJEAAAAmCAYAAADEF3nuAAADdElEQVR4nO2bYZWrMBCFrwccYKAGUIACHOAAB7WwGiphPdRCNdRC348wL7c02ZSQBNLOdw7n7LaQMJPLZCahgKIoiqIoiqLEcQLQAWj3vpECfJOtRRgA3AE86DjjMx38TbYWowdwg3ky5X9x8s9eN5WJb7K1KFdYpwo9jGPvAJrid5SPb7K1KJPncwn1NTi2g5mmhsB5n2BrVTxgQv9RaQFc8Jzf+EQS4ui2VskJNuE8OhOsiLqI62uytSom1JMjnGFFFENNtlZDA+PUPmGbvzCDPCZsU7jNbV8irs1hqwIzGKkHO5eIWtgoFNN2Dlu/ngl51ktyiWiEFdGydA+RzNYGtjxkA/u5kwlxydqRaPG6vH/Cq9MHuKeEFtvzhVwiusBdWXX4e0sjia0tjEBkPpUVy27+7Or4bo0juwTH2idryUC2TDBOO8OWxKPj3CUNjAC2kktEy9XmCe4tDR675LZ21NllbpzVy0JaE5EeCY6YRBGwznAN2pXaF5GKD67zdXzcHW3EkENEPHY9jJCu8989nm0dF9cktZXn1Cteow2vQaxZyFreYMwRs3DWwDrP5RAZzBudfwncR4rSN4eIuLQ/4/Wh46Rb7Mhiq8ypvsSMRXT0xSgWkC9hDH0fi+RdvkP6PQfOWzOI0uZ9/tsFB4hssFJdsIhC+zJ7w0+mazAaPIf/lLCfthzv5oEcZR5wJ9Bsb2xqEITnVF+Y/cV6A/eAneqLmAP+FtkWBvw9TUiyewuc9+47PWyLz94e4fHdDD+5ISWvDYelq7OfgC2ALRKyhnYPqXMiTkN89rJPsiFzqm8q46R7bfgvXZ3Jk+4TCD+5sTvdW0gtIrHX5yOOzNns5Sjj6qTBtj2ZktWZ7EL7QrvsD+XKh94hpYjYXl+eKv2lWOPywvOla/1HQuENx9/d5dxuKSKp2Dj8NzADUfJ10JQi4iTeNZXJ99nHjufLZUcS+msQEPAcVXmto4UR0Ahrr7weekfZQiGliHgRcTk+koK41vySwyvRouYGNtneI2/YAj8UUgFxuOcqs7SAuP/UIpKxOyXuI8hyJfMMu6M7oI7o42KEzadGPNvRwdq6x09jUg+wbHOIvcXHjquu2nfoa2HAZ7wR8R9OMhUlCil3s5Z/yufC5XBtybNyAPg9GxWRshp5k9F16A/5FUVRFEX5VP4BLmDgO7xkXj0AAAAASUVORK5CYII=\" alt=\"p = a^2+b^2\" style=\"width: 72.5px; height: 19px;\" width=\"72.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.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 [pp,a,b] = PythagoreanPrime(n)\r\n  pp = a^2+b^2;\r\nend","test_suite":"%%\r\nn = 1;\r\npp_correct = 5;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)\r\n\r\n%%\r\nn = 5;\r\npp_correct = 37;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)\r\n\r\n%%\r\nn = 25;\r\npp_correct = 257;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)\r\n\r\n%%\r\nn = 125;\r\npp_correct = 1657;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)\r\n\r\n%%\r\nn = 625;\r\npp_correct = 10313;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)\r\n\r\n%%\r\nn = 3125;\r\npp_correct = 62497;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)\r\n\r\n%%\r\nn = 15625;\r\npp_correct = 367229;\r\n[pp1,a1,b1] = PythagoreanPrime(n);\r\nassert(isequal(pp1,pp_correct))\r\nassert(a1 == floor(a1) \u0026\u0026 b1 == floor(b1) \u0026\u0026 a1^2+b1^2 == pp1)","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":98,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-19T01:58:26.000Z","updated_at":"2026-01-19T15:38:08.000Z","published_at":"2020-06-19T02:08:23.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\u003ePythagorean primes have the form \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p = 4n+1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep = 4n+1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, 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 is an integer, and they can be written as the sum of squares of two integers. More information is available at\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pythagorean_prime\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWikipedia\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=yu_aqA7mw7E\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eNumberphile\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A002144\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOnline Encyclopedia of Integer Sequences\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCompute 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 Pythagorean prime \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and two integers \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"a\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"b\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e such 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=\\\"p = a^2+b^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep = a^2+b^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\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":49738,"title":"Determine whether a prime is Pythagorean","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 114px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 57px; transform-origin: 407px 57px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 369.1px 7.79167px; transform-origin: 369.1px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePythagorean primes get their name from the property that they can be written as the sum of two squares. For example, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ0AAAAmCAYAAADeK5lgAAADX0lEQVR4nO2b3ZWCMBCFbw90QAM0QAVWYAd2QAe2YA2WQA+2YA224D6Ee4gYyA9DCO585+RhXYQkczOZmSCgKIqiKIqiKEoIDYAWQL13RzLQDq3auyP/lTOAF4C31a74TfFd8TnOF4ALVHxZOQF4wng5/k0B3vbq1EZcAdxhFlMFIzaK77xjv/4dD4yCIyeMXuBXPEAFM54p9Hz92gdQyTH8WjzD8bSe67qZz+kBjiC6ENs1MItpSgszzkfqw2uYLeGN79Xrohqun8YzT/iNVSodvsfDGC1GQJyHUpGyHUUXHUqwA/bDfaKrYNT9gjFIB7Pf2/c4mvAe+Bab3XqECa/BKNQSkbQd4zqXF5zlNDz0hM9J94muhxHq1AgNxtWzep/PSAfTZzsTq/Ht+UKExO+UurVK2q6PuNYJJ94nuhZmZcxBr+kKPEukwnIGxi0kZEwMuKNWvodQRxCCpO04L6sWV6joTlgOOnmf5OAyMxcsGwII3wXuw/0kkRSdlO0qfJaKkgkVnQ+uFunJ34oOYVmqb246bFObkxSdj1Db9RCqzUmIjttLaNB9FDg3c7HaGW5vmVJ+mpJLdKG2u8EtyqT+rRUds6I70ie6wlgfW9Ok64X0AC5hneEuj1SQSaZyiC7Udje4vXkz87mXVNFV+D5/7JFmeDtoX9Okt/Yn3KUEuzjaTxrPJdeypehibNdZ/5+25P6liI7ZEB88PQyOFV4D96Bim2T2SGFNvVyFcexzTSLE2Ep0Mbbz2SU5lpWI6aarxpcVHoEextNtdcRnH7m5mn2ovnTdWnaxnVT2WmPsfMlF0hAuMGPYMp5yeZrYJlUTzW47KdEBn+9d5Uj1t4DHWZJbtYsrlrcuzqMrbmST9EpZbScpOntbiE1KSsheeSS0teBCyL14U22XxBaii3X7JWSvJQkO2E90WY4xJUV3Hu4T+6bF3tkrY5ql79Mb5yK36FJtl4Sk6JjxHSmeY4F07sVMckPe17Nziy6r7UJFx0Bz7oU/Vu9L2Z5CsN8x6xYai745M3JJ0RVluxpj1f2N5dU+feGzx2gUHqUc0cOFxou5X86UFF0Rtqsxn7LPHezyl0D2tdfhsyP+RoIeLLTlXlCSovs12ykbQU+kolAURVEURVEURVEURVEUJYo/LpHxrbfjoqEAAAAASUVORK5CYII=\" alt=\"13 = 2^2 + 3^2\" style=\"width: 78.5px; height: 19px;\" width=\"78.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45964\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 45964\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: 68.45px 7.79167px; transform-origin: 68.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asked you 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: 185.167px 7.79167px; transform-origin: 185.167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth Pythagorean prime and two numbers whose squares will produce the prime. This problem merely asks you to determine whether a prime can be written as the sum of two squares. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 379.5px 7.79167px; transform-origin: 379.5px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine whether a prime is Pythagorean. All input numbers in the tests are prime. Because some are large, they are given as strings. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isPythagoreanPrime(pstr)\r\n  tf = isprime(str2num(pstr));\r\nend","test_suite":"%%\r\npstr = '13';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '17';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '23';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '31';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '541';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '997';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '2459';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '36293';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '499979';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '5999681';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '69985649';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '87178291199';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '99194853094755497';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '900900900900990990990991';\r\nassert(~isPythagoreanPrime(pstr))\r\n    \r\n%%\r\npstr = '1066340417491710595814572169';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '845100400152152934331135470251';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '19134702400093278081449423917';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '10888869450418352160768000001';\r\nassert(isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '26525285981219105863630847999999';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '263130836933693530167218012159999999';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '8683317618811886495518194401279999999';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '56713727820156410577229101238628035243';\r\nassert(~isPythagoreanPrime(pstr))\r\n\r\n%%\r\npstr = '62357403192785191176690552862561408838653121833643';\r\nassert(~isPythagoreanPrime(pstr))","published":true,"deleted":false,"likes_count":2,"comments_count":7,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":84,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-01-02T23:14:39.000Z","updated_at":"2026-01-06T08:06:28.000Z","published_at":"2021-01-02T23:21:49.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\u003ePythagorean primes get their name from the property that they can be written as the sum of two squares. For example, \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=\\\"13 = 2^2 + 3^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e13 = 2^2 + 3^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45964\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 45964\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e asked you 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 Pythagorean prime and two numbers whose squares will produce the prime. This problem merely asks you to determine whether a prime can be written as the sum of two squares. \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 prime is Pythagorean. All input numbers in the tests are prime. Because some are large, they are given as strings. \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":46624,"title":"List the emirps","description":"An emirp is a prime number that becomes a different prime when reversed. The numbers 13, 17, and 149 are emirps, but 11, 19, and 101 are not. \r\nList the emirps 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: 407.5px 36px; transform-origin: 407.5px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 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: 10.5px 7.66667px; transform-origin: 10.5px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAn \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/Emirp.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eemirp\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: 348.383px 7.66667px; transform-origin: 348.383px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a prime number that becomes a different prime when reversed. The numbers 13, 17, and 149 are emirps, but 11, 19, and 101 are not. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 168.417px 7.66667px; transform-origin: 168.417px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eList the emirps 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 = emirps(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 10;\r\nassert(isempty(emirps(n)))\r\n\r\n%%\r\nn = 100;\r\ny_correct = [13 17 31 37 71 73 79 97];\r\nassert(isequal(emirps(n),y_correct))\r\n\r\n%%\r\nn = 1000;\r\ny_correct = [13 17 31 37 71 73 79 97 107 113 149 157 167 179 199 311 337 347 359 389 701 709 733 739 743 751 761 769 907 937 941 953 967 971 983 991];\r\nassert(isequal(emirps(n),y_correct))\r\n\r\n%%\r\nn = 10007;\r\ny = emirps(n);\r\nlen_correct = 241;\r\nyp_correct = [3049 3371 3803 7321 7717 9173 9551 9967];\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(y(100:20:end),yp_correct))\r\n\r\n%%\r\nn = 100000;\r\ny = emirps(n);\r\nlen_correct = 1646;\r\nyp_correct = [17417 33287 39827 76607 92993 99401];\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(y(530:220:end),yp_correct))\r\n\r\n%%\r\nn = 1e6;\r\ny = emirps(n);\r\nsum_correct = 5129429596;\r\nlen_correct = 11184;\r\nassert(isequal(length(y),len_correct) \u0026\u0026 isequal(sum(y),sum_correct))\r\n\r\n%%\r\nfiletext = fileread('emirps.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'webread') || contains(filetext, 'urlread'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":142,"test_suite_updated_at":"2022-01-30T17:10:15.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-30T05:34:18.000Z","updated_at":"2026-01-06T08:07:22.000Z","published_at":"2020-09-30T05:52:30.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\u003eAn \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/Emirp.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eemirp\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a prime number that becomes a different prime when reversed. The numbers 13, 17, and 149 are emirps, but 11, 19, and 101 are not. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eList the emirps 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":46701,"title":"Compute the nth Naerogahtyp emirp","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: 6.60833px 8.05px; transform-origin: 6.60833px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45964-compute-the-nth-pythagorean-prime\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePythagorean prime\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: 311.542px 8.05px; transform-origin: 311.542px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a prime number that can be written as the sum of two squares. For example, 13 is a Pythagorean prime because it is \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL8AAAAmCAYAAACVg0qNAAAD50lEQVR4nO2c4bWzIAyG3x3cwAVcwAk6QTfoBt2gKziDI7hDV+gMrtD7A3NMuQioAaXNcw4/vh4/JeQlhKAXUBRFURRFURRFUb6FdmrV0R3JwC/Zqnh4AHizNgK44TuF8Uu2KgEeAHoANYwAbpiFcT2wXyn4JVuVABVM5LOh6Djk7U5SsthaobxcivrcwkSFb4DsaTzXNAAuC//3DeCZoF8paBD2XRZbn9PNfIN+FmqYZfAJ4A4TBcbp3+2B/dpKBaDDZ07L89pYSBCddAcFIVtHfNr6wjrfidl6Z504u/hbmIHrrd8rmAF8w0yGUqjxXwh2i7WHcmFXpDwDFUyAGmFsusP4kdsaOwFEbKUZVIL4uVBcg8RtKWUFGGAmLd+4Nfi/EsQ4ecC58/0Bxi47tW4w+zW2/7ttpc0En33S4pe8LwnCtQEiKPqXkPdeYGxZGhu+ItsrnQ1NfMk9m6TvWvhtiPEtv9duW3uY2cMj5pnFT9EhZhBLiP49/Dl9hc/833fdC+f23QX+jS1N9FDQErH1Nt2kRhnibxAXBXm0XLNZPIIO4SrVgLD4B6Spd+dMhSlohXy221bKsSgyliB+3kef+K+R15UCiX8pv+3gFoyEH3OJn9LvAf5URsTWJz4rCKWJ37c0xk4SG35msKdJnzfQHsbl9A7uUl+z8PtacoifKkA9wsLfbetjehh/UAni5/fybXa2it+uem1tkqlWjbkGbk8qSu8GR5Me7xTir2BWaV7mHeAOHiK2Uo3cvrgU8fOq1JLItqY9DdyDu7ZJ1tjJ6batob5KHXKl0gRVfki8vI34nAAitlJe5RLNHvHTEfVSo/teA9fFPmtpkIB5CaVrSjrssuF5cCpy+s6HvQKI79V6z033iN81e9e2mNouYQ9UBxMh6cic96fkN/7o9Y2U71rl9p0PfoA5QtDu23TDC9wz135FdM0HAw/4lyW+SV26Zu1Mr6c+09JJVQAe+V0rQylQGTp1leUI34X6I55qbZ3hZ9802Wzd7ALnqfZckUf4MeT0HZBo7xma4TxP5rNcInLmHEB+ILT2eWeo9pxJ+MBx4pdKpVY99OzVHh88ddsiwKOrPReEhd8gbyqXW/xUqctaqChd/LwKVGKFxz5xd0H7mW8W/4ADVr6Sxc+rP/dEz0gJCZ8+zFlqL+R/XVnSd7SZXfpohd7tyf4tQoni518/PXHeDzh88PfYY1puGyV9Z3+fMGCe2PR6wyF7HZ7vSi+rkgNYw0R6GsgO5dfyY/cSoXdfUiDpO/qrC9ymx/RbqSXpIDS7JQxsMZ9DKOmR9J2iKIqiKIqiKIqiKIqiKIqiKEqQP+NDZ8kTONqNAAAAAElFTkSuQmCC\" style=\"width: 95.5px; height: 19px;\" width=\"95.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 139.508px 8.05px; transform-origin: 139.508px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. In a similar way, a Naerogahtyp emirp is an \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46624-list-the-emirps\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eemirp\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: 117.833px 8.05px; transform-origin: 117.833px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e that can be written as the sum of two \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46676-list-the-erauqs\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 21.4px 8.05px; transform-origin: 21.4px 8.05px; \"\u003eerauqs\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 8.05px; transform-origin: 3.88333px 8.05px; 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: 156.233px 8.05px; transform-origin: 156.233px 8.05px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to find the nth Naerogahtyp emirp.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function ne = NaerogahtypEmirp(n)\r\n  ne = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\nne_correct = 1061;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 2;\r\nne_correct = 1069;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 5;\r\nne_correct = 15053;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 10;\r\nne_correct = 102769;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 29;\r\nne_correct = 1508621;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 53;\r\nne_correct = 11364701;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 101;\r\nne_correct = 106684421;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = 197;\r\nne_correct = 153918421;\r\nassert(isequal(NaerogahtypEmirp(n),ne_correct))\r\n\r\n%%\r\nn = [17 31 67];\r\nfor k = 1:3\r\n    ne(k) = NaerogahtypEmirp(n(k));\r\nend\r\nsum_correct = 102944443;\r\nassert(isequal(sum(ne),sum_correct))","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":16,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-06T21:38:21.000Z","updated_at":"2025-11-17T17:22:23.000Z","published_at":"2020-10-20T04:54:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45964-compute-the-nth-pythagorean-prime\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ePythagorean prime\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a prime number that can be written as the sum of two squares. For example, 13 is a Pythagorean prime because it is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e4+9=2^2+3^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. In a similar way, a Naerogahtyp emirp is an \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46624-list-the-emirps\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eemirp\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e that can be written as the sum of two \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46676-list-the-erauqs\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eerauqs\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to find the nth Naerogahtyp emirp.\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":45994,"title":"Investigate the frequency of last digits of prime numbers","description":"The last digit of a prime number greater than 5 can be 1, 3, 7, or 9. If the primes are distributed randomly, then these digits should be equally likely. However, \u003chttps://www.independent.co.uk/news/science/maths-experts-stunned-as-they-crack-a-pattern-for-prime-numbers-a6933156.html mathematicians discovered\u003e relatively recently that--as Robert Lemke Oliver put it--these digits \"really hate to repeat themselves\". In other words, last digits repeat less often than expected. \r\n\r\nFor example, five primes less than 100 end in a 1 (11, 31, 61, 71, and 91), and none of them are followed by a prime ending in a 1. In fact, none of the primes less than 100 and ending in 3, 7, or 9 are followed by a prime ending in 3, 7, or 9, respectively. \r\n\r\nWrite a function to compute the frequency of the last digits of primes between 7 and the input number. Return a matrix whose rows correspond to the digits of the first prime and columns correspond to the digits of the next prime. Please remember to (a) omit 2, 3, and 5 and (b) account for the prime following the last prime in your list. For the example given above, the function should return\r\n\r\n         0    0.6000    0.4000         0\r\n         0         0    0.3333    0.6667\r\n    0.6667    0.1667         0    0.1667\r\n    0.4000    0.4000    0.2000         0\r\n\r\nFor example, six primes less than 100 end in 7. They are followed by four primes ending in 1 (including 101), one prime ending in 3, zero primes ending in 7, and one prime ending 9. The frequencies, reported in the third row, are thus 2/3, 1/6, and 1/6. ","description_html":"\u003cp\u003eThe last digit of a prime number greater than 5 can be 1, 3, 7, or 9. If the primes are distributed randomly, then these digits should be equally likely. However, \u003ca href = \"https://www.independent.co.uk/news/science/maths-experts-stunned-as-they-crack-a-pattern-for-prime-numbers-a6933156.html\"\u003emathematicians discovered\u003c/a\u003e relatively recently that--as Robert Lemke Oliver put it--these digits \"really hate to repeat themselves\". In other words, last digits repeat less often than expected.\u003c/p\u003e\u003cp\u003eFor example, five primes less than 100 end in a 1 (11, 31, 61, 71, and 91), and none of them are followed by a prime ending in a 1. In fact, none of the primes less than 100 and ending in 3, 7, or 9 are followed by a prime ending in 3, 7, or 9, respectively.\u003c/p\u003e\u003cp\u003eWrite a function to compute the frequency of the last digits of primes between 7 and the input number. Return a matrix whose rows correspond to the digits of the first prime and columns correspond to the digits of the next prime. Please remember to (a) omit 2, 3, and 5 and (b) account for the prime following the last prime in your list. For the example given above, the function should return\u003c/p\u003e\u003cpre\u003e         0    0.6000    0.4000         0\r\n         0         0    0.3333    0.6667\r\n    0.6667    0.1667         0    0.1667\r\n    0.4000    0.4000    0.2000         0\u003c/pre\u003e\u003cp\u003eFor example, six primes less than 100 end in 7. They are followed by four primes ending in 1 (including 101), one prime ending in 3, zero primes ending in 7, and one prime ending 9. The frequencies, reported in the third row, are thus 2/3, 1/6, and 1/6.\u003c/p\u003e","function_template":"function f = primeLastDigit(n)\r\n  f = ...;\r\nend","test_suite":"%%\r\nn = 100;\r\nf_correct = [0 0.6000 0.4000 0; 0 0 0.3333 0.6667; 0.6667 0.1667 0 0.1667; 0.4000 0.4000 0.2000 0];\r\nassert(isequal(round(primeLastDigit(n),4),f_correct))\r\n\r\n%%\r\nn = 149;\r\nf_correct = [0 0.5714 0.4286 0; 0 0 0.5000 0.5000; 0.5556 0.1111 0 0.3333; 0.3750 0.3750 0.1250 0.1250];\r\nassert(isequal(round(primeLastDigit(n),4),f_correct))\r\n\r\n%%\r\nn = 1e4;\r\nf_correct = [0.1340 0.3399 0.4020 0.1242; 0.1715 0.1036 0.3236 0.4013; 0.2922 0.2890 0.0974 0.3214; 0.4026 0.2772 0.1815 0.1386];\r\nassert(isequal(round(primeLastDigit(n),4),f_correct))\r\n\r\n%%\r\nn = 1e6;\r\nf_correct = [0.1638 0.3211 0.3339 0.1812; 0.2231 0.1430 0.2959 0.3380; 0.2583 0.2774 0.1464 0.3178; 0.3546 0.2609 0.2234 0.1610];\r\nassert(isequal(round(primeLastDigit(n),4),f_correct))\r\n\r\n%%\r\nn = 1e8;\r\nf_correct = [0.1770 0.3039 0.3103 0.2087; 0.2364 0.1667 0.2869 0.3101; 0.2558 0.2732 0.1668 0.3042; 0.3308 0.2562 0.2362 0.1768];\r\nassert(isequal(round(primeLastDigit(n),4),f_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-26T15:36:30.000Z","updated_at":"2025-12-01T14:59:44.000Z","published_at":"2020-06-26T17:51:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe last digit of a prime number greater than 5 can be 1, 3, 7, or 9. If the primes are distributed randomly, then these digits should be equally likely. However,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.independent.co.uk/news/science/maths-experts-stunned-as-they-crack-a-pattern-for-prime-numbers-a6933156.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emathematicians discovered\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e relatively recently that--as Robert Lemke Oliver put it--these digits \\\"really hate to repeat themselves\\\". In other words, last digits repeat less often than expected.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, five primes less than 100 end in a 1 (11, 31, 61, 71, and 91), and none of them are followed by a prime ending in a 1. In fact, none of the primes less than 100 and ending in 3, 7, or 9 are followed by a prime ending in 3, 7, or 9, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to compute the frequency of the last digits of primes between 7 and the input number. Return a matrix whose rows correspond to the digits of the first prime and columns correspond to the digits of the next prime. Please remember to (a) omit 2, 3, and 5 and (b) account for the prime following the last prime in your list. For the example given above, the function should return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[         0    0.6000    0.4000         0\\n         0         0    0.3333    0.6667\\n    0.6667    0.1667         0    0.1667\\n    0.4000    0.4000    0.2000         0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, six primes less than 100 end in 7. They are followed by four primes ending in 1 (including 101), one prime ending in 3, zero primes ending in 7, and one prime ending 9. The frequencies, reported in the third row, are thus 2/3, 1/6, and 1/6.\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":46046,"title":"Determine whether a number is a cluster prime","description":"A \u003chttps://mathworld.wolfram.com/ClusterPrime.html cluster prime\u003e is an odd prime number _p_ such that all even numbers less than or equal to _p_-3 can be expressed as a difference of two primes _q_ and _q'_ that are no larger than _p_.  \r\n\r\nWrite a function to determine whether a number is a cluster prime.","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: 4.66667px 7.91667px; transform-origin: 4.66667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/ClusterPrime.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ecluster prime\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: 75.4667px 7.91667px; transform-origin: 75.4667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is an odd prime number\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 150.533px 7.91667px; transform-origin: 150.533px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e such that all even numbers less than or equal to\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAAB4klEQVRoge2ZW7GDMBCGPw84wEAMoAAFdVAHOMBCNVQCHrCAhlroeVh22FLg0HBpMs03k6eUdPn3kk2ARCKRSCQS8eOAK1ABFyD/rjlh4YAOeE6M6ot2BYMDHkADlECBRJMV7fo16wKhQ1JrTMYgVHuqRYFxYTmdakSkxznmhIlDImaOChGpOcecOLkjIpW+C2RIkSsRxW/9ANk6a8QDTT+/5LEQcYhA9ZZFVCRVWxeskIJXI6LpXEs8QhVIHbqzk80FgxBNv7ClMfPeYXsSBa+O1aK92W4tbk/eBRrPbwrdgykQWyteHauj2LJ4y6D4VBv/qUi5MdZ3TPU9n5LzKpZ3r5SxHEUw9Bpr082mr++Ys+VTbEM5FwT/UhrD5rzXmt+s+ZM9ImnP2nc19jufBbTIPZjeBXL29+7Z2Mj2iiQNxTWp5uWFAFCROp+HbZRMnZJzJMJiv27QdPN6hwvLUaK1KOQ004Z4Lo20cHs3wrbTHi+gteo2figw7DuMj04ZIk7HhhtKTSW7tZf9wi0bm6+TsD2cbkB63uyQVPM+lujhTxtEvZeJ8V7Y8d4+7LLJWA/EumsdjrbrP31jt8Sao8jPY48iP/8VYUyGCGQ/tdyRXSyWy7TD0cZraiSREonE0fwBJhLHJZuwMcMAAAAASUVORK5CYII=\" alt=\"p-3\" 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: 74.3px 7.91667px; transform-origin: 74.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e can be expressed as a difference of two primes\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \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);\"\u003eq\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 13.6167px 7.91667px; transform-origin: 13.6167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAYAAACe0YppAAABJ0lEQVRYhe2WYQ2DMBCFPw84qAEMoAAFOMABDmahGpAwD7OABiywH+2lt6VsZBwlS/gS/tCmL717fS1cXPwpNVCVFu2BBbiVFn5E4a6kqIuiE4VLLWXuS4oCjJyw24qTdtsSjGWGIzh04PNufBQ3EfSE8nmgieIemNV/ocKgt3VcfI6CGjmnS2ZsF+0HUYB7FJ0xdK8jlXGtnzI+WolC2s2aO2tSmc0isVWLrrnTqznOSngk9S6H5PBCqIwZsuha70Y1Z7ASbdSiuXu0U+MLodfmwv5trCME/7dW/IQEvNylDaGnA+k859LKhIHXcsqxcmxz/C5q0mWg+yjHyDSttnBIWn1DG6/oJX/jgLTawkRy++FUhBLrtJo4yNEaeW3kvqIP9YufeQJgwmvH4HW5FwAAAABJRU5ErkJggg==\" alt=\"q'\" style=\"width: 15px; height: 18px;\" width=\"15\" 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: 70.8px 7.91667px; transform-origin: 70.8px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e that are no larger than\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 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: 204.467px 7.91667px; transform-origin: 204.467px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine whether a number is a cluster prime.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isClusterPrime(n)\r\n  tf = false\r\nend","test_suite":"%%\r\nn = 2;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 53;\r\nassert(isClusterPrime(n))\r\n\r\n%%\r\nn = 87;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 97;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 311;\r\nassert(isClusterPrime(n))\r\n\r\n%%\r\nn = 314;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 509;\r\nassert(isClusterPrime(n))\r\n\r\n%%\r\nn = 631;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 751;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 983;\r\nassert(isClusterPrime(n))\r\n\r\n%%\r\nn = 2707;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 4597;\r\nassert(~isClusterPrime(n))\r\n\r\n%%\r\nn = 10891;\r\nassert(isClusterPrime(n));","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":46,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-14T00:00:56.000Z","updated_at":"2025-11-15T16:07:54.000Z","published_at":"2020-07-14T01:23:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/ClusterPrime.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ecluster prime\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is an odd prime number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e such that all even numbers less than or equal to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p-3\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep-3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e can be expressed as a difference of two primes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"q\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eq\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:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"q'\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eq\\\\prime\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e that are no larger than\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine whether a number is a cluster prime.\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":46047,"title":"Identify Wagstaff primes","description":"The numbers 3, 43, and 2731 are examples of \u003chttps://mathworld.wolfram.com/WagstaffPrime.html Wagstaff primes\u003e. \r\n\r\nWrite a function to identify Wagstaff primes in the input.","description_html":"\u003cp\u003eThe numbers 3, 43, and 2731 are examples of \u003ca href = \"https://mathworld.wolfram.com/WagstaffPrime.html\"\u003eWagstaff primes\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eWrite a function to identify Wagstaff primes in the input.\u003c/p\u003e","function_template":"function tf = isWagstaff(n)\r\n  tf = f(n);\r\nend","test_suite":"%%\r\nn = 3;\r\nassert(isWagstaff(n))\r\n\r\n%%\r\nn = 11;\r\nassert(isWagstaff(n))\r\n\r\n%%\r\nn = 43;\r\nassert(isWagstaff(n))\r\n\r\n%%\r\nn = 10923;\r\nassert(~isWagstaff(n))\r\n\r\n%%\r\nn = 178956971;\r\nassert(~isWagstaff(n))\r\n\r\n%%\r\nn = 2932031007403;\r\nassert(isWagstaff(n))\r\n\r\n%%\r\nq = primes(40);\r\nn = (2.^q+1)/3;\r\nassert(isequal(isWagstaff(n),[0 1 1 1 1 1 1 1 1 0 1 0])),","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":56,"test_suite_updated_at":"2020-07-18T17:37:48.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-17T01:44:57.000Z","updated_at":"2025-11-17T00:34:12.000Z","published_at":"2020-07-17T02:02:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe numbers 3, 43, and 2731 are examples of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/WagstaffPrime.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWagstaff primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to identify Wagstaff primes in the input.\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":46099,"title":"Identify full reptend primes","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/groups/50/problems/273\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 273\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: 61.4667px 7.8px; transform-origin: 61.4667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which is based on \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://projecteuler.net/problem=26\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProject Euler Problem 26\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: 57.95px 7.8px; transform-origin: 57.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, introduced me to \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/FullReptendPrime.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003efull reptend 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: 9.71667px 7.8px; transform-origin: 9.71667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. If \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ep\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 51.35px 7.8px; transform-origin: 51.35px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a full reptend prime, then \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAlCAYAAAAJBxroAAAByUlEQVRYhe2Y/Y2DMAzFfztkAxboAkzABGzQDW4DVmAGRugOrNAZWKH3h2PVQvQAxxVIx5MiIYXEfvgjj8CFC/8et6Md+AYSMAH10Y5EowWeRzth0QJVwD4D0AXsUwz9wi/Ka6MK2qcINW9COkodunNwGjZ5JCR1ooiNCLlT4IcYYpqGEXUagihiHfAI8SgIUcSeSCM6DSKI1Xl92vBuyu832XafB0gaa+QfeX7LnouIIGadW4MSs02ry34883Nv5kac5CKITUgE9kCj/EKiM8zmH2Z+795AObEWIVZid05qPu9SMqXEvBJqzDYnlo+IQ4mlwnWfogVC5rBU9Eqoxtj8dESM5h3XoV9CzCuhtOtNLHc8VTF/RXQVXmIlEkrF95Y0dIsGL7EOidhe2GgsRbtCIvnKvrnhJeaVUO2KPa0tdwoqPGG/sV1CzWEVx3y91t5WFbOIxPtwtYW6pWZ6/F/U2tM23iCRGim8BKqQFPw01jqdR0LBO9J66LbZXtR9SxEafBIK4n6RvoIBfw2osPV+mK/BK6Hs2pCOF42Sy1Aro05z4aMY2X9oJoSUveobkO7n/juOhFdC6R/z0jgFsRsnubq+cOEk+AX6L71CZkqzggAAAABJRU5ErkJggg==\" alt=\"1/p\" style=\"width: 27px; height: 18.5px;\" width=\"27\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 50.1833px 7.8px; transform-origin: 50.1833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e has a period of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABeUlEQVRoge2Zca2EMAzGPw9zgIEzcAqmAAfnAAdYQAMS8ICF04CFe3+szWsIvO2gA8brL2lCMujGx9puAzAMwzAM417UAKqzB3FVagBvAB8Aj5PHcjme+BWHzUQSeDIHoIeJFKWBiRTFREpAVSSHkOw8Oe7IgFA6WwADWUP3l0AWkWSia6mTN113om1EGUJlCbencDogiCYZRLvX6jQjWUSSTucCzdtbrU4zkkWkkRxOWF7GfytSRc/ssXrz22QQyeHvWQQEYb4JNxm+W21tLCmoi+SFw7WvN4p7UjaMGjNpT+5TF4mr14TlylVB5+seibpIvCFMCbVSVq+qIslZ8lppn6i92dvZgaiKVEeccS4qJcwYVZHkSnuejzhXdfOHCkA1RXAoydLuEWbQiFDKS8IhRId8rx47jnAfwlFLznkRV+K5cGzZsZRzo9iZSwK8aZ3OHshVSdmK/HvkVmRTrN4ZhyCQ/O3SI1SxEg7TDoFPIpfMRDIMIzc/9Bu4+nar+LwAAAAASUVORK5CYII=\" alt=\"p-1\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 108.133px 7.8px; transform-origin: 108.133px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. That is, the decimal expansion of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAlCAYAAAAJBxroAAAByUlEQVRYhe2Y/Y2DMAzFfztkAxboAkzABGzQDW4DVmAGRugOrNAZWKH3h2PVQvQAxxVIx5MiIYXEfvgjj8CFC/8et6Md+AYSMAH10Y5EowWeRzth0QJVwD4D0AXsUwz9wi/Ka6MK2qcINW9COkodunNwGjZ5JCR1ooiNCLlT4IcYYpqGEXUagihiHfAI8SgIUcSeSCM6DSKI1Xl92vBuyu832XafB0gaa+QfeX7LnouIIGadW4MSs02ry34883Nv5kac5CKITUgE9kCj/EKiM8zmH2Z+795AObEWIVZid05qPu9SMqXEvBJqzDYnlo+IQ4mlwnWfogVC5rBU9Eqoxtj8dESM5h3XoV9CzCuhtOtNLHc8VTF/RXQVXmIlEkrF95Y0dIsGL7EOidhe2GgsRbtCIvnKvrnhJeaVUO2KPa0tdwoqPGG/sV1CzWEVx3y91t5WFbOIxPtwtYW6pWZ6/F/U2tM23iCRGim8BKqQFPw01jqdR0LBO9J66LbZXtR9SxEafBIK4n6RvoIBfw2osPV+mK/BK6Hs2pCOF42Sy1Aro05z4aMY2X9oJoSUveobkO7n/juOhFdC6R/z0jgFsRsnubq+cOEk+AX6L71CZkqzggAAAABJRU5ErkJggg==\" alt=\"1/p\" style=\"width: 27px; height: 18.5px;\" width=\"27\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 45.5px 7.8px; transform-origin: 45.5px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e has strings of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAkCAYAAADFGRdYAAABeUlEQVRoge2Zca2EMAzGPw9zgIEzcAqmAAfnAAdYQAMS8ICF04CFe3+szWsIvO2gA8brL2lCMujGx9puAzAMwzAM417UAKqzB3FVagBvAB8Aj5PHcjme+BWHzUQSeDIHoIeJFKWBiRTFREpAVSSHkOw8Oe7IgFA6WwADWUP3l0AWkWSia6mTN113om1EGUJlCbencDogiCYZRLvX6jQjWUSSTucCzdtbrU4zkkWkkRxOWF7GfytSRc/ssXrz22QQyeHvWQQEYb4JNxm+W21tLCmoi+SFw7WvN4p7UjaMGjNpT+5TF4mr14TlylVB5+seibpIvCFMCbVSVq+qIslZ8lppn6i92dvZgaiKVEeccS4qJcwYVZHkSnuejzhXdfOHCkA1RXAoydLuEWbQiFDKS8IhRId8rx47jnAfwlFLznkRV+K5cGzZsZRzo9iZSwK8aZ3OHshVSdmK/HvkVmRTrN4ZhyCQ/O3SI1SxEg7TDoFPIpfMRDIMIzc/9Bu4+nar+LwAAAAASUVORK5CYII=\" alt=\"p-1\" style=\"width: 36.5px; height: 18px;\" width=\"36.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 71.5667px 7.8px; transform-origin: 71.5667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e digits that repeat. The first five full reptend primes are 7, 17, 19, 23, and 29.  \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 227.033px 7.8px; transform-origin: 227.033px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that determines whether the input is a full reptend prime. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isFullReptendPrime(n)\r\n  tf = f(n);\r\nend","test_suite":"%%\r\nn = 3;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 5;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 7;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 19;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 23;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 47;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 53;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 101;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 128;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 379;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 1607;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 9967;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 9973;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 28513;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 177217;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 225457;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nn = 225547;\r\nassert(~isFullReptendPrime(n))\r\n\r\n%%\r\nn = 308927;\r\nassert(isFullReptendPrime(n))\r\n\r\n%%\r\nfiletext = fileread('isFullReptendPrime.m');\r\nreading = ~isempty(strfind(filetext, 'urlread')) || ~isempty(strfind(filetext, '001913'));\r\nassert(~reading, 'Illegal approach')","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-08-04T01:38:04.000Z","updated_at":"2025-11-15T16:17:10.000Z","published_at":"2020-08-04T02:03:14.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/groups/50/problems/273\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 273\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, which is based on \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://projecteuler.net/problem=26\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProject Euler Problem 26\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, introduced me to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/FullReptendPrime.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efull reptend primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. If \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is a full reptend prime, then \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"1/p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e1/p\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e has a period of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p-1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep-1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. That is, the decimal expansion 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=\\\"1/p\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e1/p\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e has strings of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p-1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep-1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e digits that repeat. The first five full reptend primes are 7, 17, 19, 23, and 29.  \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that determines whether the input is a full reptend prime. \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":46054,"title":"Count trailing zeros in a primorial","description":"\u003chttps://www.mathworks.com/matlabcentral/cody/problems/44068-the-number-of-trailing-zero-digit-of-a-factorial Cody Problem 44068\u003e asked us to count the  trailing zeros in a factorial. This problem deals with the  _\u003chttps://mathworld.wolfram.com/Primorial.html primorial\u003e_. If p_n is the nth prime number, then the primorial p_n# is the product of the prime numbers up to and including p_n. For example, if n = 5, then p_5# = 2*3*5*7*11 = 2310, which has one trailing zero. \r\n\r\nCount the trailing zeros in the primorial p_n#. Because primorials become large quickly, for large n it helps to derive a formula for the number of trailing zeros.* \r\n\r\nPlease make your code general because I might add more tests later. \r\n\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: 205px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 102.5px; transform-origin: 407px 102.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63.75px; 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.8833px; text-align: left; transform-origin: 384px 31.8833px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44068-the-number-of-trailing-zero-digit-of-a-factorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 44068\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: 238.833px 7.91667px; transform-origin: 238.833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asked us to count the trailing zeros in a factorial. This problem deals with the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/Primorial.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"font-style: italic; \"\u003eprimorial\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: 9.71667px 7.91667px; transform-origin: 9.71667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. If \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 20.6167px 7.91667px; transform-origin: 20.6167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is 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: 7.28333px 7.91667px; transform-origin: 7.28333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime number, then the primorial \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 178.55px 7.91667px; transform-origin: 178.55px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e# is the product of the prime numbers up to and including \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 52.1167px 7.91667px; transform-origin: 52.1167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For example, if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 29.85px 7.91667px; transform-origin: 29.85px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 5, then \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABUElEQVRYhe2WUZGEMAxAnwccYAADKEDBOlgHOMACGlYCHrCABizsfTSZy3abXtnr3VffTGaYSZukSRoKjUaj0Wj8MR0wAhMwA6sIQA8swCYyy/rqzh/AU2QRR4d8r0a31w4ACUAdbBKMZTP6qbbz2RiPHcf6pbbzXQyfhFr/1vng2HmjI39qxKGX9pvRqRwU9sZkNt2cNbtZE59o47tJVTw7b2g3n060PX5mRi6cMsXhGFZsyodI95D994TuR+yp7o7+FP2c2WvnQFGjwWuzpCLXWntZ0eloB9GTwjLYyRZvUINrvMmhLwj2BU2pvUKTGNkJJ7uCLVOWwTheCCXQa1JctwSasWzq7dS63KkFdrPO9WdxVnQMIYt7bkHJSP0UvfcudqRmF2bQxrI/Gn2MJFPeiWOdanry0duQQR8cWrqV0KyuHX25pKT6C6XRaPw7XzNJhcKNex7mAAAAAElFTkSuQmCC\" alt=\"p_5\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.8667px 7.91667px; transform-origin: 11.8667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e# = \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALgAAAAkCAYAAAA6l/D/AAADYElEQVR4nO2b3XGEMAyEtwc6oAEaoIJUQAd0QAdp4WpICfRwLVwNtHB5gM3ZDj9HbCRlRt+MnxIuG3uRZNkHOI7jOI7jOI7jOI7zr6i1BTjbtACGZfQAGl05AGYNPWZNHWwYaNgZoxEd6WgFdaXUmNdO+tkfWgAPAM+V8QWgyv0Df6DZ0TQo6CHdhiaO7MV4k/ZARzo0DF4DuOHlI6lnI8KJGpcxIZ6cEbImbxYNI4CPRWOP2PC9oJ6QxzLGlXGD3Dxx8e8bWsblZ89FryQVgE/8DpRXP7v6YVysNPV3iI0uaagH1iMh9XJhpWH01shoIfWi4+Pg96j383JFMQPmINXgvElznv1Fh9kwWwsWpmOp2rLDfgnCt3uSkRNxR2a6LATr6iO+oFeekByTZhucJcAejOJShmqwHyEHyL5whKXcCP1NW4XjLFJBLxCEqBq8x/FEjbAxUYRR6ejFLA3nIRwT5oxiobOTwux7U9ahavB34MJaSM2sy6RryhqvDdvamCD/wh2hFQhSzBucJYr2RLWLFq22JWFfdi2ia5YtIWF5or0hNm1wRsw79CaqxaslZi1ipucHext2SayUJ4Bxg9NYWpEpPFm1GjErxOWLhRfPSnkCGDZ4br3Lk8iS0bZGbPSzvXD29u8oew0h7Nmena/SmkqUJ2zFligHTRqcUSnngxlFSp+khYc9E851MMKDq9Lpm1H87JyV1pRbnoQv6xP5Vw9MGvyG/ON59quvENgHn30m6oXRv/TJLP/fs/9raU255UmF+KXLzSrmDF7C3KRbRumNV3h/5kwErzCb6IralAY/W6KU1MQj/NzuSY3XkXkupgxe0txXQoNLXyLagxtyzY0dM5uF7gkxY3B2KvbM/QEbd8S5kJrXZkOY1rXbhNwHWOieEBMG505+L93zCuvVC1hhjtBbWrjJlOzN8wLYVluS5YnUXfA1WJ48YSsDqxucu+6tO84cUqkv7L4MiBeL3Z0H5O5/pF8sSO98M5to3U9PdUhfQtuDLcu/mDTn2R+Ovp2icbASdl+4YeJL9sB7F8RKkx4yURMziYWyjeWJZhYJaRAHqwnva8t5NuLMd/okI1ST/G0Ltb9FTSHUZaE8YUm3NfbmLedZx3Ecx3Ecx3Ecx3Ecx3Ecx3Ec5z/yDQ0/w8DiRRB6AAAAAElFTkSuQmCC\" alt=\"2*3*5*7*11\" style=\"width: 92px; height: 18px;\" width=\"92\" 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: 112.233px 7.91667px; transform-origin: 112.233px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 2310, which has one trailing zero.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42.25px; 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 21.1333px; text-align: left; transform-origin: 384px 21.1333px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 121.767px 7.91667px; transform-origin: 121.767px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCount the trailing zeros in the primorial \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 254.467px 7.91667px; transform-origin: 254.467px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#. Because primorials become large quickly, for large n it helps to derive a formula for the number of trailing zeros.*\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: 215.1px 7.91667px; transform-origin: 215.1px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease make your code general because I might add more tests later.\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.1833px 7.91667px; transform-origin: 29.1833px 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/46057-find-the-last-non-zero-digit-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problems 46057 \"Find the last non-zero digit in a primorial\"\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: 15.5667px 7.91667px; transform-origin: 15.5667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46060-identify-primorial-primes\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46060 \"Identify primorial 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: 1.95px 7.91667px; transform-origin: 1.95px 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: 9.33333px 7.91667px; transform-origin: 9.33333px 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 = primorialTrailingZeros(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(primorialTrailingZeros(n),y_correct))\r\n\r\n%%\r\nn = 2;\r\ny_correct = 0;\r\nassert(isequal(primorialTrailingZeros(n),y_correct))\r\n\r\n%%\r\nn = 5;\r\ny_correct = 1;\r\nassert(isequal(primorialTrailingZeros(n),y_correct))\r\n\r\n%%\r\nn = 10;\r\ny_correct = sin((n+3)*pi/2);\r\nassert(isequal(primorialTrailingZeros(n),y_correct))\r\n\r\n%%\r\nn = 100;\r\ny_correct = sum(1./2.^(1:n));\r\nassert(isequal(primorialTrailingZeros(n),y_correct))\r\n\r\n%%\r\nn = 1e4;\r\ny_correct = besselj(mod(n,10),prod(num2str(n)'-'0'));\r\nassert(isequal(primorialTrailingZeros(n),y_correct))\r\n\r\n%%\r\nn = 1e6;\r\nf = [factor(log10(n)) 3 7 7 89];\r\ny_correct = length(primes(n))/prod(f);\r\nassert(isequal(primorialTrailingZeros(n),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":83,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-26T15:54:06.000Z","updated_at":"2025-12-09T22:52:30.000Z","published_at":"2020-07-26T16:20:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44068-the-number-of-trailing-zero-digit-of-a-factorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 44068\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e asked us to count the trailing zeros in a factorial. This problem deals with the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/Primorial.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprimorial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. If \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime number, then the primorial \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e# is the product of the prime numbers up to and including \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"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 = 5, then \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_5\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e# = \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"2*3*5*7*11\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2\\\\cdot3\\\\cdot5\\\\cdot7\\\\cdot11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e = 2310, which has one trailing zero.\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\u003eCount the trailing zeros in the primorial \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#. Because primorials become large quickly, for large n it helps to derive a formula for the number of trailing zeros.*\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\u003ePlease make your code general because I might add more tests later.\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/46057-find-the-last-non-zero-digit-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problems 46057 \\\"Find the last non-zero digit in a primorial\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46060-identify-primorial-primes\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46060 \\\"Identify primorial primes\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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":46057,"title":"Find the last non-zero digit in a primorial","description":"\u003chttps://www.mathworks.com/matlabcentral/cody/groups/2001/problems/45251 Cody Problem 45251\u003e asked us to find the last non-zero digit in a factorial. For this problem consider the primorial p_n#, the product of primes up to and including the nth prime p_n. For example, for n = 12, the primorial is 7420738134810, whose last non-zero digit is 1.\r\n\r\nFind the last non-zero digit in the primorial p_n#. \r\n\r\nSee also \u003chttps://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial Cody Problem 46054\u003e \"Count trailing zeros in a primorial\".","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: 123.75px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 61.8833px; transform-origin: 407px 61.8833px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63.5px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.75px; text-align: left; transform-origin: 384px 31.75px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/groups/2001/problems/45251\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45251\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: 284.733px 7.91667px; transform-origin: 284.733px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asked us to find the last non-zero digit in a factorial. For this problem consider the primorial \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.45px 7.91667px; transform-origin: 19.45px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#, the product of primes up to and including 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: 27.2333px 7.91667px; transform-origin: 27.2333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.7833px 7.91667px; transform-origin: 56.7833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For example, for \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: 143.75px 7.91667px; transform-origin: 143.75px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 12, the primorial is 7420738134810, whose last non-zero digit is 1.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.25px; 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.6333px; text-align: left; transform-origin: 384px 10.6333px; 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: 132.267px 7.91667px; transform-origin: 132.267px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFind the last non-zero digit in the primorial \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 5.83333px 7.91667px; transform-origin: 5.83333px 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: 27.2333px 7.91667px; transform-origin: 27.2333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSee also\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problems 46054\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: 124.783px 7.91667px; transform-origin: 124.783px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \"Count trailing zeros in a primorial\" and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46060-identify-primorial-primes\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46060 \"Identify primorial 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: 1.95px 7.91667px; transform-origin: 1.95px 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 = primorialLastNonzeroDigit(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 2;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 2;\r\ny_correct = 6;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 3;\r\ny_correct = 3;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 4;\r\ny_correct = 1;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 12;\r\ny_correct = 1;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 29;\r\ny_correct = 3;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 53;\r\ny_correct = 3;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 89;\r\ny_correct = 7;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 163;\r\ny_correct = 3;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 211;\r\ny_correct = 1;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 254;\r\ny_correct = 9;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 350;\r\ny_correct = 7;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 1379;\r\ny_correct = 3;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 37913;\r\ny_correct = 3;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))\r\n\r\n%%\r\nn = 1379137;\r\ny_correct = 9;\r\nassert(isequal(primorialLastNonzeroDigit(n),y_correct))","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":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-26T18:50:12.000Z","updated_at":"2025-11-15T15:07:03.000Z","published_at":"2020-07-26T19:43:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/groups/2001/problems/45251\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45251\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e asked us to find the last non-zero digit in a factorial. For this problem consider the primorial \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#, the product of primes up to and including the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"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 = 12, the primorial is 7420738134810, whose last non-zero digit is 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the last non-zero digit in the primorial \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problems 46054\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \\\"Count trailing zeros in a primorial\\\" and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46060-identify-primorial-primes\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46060 \\\"Identify primorial primes\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46060,"title":"Identify primorial primes","description":"Cody Problems \u003chttps://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial 46054\u003e and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial 46057\u003e deal with the \u003chttps://mathworld.wolfram.com/Primorial.html primorial\u003e p_n#, which is the product of all primes up to and including the nth prime p_n. The primorials corresponding to n = 1 through 5 are 2, 6, 30, 210, and 2310. \u003chttps://mathworld.wolfram.com/PrimorialPrime.html Primorial primes\u003e are prime numbers that are either one smaller or one larger than a primorial. Examples include 3, 5, 7, 29, 31, 211, 2309, and 2311. \r\n\r\nWrite a function to identify primorial primes and their associated primorials. Given an input |x|, return a variable |y| with one of the following values:\r\n\r\n y = 1    if x is a primorial prime\r\n y = 0    if x is prime but not a primorial prime\r\n y = -Inf if x is composite or 1\r\n\r\nAlso return a variable |p| that is the associated primorial in the first case and |NaN| in the other two cases.","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: 246.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 123.4px; transform-origin: 407px 123.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63.5px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.75px; text-align: left; transform-origin: 384px 31.75px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 47.85px 7.91667px; transform-origin: 47.85px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCody Problems\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46054\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 13.6167px 7.91667px; transform-origin: 13.6167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46057\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: 41.2333px 7.91667px; transform-origin: 41.2333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e deal with the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/Primorial.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eprimorial\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 183.6px 7.91667px; transform-origin: 183.6px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#, which is the product of all primes up to and including 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: 7.78333px 7.91667px; transform-origin: 7.78333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABU0lEQVRYhe2Wa7GDMBCFPw84wEANoAAFOLgOcIAFNFQCHmIBDbHQ/mAXlpQELpP2V85MZhjyOGefCRQUFBQUFHwZFdAALdADowyAGhiASUYv67OTP4GXjEGIZvkezZzLLQARoASTiLGYzHybm7w3h4fE4fyQm9zJwZ4l1j8jr0hbjRB+xe2tObiLrHFmzZFnbkOz2XOcyTXnnrmN+eRg6/JHTmJr1V9k3st8n5MYlhinrNJYH3mlYwnZJOsQgZ541exgO1sYb82FMdxkoCXYs4SnYwtTLHlXqEttCbViiWPpfFfEP9nCpqKTex/sG0cnFnRcLycVb8Myy0jeAbZr3clivQ+82a8JfFqSeln4G8Swibc5oQl8VDkrrrTUM6h46zWNd00i4WxLTapM4MVnbL380/zZoRJi7WpqecP/HgkqPrzhXOT/St5ERvYXSkFBwc/xBpPKhVYv9UiJAAAAAElFTkSuQmCC\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 104.25px 7.91667px; transform-origin: 104.25px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The primorials corresponding to \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: 131.267px 7.91667px; transform-origin: 131.267px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 1 through 5 are 2, 6, 30, 210, and 2310.\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/PrimorialPrime.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePrimorial 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: 62.6333px 7.91667px; transform-origin: 62.6333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are prime numbers that are either one smaller or one larger than a primorial. Examples include 3, 5, 7, 29, 31, 211, 2309, and 2311.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 278px 7.91667px; transform-origin: 278px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to identify primorial primes and their associated primorials. Given an input\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.91667px; transform-origin: 3.85px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ex\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: 54.4667px 7.91667px; transform-origin: 54.4667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return a variable\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.91667px; transform-origin: 3.85px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ey\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: 37.7333px 7.91667px; transform-origin: 37.7333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with one of the following values:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 61.3px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30.65px; transform-origin: 404px 30.65px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 134.75px 7.91667px; transform-origin: 134.75px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 38.5px 7.91667px; transform-origin: 38.5px 7.91667px; \"\u003e y = 1    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); perspective-origin: 11.55px 7.91667px; text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 11.55px 7.91667px; \"\u003eif \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 19.25px 7.91667px; transform-origin: 19.25px 7.91667px; \"\u003ex is \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 65.45px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 65.45px 7.91667px; \"\u003ea primorial prime\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 188.65px 7.91667px; transform-origin: 188.65px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 38.5px 7.91667px; transform-origin: 38.5px 7.91667px; \"\u003e y = 0    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); perspective-origin: 11.55px 7.91667px; text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 11.55px 7.91667px; \"\u003eif \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 19.25px 7.91667px; transform-origin: 19.25px 7.91667px; \"\u003ex is \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 119.35px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 119.35px 7.91667px; \"\u003eprime but not a primorial prime\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 123.2px 7.91667px; transform-origin: 123.2px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 38.5px 7.91667px; transform-origin: 38.5px 7.91667px; \"\u003e y = -Inf \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); perspective-origin: 11.55px 7.91667px; text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 11.55px 7.91667px; \"\u003eif \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 19.25px 7.91667px; transform-origin: 19.25px 7.91667px; \"\u003ex is \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 53.9px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 53.9px 7.91667px; \"\u003ecomposite or 1\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 66.1333px 7.91667px; transform-origin: 66.1333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAlso return a variable\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.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.91667px; transform-origin: 3.85px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ep\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: 159.083px 7.91667px; transform-origin: 159.083px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e that is the associated primorial in the first case and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.55px 7.91667px; transform-origin: 11.55px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eNaN\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: 71.95px 7.91667px; transform-origin: 71.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in the other two cases.\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.1833px 7.91667px; transform-origin: 29.1833px 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/46054-count-trailing-zeros-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problems 46054 \"Count trailing zeros in a primorial\"\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: 15.5667px 7.91667px; transform-origin: 15.5667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46057 \"Find the last non-zero digit in a primorial\"\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 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,p] = isPrimorialPrime(x)\r\n%  x = candidate primorial prime\r\n%  p = primorial (or NaN)\r\n%  y = 1 for primorial primes, 0 for primes that are not primorial, -Inf for 1 or composites\r\n\r\n  y = f(x);\r\n  p = f(x);\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = -Inf;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 0;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 1;\r\np_correct = 2;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 1;\r\np_correct = 6;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 7;\r\ny_correct = 1;\r\np_correct = 6;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 13;\r\ny_correct = 0;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 17;\r\ny_correct = 0;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 29;\r\ny_correct = 1;\r\np_correct = 30;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 31;\r\ny_correct = 1;\r\np_correct = 30;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 61;\r\ny_correct = 0;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 128;\r\ny_correct = -Inf;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 211;\r\ny_correct = 1;\r\np_correct = 210;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 599;\r\ny_correct = 0;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 2311;\r\ny_correct = 1;\r\np_correct = 2310;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 30029;\r\ny_correct = 1;\r\np_correct = 30030;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))\r\n\r\n%%\r\nx = 999983;\r\ny_correct = 0;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 142438007;\r\ny_correct = -Inf;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isnan(p))\r\n\r\n%%\r\nx = 200560490131;\r\ny_correct = 1;\r\np_correct = 200560490130;\r\n[y,p] = isPrimorialPrime(x);\r\nassert(isequal(y,y_correct) \u0026\u0026 isequal(p,p_correct))","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":35,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-27T02:21:36.000Z","updated_at":"2025-11-16T17:45:44.000Z","published_at":"2020-07-27T04:12:44.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\u003eCody Problems\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46054\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46057\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e deal with the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/Primorial.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eprimorial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#, which is the product of all primes up to and including the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The primorials corresponding to \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\\n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e = 1 through 5 are 2, 6, 30, 210, and 2310.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/PrimorialPrime.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ePrimorial primes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are prime numbers that are either one smaller or one larger than a primorial. Examples include 3, 5, 7, 29, 31, 211, 2309, and 2311.\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 identify primorial primes and their associated primorials. Given an input\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return a variable\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ey\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with one of the following values:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ y = 1    if x is a primorial prime\\n y = 0    if x is prime but not a primorial prime\\n y = -Inf if x is composite or 1]]\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\u003eAlso return a variable\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that is the associated primorial in the first case and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNaN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in the other two cases.\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/46054-count-trailing-zeros-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problems 46054 \\\"Count trailing zeros in a primorial\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46057 \\\"Find the last non-zero digit in a primorial\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46087,"title":"Investigate the frequency of last non-zero digits of primorials","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: 529.633px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 264.817px; transform-origin: 407px 264.817px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 64.6333px; 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 32.3167px; text-align: left; transform-origin: 384px 32.3167px; 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: 49.8px 7.8px; transform-origin: 49.8px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCody Problems \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46054\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.8px; transform-origin: 3.88333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46057\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 17.5px 7.8px; transform-origin: 17.5px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46060-identify-primorial-primes\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46060\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: 66.1333px 7.8px; transform-origin: 66.1333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e involve the primorial \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABWklEQVRYhe2Wa62EMBSEPw84wMAaQAEKcLAOcIAFNKwEPGABDVi49wfnZCe9pWVJ9/7qJE029DFzHp0tVFRUVFRUfBkN0AE9MAKzDYAWmIDFxmjri5O/gB8bkxFt9nuWubW0AEyAEywmRrHIfF+afJTDQ+JwfipNvtrBO0et/428IR01RviVtPdy8HCyZpU1sczchnfzTryTW/KZuY0tc7Cm/FGSWKN6nszvNj+WJIajxqmovNZnWWk5PMKFNRxBPLlgRups4WLvhTncJMLdfF4mfhXB2VvhKdXFvRzSZfZ7P4wmBN6ecHZzwJSqcQy2ceD6dfIo1fM9G8m0q2vd6WJtVo3SxSThCvcbxPBu1k2++R9U0oKvWGoO3pAatWcz2StqqbH7fQVuTlrbVb79SX1jxL7RI+/47JHg9V6C716G6KPDXy6x8Qn5gyPFYaP6c6z4a6eiouISfgF1CoWEjhYNVwAAAABJRU5ErkJggg==\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 180.533px 7.8px; transform-origin: 180.533px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#, or the product of prime numbers up to and including 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: 27.2333px 7.8px; transform-origin: 27.2333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABWklEQVRYhe2Wa62EMBSEPw84wMAaQAEKcLAOcIAFNKwEPGABDVi49wfnZCe9pWVJ9/7qJE029DFzHp0tVFRUVFRUfBkN0AE9MAKzDYAWmIDFxmjri5O/gB8bkxFt9nuWubW0AEyAEywmRrHIfF+afJTDQ+JwfipNvtrBO0et/428IR01RviVtPdy8HCyZpU1sczchnfzTryTW/KZuY0tc7Cm/FGSWKN6nszvNj+WJIajxqmovNZnWWk5PMKFNRxBPLlgRups4WLvhTncJMLdfF4mfhXB2VvhKdXFvRzSZfZ7P4wmBN6ecHZzwJSqcQy2ceD6dfIo1fM9G8m0q2vd6WJtVo3SxSThCvcbxPBu1k2++R9U0oKvWGoO3pAatWcz2StqqbH7fQVuTlrbVb79SX1jxL7RI+/47JHg9V6C716G6KPDXy6x8Qn5gyPFYaP6c6z4a6eiouISfgF1CoWEjhYNVwAAAABJRU5ErkJggg==\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 338px 7.8px; transform-origin: 338px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. In particular, the second of these deals with the last non-zero digit (LNZD) in the primorial. For example, the first eleven primorials are\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: 13.6px 7.8px; transform-origin: 13.6px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e       \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" alt=\"2, 6, 30, 210, 2310, 30030, 510510, 9699690, 223092870, and 6469693230\" style=\"width: 541px; height: 18px;\" width=\"541\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.8px; transform-origin: 3.88333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e  \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 263.7px 7.8px; transform-origin: 263.7px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAfter the second primorial, the LNZD is 1, 3, 7, or 9. This observation holds for larger \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.317px 7.8px; transform-origin: 102.317px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e as well because prime numbers greater than 5 end in 1, 3, 7, or 9 and products of numbers whose LNZDs are 1, 3, 7, or 9 also have a LNZD of 1, 3, 7, or 9. \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: 50.9667px 7.8px; transform-origin: 50.9667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eMathematicians \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.independent.co.uk/news/science/maths-experts-stunned-as-they-crack-a-pattern-for-prime-numbers-a6933156.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ehave determined\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: 278.483px 7.8px; transform-origin: 278.483px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e that the last digits of prime numbers repeat themselves less often than expected. If these digits occurred randomly, 25% of the primes that follow primes ending in a 1 should also end in a 1. However, as verified in \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45994-investigate-the-frequency-of-last-digits-of-prime-numbers\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 65.75px 7.8px; transform-origin: 65.75px 7.8px; \"\u003eCody Problem 45994\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: 54.45px 7.8px; transform-origin: 54.45px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, for primes up to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAmCAYAAAC76qlaAAABxklEQVRYhe2YbZGEMAyGHw84qAEMrIJVgAMc4AALaEBCPWBhNWBh7wfNNdflI8CyOzfTZ4Yf5NLmbRvS7EEmk/kGt/C4bwux0gAeuIdnAFqg+KaoLSpgTGxFsLWfl2PHM+2w1b4Lx/5jc8ScXcMz7W6a1w+g3xnzT/AOeAKlcUylgjZh/AjUzC++CvMPRPH1zpi/FEqwPJZJZEyamyLEMy9exo1MC9aLMHNn2in5uq3CRdxjQZxnflFCr2INhnirNNiESxVYEyYpMTeX/E3STHZ/6/s4LbxWfvcFH6d89OLKYGvCe0E8nYGDtdwqXKfUWm7KqTyUTfJbjyuIO39o163CxSe9SFI8rwsUW7qzEnvpBFexCC85JlwEtczvrNgP9S0W4TeOCa+DrWBKtV6JLIm1/xB7hW/ddHo+LaoI713waTlRUdJAFuF+Y76WeeFv5xOpcglXVpVTN+MWVuH6tlvDK79Lf+VYhXdGP92LXIpVuM7zasFH1/tL8xvswiGmwVJlkYqy1D2+lT3CHbEXSX1193iqPltwxI9Od29ryI03EsU7YhN2qO+w4piO1c88Hdv5KbdgH8b04f3f/K8kk8lkMpkXfgBUBNSjr8Pw0QAAAABJRU5ErkJggg==\" alt=\"100 million\" style=\"width: 23px; height: 19px;\" width=\"23\" 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: 123.683px 7.8px; transform-origin: 123.683px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, the actual frequency is less than 18%. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.2px 7.8px; transform-origin: 374.2px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhat about primorials? What happens when basic multiplication facts interact with the frequency of last digits of primes? Will the frequencies be similarly skewed? Or will they all approach 25%? \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 86.45px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 43.2333px; text-align: left; transform-origin: 384px 43.2333px; 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: 142.233px 7.8px; transform-origin: 142.233px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes as input an integer \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: 211.217px 7.8px; transform-origin: 211.217px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and computes the frequency of the last digits of primorials between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABY0lEQVRYhe2WYZGEMAyFPw84qAEMoAAF6wAHdYAFNJwEPGABDVjY/dFkyfTapb1h71ffTIddWvqSvCQtNDQ0NDQ0fBkdMAAj4IFFBoADZmCV4WX97eQ/wFPGLES7/F7M3Ha3AYgBSrCKMRarmR/vJvdm85g4np/vJt9k44Og9b+Rd3z2GiHMhd0Bkxg41ZKPZuNHZs1m1tjIPDjzZOdMylT0ktBsPkhnsiMdGSeElkirpjgCanFJyHvzfor+w1k1RXlhvUpZ6wgReRI0vYJKGBuVhGqW+0C1zkUlxkpFyG1ni/XWXFjijxJwQnxQUYoaUltCI8HjjaDhFXqCJLYLXkrUm8UzQQIvz+JSiaAy7lcLbdcqSpBCqFwfDyAN03EjMQSncj0DKGupf4XeAbKwLbW6HwsGfrfjjuB18tjtZEK7mno+UH9JUNk2MWKUvXLnw/vmkhq15B3naeYpK8uGhobv4gUDlYEOU1DyDQAAAABJRU5ErkJggg==\" alt=\"p_3\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.8667px 7.8px; transform-origin: 11.8667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e# = 30 and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABWklEQVRYhe2Wa62EMBSEPw84wMAaQAEKcLAOcIAFNKwEPGABDVi49wfnZCe9pWVJ9/7qJE029DFzHp0tVFRUVFRUfBkN0AE9MAKzDYAWmIDFxmjri5O/gB8bkxFt9nuWubW0AEyAEywmRrHIfF+afJTDQ+JwfipNvtrBO0et/428IR01RviVtPdy8HCyZpU1sczchnfzTryTW/KZuY0tc7Cm/FGSWKN6nszvNj+WJIajxqmovNZnWWk5PMKFNRxBPLlgRups4WLvhTncJMLdfF4mfhXB2VvhKdXFvRzSZfZ7P4wmBN6ecHZzwJSqcQy2ceD6dfIo1fM9G8m0q2vd6WJtVo3SxSThCvcbxPBu1k2++R9U0oKvWGoO3pAatWcz2StqqbH7fQVuTlrbVb79SX1jxL7RI+/47JHg9V6C716G6KPDXy6x8Qn5gyPFYaP6c6z4a6eiouISfgF1CoWEjhYNVwAAAABJRU5ErkJggg==\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 348.9px 7.8px; transform-origin: 348.9px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#. Return a matrix whose rows correspond to the digits of the first primorial and columns correspond to the digits of the next primorial. Please remember to (a) omit \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABJklEQVRYhe2WURGDMAyGPw84wMAMoAAFc4CDOsACGiYBD1iYBixsD01uuR7tBpQ95b/LsbuUfE2aZoDL5XK5XBerATqgBwIwiQG0wAjMYkHWV4c/gJfYKKCn/J6Mb6m9AWQDCphlM1az8fe14cEET8Gpf6wNXyTwSjzrv8EbylkjwG9l7wq+rHoT+J5Zs5g1aWVaPg27uyrazSvbndySr0wHDGfgz0xglS35LbNGe2IX3GY1ZPyr+EMhziH4nXJWeta5qpyC28mWnrf2wpS+VAuuJbVXqCdmvBAb6hftht8MeCQeQZDn1qCpCrdTK9fFl8H1z2I9Cd4N/2WkXga3I3Xrfl8CbwSsU00z7zj3kaBHWKyifrls2RF4S6xcMHbktrhcrjp6A2YcfI+YyrElAAAAAElFTkSuQmCC\" alt=\"p_1\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 31.3167px 7.8px; transform-origin: 31.3167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e# = 2 and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABUklEQVRYhe2WYY3DMAyFPw5hMAIjUARFMAZlUAalEAwHoRxCYRhC4e5HbMlKk56r6+1XnmRpm1O/Z8d2BwMDAwMDA/+MAEzADKxAFAN4ABuwi61y/nbyL+BbbBOit3yOxpfuFoAIUIJdxFjsxj/fTb6a4DVx7d/uJk8SOFPu+mPkgfOsEcJe2Z/AIgJfV8lnE7j3cDJnbGUipVq2J5IIckG7OdPu5AftyqzV92BE7l7ydyOwhS25zShx7I+nOfvrSNqslo4/i3+tfL2Rc5O/aGel0DL2qtIjT56DdrPVSrUXYv3QCXRZtap4gJbUjtBMUZ4k2BVEnFnb5tgoV6Cz2lo0nngZ55jZreWeyw4CZbzcldLFkP9IDKV3XPcMvpXqRewQz3TGza5Ut+IOcUv81Po9CLFuNc186qk8wWJitOzwntB/Li27Qh4oDXtmAwMDn8cPovyFXYmxwccAAAAASUVORK5CYII=\" alt=\"p_2\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 148.017px 7.8px; transform-origin: 148.017px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e# = 6 and (b) account for the primorial following \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABWklEQVRYhe2Wa62EMBSEPw84wMAaQAEKcLAOcIAFNKwEPGABDVi49wfnZCe9pWVJ9/7qJE029DFzHp0tVFRUVFRUfBkN0AE9MAKzDYAWmIDFxmjri5O/gB8bkxFt9nuWubW0AEyAEywmRrHIfF+afJTDQ+JwfipNvtrBO0et/428IR01RviVtPdy8HCyZpU1sczchnfzTryTW/KZuY0tc7Cm/FGSWKN6nszvNj+WJIajxqmovNZnWWk5PMKFNRxBPLlgRups4WLvhTncJMLdfF4mfhXB2VvhKdXFvRzSZfZ7P4wmBN6ecHZzwJSqcQy2ceD6dfIo1fM9G8m0q2vd6WJtVo3SxSThCvcbxPBu1k2++R9U0oKvWGoO3pAatWcz2StqqbH7fQVuTlrbVb79SX1jxL7RI+/47JHg9V6C716G6KPDXy6x8Qn5gyPFYaP6c6z4a6eiouISfgF1CoWEjhYNVwAAAABJRU5ErkJggg==\" alt=\"p_n\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 20.2167px 7.8px; transform-origin: 20.2167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#. For example, if your function is given \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: 81.5px 7.8px; transform-origin: 81.5px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 10, then it should return\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 154px 8.25px; transform-origin: 154px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    0.3333    0.3333         0    0.3333\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 154px 8.25px; transform-origin: 154px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e    0.6667    0.3333         0         0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 154px 8.25px; transform-origin: 154px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e         0    1.0000         0         0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 154px 8.25px; transform-origin: 154px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e         0         0    1.0000         0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.8167px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 31.9167px; text-align: left; transform-origin: 384px 31.9167px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.2833px 7.8px; transform-origin: 39.2833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThat is, with \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 110.683px 7.8px; transform-origin: 110.683px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 10, we consider eight primorials (\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAABY0lEQVRYhe2WYZGEMAyFPw84qAEMoAAF6wAHdYAFNJwEPGABDVjY/dFkyfTapb1h71ffTIddWvqSvCQtNDQ0NDQ0fBkdMAAj4IFFBoADZmCV4WX97eQ/wFPGLES7/F7M3Ha3AYgBSrCKMRarmR/vJvdm85g4np/vJt9k44Og9b+Rd3z2GiHMhd0Bkxg41ZKPZuNHZs1m1tjIPDjzZOdMylT0ktBsPkhnsiMdGSeElkirpjgCanFJyHvzfor+w1k1RXlhvUpZ6wgReRI0vYJKGBuVhGqW+0C1zkUlxkpFyG1ni/XWXFjijxJwQnxQUYoaUltCI8HjjaDhFXqCJLYLXkrUm8UzQQIvz+JSiaAy7lcLbdcqSpBCqFwfDyAN03EjMQSncj0DKGupf4XeAbKwLbW6HwsGfrfjjuB18tjtZEK7mno+UH9JUNk2MWKUvXLnw/vmkhq15B3naeYpK8uGhobv4gUDlYEOU1DyDQAAAABJRU5ErkJggg==\" alt=\"p_3\" style=\"width: 15.5px; height: 20px;\" width=\"15.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 31.5167px 7.8px; transform-origin: 31.5167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e# through \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAAoCAYAAABjPNNTAAABjklEQVRYhe2WXZGFMAxGjwccYOAaQAEKcHAd4AALaFgJeMACGrCw+9BkCN2mcP+4L/1mOsNM0nBI2gQoKioqKioqKrpAFdAALdADoyyAGhiASVYv/pdLIX+AX1mDAC3yPBrb/C1QCKAKMhGgrSZjb69F29QbiBgwtg8Xcu00C8BKOIuxvg5Zkc8iBLCjcjcZm76nI3xw9yhkawC8zbPxiTNds108L8stoUp3gR0lZqpqSentXUnf3Bo/0428OAdZS+x47yKgp7Q4ACpb6pvjo2c2BalJiKukcQ+7hc3S3bGvYu8zcXKQuj/+wI58cv45elnSs3gUyIO0SYiPkvbm5QjSTpo4iJZpjDc9AGmHhAeZsu20Gkc9Gy0hg7MEOqOPQd6M08C+h51uDZ+GtFPEu7WvQtpB4UGuucDTGacXIWFrcXF1Dm/3mVH4LsijPplqfcB+FLpOb4LMTZxk+6kEUEugmWx47WdWj45XlY5tdkPI7oJzF/RPPLWegazlxb1ZXneojO/XfpyLioqKMvoD5x6yY7vGR8UAAAAASUVORK5CYII=\" alt=\"p_10\" style=\"width: 20.5px; height: 20px;\" width=\"20.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 169.567px 7.8px; transform-origin: 169.567px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e#). Of these eight, three have a LNZD of 3 (30, 30030, and 6469693230). Two of those (i.e., 66.7%) are followed by primorials with a LNZD of 1, and one (33.3%) is followed by a primorial with a LNZD of 3.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function f = primorialLastNZDigitFreq(n)\r\n  f = ...;\r\nend","test_suite":"%%\r\nn = 10;\r\nf_correct = [0.3333 0.3333 0 0.3333; 0.6667 0.3333 0 0; 0 1.0000 0 0; 0 0 1.0000 0];\r\nassert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))\r\n\r\n%%\r\nn = 100;\r\nf_correct = [0.1923 0.2308 0.3077 0.2692; 0.3636 0.2273 0.1818 0.2273; 0.2800 0.2800 0.2400 0.2000; 0.2400 0.1600 0.2800 0.3200];\r\nassert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))\r\n\r\n%%\r\nn = 1000;\r\nf_correct = [0.2394 0.2625 0.2432 0.2548; 0.3095 0.2460 0.2143 0.2302; 0.2389 0.2672 0.2551 0.2389; 0.2500 0.2292 0.2792 0.2417];\r\nassert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))\r\n\r\n%%\r\nn = 1e4;\r\nf_correct = [0.2426 0.2512 0.2471 0.2590; 0.2551 0.2544 0.2385 0.2520; 0.2374 0.2602 0.2466 0.2558; 0.2394 0.2453 0.2654 0.2500];\r\nassert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))\r\n\r\n%%\r\nn = 1e6;\r\nf_correct = [0.2489 0.2493 0.2509 0.2509; 0.2505 0.2506 0.2484 0.2505; 0.2499 0.2505 0.2504 0.2492; 0.2500 0.2494 0.2507 0.2498];\r\nassert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))","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":"2020-08-01T14:57:24.000Z","updated_at":"2025-11-15T15:20:56.000Z","published_at":"2020-08-01T16:58:23.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\u003eCody Problems \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46054\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46057-find-the-last-non-zero-digit-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46057\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46060-identify-primorial-primes\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46060\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e involve the primorial \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#, or the product of prime numbers up to and including the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. In particular, the second of these deals with the last non-zero digit (LNZD) in the primorial. For example, the first eleven primorials are\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\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"2, 6, 30, 210, 2310, 30030, 510510, 9699690, 223092870, and 6469693230\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2, 6, 30, 210, 2310, 30030, 510510, 9699690, 223092870, 6469693230, {\\\\rm and}\\\\,\\\\,200560490130 \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e  \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAfter the second primorial, the LNZD is 1, 3, 7, or 9. This observation holds for larger \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 well because prime numbers greater than 5 end in 1, 3, 7, or 9 and products of numbers whose LNZDs are 1, 3, 7, or 9 also have a LNZD of 1, 3, 7, or 9. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMathematicians \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.independent.co.uk/news/science/maths-experts-stunned-as-they-crack-a-pattern-for-prime-numbers-a6933156.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehave determined\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e that the last digits of prime numbers repeat themselves less often than expected. If these digits occurred randomly, 25% of the primes that follow primes ending in a 1 should also end in a 1. However, as verified in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45994-investigate-the-frequency-of-last-digits-of-prime-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45994\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, for primes up to \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=\\\"100 million\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e10^8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, the actual frequency is less than 18%. \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\u003eWhat about primorials? What happens when basic multiplication facts interact with the frequency of last digits of primes? Will the frequencies be similarly skewed? Or will they all approach 25%? \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 as input an integer \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 and computes the frequency of the last digits of primorials between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_3\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e# = 30 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=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#. Return a matrix whose rows correspond to the digits of the first primorial and columns correspond to the digits of the next primorial. Please remember to (a) omit \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e# = 2 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=\\\"p_2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e# = 6 and (b) account for the primorial following \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#. For example, if your 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\\\"/\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 = 10, then it should return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    0.3333    0.3333         0    0.3333\\n    0.6667    0.3333         0         0\\n         0    1.0000         0         0\\n         0         0    1.0000         0]]\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\u003eThat is, with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"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 = 10, we consider eight primorials (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_3\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e# through \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"p_10\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep_{10}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e#). Of these eight, three have a LNZD of 3 (30, 30030, and 6469693230). Two of those (i.e., 66.7%) are followed by primorials with a LNZD of 1, and one (33.3%) is followed by a primorial with a LNZD of 3.\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":46016,"title":"Determine digits of the Copeland-Erdos constant","description":"\u003chttps://www.mathworks.com/matlabcentral/cody/problems/1477-champernowne-constant/solutions/new Cody Problem 1477\u003e asks us to determine the nth digit of the Champernowne constant, whose decimal digits are formed by concatenating all of the positive integers--i.e., 0.12345678910111213... \r\n\r\nThis problem deals with the \u003chttps://mathworld.wolfram.com/Copeland-ErdosConstant.html Copeland-Erdos constant\u003e, whose decimal digits are formed by concatenating all of the _primes_ --i.e., 0.2357111317192329...\r\n\r\nReturn the digits of the Copeland-Erdos constant specified by the input vector. For example, the command\r\n\r\n CopelandErdosDigit(1:8)\r\n \r\nshould return\r\n\r\n \r\n 2     3     5     7     1     1     1     3\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: 214.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 107.433px; transform-origin: 407px 107.433px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/1477-champernowne-constant/solutions/new\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 1477\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: 80.1167px 7.8px; transform-origin: 80.1167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asks us to determine 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: 235.333px 7.8px; transform-origin: 235.333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth digit of the Champernowne constant, whose decimal digits are formed by concatenating all of the positive integers--i.e., 0.12345678910111213...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 85.2px 7.8px; transform-origin: 85.2px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals with the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/Copeland-ErdosConstant.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCopeland-Erdos constant\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: 187.5px 7.8px; transform-origin: 187.5px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, whose decimal digits are formed by concatenating all of the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 21.0167px 7.8px; transform-origin: 21.0167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprimes\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.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e --i.e., 0.2357111317192329...\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: 328.683px 7.8px; transform-origin: 328.683px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn the digits of the Copeland-Erdos constant specified by the input vector. For example, the command\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 92.4px 8.25px; transform-origin: 92.4px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e CopelandErdosDigit(1:8)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40.85px 7.8px; transform-origin: 40.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eshould return\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 169.4px 8.25px; transform-origin: 169.4px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 2     3     5     7     1     1     1     3\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function d = CopelandErdosDigit(n)\r\n  d = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\nd_correct = 2;\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 2;\r\nd_correct = 3;\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 10;\r\nd_correct = 7;\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 100:105;\r\nd_correct = [1 1 9 3 1 9];\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 2000:2005;\r\nd_correct = [3 9 8 9 4 0];\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 54321:54331;\r\nd_correct = [1 1 1 1 5 2 2 3 1 1 5];\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 951943;\r\nd_correct = 7\r\nassert(isequal(CopelandErdosDigit(n),d_correct))\r\n\r\n%%\r\nn = 8675309;\r\nd_correct = 5;\r\nassert(isequal(CopelandErdosDigit(n),d_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":39,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-03T02:33:28.000Z","updated_at":"2025-12-02T03:19:36.000Z","published_at":"2020-07-03T03:10:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/1477-champernowne-constant/solutions/new\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 1477\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e asks us to determine 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 digit of the Champernowne constant, whose decimal digits are formed by concatenating all of the positive integers--i.e., 0.12345678910111213...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem deals with the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/Copeland-ErdosConstant.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCopeland-Erdos constant\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, whose decimal digits are formed by concatenating all of the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprimes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e --i.e., 0.2357111317192329...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the digits of the Copeland-Erdos constant specified by the input vector. For example, the command\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ CopelandErdosDigit(1:8)]]\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\u003eshould return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 2     3     5     7     1     1     1     3]]\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":46050,"title":"Construct a prime circle","description":"A \u003chttps://mathworld.wolfram.com/PrimeCircle.html prime circle\u003e is a circular arrangement of the numbers 1 to 2n such that pairs of consecutive numbers add to primes. For example, if n = 3, a valid prime circle would be \r\n\r\n 1   6   5   2   3   4\r\n\r\nbecause the sums of pairs would be 7, 11, 7, 5, 7, and (wrapping around) 5--all of which are prime.  \r\n\r\nWrite a function to create a prime circle given n. The test suite will check that prime circle has the right numbers and that the sums of pairs are prime. ","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: 154.433px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 77.2167px; transform-origin: 407px 77.2167px; 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: 4.66667px 7.91667px; transform-origin: 4.66667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.91667px; transform-origin: 1.95px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/PrimeCircle.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eprime circle\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: 143.133px 7.91667px; transform-origin: 143.133px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a circular arrangement of the numbers 1 to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABY0lEQVRYhe2WTbGEMBCEPw84WAMYQAEKcICDOFgLaEBCPGBhNayFfYdkKj8bQqCAPbx01ZySzDQ9mSZQUVHxe3SAsjEC7S+JvIBPImaguZuMFNc23hEpfRepBqOMBh7R2hARG+8gNFhCa18/EKp0OTTQb+wRld7X0zFt2LobmhsJlUAIzZk9LUZpX+0G03LFdhd2QVoWJx1xZCUGu9bzPamnkGptsoX11i64looqL4yd9B6h5xmEJpusy+wRQ51xBivkfY/L5SiCqJP7sgehT4kyAkWo3mE0mFbkLjKEPvXi2zxntgeiCBNlvwspuGacp7h8KRkITTN+Gfj3J/4tXULGLzgl1p+4Vh6CKiDT45SQgh/S7yaxAxmKXSrJnz13qCWcFimYUsCfvs6e0SvEk2Qksc6E35rGK6gSOUfC+7PgXLyITGl0iXMpw4vzFk+Z2hF+Uv/tvYbRrh+esIqKiop/hz906Z3NImegagAAAABJRU5ErkJggg==\" alt=\"2n\" style=\"width: 18px; height: 18px;\" width=\"18\" 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: 183.967px 7.91667px; transform-origin: 183.967px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e such that pairs of consecutive numbers add to primes. For example, if \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 103.683px 7.91667px; transform-origin: 103.683px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e = 3, a valid prime circle would be\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 84.7px 7.91667px; transform-origin: 84.7px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e 1   6   5   2   3   4\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 304.833px 7.91667px; transform-origin: 304.833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ebecause the sums of pairs would be 7, 11, 7, 5, 7, and (wrapping around) 5--all of which are prime.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 141.85px 7.91667px; transform-origin: 141.85px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to create a prime circle given \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: 227.917px 7.91667px; transform-origin: 227.917px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The test suite will check that prime circle has the right numbers and that the sums of pairs are prime.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primeCircle(n)\r\n  y = 1:2*n;   % Remember that the circle uses the numbers 1 to 2n\r\nend","test_suite":"%%\r\nn = 2;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 3;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 4;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 5;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 10;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 25;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 100;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 250;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))\r\n\r\n%%\r\nn = 500;\r\ny = primeCircle(n);\r\nassert(isequal(sort(y),1:2*n) \u0026\u0026 all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))","published":true,"deleted":false,"likes_count":7,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":49,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-07-18T23:25:40.000Z","updated_at":"2025-11-15T11:47:21.000Z","published_at":"2020-07-19T00:34:39.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/PrimeCircle.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eprime circle\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a circular arrangement of the numbers 1 to \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=\\\"2n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e such that pairs of consecutive numbers add to primes. For example, if \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"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 = 3, a valid prime circle would be\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1   6   5   2   3   4]]\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\u003ebecause the sums of pairs would be 7, 11, 7, 5, 7, and (wrapping around) 5--all of which 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 create a prime circle 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\\\"/\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. The test suite will check that prime circle has the right numbers and that the sums of pairs are prime.\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":46582,"title":"Find jumping medalists","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: 288px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 144px; transform-origin: 407.5px 144px; 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: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 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: 377.308px 7.875px; transform-origin: 377.308px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eKey questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=vkMXdShDdtY\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003evideo from Numberphile\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.875px; transform-origin: 3.88333px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.983px 7.875px; transform-origin: 374.983px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/JumpingChampion.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 56.8083px 7.875px; transform-origin: 56.8083px 7.875px; \"\u003ejumping champion\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: 324.392px 7.875px; transform-origin: 324.392px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.) \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: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 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: 293.708px 7.875px; transform-origin: 293.708px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTo me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAmCAYAAACMJGZuAAACdElEQVRoge2Z7ZGCMBCGnx7owAZsgAqowA6uAzqwBWuwBHuwBWugBe9HsucaIdnNHOLN5Z3J6MCSj4fN7gLQ1NTU1PQp2gFfwBh/c3Zj0s7Afu0JfooOwB24ALf4/0oAk+oYz+t2ec80t9eOAEiDORMgpB7WARPzEP+FvnjdQj0B1jE5PvIHvKiPzaoOGHjElME53kCAlUKULToRvM/b76rqCXdybkssaSQs5hSvHwjx54p9cZeZ8Xbx+JXneHUy9rmaZGJ6UhZYJ+YXILHmTh6YjDvxugVTOxnrTkgQm0hSuPxaYQ3Ktps5LxnvtnB+zyMmST9jYUyZ361g96PdwuAlWeoSCbQWWBJPlgJwp/rKeQ08gy1JtmWRwZ7gsheL8cxkjoXrrLC0V+W8QRZmgSDbrLSu0WhHzyMWWIEJKMsdtsLS8SMXk7RdybMlUVhgTQWbH4l3WYB5QIEdlo4zOQgj9m19xFZTnWMzywLMCwrssHTWtMKSjNnzms0ke2ovledGXb3Lut3PhTlgNaCgDlbuUURnV/EG8cprnOcQz6UAZW1T7OcQr/EUy0+aA1YLCvywSrFD9yewOh5eM7K8eFlLyc4lDUxXu15QUAcr51n6xrnizJra87w1akCBHdak7Lwxa3PpO+gpK1JtmQ3fotTVvXWYlhWWfiGXiyVWu7doLph76rBUNRW8xQMtxeaqymW9WmBbPRuuKkt5UAPMA0u8aykjHvgAr/LUUV5g1u0lyr3PEs/b7O1mTcFpBSZvOKV/a7UsQTx9U5o+vrxdsnBvDChdl36XS1vJI3esUG3/hmo/C/3bz0lNTU1NTU1NTU31+gYmIUCl6G4nbQAAAABJRU5ErkJggg==\" style=\"width: 37.5px; height: 19px;\" width=\"37.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 68.45px 7.875px; transform-origin: 68.45px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Therefore, I will coin another term: the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.025px 7.875px; transform-origin: 56.025px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ejumping medalists\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: 266.817px 7.875px; transform-origin: 266.817px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 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: 336.983px 7.875px; transform-origin: 336.983px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that determines the jumping medalists as well as the maximum gap. Award the medals as in \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46576-award-medals-to-winners\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46576\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: 206.925px 7.875px; transform-origin: 206.925px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and return an empty vector for any medal that cannot be awarded.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.875px; transform-origin: 0px 7.875px; 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 [J1,J2,J3,Jmax] = jumpingMedalists(n)\r\n  % J1, J2, J3 = most, second-most, and third-most common gaps, respectively\r\n  % Jmax = maximum gap \r\n  \r\n  J = f(n);\r\nend","test_suite":"%%\r\nn = 2;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nassert(isempty(J1) \u0026\u0026 isempty(J2) \u0026\u0026 isempty(J3) \u0026\u0026 isempty(Jmax))\r\n\r\n%%\r\nn = 5;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = [1 2];\r\nJmax_correct = 2;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isempty(J2) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 7;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = 1;\r\nJmax_correct = 2;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 11;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = [1 4];\r\nJmax_correct = 4;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 20;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = 4;\r\nJ3_correct = 1;\r\nJmax_correct = 4;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 100;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = [4 6];\r\nJmax_correct = 8;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 3141;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 4;\r\nJ3_correct = 2;\r\nJmax_correct = 34;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 50011;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 2;\r\nJ3_correct = 4;\r\nJmax_correct = 72;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 6021023;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 2;\r\nJmax_correct = 154;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 12221997;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 2;\r\nJmax_correct = 154;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 2e8;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 4;\r\nJmax_correct = 248;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-10T02:33:57.000Z","updated_at":"2026-01-20T11:05:32.000Z","published_at":"2020-09-10T04:15: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\u003eKey questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=vkMXdShDdtY\\\"\u003e\u003cw:r\u003e\u003cw:t\u003evideo from Numberphile\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/JumpingChampion.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ejumping champion\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.) \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\u003eTo me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\times 10^{35}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Therefore, I will coin another term: the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ejumping medalists\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that determines the jumping medalists as well as the maximum gap. Award the medals as in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46576-award-medals-to-winners\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46576\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and return an empty vector for any medal that cannot be awarded.\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":46117,"title":"Test approximations of the prime counting function","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: 162.817px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 81.4083px; transform-origin: 407px 81.4083px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 90px; 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 45px; text-align: left; transform-origin: 384px 45px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/241\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 241\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: 61.4583px 7.79167px; transform-origin: 61.4583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which is based on \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://projecteuler.net/problem=7\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProject Euler Problem 7\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: 73.1083px 7.79167px; transform-origin: 73.1083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, asks us to identify 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: 91px 7.79167px; transform-origin: 91px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth prime number. That is, the problem seeks the inverse of the prime counting function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAlCAYAAAAa0FocAAACX0lEQVRoge2YXZGDMBSFPw84wAAGUFAFdYADHNRCNSChHmoBDVjoPoSzvaVJubCkywNnhtmZpHv/cnJuEjhw4MCBPKiAYiNb5Ya2suIMXDe0VwG38e9usXXSQgn07DT5EyG4XLSsMttfhRIYgDqznwvQZfaxCFfCPsyNglDg0xd8zaIEHuRfbeFKoPy/49uBVHy30EkM5FHyrD5LQgtqHV+sldSE6p8X+KzH31t7JdB88DPFjZUsKwgVeyz4yoidFh/trsA9Ya+djA8JXzG/i1pbMQbREyonh7fxU4C9GUvRSsXzBFBMfOn/b4REL2Z+TrW9BX/BjUAreAqFbUXNONY6bT2cfqX+D560tj1ZyQzMF/KEr0C/KHjdQ1qxxoz145h3r3kTP/NM/Mz7KUy2POcBaYtncd5gqac9JQZ4hWNJ4iryMNqf0nTgfRFS+FPiorStsPbZxWljSeJKLBZwbeY8TFvTTX4hStsgFJxXNDp8iYtJKTa1H+ZiWCVuEK+wBMMjLtMA5lbJtqzYKqmTeA8lsjfX9t4git7NWBcZu8wY96qrEhsic1ZrZGcuoS5hK4mSZ4LT6ov6olvDaxFiUNCfRMYmFltRqb2YVjn89iy4nlp6T1eWyZw+zx7qZgIVK1L2LNP02PBp60gv3MJm++gQMW6Z4G0r1m6KnraNxbTDHp09jxktC2kOofpNIsiC54lqqWj0pFugLkGpFSrG+QafqPas7N85UOO7XPwVDTt5hLDI/R6md71dvrR2+LVhKe6sPKl9A7rnbx1gDptZ0LLd+/eJHbyvHThw4MC/4wdzuO6gMG8oWgAAAABJRU5ErkJggg==\" alt=\"pi(n)\" style=\"width: 31px; height: 18.5px;\" width=\"31\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 185.15px 7.79167px; transform-origin: 185.15px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which provides the number of primes less than or equal to \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: 17.8833px 7.79167px; transform-origin: 17.8833px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/PrimeNumberTheorem.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePrime Number Theorem\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: 87.9px 7.79167px; transform-origin: 87.9px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e gives approximate forms of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAlCAYAAAAa0FocAAACX0lEQVRoge2YXZGDMBSFPw84wAAGUFAFdYADHNRCNSChHmoBDVjoPoSzvaVJubCkywNnhtmZpHv/cnJuEjhw4MCBPKiAYiNb5Ya2suIMXDe0VwG38e9usXXSQgn07DT5EyG4XLSsMttfhRIYgDqznwvQZfaxCFfCPsyNglDg0xd8zaIEHuRfbeFKoPy/49uBVHy30EkM5FHyrD5LQgtqHV+sldSE6p8X+KzH31t7JdB88DPFjZUsKwgVeyz4yoidFh/trsA9Ya+djA8JXzG/i1pbMQbREyonh7fxU4C9GUvRSsXzBFBMfOn/b4REL2Z+TrW9BX/BjUAreAqFbUXNONY6bT2cfqX+D560tj1ZyQzMF/KEr0C/KHjdQ1qxxoz145h3r3kTP/NM/Mz7KUy2POcBaYtncd5gqac9JQZ4hWNJ4iryMNqf0nTgfRFS+FPiorStsPbZxWljSeJKLBZwbeY8TFvTTX4hStsgFJxXNDp8iYtJKTa1H+ZiWCVuEK+wBMMjLtMA5lbJtqzYKqmTeA8lsjfX9t4git7NWBcZu8wY96qrEhsic1ZrZGcuoS5hK4mSZ4LT6ov6olvDaxFiUNCfRMYmFltRqb2YVjn89iy4nlp6T1eWyZw+zx7qZgIVK1L2LNP02PBp60gv3MJm++gQMW6Z4G0r1m6KnraNxbTDHp09jxktC2kOofpNIsiC54lqqWj0pFugLkGpFSrG+QafqPas7N85UOO7XPwVDTt5hLDI/R6md71dvrR2+LVhKe6sPKl9A7rnbx1gDptZ0LLd+/eJHbyvHThw4MC/4wdzuO6gMG8oWgAAAABJRU5ErkJggg==\" alt=\"pi(n)\" style=\"width: 31px; height: 18.5px;\" width=\"31\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 29.5583px 7.79167px; transform-origin: 29.5583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for large \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: 96.8583px 7.79167px; transform-origin: 96.8583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Two such approximations are \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAAlCAYAAACu2qwTAAADf0lEQVRoge1a0ZGDIBTcHuyABmzAClJBOkgHdpAWrCElXA9pwRpsIfeBO3lHEB6oaObYmcxczggP9rHsQ4GKioqKih3QHh1AxTIaABOA7uhAFNgyRgM79tPjCmA8OggFBthYt0IL4AdfoB4PAHflb1sANwDP+b5S2JocwsAm52lJMgBeiAdoYAkZ59+/UI6g+859tbDjOqXc3ZAmbyS0FEEX2P1x78nbOwmy8YQlKQUlCRoB9AX6oVG6FOhLDa4Gk3hfKYKuKLN6iAEnM0t3WBeTilIEjbCTVgot7LhOU26MyHNGMYKaud3O+d7DyqlmxXKy9nBuIUxYkRQtrEZKnZSDT9HPDnYCcuTDR1ADO/kPcf2Gt0y9xEdja3uky2839yfbNnMcvaJPwCpKkszd5pvkAJlVdDjympakAfmZskSQgZVNSYQsBDtxLSatHHMMA6zRkXNAUnvn/xPihPOe5MRlENw0Wf13sKQwCG3BucaxhCROkjDgc6BcYbHNf4QdswYNPokf5r/dpImNmQQl70MsEB/zzbKwkpOiaZiykwstQT77LrM6JDmaVUbI2oxyJmNjnxpHyGRPSl43AK6cnACAtKMdH85G0FW0SWWR80C51LTH+JNqLxnAiM+BUzY0tpdysObs6WwEDXgnqJu8wHuf1hTkWQRJZ+QLOjQhLlKPdnw4G0HSKLkTK+PRJCV/n2TvGcDk6UQGoLGkOUc7LkoQNEFHEOslqstSf9qkTDYJrityQYeiCSD3aMdFCYJ+oDMysj1f1tP9akuK5PpLWkTfgBgAN/1Qw3forWsIJQjiuGOmR5YfLqT9piuLTfxjoa1oAL4VIt1dNwcUekKYe7TjogRBtLshqZEE+FYIzRXdbYt4go5IOGOUAfhcxU1cN3PnSwRQq9eeDMuYcgiKKYLEhHA5IAt0H5E0V0+8H8qF+kw+/5P22heAvB5zcQPWnz4bvC0tM9M9F5SO84m/ktLhr+PynTS4MYf2Vmmvfe24scY2/h6J8tbNN4U8OSvnmLaufRhlRCzuh4mxdL0N3B9KKkr4Utw8JF7K+Eb0oVGOUg8HP8BD1W9Ej22MTQxb1IfZeKDsg6+tsUXtFoKBv8Ysgi2Odo5Gg31fjQqZq93xLS8lxmCwz0uGe71vp8YTB218O4Cb/la44OD3D7Y62qnYCS3WPfepqKioqPg/+AVFtJvsMIygjwAAAABJRU5ErkJggg==\" alt=\"n/ln(n)\" style=\"width: 52px; height: 18.5px;\" width=\"52\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.225px 7.79167px; transform-origin: 27.225px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Logarithmic_integral_function#Offset_logarithmic_integral\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 77.675px 7.79167px; transform-origin: 77.675px 7.79167px; \"\u003eoffset logarithmic integral\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAAAlCAYAAABmmoSAAAAFV0lEQVR4nO2c4bHqIBCFTw/pIA3YgBVYgR3YgR3YgjVYgj3YgjXYgvcH2ckmJrCQBcG730xm3nvxEXLCgWUhAQzDMAzDMAzDMAzDMLbRAdgplqdZ1i9ieufHNF6hA3CH7g1dhsP4JIfeRwC3oWyjUo2PAM6BI6XMU0SlcghDXABcM5Rbih7jQ36t/GYP95x6YZk59T4AeKAt0+/g2usDTuclcmlMz5e8dkBYu00a71gBb3a8hn/fR5Z3ZGVIR9cHnOC5uGUuPxdXTJ/LkuF7dv4hLDe33iesG6cmerh6PjFquFTvHBp3cP54LxzkPR+bNeY39RZccI1Yw1/gesKc9HAitjr/oQapYfgSegP5OxVNuIYahpdofB/Kew5/ng+4Eg9u1phfbIs5jsMRCjlIyNgoIoUz5L1zbVDj8IX0J4TDzZJ67+HqKw2Bv43P8ICuxqfhN8eF/3tjdXnC76HNGmsZXsoVZUYbYHwQc5FbIGR4KSX1BlyDbSV/EjK8FInGT/hHZj7FCHXOmzQuafhvGPCGsg1eCw3Df0PvE1ydW0jgaRheovEe4UiTIoA3wiH7Jo1LGp5uShKOdHAi7md/P0MWZqVcsyY0DB977wdMG+4BYyZZ2jZ2aCeq0jC8ROM9wqP2HnLDb9JYcw5/g1+8O1w4skaHMRPJb/4I1/B5XZ/C+pKQLTRAjmQOf4Vfz5DegNPlilHfG5yuPMSMTeq+0UZYL5nDa2gsgRte0q6TNd5i+B7TxhLqLd/wh9fdUCZfuqCMJtWNCyMN1WOWCzk9wvsVJEdKwmzN8BdMzeiLACQa0RIt1/uFsc49pisGkjCSMtC1s9ZmtTWWQJGCVLdkjTVGeAoxfIanuY7EeNzUV3w2MooApA0w9aHwemw5UpZRfCN8B/+yHRCnNzBdgpqHp3x+Kem8qO6142uzOTT2QW1aGokma6wV0kvCozdku/hC85kz4ur8QFpvqDXCp+gaCuklIb9Ub8D//GLml8AYodWeuAu1WW2N16COI2ZQStb4Pxi+lRGH07Lh6fnETGU0OtfYPE0thqct1DGJ5RSNAZjha+W/GV5j+hSbba/B8LRLNdZ7ZngPWpnUkvyC4WNGLI0RPnZr+LcNv4NsD/0SKRoDKGd4Sux9w/Cx8yOixiy99HyM3oCu4VuJqLYaPlbj+f9NNTtQOGlHrwEulRNalpOEXTkMn7JmWWuWXnIeiAtztQ3fQkS11fBURuxUYqvZgQ0apxh+6aUUieGl2XJNw1MvnGK6lrP0QNzqhKbhXyvl1IaG4WNXgDrIzB6KGpI1jjU89U7zCkkMT0sJITQNn5oU+TYahpfqDegZvhf+rgY0DB+jcQfXOYTW7a+B3yRrHPs+PN/iOp+XSgxPo23oOqEGxnfihYxMHztoDXpXeovhpXoD/ufHd+JJXuxISiYVpoOO4aUak9kpn7R20GYfn35JGu8w3hA/1irCf8N3uHWYjrihcCX0al+H6V76+c4veh+Yzi/txONlvdDGaEPQ+wTzHAC/x0PgPEfyKuX8+fHOvMf0Qw1LO/E4d9QfztOWcF+b1dSYm11ySD6kEaWx5Jt2kuUP3xx3zWQUYq+J55sHr13Pd61WXtUkfLp3gvNzQnqvtQV6xjHXKvmxjVQkbVZbY/o2nkbOpwWNP7gj/5dlaS90a2/J5aCE3oAbdVJWQ34B09hDie/NXVB/aFmKEnofEP480y9jGgegd65zVL7FzybnJqfe9Aptaysh2pjGAfZwoZCmQJSMNLN/kkPvnN+7bxHTOMAOuvPstcSK4dDWO+ZzY/8F09gwDMMwDMMwDMMwDMMwjCl/+3GdfYQc30QAAAAASUVORK5CYII=\" alt=\"Li(n) = li(n) - li(2)\" style=\"width: 126px; height: 18.5px;\" width=\"126\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 24.8917px 7.79167px; transform-origin: 24.8917px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, where \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-8px\"\u003e\u003cimg src=\"data:image/png;base64,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\" alt=\"li(x) = integral of 1/ln(t) from t = 0 to t = infinity\" style=\"width: 122px; height: 27px;\" width=\"122\" height=\"27\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 18.6667px 7.79167px; transform-origin: 18.6667px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (See \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46066-evaluate-the-logarithmic-integral\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46066\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: 4.275px 7.79167px; transform-origin: 4.275px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.8167px; 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.9083px; text-align: left; transform-origin: 384px 31.9083px; 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: 160.642px 7.79167px; transform-origin: 160.642px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTest these approximations by computing two ratios: \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAoCAYAAAAR+iSJAAAGTElEQVR4nO2d8ZGyMBDFXw90YAM2YAVWYAd2YAe2YA2WYA/XgjXYgt8f+D4XJGQ3gRB0fzPM3A0HJJvNyyZZOMBxHMdxHMdxHOenaADsAkezQFk2hZ+5JuZqq03m9c6K2QF4Bo5d4bKcANwKPzOFDaYTKovozdVWN7S2L81SdnQEdKoauAM4LF2ICFu0HWaqEbMBcEVevXMEYPO6vnTnqdGOP0ktArBFWw6NQzQA9gAuAB6va0swtdNK/pDuvDkCcHw9uyS12vEnqUUALmgVPMYRrfPI8LeEAGwwr9g0aCOglPvnCMAdrU1LUbMdf5JaBOABm3JfUFYA/jD/PHmP1nmtI2OqADDqKhn+12zHn6QGAdijFQALJ5QTgAPa8pVwqBuAs/GaVAE4Qxd1TUXtdvxJahCAy+uwUFIA7ii3Sn6AfVROFYDSi6612/EnWVoAGqQ5cCkBWMKRHrB1lBT7MeoqFSavwY4/ydICcEA7MljRCMAWXQfg7ye0HUDDNbF8OVifmSIAKVFXDmuw4wcbtIY94a1cDdpV0xO+Y5HBKgDMRjuiW3/ZuSx2SZ2rhQRg97rf/XWOo1x/5+CpfO4Tto6yRSsuUmAatEKnFR7WTTtaWgWgQWsXrQhy2/WkOEL3XIMd/9PfaqITbV8/WxxIC4Um97BWViMA7EDsVE+8lZUJGLJjafeVc5JQQgKwxXuriW3HHYZmoLxjHYe2iYWRQ1uTnFsz1JbnYs67U/4dsQqAJeo64bP8Y8fQmsJa7PgBC3ND61h3dLefppxfSIfOOazzYUsEsEe37g3azn4WP/O8JgrISUKJTQFuI+e30LUh561aB2L9OWCwo+3QtV1s4NB2GGIVgKuiDMA70eqGd+f7e/1O+z7E76HknrXY8QOOeCd0M4z2+AyBc5kqArCWySIAbEh2qhu6SSRSMDXkJKFoBSC0vchrx7bB+Axt56K/XF/XyL1omccfux8XRrURpqWMjLpiA8UJXdswkmJ9KKKatl6LHTvQUCxIyQWTklgEgNEPt3P6nccSGVlSf4eoTQCkvxzxHrH699KuvFuE1NK5tFGXvB+FX9qKvqAR8LXYsYMc7e7QzVO5QLimxUGLAFCZ7/jMtJJhtWYakpuEUpsA9P2l3zG47qCt81wC8Ad71MWQXM7vOSXQ9Iu12HHwQdoQgllOOaPaEmgFQHbwocaUyqzBmvrbpzYBkP4y5HByVNPwhD7q1JYxJfWX18gRl/Nw7frNWuzYQa4ixwx2RndxIkUAat4FAFqDs35DBr2NnOuTkvrbp4QAsM4ax5X+0i+PnLdq2meuRcCUqIuhvuyM7KTa8q3FjoMPsqhHjgDUvgsgV9X7xm/EOc2oPkUSSgkBoG1io03MX854h7QaeD9thKTtXNbUX+YLSBvIttZOO9Zix48HWTtUDRHAHLsAstGHOsxQ9BNSaN4reW/2RQkB0K4ix/yFc2jeJzZ6ccTU+p6mM7KNLP4hp3Uss4wEea8DxttzLXb8eJA1jTBHAJZCIwCygw+paT9MPCA8wqem/vYpIQDAe9879jchf5Gr2ju8k6rGnJL771o0AmCJuhp07Suvk3kwzJTVLJKvwY4fD7LOHb5VAKjMoa0XholnxDu4NgklRmy0GBOAWEQj4SgSalN5ryF/kSPmBrov1jxgn3rGBECb+ivD/v7oDwynVGv6yRrsCKC7DWF9weJbBYDbfyEF76cIh+qvTUKJ0U8LvaDrpHIu2Z97NuiOYg+MtzPLHHK2mL/I85Z5sHXqOVYH7lBpkAPgUL2PvfPaRcU12BFA96UHK98qALRHyMn4IlBMkaf4/hxfBhk6tgivpRwj18dCyVC55fNC8OUxzcr1BfZ965gAWKMutmfIJrRhyhuINdsxm28VgKlISUKpAevbc6mkfqJrTAAYWtfwjbza7ZiNC0CYxRplIkp8Zy5VIMcEgOm0tVCzHbNxAQhT+vtzc3DEfHU4Iz03YkwAaoy6arVjNi4AYaxJKLVyxPQONrZtqiEkAEv90w8NNdoxC7nyXMN8S0t/xVwe1kWeEKW/Pzc3e0xnmw30I7S1rc6o+1+tLWXHyRn6XNJUFZubEv8cdIrUX8feVt8SdTkr54x1RUXfwhXfE3U5juM4juM4juM4juM4juM4juMY+Afhj6HXww+3bQAAAABJRU5ErkJggg==\" alt=\"r1 = [n/ln(n)]/pi(n)\" style=\"width: 128px; height: 20px;\" width=\"128\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5583px 7.79167px; transform-origin: 15.5583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,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\" alt=\"r2 = Li(n)/pi(n)\" style=\"width: 100.5px; height: 20px;\" width=\"100.5\" height=\"20\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 57.95px 7.79167px; transform-origin: 57.95px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Do not round the approximations to integers. For \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAAAkCAYAAACUjSQ7AAACLklEQVRoge2ZfZGDMBDFnwccxEANoAAFOKgDHNQCGiqhHmoBDVjo/UH2sqX52BCuR4b9zWRu5rIvJVk2eQCgKIqiKIqiKEeltU1KA6ADMNjWfUl7KloADwAvAFehZgAwAxitvgPwtC210CXa02DgkkJNkpzRxo6r/zdYFv2F8CKXaE+DwZII+itNTsdiG09/b/smT3+J9rS0kCdnsnGPQH/DxrrtqD0t0uTwO3+IxD3hKmAP7amRJmdkcbFzgcdddtCKuNiB+eANlr2yZjsoTQ43D7GFGzzjlWiDXPHpaHrb18E5DMldscbA+fySlvNs4kOaHD5P6QKTKyvRJqG9cIarlgnOp285yPiilDTps4nkOqTJMZE47v7uO2iTkNO4Y5kMt3t8cjl38V6Vk7U3e8hNzpwx3jo5W7RRDN4vniqGoFKkqqqNLcmJ3f094snJ1UbhggmfE7jnDHZApMnh52vuuVGijUKLH3qA2mvv/y+qdWuAy/rsGZhPLFauPmpzazcWF/tNX1yJVnThvjKjwbY80dbm1jphHFUJP4NLtEF4Jn3lSBabLHRO9dTm1oCDvVuLvevhLq61gz9QvljfJic5VAEh19UjfOeXaD/gmfS9rOMPTAZLIntP3NGRbjlE7JsMVceW7zkp7RvcQvsOJ95fq1ujr5A0hydkBoO2+/XXzBnpxS3R/tLC7eshrrY/16kdgdRZltpaDNxL31zXWKJVFEVRFEVRFEVRlL/lB90inPH0D2r4AAAAAElFTkSuQmCC\" alt=\"n = 100\" style=\"width: 51.5px; height: 18px;\" width=\"51.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: 257.5px 7.79167px; transform-origin: 257.5px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, you will find that the first approximation is about 13% low and the second is about 16% high. However, for \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGIAAAAmCAYAAAA/bE50AAACk0lEQVRoge2abZGDMBCGHw9xgIEaqIIqwME5wAEWqgEJeKiFasBC70eyw14INCnctRz7zDA3kyYk7JvsR+bAMAzDMIx3cgLO4a/xBi7ADajxQnRAD1TvXNTRqIAH01PQh8f9+YoOSoMXIjb4XPuhcZS7CYd3M2eWjSkGv0TtV2AonPPf4vCGGoCvzDFnvEu5hbFtGN+SFlNc0xDGgndTj4I5/zUiwIN8o9Shb+zbxbADaTFk3AMfqO+MohyWCr97a7x7yBXipPqm0k9xQbeZ8V9q/MDUVR2aM/lC9CwbWlxQ6l0nvPEb9R5zTYpcIfRpaBf63ZmK5UJ7r9paxpNhxR35QrSqX73Qr1P9JFZIfIjHSd+mdNGOqXoV/mP2WiHmCqHdydIObpgKNpe+ytxLJwzCQPFpkl3IYqtocaVHTOfga561GyBXCJ1d5QohBr6Q3vnSvnTCgHG3i9+T46YDT2riHLQB1jxrg12uEHrOXCE61X7F21HGOnwc6Sjgxpg7V/zc/fpDniqrODHetax51qaApUI8q4T1+2IjS7osRWCJvXDRQuUGUdC58R7vTF4RYuk7L8wLsQr94h6vqOaqftsjf+WaVqMrz3vidwlixSnYh/CbWdOmxZoO1LE/flbyL7G3rElvyFwhNrvC0IZOHTOJD69c5e4ta6oz+8nJmbv8ewkdiFPqyqRx3Mhhb1mTY3TDS98rfTaND1rd1MLitLVjf/cmJZd+4nbmMied2GxqB3lpagfoo+pCn5KC7lMoEQLGmirVVzbupomLVjd1/LXbKq4QPwTHz0u6jue1kFTE2hPIRiy9XciiZvTDcwuSfwkpqhA/BLlDi58u/PZMEKmSZVzD/tyyYRiGYRiGYRiGsSXfQQpnPGbnc4wAAAAASUVORK5CYII=\" alt=\"n = 10^8\" style=\"width: 49px; height: 19px;\" width=\"49\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 216.658px 7.79167px; transform-origin: 216.658px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, the first approximation is 6% low and the second is only 0.01% high. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [r1,r2] = primeCount(n)\r\n  r1 = (n/ln(n))/primepi(n);\r\n  r2 = Li(n)/primepi(n);\r\nend","test_suite":"%%\r\nn = 1e2;\r\nr1_correct = 0.86859;\r\nr2_correct = 1.16324;\r\n[r1,r2] = primeCount(n);\r\nassert(isequal(round(r1,5),r1_correct) \u0026\u0026 isequal(round(r2,5),r2_correct))\r\n\r\n%%\r\nn = 1e4;\r\nr1_correct = 0.88343;\r\nr2_correct = 1.01309;\r\n[r1,r2] = primeCount(n);\r\nassert(isequal(round(r1,5),r1_correct) \u0026\u0026 isequal(round(r2,5),r2_correct))\r\n\r\n%%\r\nn = 1e6;\r\nr1_correct = 0.92209;\r\nr2_correct = 1.00164;\r\n[r1,r2] = primeCount(n);\r\nassert(isequal(round(r1,5),r1_correct) \u0026\u0026 isequal(round(r2,5),r2_correct))\r\n\r\n%%\r\nn = 1e8;\r\nr1_correct = 0.94224;\r\nr2_correct = 1.00013;\r\n[r1,r2] = primeCount(n);\r\nassert(isequal(round(r1,5),r1_correct) \u0026\u0026 isequal(round(r2,5),r2_correct))\r\n\r\n%%\r\nn = 1e5;\r\n[r1,r2] = primeCount(n);\r\ns1 = floor(1e5*round(r1,5));\r\ns2 = floor(1e5*round(r2,5));\r\nbxo_correct = 59814;\r\nassert(isequal(bitxor(s1,s2),bxo_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":16,"test_suite_updated_at":"2021-01-03T15:27:20.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-08-07T15:57:52.000Z","updated_at":"2025-08-18T01:32:16.000Z","published_at":"2020-08-07T16:33:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/241\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 241\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, which is based on \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://projecteuler.net/problem=7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProject Euler Problem 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, asks us to identify the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"N\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth prime number. That is, the problem seeks the inverse of the prime counting function \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=\\\"pi(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, which provides the number of primes less than or equal to \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. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/PrimeNumberTheorem.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ePrime Number Theorem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e gives approximate forms 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=\\\"pi(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e for large \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\u003e n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Two such approximations are \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/ln(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en/\\\\ln(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Logarithmic_integral_function#Offset_logarithmic_integral\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eoffset logarithmic integral\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"Li(n) = li(n) - li(2)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e{\\\\rm Li(n)} ={\\\\rm li(n)} - {\\\\rm li(2)}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, 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=\\\"li(x) = integral of 1/ln(t) from t = 0 to t = infinity\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e{\\\\rm li}(x) = \\\\int_0^\\\\infty dt/\\\\ln(t)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e (See \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46066-evaluate-the-logarithmic-integral\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46066\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTest these approximations by computing two ratios: \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=\\\"r1 = [n/ln(n)]/pi(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003er_1 =[n/\\\\ln(n)]/ \\\\pi(n)\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=\\\"r2 = Li(n)/pi(n)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003er_2 = {\\\\rm Li}(n)/\\\\pi(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Do not round the approximations to integers. For \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n = 100\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 100\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, you will find that the first approximation is about 13% low and the second is about 16% high. However, for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n = 10^8\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 10^8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, the first approximation is 6% low and the second is only 0.01% high. \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":46594,"title":"Create a sequence of primes p such that p \u003e n π(p)","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: 407.5px 46.5px; transform-origin: 407.5px 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: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 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: 83.1px 7.875px; transform-origin: 83.1px 7.875px; 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: 126.017px 7.875px; transform-origin: 126.017px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term of a sequence of prime 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);\"\u003ep\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.275px 7.875px; transform-origin: 32.275px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e such that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAAAlCAYAAACZOKFiAAAEI0lEQVR4nO1bW5HjMBBsDmYQAiFgBEFgBmFgBqYQDIEQDqEQDKGQ+5D71FbJlqyHs3errnJt7TrRSKOep7RAQ0NDQ0NDQ0NDA3ABcK409rXSuA0HYQBwqzj+BcADQFdRRkMlDADuB8l5opHkn0IP4I3jNm1EXU/VUBAdDDmGg2W+YEJOww/HCLNZR2PAsV4rCRf88AlWxje8hyv7R1c2D9hJ/kaiXAF88L213/Ad7xWNEUZBH/xOojzn51sYYHSf3HfpYDLsC2zmy+z3BGCC8QKP+X3K5p7mMZUo0/z3mjjBrM11sVxryPV28tnQ40sGO5j1Tjvn3c/PCKv/bn6usPsxIbzx53kOyWGGBLnDbuAEm1hNWG5uTn3tEoWyShKlhw1rlEHCn2Hm78r3YXTGCD2+HKOf340Ja1DP+4Qh4GteyyRzeyNMEtVBMriYD4yC3YbOQ97nlk5HEGWSsXsYJb5gQ5wq38UNRvFKtCes5X7kPR+f0TD/6BPXoPvxcmQogUIeimNkQQX6un17JhSLmkThuCzzXlhuFOW51j1iuf43lqUiXXaMwqmzFIKowbrkcN+HchwSLAt0vW/4N6gGQYgaRHnButYHljFYletunv7OBE8Jw3nGxPQcgqgH9HnsvQT5JMzhL9Tlrp0VhCZcAkyKNfbfsT8DP2Fpfe6a6PrfgXFoNJpfcG4x5M0hiBqsDxfEG2w2QVTYWkNHk7ta1QcTzNyymATQEKOgjK2DM4YS/T71FFu2phJEDXYtuVSDDTXhskttN167UIuscRrpEiP3DEErMp/yYhRLnWiuwXFjqxKGqL0E4fe2vssQGvKCQIEklcJiwkvJiy4DyhKD0PFcqLdc84RsUWuuoVYdu+GpZa4arA+6hphcKCtvVO/gE3aCVdbeha5hgCVlSWIAYeWR7HS5bEApGBo0Ydewxc8PEfPeChNrCBksw32MVyBJk8+C1J35vAMnUyK0uMR4oHzCq97O5yEon2S/wSqvw7Ja043VKosd2teKDMUd++J/yGC5Pl/p6wOJnZw3arx2BVIpuV04HzFq3cncsi4mnqzE9FhBw4qv3NdQyCfGo9IAYzdIPZVrPBxrTzebjbxkqFI4oQts5pvaBSSUgDWJASytz7d5+t71iu471yVfN767BRIvNjy7Rx6A0dkdthMcC64pObyoRU3zQOP8s1QpSwbXJAZxgj08W5s/D998xD/P79bmSv3sNZo9F4ZosAy/PFRM0d+IzPJW422tDax9Yvuv4ImwF9HuaO4lHxYXWRFAD54a6oKHhVuGWNJgeT0jGTHt9Yay6LGdYIba67EocqN9b7OloQzO8F8PKGWw2f+YxVtSWnbeYdj9m64CfhMnLEOIe9TAC0Ip+Vt2X4k3yHxPI8h3sLYfLcFvaGhoaGho+G/xBwvy6k6tSXebAAAAAElFTkSuQmCC\" style=\"width: 68px; height: 18.5px;\" width=\"68\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 24.8917px 7.875px; transform-origin: 24.8917px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, where \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAlCAYAAAD2pT8KAAACbklEQVRoge2ZXZWDMBCFPw84wEANVEEV4KAOcFALaEACHmoBDVjoPiT3MKX8JGH5eeCewwvsZpKZe2cmU7hw4cKFc+IJZBusmwOPDdbdBBVQbLh+6W2cGhWODXvYOa0zSqDZ0V7DtsxLwh344DS8F25At7PNRTQcQ9WKfVk4iyPYMLR9O8D2D2rgfaD9lhMkzgwXkdeBe6hwuWIVclzmLQOeMfo9cI6IaXJyHKVlt6YvuXd63dv3c3iyQh6ZN/iJeMZyQOm/3SNsqzt8m7ULeompDOvbEu2VJ6JLaeYNtgODjX+0wda8m9pM7f82BXJi523a6Gf+vfY2167LEWXsBhpj9EbvBEFUC1lYjkyBDcKYBOz3JemFMOcLGd9akjzsRlrCNZfqCCXZD9MVJ9YRyf2E3Yz0L4a0gWukOkJJdooN8J1Dlm6yqxwhCdgFXsSVw1RHyM5UErZBWgrK6hIuCdhcoAQVWgUkrVTbU1EsWGaMkJws7T/bXCC6doQPVVLLZ6gsQholnSVpYCNK20RVj7x7MX+HSKnhNtpzTVqogxWMqLtOTn/g4QFEV2nySdgdoiNOn5LTWLRzenmGDnhqwpM78C2HsbI11k2GRKSK3IgOOrSvRq8jbsoVnR8sJTt+aWmZEhMROTjEaSrPYt4N54DC76kmjuI6U/QI4IE74FTJeuK8G7tw6GBGJVuylL0HaVPvhmNvvj+QtpdYoSS9+tqMc15MhdsNBU7jcxsTG+qVtnQpiynbu2LuN4eQtjoUp5xgD1Ew7gzbVq+ZMW79A9K/4k4vEU3BbEUqSaN1zkkGtSnQaG7suXDhwoXD8QfFOP66PhBRrQAAAABJRU5ErkJggg==\" style=\"width: 33px; height: 18.5px;\" width=\"33\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40.0583px 7.875px; transform-origin: 40.0583px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the prime counting function. The first three numbers in this sequence are 2, 11, and 37. For example, the second number is 11 because five primes are less than or equal to 11 (i.e., \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAAlCAYAAACOGjGrAAAC7klEQVR4nO2a3bWqMBCFdw90QAM2QAVWYAd2QAe2QA2WQA+2YA20cO5D2IdcBEwm3jUT73xr5UUJDmTPXwzgOI7jOI5jiyuARtsIAB2Ak7YR/ysDgIu2ETMNgDvs2POvabUNIANCNEilybxeMrcB8MD3iKE/GKOiXb/kGNLM10/zyEEytwHwRP1p4gLg52Coi72bDUkJTVeEBaTxOUIonfvIuN4iz3mMG2OAgbqMhrzjiiAaemjOYpbMJU+EaFIjjAbqi71HTjSIGSFbzJK5TCk18kAofM1yhyzkagihhZFcmgmdbUQQc6drzisNgoE3wVwNIQAhPZj2rA34vPGYEN77R1rGFsE7jloSjq2K+zwbdRb8tpYQ7sJ5WrQIEXevU5gge/8AgicPBzffGlvK6+fvJKFKSwi0WeJJqU7zbkih425FiOw14AYL2xDeiG0I1Re3KXsdwX2+VoK2EErEWzI+FY06LN0T1yuroxix7MidsIiAXOfPUpTLFyNBSwgsvCQF4ycignQndQs6NcWQnCIa/J3rmR5i46iylF24moVQ637CGjqztGj/rfjjfMmbPhPv4UKwAaOCqBtiCojTwg15yqpRCCWdjlVY94iEwBQQewb38VMLKaYWCTUWi9pdwx58puzUwPAY1wL0lAnp1WfN7aNkz95S1xBDh8yOcnygeGv4vvHZu52rkgpcSwgj0mugNda6BiAIekJm+9hiWfD1AjJV8CWl/m3Lrc5ctIQwIe2fUitQfHtRlxEu2RnjdLD2fGA7jKWE/AEyD2OlK1lM6Vy+A3N/2uywXrP1mQMW/FlRJj7dMuF1nyCOFDk3z325LRYVc/RIC2slcwG5aDVZ1yUTlvT2gPDU1RlhgbfyPs8A9jvfvzM2Jdx2OM6fR8VOyVxgyaU1to0nvD6ryWN3LcJLthxybzByuPPbuSCEKotHqTrktcVOIT3sVeTfcoK5Oi6wI4YGIR24CJTgaWNtrNjhOI7jOI7jODb5Ax+QqaGPbwHFAAAAAElFTkSuQmCC\" style=\"width: 65px; height: 18.5px;\" width=\"65\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 33.1333px 7.875px; transform-origin: 33.1333px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) and 11 \u0026gt; \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAAkCAYAAACkATUaAAACwklEQVR4nO2a4bWzIAyG3x3YwAVcwAk6gRt0g27QFTpDR3CHu4IzdIV+PyDH6CeSCBf1njzn5FcRIW8TAggYhmEYhmEYxklwwYwMOgCPYHcA7bHDAQD0mMa0tB9cW/QeQKNo32Dujyx9OgAjgO+KvXGcY5vImMheB40rlx6TvyXCOfi5fuGDsQt9fOD1UYvfYXLiEOyDuXMHHCP8K4xliJgmSs7AWnClBHPwGe0LL/Syv2/oUyy8Cw+sOZD+STS4u7TTQlCU3yq/97e4BXPw0SkV/Rna/UR+pwzwlg6E0kwsinvMo70mT2yP7co8IBOdL2+PSJsbayMKkEHQkKL9I+mwEC68b4SfLEXIX0Eq+pO16yJtHGsjqnHuSDtzQH3RuVOWhVts8ldCKjpf/7d0onbFNCLRxWtGAfiat2axVHcVpKJTm5SYA2T9iaH0fkRB5cJ7qVjJFb5BfM+vsdxsIxGd76o0oi8rfDUtpsrx6DW1wXxye/7V3JE5lruT0Yo+JvrjmTF7l0URdqZ1lEf9U/lsqUjPTaFa0VNLK+8vS3SKcq1j+fMjfGoquTTQ2cLW3vXsaEVPzZMHwm7R6RQop3jjKSeVnrTQVqbmjqIkEtFb1qbKmv5C/tErn1jpyp+i4C+LDuwTfdfSU0Jwog9Wuggk0bXp/UrVOzCduX+w7UNpu1VKCv6b0PGwtt64UvUOzE/kJBlBfVT+QFrwW+LltaB0ph3Llap3Gm/qXEJ99k7QjdrWVWWLnelDCX3IEStIKFqvepcOyEUH5LdsqiinVElXrDGr5WieRgfMndLB//FeOP8StIU0bQPb9+lU4acCdga/OpVYjUOatcuWAX7iIwocMx6Iw//fKbyRFsxhCrzllzOj4PkZmnWs5kcUTXgfvbvHuU4F95CqJyT+bTH55SzfMBqGYRiGYRiGYRiGYRgx/gE3xZETjAK45gAAAABJRU5ErkJggg==\" style=\"width: 62.5px; height: 18px;\" width=\"62.5\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.875px; transform-origin: 3.88333px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 64.1833px 7.875px; transform-origin: 64.1833px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA related problem is \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46117-test-approximations-of-the-prime-counting-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46117\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: 161.808px 7.875px; transform-origin: 161.808px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Test approximations of the prime counting function. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function p = GTnPrimePi(n)\r\n  p = f(n);\r\nend","test_suite":"%%\r\nn = 1;\r\np_correct = 2;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 2;\r\np_correct = 11;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 3;\r\np_correct = 37;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 6;\r\np_correct = 1087;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 10;\r\np_correct = 64553;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 15;\r\np_correct = 9558533;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 20;\r\np_correct = 1394193607;\r\nassert(isequal(GTnPrimePi(n),p_correct))\r\n\r\n%%\r\nn = 18;\r\nd = num2str(GTnPrimePi(n))-'0';\r\nassert(isequal(sum(d),50) \u0026\u0026 isequal(prod(d),349920))","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":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-22T04:38:46.000Z","updated_at":"2025-11-15T06:35:07.000Z","published_at":"2020-09-22T04:53:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\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 of a sequence of prime 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\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e such 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\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ep \u0026gt; n \\\\pi(p)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, 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\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi(p)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the prime counting function. The first three numbers in this sequence are 2, 11, and 37. For example, the second number is 11 because five primes are less than or equal to 11 (i.e., \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi(11) = 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e) and 11 \u0026gt; \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2\\\\cdot5 = 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA related problem is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46117-test-approximations-of-the-prime-counting-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46117\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e Test approximations of the prime counting function. \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":47950,"title":"Test the generalized Legendre conjecture","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 114px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 57px; transform-origin: 407px 57px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 166.475px 7.79167px; transform-origin: 166.475px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Legendre conjecture states that for every integer \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: 106.192px 7.79167px; transform-origin: 106.192px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e there is a prime number between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAmCAYAAAA820BcAAABQElEQVRYhe2VTZGEMBCFPw9xEAMYGAUowAEOcICFaEACHrAwGrDAHJKuapjO7tZOwlzyqnJJKv1e/0NDQzk80nF3ks7Aoc4OjHeImIEF8IlsVCKGmsSO6KUl6ADWmuQd0Bv3j0S+1STPQcjDN8gl71ZUqmOlcr5zkJDf2uskwiexEG/HSoHedryr98SQ+syfQCy0K36NQg9MROU7MWdiyKd7PTqvBgN2W3WZ+xPEq6ci8enznoRN6m1Wf+V+Nc5hCM1iU4Y8Zy+livXM7jKkcv48ZJwyPiYhunj0wijeRr0ybqkOVFwWYvwg5v4KKcSpBrkututM7tRb8QGijS/Gu+Tb2t0fQxeTtYmkbaqsSDFueaa7QKp/oWD4xbjl2cC5xQLnIfMRdItZIdcp2bBr4t8Y+Hn5u0RYZGM1NDQ0VMULbnF1B0s+y7QAAAAASUVORK5CYII=\" alt=\"n^2\" style=\"width: 15.5px; height: 19px;\" width=\"15.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5583px 7.79167px; transform-origin: 15.5583px 7.79167px; 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,iVBORw0KGgoAAAANSUhEUgAAAGcAAAAnCAYAAAASGVaVAAACwUlEQVRoge2abZGzMBSFHw84qAEMVEEV4GAd4KAWqgEJ9YCFasBC3x/pGfKyfNwE2GYgzww/dqAk5OTenNwsZDKZTCaTOTolcAUu3+5IpqcCOuDtXXeySF/nBrxwUaO/JdRj7curLV5yMO5AbXy2pRdG3HDidEAR24mzCjMczDFqbGMzJaLSW5Q4FU71M1HhUlBjfP6BPYKGvD9tBVPiQs4yg46A1gXNZqs4BW6croHtlfSmIJgn50lnd+Dnc4WKA320haSnmsj15orrYGo2ryZ84EKJEQfcQFvTm6LtFtgG4KJmzwGIJWVx7tjXjwYXpcFccJ2L+vHOpCyOss1SNFgd3ijKu6FG4MLvNKhSRbSPH5CyOPrt3AJfTbz3gnGMmk8jS/x8OvKk/yAJeuV/59NaG18gdXFa3HiMIdMwpJj5zWgDltxZ0u9yfb+uGpJmie5HLX4DUhdHE3WIUp7E86+OgCXkjV3Jgv5javq9gqKk9u5v4fxSF+fBb3GKz7uGoviXOauEiONHjop5vgiKHGuVocDNsqlLH/9ceG7NRFgjjiZP6IbUTIg4d/riXYtLZT5ad6z+X+G/9lrjNA8jjr/oD+1h6d2zdrZkPvzVXrfw3Jr1bQtxdit5WcXRfmiqsipL3m3Yt9TXHKvTjUYzdAm/DjWWRtTRLQcydXHkvnZjzHGM4dvkMbehe8N1aA2pi/MiYM8SQ4VtnZj7CN/Fafe7xblQyuJoWxF7thPUyJzj8V3VWGQo+lQZaDn+JlSTevfzr4b5mS4LPZXSlPI6XKhvVUTdWxx/0/wibL/04I9OjRUZU7NANbWpIp8sccO2nn8vcVRqGrPlNcvRoGyz5fo6S0N6ZzpX3GD92SAYqdnZCAyJPRs/G1/7X4uS8LPxMyGz87VIvhFYOT0RDxJIsSXn+U8cKzoiyWQymUwmk9mef/ZwPiwesE35AAAAAElFTkSuQmCC\" alt=\"(n+1)^2\" style=\"width: 51.5px; height: 19.5px;\" width=\"51.5\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.0167px 7.79167px; transform-origin: 56.0167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The generalized Legendre conjecture (GLC) is that there is a prime number between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAmCAYAAACsyDmTAAABZElEQVRYhe2WTbHDMAyEl4MZhEAIFEEQhIEZhEEpFEMghEMoBEMp5B2sHW9dt9M/O4fnb8aHWDORLK1kA41G4yVOmdU/sRWnAzAD2G1NtkfbZvsX2S/O2Zwuyf5o+2OtQAizMNm3Q8jIhli+anSI5eptrRaQqx0MAHgLZkPI0CElUlTQO4KeDuWKKOjdvg8pFRDmCjPjcNvih8B2X+1bA/zJzHG4b9POHOUcrLjXDUuXzqSXGBA6Y0HUgpdA+HNqQ4PVdj892H+723h61p6p7i2ACbGV00yMeFweHmTFhwJn6hf7uWZDdcETDwjtvtjSIegztrcuVScOvQWnqfa47aTiDOKQJ1Iu+EKkn0CHHP8pFPuUsRVBBT0ktl5sVW5tdThn7NTPtUYw6jCXHSC2b7WrQC/EFO0+dt2MwqWjw1wGdPDxBVj0aaHtniuXlnNFXmM/ZUScpjkc4sQ99AXYaDQa/4Y/fwGN5R/2og0AAAAASUVORK5CYII=\" alt=\"n^K\" style=\"width: 18px; height: 19px;\" width=\"18\" 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: 15.5583px 7.79167px; transform-origin: 15.5583px 7.79167px; 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,iVBORw0KGgoAAAANSUhEUgAAAG0AAAAnCAYAAAAFO8ZcAAAC6UlEQVR4nO2aW9XqMBCFtwccYKAGUFAFdYADHNQCGpBQD7WAhlrgPEz3ylASmjTDTw7Nt1ZfUuglO3NNgUqlUqlUKpXKrmgAnDxH6NzhC89YWXAAcAHwmI8bRCyeu83joxrfTAfgmnuRH6OHCJBKCxFmwrMlNfNYDwML26tgMSv9gvS5uUJEG9TYeR5rE6/lpYOY6p7oANwhriqGK9Is7g4R6AznEkcAx4RrBKG5ZvvW/4QWbkIZb2I4QObptPZDyFzy+mcYukMyYD9usYdMIt1UimiAs861ydfXZ8Jhxmm+qInJGsLMK2VCU9kiGiBWs+YmmR0O6j4xFhrFgM9OzFZKFq2HWFvMtVu4hGSEgXs8wvnc0ihZNHqnUAbIVP8BEYmx8AFxr1nQ76YmIEe8ulNW+VaBtmTR+N8+cK7Haxzj+yxrtmTod9c4zw+i/TOFPuE5EzNxAShftBHP9ZeG87GMexzPSvpGrPtmQATSJs//dJCV08EtAKvCsXTRuICXMOT4XKFua21O/JbV+jsO6oYXuFqHVmXyQIrSRWNyoWnm8QEuwaNHaj3nNsW3FNG0pbUQC9Pi6AZoDAf4u+A8dAvo3e9yFkiOaFxUZml8LCmiMbhOEGGWqyTkx0MwA8s9cjLfnxdNJxvLQKpbNrEv0cC5Ct/B+00rv8uJnxai/XnrL1Y0HVxZe2hYOkyGz1Z6TIvNvM3hil5D99F87ogvYDnBpYs2wHaRRuPLgHzodN5Xg4VS3BxKF+2O+NBiSoe4OPTu5XRWeYSIatHRLlk0lj9bdrOz4c3fZWA6y/NZ0rIZOuL3i2su9q/tP3I3NQRT/ZBrpOucIC7Dqvn8adF0M+COtHrvii/v8tOSQquGPcdQc5Sp+w22NcunRGPLzVc+XLBuPfROlvF7EzeUt6d2gkzi1ydnwQVfSkCWpHz7sGeK+5amQdy3D3uFSVZplo8WYvpVuFeuKFAwwu2FioNbUZVKpVKpVCq/zz8zIlbeQnNdygAAAABJRU5ErkJggg==\" alt=\"(n+1)^K\" style=\"width: 54.5px; height: 19.5px;\" width=\"54.5\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 98.3917px 7.79167px; transform-origin: 98.3917px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; a further conjecture is that the smallest \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eK\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 36.5667px 7.79167px; transform-origin: 36.5667px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e possible is \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" alt=\"log(1151)/log(95)\" style=\"width: 121.5px; height: 18.5px;\" width=\"121.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 114.992px 7.79167px; transform-origin: 114.992px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a value of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eK\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 124.075px 7.79167px; transform-origin: 124.075px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which you can assume to be less than \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" alt=\"log(1151)/log(95)\" style=\"width: 121.5px; height: 18.5px;\" width=\"121.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 77.0167px 7.79167px; transform-origin: 77.0167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and determines the first value of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.075px 7.79167px; transform-origin: 145.075px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for which the GLC fails as well as the interval [\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAmCAYAAACsyDmTAAABZElEQVRYhe2WTbHDMAyEl4MZhEAIFEEQhIEZhEEpFEMghEMoBEMp5B2sHW9dt9M/O4fnb8aHWDORLK1kA41G4yVOmdU/sRWnAzAD2G1NtkfbZvsX2S/O2Zwuyf5o+2OtQAizMNm3Q8jIhli+anSI5eptrRaQqx0MAHgLZkPI0CElUlTQO4KeDuWKKOjdvg8pFRDmCjPjcNvih8B2X+1bA/zJzHG4b9POHOUcrLjXDUuXzqSXGBA6Y0HUgpdA+HNqQ4PVdj892H+723h61p6p7i2ACbGV00yMeFweHmTFhwJn6hf7uWZDdcETDwjtvtjSIegztrcuVScOvQWnqfa47aTiDOKQJ1Iu+EKkn0CHHP8pFPuUsRVBBT0ktl5sVW5tdThn7NTPtUYw6jCXHSC2b7WrQC/EFO0+dt2MwqWjw1wGdPDxBVj0aaHtniuXlnNFXmM/ZUScpjkc4sQ99AXYaDQa/4Y/fwGN5R/2og0AAAAASUVORK5CYII=\" alt=\"n^K\" style=\"width: 18px; height: 19px;\" width=\"18\" 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: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG0AAAAnCAYAAAAFO8ZcAAAC6UlEQVR4nO2aW9XqMBCFtwccYKAGUFAFdYADHNQCGpBQD7WAhlrgPEz3ylASmjTDTw7Nt1ZfUuglO3NNgUqlUqlUKpXKrmgAnDxH6NzhC89YWXAAcAHwmI8bRCyeu83joxrfTAfgmnuRH6OHCJBKCxFmwrMlNfNYDwML26tgMSv9gvS5uUJEG9TYeR5rE6/lpYOY6p7oANwhriqGK9Is7g4R6AznEkcAx4RrBKG5ZvvW/4QWbkIZb2I4QObptPZDyFzy+mcYukMyYD9usYdMIt1UimiAs861ydfXZ8Jhxmm+qInJGsLMK2VCU9kiGiBWs+YmmR0O6j4xFhrFgM9OzFZKFq2HWFvMtVu4hGSEgXs8wvnc0ihZNHqnUAbIVP8BEYmx8AFxr1nQ76YmIEe8ulNW+VaBtmTR+N8+cK7Haxzj+yxrtmTod9c4zw+i/TOFPuE5EzNxAShftBHP9ZeG87GMexzPSvpGrPtmQATSJs//dJCV08EtAKvCsXTRuICXMOT4XKFua21O/JbV+jsO6oYXuFqHVmXyQIrSRWNyoWnm8QEuwaNHaj3nNsW3FNG0pbUQC9Pi6AZoDAf4u+A8dAvo3e9yFkiOaFxUZml8LCmiMbhOEGGWqyTkx0MwA8s9cjLfnxdNJxvLQKpbNrEv0cC5Ct/B+00rv8uJnxai/XnrL1Y0HVxZe2hYOkyGz1Z6TIvNvM3hil5D99F87ogvYDnBpYs2wHaRRuPLgHzodN5Xg4VS3BxKF+2O+NBiSoe4OPTu5XRWeYSIatHRLlk0lj9bdrOz4c3fZWA6y/NZ0rIZOuL3i2su9q/tP3I3NQRT/ZBrpOucIC7Dqvn8adF0M+COtHrvii/v8tOSQquGPcdQc5Sp+w22NcunRGPLzVc+XLBuPfROlvF7EzeUt6d2gkzi1ydnwQVfSkCWpHz7sGeK+5amQdy3D3uFSVZplo8WYvpVuFeuKFAwwu2FioNbUZVKpVKpVCq/zz8zIlbeQnNdygAAAABJRU5ErkJggg==\" alt=\"(n+1)^K\" style=\"width: 54.5px; height: 19.5px;\" width=\"54.5\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e].\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [n,interval] = genLegendreConjecture(K)\r\n  n = f(K);                 %  First integer for which the GLC fails for this value of K\r\n  interval = [n1 n2];       %  Interval that will not contain a prime\r\nend","test_suite":"%% \r\nK = 1;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 1;\r\ninterval_correct = [1 2];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.1;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 3;\r\ninterval_correct = [3.348370 4.594793];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.2;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 4;\r\ninterval_correct = [5.278032 6.898648];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.3;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 5;\r\ninterval_correct = [8.103283 10.270619];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.4;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 10;\r\ninterval_correct = [25.118864 28.704485];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = sqrt(2);\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 4;\r\ninterval_correct = [7.102993 9.738517];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.5;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 10;\r\ninterval_correct = [31.622777 36.482873];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.51;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 8;\r\ninterval_correct = [23.102867 27.599816];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.52;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 8;\r\ninterval_correct = [23.588307 28.212957];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.53;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 8;\r\ninterval_correct = [24.083948 28.839720];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.54;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 22;\r\ninterval_correct = [116.769905 125.043427];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.542;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 22;\r\ninterval_correct = [117.494023 125.830037];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.544;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 22;\r\ninterval_correct = [118.222631 126.621595];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.545;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 32;\r\ninterval_correct = [211.571281 221.872786];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.547;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 105;\r\ninterval_correct = [1338.997745 1358.776958];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))\r\n\r\n%% \r\nK = 1.5476;\r\n[n,interval] = genLegendreConjecture(K);\r\nn_correct = 94;\r\ninterval_correct = [1131.390861 1150.072057];\r\nassert(isequal(n,n_correct) \u0026\u0026 all(abs(interval-interval_correct) \u003c 1e-6))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":"2020-12-31T13:21:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-13T19:59:49.000Z","updated_at":"2025-12-02T17:41:25.000Z","published_at":"2020-12-13T20:02:06.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 Legendre conjecture states that for every integer \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 there is a prime number between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e 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+1)^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(n+1)^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The generalized Legendre conjecture (GLC) is that there is a prime number between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n^K\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en^K\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+1)^K\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(n+1)^K\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e; a further conjecture is that the smallest \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"K\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eK\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e possible is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"log(1151)/log(95)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\log(1151)/\\\\log(95)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a value of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"K\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eK\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, which you can assume to be 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=\\\"log(1151)/log(95)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\log(1151)/\\\\log(95)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, and determines the first value of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\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 for which the GLC fails as well as the interval [\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^K\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en^K\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"(n+1)^K\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e(n+1)^K\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\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":48075,"title":"Play PRIMEGAME","description":"Have you ever used the Sieve of Eratosthenes and said, \"I wonder whether there’s a less efficient way to find prime numbers.\"? No? Neither have I. \r\nNevertheless, let’s consider PRIMEGAME, a creation of John Conway that is somewhat less well known than the Game of Life. PRIMEGAME uses the fractions\r\n17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/2, 1/7, 55/1\r\nYou start with a number and choose the first fraction in the list that—when multiplied by the starting number—yields an integer. If the starting number is 2, then the first fraction fitting the rule is 15/2, and the product is 15. \r\nIn the third step, the next fraction is 55/1, and the product is 825. In the fourth, the fraction is 29/33, and the product is 725. The first twenty steps give\r\n2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4\r\nNotice that the 20th number is --that is, 2 raised to the first prime number. If you continue another 50 steps, you get 2 to the second prime number (3), or 8. Another 210 steps give 2 raised to the third prime number (5), or 32. In fact, all exponents in powers of 2 that appear in the sequence are prime numbers. So, PRIMEGAME generates the primes! Painfully slowly!\r\nWrite a function to find the nth number generated by PRIMEGAME if the first number is 2.","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: 380.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 190.433px; transform-origin: 407.5px 190.433px; 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: 384.5px 21px; text-align: left; transform-origin: 384.5px 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: 75.85px 7.66667px; transform-origin: 75.85px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHave you ever used the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45367\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eSieve of Eratosthenes\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: 119.042px 7.66667px; transform-origin: 119.042px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and said, \"I wonder whether there’s a \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 12.45px 7.66667px; transform-origin: 12.45px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eless\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: 82.7167px 7.66667px; transform-origin: 82.7167px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e efficient way to find prime numbers.\"? No? Neither have I. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 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: 351.1px 7.66667px; transform-origin: 351.1px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNevertheless, let’s consider PRIMEGAME, a creation of John Conway that is somewhat less well known than the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/groups/2/problems/52\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eGame of Life\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: 103.442px 7.66667px; transform-origin: 103.442px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. PRIMEGAME uses the fractions\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404.5px 10.2167px; transform-origin: 404.5px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.666667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.666667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.666667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.666667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 350.35px 8px; tab-size: 4; transform-origin: 350.35px 8px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/2, 1/7, 55/1\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 367.708px 7.66667px; transform-origin: 367.708px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou start with a number and choose the first fraction in the list that—when multiplied by the starting number—yields an integer. If the starting number is 2, then the first fraction fitting the rule is 15/2, and the product is 15. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 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.75px 7.66667px; transform-origin: 380.75px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn the third step, the next fraction is 55/1, and the product is 825. In the fourth, the fraction is 29/33, and the product is 725. The first twenty steps give\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404.5px 10.2167px; transform-origin: 404.5px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.666667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.666667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.666667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.666667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 361.9px 8px; tab-size: 4; transform-origin: 361.9px 8px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384.5px 42px; text-align: left; transform-origin: 384.5px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54.8417px 7.66667px; transform-origin: 54.8417px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNotice that the 20\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 5.83333px 7.66667px; transform-origin: 5.83333px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 34.6167px 7.66667px; transform-origin: 34.6167px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e number is \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAmCAYAAAA820BcAAACFklEQVRYR+1WOy9EQRTe/QvodOiJ0NEoEEoS/AKh02yC2vMHeFVKEi1BoyASoVEpPP6BV/wAvk9mZO65Z+6dnd2bLexNTmb3zJnznfnO495yqYFPuYHYpSZ4EewPGKcPWF81gCJoXwHQkgP2jt+LkCMZRL3BCdxpwD+xTkJ2TCAzWA9cBuoJ3grHj5AWQbFl4gz60WrAO0z0Q+bQB9YLjULouiHtkBMBztxfQu4g/aHgFRhuaIUC3TNkAnLv2XfVFnwbyvkQ8FmTK4LsmQO9WKecw9wbhrzkBGB9jUtWtJyTalLESJeFY+4dQvqMflWxkbGcGkUi39Rp4KSbOU4ZGyeWRv5N5VEgW9s26FO9roHfwnABcpVB5xP22FLsYVnd9hir/wbirQ0NnFWbV0ikcgTCvHd5gqTNPiTR265tbJ9b8FQFG+db5gK7IrDExWLBv43TQSU9BOaTaCv8JzAr/08fAz4GB8cQVv20uJmdDZxm8mGaetyUxoBbyllwbo/zZr6hxEBoGzRklMB/VfbWqYHhO5Clr+bmdvisw+FmDJg8EwrOniXd5xA59aLjCAEvBJgR54EXBhwCzun0JqtUaa9r6LLGsZqarJtzWPDln/gAEF44NNYgvvmeWQ8+cALPBVZSyGs1+ObVANOpHDaBMesFZ7+3Q5x8wSjvDej1k1ftIQFE2zTBo6mr5WCT9lrYiz77f2n/AQK+XSdneCf8AAAAAElFTkSuQmCC\" alt=\"2^2\" style=\"width: 15.5px; height: 19px;\" width=\"15.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 275.35px 7.66667px; transform-origin: 275.35px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e--that is, 2 raised to the first prime number. If you continue another 50 steps, you get 2 to the second prime number (3), or 8. Another 210 steps give 2 raised to the third prime number (5), or 32. In fact, all exponents in powers of 2 that appear in the sequence are prime numbers. So, PRIMEGAME generates the primes! Painfully slowly!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 276.783px 7.66667px; transform-origin: 276.783px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to find the nth number generated by PRIMEGAME if the first number is 2.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = PRIMEGAME(n)\r\n  y = f(n);\r\nend","test_suite":"% Clean user's function from some known jailbreaking mechanisms--from Binbin Qi\r\nfunctions={'!','feval','eval','regex','system','assert','assignin','urlread'};\r\nfid = fopen('PRIMEGAME.m');\r\n  st = char(fread(fid)');\r\n  for n = 1:numel(functions)\r\n    st = regexprep(st, functions{n}, 'error(''No fancy functions!''); %','ignorecase');\r\n  end\r\n  st = regexprep(st, 'function', 'error(''No fancy functions!''); %','ignorecase',2);\r\nfclose(fid);\r\nfid = fopen('PRIMEGAME.m', 'w');\r\nfwrite(fid,st);\r\nfclose(fid);\r\n\r\n%%\r\nn = 1;\r\ny_correct = 2;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 3;\r\ny_correct = 825;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 5;\r\ny_correct = 1925;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 11;\r\ny_correct = 770;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 17;\r\ny_correct = 550800;\r\nassert(isequal(PRIMEGAME(PRIMEGAME(n)),y_correct))\r\n\r\n%%\r\nn = 20;\r\ny_correct = 2^2;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 37;\r\ny_correct = 10780;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 53;\r\ny_correct = 1650;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 70;\r\ny_correct = 2^3;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 101;\r\ny_correct = 5320;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 179;\r\ny_correct = 11790625;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 282;\r\ny_correct = 2^5;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 353;\r\ny_correct = 1705200;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 467;\r\ny_correct = 91238000;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 547;\r\ny_correct = 314496;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 711;\r\ny_correct = 2^7;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 956;\r\ny_correct = 123853146484375;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 1293;\r\ny_correct = 25088;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 1553;\r\ny_correct = 2225664;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 1637;\r\ny_correct = 197791083984375;\r\nassert(isequal(PRIMEGAME(n),y_correct))\r\n\r\n%%\r\nn = 2376;\r\ny_correct = 2^11;\r\nassert(isequal(PRIMEGAME(n),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2022-01-29T15:31:27.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-18T03:10:48.000Z","updated_at":"2025-11-15T17:21:00.000Z","published_at":"2020-12-18T03:53:35.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\u003eHave you ever used the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45367\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSieve of Eratosthenes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and said, \\\"I wonder whether there’s a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eless\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e efficient way to find prime numbers.\\\"? No? Neither have I. \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\u003eNevertheless, let’s consider PRIMEGAME, a creation of John Conway that is somewhat less well known than the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/groups/2/problems/52\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGame of Life\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. PRIMEGAME uses the fractions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/2, 1/7, 55/1]]\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\u003eYou start with a number and choose the first fraction in the list that—when multiplied by the starting number—yields an integer. If the starting number is 2, then the first fraction fitting the rule is 15/2, and the product is 15. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn the third step, the next fraction is 55/1, and the product is 825. In the fourth, the fraction is 29/33, and the product is 725. The first twenty steps give\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4]]\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\u003eNotice that the 20\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eth\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e number is \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"2^2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e2^2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e--that is, 2 raised to the first prime number. If you continue another 50 steps, you get 2 to the second prime number (3), or 8. Another 210 steps give 2 raised to the third prime number (5), or 32. In fact, all exponents in powers of 2 that appear in the sequence are prime numbers. So, PRIMEGAME generates the primes! Painfully slowly!\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 nth number generated by PRIMEGAME if the first number is 2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}