{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":43967,"title":"Compound interest - number e","description":"A moneylender wants to receive his annual interest of 12% more frequently.\r\n\r\nIf he receives his interest rate every six months, he will receive 6% each time (12%/2).\r\n\r\nHe wants to know how much will he win during a year if he received his interest every year (n=1), every six months (n=2), every month (n=12), every week (n=52), every day (n=365) and every second (n=31536000). These will be the test cases.","description_html":"\u003cp\u003eA moneylender wants to receive his annual interest of 12% more frequently.\u003c/p\u003e\u003cp\u003eIf he receives his interest rate every six months, he will receive 6% each time (12%/2).\u003c/p\u003e\u003cp\u003eHe wants to know how much will he win during a year if he received his interest every year (n=1), every six months (n=2), every month (n=12), every week (n=52), every day (n=365) and every second (n=31536000). These will be the test cases.\u003c/p\u003e","function_template":"function y = compound(n)\r\n  y = exp(0.12); % This would be the solution if n=inf;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_ok = 1.12;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 2;\r\ny_ok = 1.1236;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 12;\r\ny_ok = 1.126825030132;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 52;\r\ny_ok = 1.127340987167;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 365;\r\ny_ok = 1.127474615638;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 31536000;\r\ny_ok = 1.1274968514306000;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":12767,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":42,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-25T20:20:55.000Z","updated_at":"2026-02-24T10:16:47.000Z","published_at":"2016-12-25T20:20:55.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA moneylender wants to receive his annual interest of 12% more frequently.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf he receives his interest rate every six months, he will receive 6% each time (12%/2).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHe wants to know how much will he win during a year if he received his interest every year (n=1), every six months (n=2), every month (n=12), every week (n=52), every day (n=365) and every second (n=31536000). These will be the test cases.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44654,"title":"convert the number to binary format \u0026 count digits","description":"Convert the given number to the corresponding binary format and count the number of digits in that binary number","description_html":"\u003cp\u003eConvert the given number to the corresponding binary format and count the number of digits in that binary number\u003c/p\u003e","function_template":"function y = dec_2_bin(x)\r\n \r\nend","test_suite":"%%\r\nx = 23;\r\ny_correct = 5;\r\nassert(isequal(dec_2_bin(x),y_correct))\r\n\r\n%%\r\nx = 234;\r\ny_correct = 8;\r\nassert(isequal(dec_2_bin(x),y_correct))\r\n\r\n%%\r\nx = 22;\r\ny_correct = 5;\r\nassert(isequal(dec_2_bin(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 2;\r\nassert(isequal(dec_2_bin(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":171559,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":57,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-05-25T11:50:28.000Z","updated_at":"2026-02-10T18:29:49.000Z","published_at":"2018-05-25T11:50:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConvert the given number to the corresponding binary format and count the number of digits in that binary number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45412,"title":"Determina el número de cifras de un número","description":"Crea una función que te devuelva el número de cifras de un número.\r\n\r\nAlgunos ejemplos para ayudarte serían: \r\nEl número 125 tiene 3 cifras.\r\n\r\nEl número 8749023 tiene 7 cifras.\r\n\r\nEl número 4 tiene 1 cifra.\r\n\r\nY así sucesivamente.\r\n\r\n","description_html":"\u003cp\u003eCrea una función que te devuelva el número de cifras de un número.\u003c/p\u003e\u003cp\u003eAlgunos ejemplos para ayudarte serían: \r\nEl número 125 tiene 3 cifras.\u003c/p\u003e\u003cp\u003eEl número 8749023 tiene 7 cifras.\u003c/p\u003e\u003cp\u003eEl número 4 tiene 1 cifra.\u003c/p\u003e\u003cp\u003eY así sucesivamente.\u003c/p\u003e","function_template":"function y = compute_number(x)\r\n \r\nend","test_suite":"%%\r\nx = 1000;\r\ny_correct = 4;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%\r\nx = 0;\r\ny_correct = 1;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%%\r\nx = 7675483;\r\ny_correct = 7;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%%\r\nx=-2\r\ny_correct = 1;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%%\r\nx=8476352689256\r\ny_correct = 13;\r\nassert(isequal(compute_number(x),y_correct))\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":394942,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":64,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-31T15:06:04.000Z","updated_at":"2026-02-18T09:33:27.000Z","published_at":"2020-04-03T07:06:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCrea una función que te devuelva el número de cifras de un número.\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\u003eAlgunos ejemplos para ayudarte serían: El número 125 tiene 3 cifras.\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\u003eEl número 8749023 tiene 7 cifras.\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\u003eEl número 4 tiene 1 cifra.\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\u003eY así sucesivamente.\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":2275,"title":"Palindrome numbers","description":"Find the palindrome numbers (two or more digits) from 1 to n where n is the number passed to the function.","description_html":"\u003cp\u003eFind the palindrome numbers (two or more digits) from 1 to n where n is the number passed to the function.\u003c/p\u003e","function_template":"function y = palin(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 100;\r\ny_correct = [11 22 33 44 55 66 77 88 99]; \r\nassert(isequal(palin(n),y_correct))\r\n\r\n%%\r\nfor n = 101:110\r\n y_correct = [11 22 33 44 55 66 77 88 99 101]; \r\n assert(isequal(palin(n),y_correct))\r\nend\r\n\r\n%%\r\nn = 200;\r\ny_correct = [11 22 33 44 55 66 77 88 99 101 111 121 131 141 151 161 171 181 191]; \r\nassert(isequal(palin(n),y_correct))\r\n\r\n%%\r\nn = 300;\r\ny_correct = [11 22 33 44 55 66 77 88 99 101 111 121 131 141 151 161 171 181 191 202 212 222 232 242 252 262 272 282 292];\r\nassert(isequal(palin(n),y_correct))\r\n\r\n%%\r\nn = 400;\r\ny_correct = [11 22 33 44 55 66 77 88 99 101 111 121 131 141 151 161 171 181 191 202 212 222 232 242 252 262 272 282 292 303 313 323 333 343 353 363 373 383 393];\r\nassert(isequal(palin(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":"2018-08-30T16:46:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-04-09T05:09:16.000Z","updated_at":"2025-11-21T16:32:11.000Z","published_at":"2014-04-09T05:09:16.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the palindrome numbers (two or more digits) from 1 to n where n is the number passed to the function.\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":57502,"title":"Determine if input is a Harshad number","description":"In mathematics a harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.\r\nExample: 2023 is a harshad number because 2023 / (2+0+2+3) = 289\r\nAssume all numbers in this problem are in 10 base","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: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 51px; transform-origin: 407px 51px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eIn\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e mathematics 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: 0px 0px; transform-origin: 0px 0px; \"\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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eharshad 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: 0px 0px; transform-origin: 0px 0px; \"\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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(or\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eNiven 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e) in a given\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e number base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eis an\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ethat is divisible by 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e sum of its digits \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ewhen written in that base.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eExample: 2023 is a harshad number because 2023 / (2+0+2+3) = 289\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eAssume all numbers in this problem are in 10 base\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = is_harshad(x)\r\n  y = 1;\r\nend","test_suite":"%%\r\nx = 5;\r\ny_correct = 1;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 13;\r\ny_correct = 0;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 199;\r\ny_correct = 0;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 1;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 89727;\r\ny_correct = 1;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 89728;\r\ny_correct = 0;\r\nassert(isequal(is_harshad(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2686445,"edited_by":2686445,"edited_at":"2023-01-03T18:21:04.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-01-03T18:20:01.000Z","updated_at":"2026-03-17T07:31:55.000Z","published_at":"2023-01-03T18:21:04.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e mathematics a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eharshad number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e(or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNiven number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) in a given\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e number base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eis an\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ethat is divisible by the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e sum of its digits \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ewhen written in that base.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample: 2023 is a harshad number because 2023 / (2+0+2+3) = 289\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\u003eAssume all numbers in this problem are in 10 base\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":42380,"title":"Dice roll - opposite faces","description":"For this problem, you will be provided with the values of a dice roll (regular six-sided dice). The number of dice will be at least one. Your function should return the values on the opposite faces of the dice and in the same order. See the test suite for examples.","description_html":"\u003cp\u003eFor this problem, you will be provided with the values of a dice roll (regular six-sided dice). The number of dice will be at least one. Your function should return the values on the opposite faces of the dice and in the same order. See the test suite for examples.\u003c/p\u003e","function_template":"function y = dice_roll_opposite_face(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 6;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 5;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 4;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 3;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 2;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 6;\r\ny_correct = 1;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 1:6;\r\ny_correct = 6:-1:1;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [6,4,3];\r\ny_correct = [1,3,4];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [5,5,2];\r\ny_correct = [2,2,5];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [3,1,6];\r\ny_correct = [4,6,1];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [5,4,3];\r\ny_correct = [2,3,4];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [3,1,2,6,1,5,4,6,1,3];\r\ny_correct = [4,6,5,1,6,2,3,1,6,4];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [1,6,1,5,5,6,1,3,2,5];\r\ny_correct = [6,1,6,2,2,1,6,4,5,2];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [3,6,2,2,1,1,6,4,4,1];\r\ny_correct = [4,1,5,5,6,6,1,3,3,6];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-06-16T16:42:56.000Z","updated_at":"2026-03-04T15:36:22.000Z","published_at":"2015-06-16T16:42:56.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, you will be provided with the values of a dice roll (regular six-sided dice). The number of dice will be at least one. Your function should return the values on the opposite faces of the dice and in the same order. See the test suite for examples.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45191,"title":"generate nth pentatope number","description":"https://en.wikipedia.org/wiki/Pentatope_number","description_html":"\u003cp\u003ehttps://en.wikipedia.org/wiki/Pentatope_number\u003c/p\u003e","function_template":"function y = pentatope(x)\r\n  y = ;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(pentatope(x),y_correct))\r\n%%\r\nx = 4;\r\ny_correct = 35;\r\nassert(isequal(pentatope(x),y_correct))\r\n%%\r\nx = 12;\r\ny_correct = 1365;\r\nassert(isequal(pentatope(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":72,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-02T17:27:57.000Z","updated_at":"2026-03-05T11:53:55.000Z","published_at":"2019-11-02T17:28:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Pentatope_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45254,"title":"Tribonacci Sequence","description":"Generate the tribonacci sequence upto n","description_html":"\u003cp\u003eGenerate the tribonacci sequence upto n\u003c/p\u003e","function_template":"function t = tribonacci(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 5;\r\ny_correct = [0,0,1,1,2];\r\nassert(isequal(tribonacci(n),y_correct))\r\n%%\r\nn = 11;\r\ny_correct = [0     0     1     1     2     4     7    13    24    44  81  ];\r\nassert(isequal(tribonacci(n),y_correct))\r\n%%\r\nn = 21;\r\ny_correct = [0\t0\t1\t1\t2\t4\t7\t13\t24\t44\t81\t149\t274\t504\t927\t1705\t3136\t5768\t10609\t19513\t35890];\r\nassert(isequal(tribonacci(n),y_correct))\r\n%%\r\nn = 30;\r\ny_correct =[ 0\t0\t1\t1\t2\t4\t7\t13\t24\t44\t81\t149\t274\t504\t927\t1705\t3136\t5768\t10609\t19513\t35890\t66012\t121415\t223317\t410744\t755476\t1389537\t2555757\t4700770\t8646064];\r\nassert(isequal(tribonacci(n),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":45,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T19:15:46.000Z","updated_at":"2025-06-14T03:37:34.000Z","published_at":"2020-01-03T19:19:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGenerate the tribonacci sequence upto n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2274,"title":"Find the square of the sum of the digits of a number","description":"If a number (n) is provided as an input, find the square of the sum of the digits of the number.\r\n\r\nExample\r\n\r\nIf n = 21, the answer will be square of (2 + 1) = 9","description_html":"\u003cp\u003eIf a number (n) is provided as an input, find the square of the sum of the digits of the number.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cp\u003eIf n = 21, the answer will be square of (2 + 1) = 9\u003c/p\u003e","function_template":"function y = sq_sum(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 35431;\r\ny_correct = 256;\r\nassert(isequal(sq_sum(x),y_correct))\r\n\r\n%%\r\nx = -431;\r\ny_correct = 64;\r\nassert(isequal(sq_sum(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":161,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-04-09T05:05:28.000Z","updated_at":"2026-03-16T10:39:17.000Z","published_at":"2014-04-09T05:05:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf a number (n) is provided as an input, find the square of the sum of the digits of the number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf n = 21, the answer will be square of (2 + 1) = 9\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":60939,"title":"Frequencies of prime gaps","description":"Problem statement\r\n\r\nGiven two positive integers n and , write a function which computes the frequency of the gap   between two consecutive of the primes in the prime vector going from 2 to n.\r\n\r\nExamples\r\n\r\nFor n = 100 and = 2, your function should return f = 1/3 since one third of the prime gaps between 2 and 97 equal ;\r\nFor n = 1000 and = 6, your function should return f = 44/167;\r\n\r\n\r\nSee also\r\nProblem 60940. Find the first occurence of a given gap between two consecutive prime numbers\r\nPrime numbers properties II","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: 414.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 207.367px; transform-origin: 408px 207.367px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 63.0083px 8px; transform-origin: 63.0083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eProblem statement\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 85.575px 8px; transform-origin: 85.575px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven two positive integers \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 8px; transform-origin: 5.83333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en \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.675px 8px; transform-origin: 11.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\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 8px; transform-origin: 3.88333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 180.475px 8px; transform-origin: 180.475px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewrite a function which computes the frequency of the gap  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\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: 81.7833px 8px; transform-origin: 81.7833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e between two consecutive of the primes in the prime vector going from \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e2\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: 9.71667px 8px; transform-origin: 9.71667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 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: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.675px 8px; transform-origin: 32.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExamples\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 81.7333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 40.8667px; transform-origin: 392px 40.8667px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 20.4333px; text-align: left; transform-origin: 364px 20.4333px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 12.4417px 8px; transform-origin: 12.4417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 25.4833px 8px; transform-origin: 25.4833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en = 100 \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 13.6167px 8px; transform-origin: 13.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\u003eΔ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.925px 8px; transform-origin: 9.925px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e= 2\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 86.7417px 8px; transform-origin: 86.7417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, your function should return\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 21.5833px 8px; transform-origin: 21.5833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e f = 1/3\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 133.808px 8px; transform-origin: 133.808px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e since one third of the prime gaps between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e2\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 13.6167px 8px; transform-origin: 13.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.725px 8px; transform-origin: 9.725px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e 97\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 21.0083px 8px; transform-origin: 21.0083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e equal \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\u003eΔ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 55.4333px 8px; transform-origin: 55.4333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor n = 1000 and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\u003eΔ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.925px 8px; transform-origin: 9.925px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e= 6\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 86.7417px 8px; transform-origin: 86.7417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, your function should return\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 11.8583px 8px; transform-origin: 11.8583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e f = \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.725px 8px; transform-origin: 9.725px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e44/\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 13.6167px 8px; transform-origin: 13.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e167;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.3917px 8px; transform-origin: 28.3917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eSee also\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://fr.mathworks.com/matlabcentral/cody/problems/60940-find-the-first-occurence-of-a-given-gap-between-two-consecutive-prime-numbers\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 60940. Find the first occurence of a given gap between two consecutive prime numbers\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://fr.mathworks.com/matlabcentral/cody/groups/95759\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePrime numbers properties II\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function f = frequencies_of_prime_gaps(delta, n)\r\n  f = delta*n;\r\nend","test_suite":"%%\r\ndelta = 2;\r\nn = 100;\r\nf_correct = 1/3;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 2;\r\nn = 200;\r\nf_correct = 15/45;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 6;\r\nn = 1000;\r\nf_correct = 44/167;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 4;\r\nn = 200;\r\nf_correct = 13/45;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 24;\r\nn = 10000;\r\nf_correct = 15/1228;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 1;\r\nn = 100;\r\nf_correct = 1/24;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 3;\r\nn = 100;\r\nf_correct = 0;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%% Forbidden functions\r\nfiletext = fileread('frequencies_of_prime_gaps.m');\r\nillegal = contains(filetext, 'regexp') || contains(filetext, 'str2num') || contains(filetext, 'assignin') || contains(filetext, 'echo')\r\nassert(~illegal);","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":149128,"edited_by":149128,"edited_at":"2025-07-26T06:48:50.000Z","deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":"2025-07-09T05:56:16.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2025-06-24T10:21:21.000Z","updated_at":"2026-03-16T13:25:01.000Z","published_at":"2025-06-24T11:07:25.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eProblem statement\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two positive integers \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eand\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: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\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\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:r\u003e\u003cw:t\u003ewrite a function which computes the frequency of the gap  \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\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e between two consecutive of the primes in the prime vector going from \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en = 100 \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eand \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\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e= 2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, your function should return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e f = 1/3\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e since one third of the prime gaps between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e 97\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e equal \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\\\\Delta\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor n = 1000 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\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e= 6\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, your function should return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e f = \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e44/\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e167;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\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\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSee also\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:hyperlink w:docLocation=\\\"https://fr.mathworks.com/matlabcentral/cody/problems/60940-find-the-first-occurence-of-a-given-gap-between-two-consecutive-prime-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 60940. Find the first occurence of a given gap between two consecutive prime numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://fr.mathworks.com/matlabcentral/cody/groups/95759\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ePrime numbers properties II\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45253,"title":"Pell numbers ","description":"Find the nth pell number\r\n\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Pell_number\u003e","description_html":"\u003cp\u003eFind the nth pell number\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Pell_number\"\u003ehttps://en.wikipedia.org/wiki/Pell_number\u003c/a\u003e\u003c/p\u003e","function_template":"function p=pell_seq(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 3;\r\ny_correct = 2;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 6;\r\ny_correct = 29;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 408;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 12;\r\ny_correct = 5741;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 15;\r\ny_correct = 80782;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 19;\r\ny_correct = 2744210;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 23;\r\ny_correct = 93222358;\r\nassert(isequal(pell_seq(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":77,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T18:34:11.000Z","updated_at":"2026-01-16T23:48:17.000Z","published_at":"2020-01-03T18:35:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the nth pell number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pell_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Pell_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":60969,"title":"Check p = 4n +/- 1, the generic formula for odd prime numbers","description":"Problem statement\r\n\r\nFor all odd prime number p, there exists a positive integer n, such that p = 4n +/- 1 :\r\n\r\n\r\n\r\nCheck this formula for some given odd primes in a vector by computing n for each p.\r\n\r\nExamples\r\n\r\np = 17 =\u003e n = 4;\r\n\r\np = 19 =\u003e n = 5;\r\n\r\n p = [3, 5, 7, 11, 13, 17, 19] =\u003e n = [1, 1, 2, 3, 3, 4, 5];\r\n\r\np = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\r\n             =\u003e n = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\r\n\r\n\r\nForbidden functions / expressions\r\n\r\nregexp\r\nassignin\r\nstr2num\r\necho\r\n\r\nSee also\r\n\r\nPrime numbers properties I","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: 919.467px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 459.733px; transform-origin: 408px 459.733px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 63.0083px 8px; transform-origin: 63.0083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eProblem statement\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 80.1333px 8px; transform-origin: 80.1333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor all 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: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 96.4583px 8px; transform-origin: 96.4583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, there exists a positive integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.775px 8px; transform-origin: 7.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.3333px 8px; transform-origin: 30.3333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003esuch that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.675px 8px; transform-origin: 39.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ep = 4n +/- 1 :\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAAAkCAYAAAAATtrgAAANzUlEQVR4Xu2dW+i+2RTHZ+7J6YqEcDFyLqdG5kKiRJJyuvrXyKkkiXChSWJyaJILhzT9U47FJKVIFJkYFIa4oJC4cop71sc831qz7ed59trPs5/f+/5+663V//DuZz97f/fa67v22mvv98Yb8pMIJAKJQCKQCCQCzQjc2FwyCyYCiUAikAgkAonADUmcqQSJQCKQCCQCiUAAgSTOAFhZNBFIBBKBRCARSOJMHUgEEoFEIBFIBAIIJHEGwMqiiUAikAgkAolAEmfqQCKQCCQCiUAiEECgJM4f2rPPNvm0yRsC9XzKyr7e5Ecmzwk8d65FP2QNf0dj4/9i5e41ucvkk43PZLH7EHihydtNbjZ5wAQKOnaHyZcuCUj08ZvBvrzHyn8w+My5Ff9P0eAP27/f2dgJ7Ng/TV7UWD6L3R+BZ9o/v2Ny9xXDkLn4PpOvrc2vkjjfaA98wgRj/4iANv1rMmxvsj+vAjlAnPT1FRNGGD6cja9UMKMMTsW/TcDpeSa/C2B7VYvKGZvrf9S5O1UckzjrIwNxak7dan9/5WTEv9UwkEmcDSAtFPm1fXeTCVhfBedDhMmikc+qY1oS50Ptob9ODwNYi5K+ysp9cSKGR9uff9s2ZmfxtIjzgVNrmeRzYMswgicG4MUmVwWn3sGUTqF/d5r83eSxJtdMpNxNCt7bgBN9ThGh1Yl9ou2PNIs55VeZGPNHNs6dJM4I0vcv6x3Wy06c8N27Jp16iv2Js9BkV2p7nITA8O6+bIIBW/tEy6/Vdw7f9xDns6xjrDR/afL9RmzPAYsRbWRl/nmT2nbBu+3/PzC9NBoZ6W0rEQUI/KLDw1eNOBmvx0/zJhI+TOLs03Ts/WdMmH8PN7kKxAlSLPZ85GfVMa0Rp7x9KmxJHlKY9tUnYFho8+NM2At5qolfnSypEqT244Cu9RIn78DwMzBarQZeeyFFIY2fT5ge0QC2C95q8txJoWvv/PM0sflOhnVk22S02cZo3Wcb0Z5TIU7G6OUmT3bjsNTfHgOsPU7vHGkrac2wJXHGtY/V1x9McEpfNtnOnnGLv/k0nthMnHRDhmmNDHv3REdBtbYvNvfeI4lTA3SEwd8DZxlr9miPIA5Wdd81Wdor9+McHbteTESe37AKWiIxve9Zeu6iiRMMSJxgNRL59BhgiJOoVxn9UoRradyTOCOjc19Zj5n0rGfc4m9uewKuuWbyPZMRzusuxCnDhLf3x4V+PWqaRJFEDSYfS2MlyLBCRNjHiqz6ymZpQvH/ZF5enybeiD3XLStODdAogw+WeI/Ckr8/YwKrZc+6xJX68EIxYHxEoLdP49im9vuWUlYzbXma06V93/L/tclR/I19tbQiHtWOiyROOQ5kN2MX2G74yMY5u4ST8gYog/4p8RB9/oEJ+51zUZvRxKk55ecT85rPTy5wXvTqHVGwt5g8aWr7KRKn5vwoMt+FOJkk9zSOAsbr+QsTiAaRWfpSE3mqhFq+bfJxEx9OXatrrkki+qNWRVuIE+NL0sNeoVqIjb1A8NXmNsr1GhNWiCI8Ydeb+VwSKPWxIqC+Ec7JkvppvCGwJzTq6R7FfPJcr65uaccccTLHSJ56uglbFDi0MoLM5febyLD3jD9j/zMTSBOnFCO7xcltwcAn3LFdQPtb9ztHECdzHmyFI84DGJNcAqY6LqV5cVFRiRZsfRk5RK+z/9Qe/hpxjta3Wh/OgjhpuFKS5/YTlKTRarx8eI0V6i0mt02D5fdVMUgRUmFS/3ZCOnLWK6pgvvwW4kQp+ex93tVjCKFx7IUzSfz9ISYyfLx7y2r3FAhUutlDApEzuC06srbf1lJHa5kacSoz0Bt1eeVy0ki0eq2JjHtL7oJvk6I5kMVRx6k8cdJHkur46Jic7E9NB0YQJ+/2jhMOxINMvm6CbSNiRhi/+UiDA1jj2qoHtXJRu6n+sHqnDz78uUScR+hbrX9nQ5xrxKh90FbDocnHAP/J5CUm/jyjjCGgRQy7AG0l8C3KqWd7ifMFVgF4sQLvCZsutV1hRMpg4K4V7/COS+uYLb3voghUjlLveO9NnGC09eKPqOGsjZ8PNUEmfEiy0jzTO7RSikQJlKizlvOwx9xSHeURL0XB/LZQuRLVs6OI0zvp2DFCyP4iCu+8RkKK0fGv4dxDnNgEHC6OyHl9WFtx8v6R+lbr39kQp1eSksikxJE9JhHt3DNeeSITVM8dtdpkUCPEqcmEcX2iCTcOjbgkwu/x1vDzhBHZk14zhkcTKP1koo9wPtb6Wn6P961w+JbQbdRw1ojT7/uCzXUTvzrU/Gs9Zqa+ykDSvyPPH9fORsuZl37XVqK0exRxeue0Noc8mfQ6dlEd7C2voye1bbYW4hylb3P9ORvipAPy6EolkZFu9bT9nuncxPXGI7LiLK/m6lGkyPvmiHPpvRidu00+arL3SlPv1bGgucQVT5x7rDjL/s4R6J4JJBgmbmca5Xz06A7P+GjJCGzVrqXkIH3H+PO5zUR7Vj7EGA1v77FCj6y+1Ne5S0WwSTebKClMtsXblVHEKXtIG2tZ8Z44e/rcq3/R53T0ZG4etRDn3vrmsYv2x5fvnX+7JAepIfKwyjBA9OymP7Q+dyOR6ox6tqdCnDgXtSv3tmYLtyiRd0zmVt5+0rfeCtXy7rKMPFntp9XCxj31arKzXxe5R7nnXdFnRJyjk9PmiNMTI20vHV2/UnqYfR8J054acWqVyV20Sgwr9ztHEads1NyCwdu5IyNgUX0FH85sziUwrRHnCH27VMTJgJQk6cm0NXQjoz23v+INf9RT25IoElU4lY+EanvfEXnOT9i51bPGsWePq6UtKD7JSEqOYOXzWRP2USKGuvYuHUHgDNcpkaYP1e7lICxhPUecfm+tNr7RCJFvg+o+6pYmvXvpGsu1/c7PWSV7X/LubdTcqsY7p9EoVssc26NML0F5uzxS3+b6eFahWjqhSSfg5sK3S4OqVeFcmNbvz0UVrmzfHsq1VsepEacPm9TOF/oVR28oYw6TGmF+zArvtY+7N2nusYIqsdDxn60OwprezRHn2v629jd7VkFLuQ5r7d3y/RJxUq+cRUVP/EoU0tybOL3e1MK0Hqeo8x/d467h2poctAdxjtS3S0OcHmhI7Z6pZ63hPv98LWlFIThCe9HEBZrivZ8o6fZO7FMjTjkmc0k/a8TagwNk/F4Tnc1lhbknYdKmVtKkXCtp7Umco0Oz5bjMEaeIsbba9Cul3vmhqE6UEHr0Ss+sESflwIOEO0W+Ru4x+jlUOzvsk2WWzrXXMDmSOFvGZC1UO1rfam08uxUnnfBAYSgjYRtvqGr7K1rBbrmNRe07KpNtBHFi4DhvGU0eWnNM5Jlvyfr0inwEYep9eLYPNln6aSP6B24jruEqJ7Df22EOcKfn6IsAfBtqxLm2v63xF6lSH4f2I3j5iEUk473FSM+VaSFOOd2/skp0LnrJwOqWsp7bfZacUz8G0eSrLRiNenaJOI/Qt0tDnKWXHgn5yFutkZo/K1qe64woxdFp4HsTp8c3mhzlz2eWjok/NrT1+EZJmBD8yCxhHTvhRhMSrGofzsViqI66dk8EQnJIefYtoq+9ZWvEuba/rflHNAesOPDO+c6og+ZXRUeQZwtxgqPmfvkTZFwV6h2uMkTZGjHjHT6qVfZdIWIWFHtvg/TqydbnlojzKH0r+3CWK87y4G9rKMJ76CVxCgjCi/x96487e68Y8hl5ZEFt18Rk1bxl0pShmsg5S38UwhOnslvxxrdckUY9d5goJDuaMJkwfg9lzQgcFT7U1WR7Z/X27Dl5XVuL2GilpGMqJGz5Q/tr+Op7hc1vmv4D3N+8w7yde38rcfK85iO4/NSELYOSOEvnPxKd8s6pJ050Ajy5Qehtk9624nnK5ZaI8yh9O5o4vX6s2t/I1Vsy0K1nN+m499RQ1F+Y/MPkMSa/N+G33/YMdUGeeJ7+3sgWBY3u/dT2ybYQZ3mEo5UMytDhvdZZfgKM20DA+as7TGY/iUauMDVO3ki1jN0Rqx/9KghXk+2d1buVONcS74QnoVqynrckbaFv/lq5lvGhTKs++/oixMlzpfNZvhPnn4vp5QC2JtNQtz9uhCNKdjf7qmwj3GXCar51j70Vs4sst0ScR+qbx2CvHwMpccWW+3u+9T08xzjfXhvbCHH2DKRfOUTPj/W8j2eY3Bg3/aZcSz1R4myps7cMSstPN7WsCo7Ye0KxuJA/Gtrr7f8pPocer/3U2Sm2e1SbIPtbTbiZSES09K4e4hzVdupFp3Eul/bO9X4fbVtdiYxsdNZ9OgiMJs6jk3ZOB9m+lmi/pPUi7YtwTPp6lk8lAqeDAM4p2w+6WWmpZUc4p6eDzMW1pCfyUmvtlshfc+9HEmd6as3D8L+CCoNdt7+3htPSMYlhnKUTAciSbYzWkHs6p8foTBLnhLPPvjpiH+qY4R3zFkjzCyZ3NnrBtMKnhWcIacy4ZK2XCwH2e7kYIXIUx98BXTu/ebkQyt40ITByxemzPWs3bTQ1MAvNIuCTaC7D2bEc6kTg1BAof+N27m7XU2t3tmcwAiOIU4kDZJ3pg5dHtmfE0xvc9bOtnhA4OJLc4D9kgEGmW4/1nC0w2fBEYEcESCC6pagPG8YPOVzlRLkdIT7fqkYQ5/mikS1PBBKBRCARSARWEEjiTBVJBBKBRCARSAQCCCRxBsDKoolAIpAIJAKJwH8BBNZTYc8CqCgAAAAASUVORK5CYII=\" width=\"231\" height=\"18\" style=\"width: 231px; height: 18px;\"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 222.1px 8px; transform-origin: 222.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCheck this formula for some given odd primes in a vector by computing \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: 15.9417px 8px; transform-origin: 15.9417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en for \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: 15.175px 8px; transform-origin: 15.175px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eeach\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.775px 8px; transform-origin: 7.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e p.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.675px 8px; transform-origin: 32.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExamples\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 50.575px 8px; transform-origin: 50.575px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = 17 =\u0026gt; n = 4;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 50.575px 8px; transform-origin: 50.575px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = 19 =\u0026gt; n = 5;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 164.367px 8px; transform-origin: 164.367px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = [3, 5, 7, 11, 13, 17, 19] =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5];\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 280.842px 8px; transform-origin: 280.842px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 287.408px 8px; transform-origin: 287.408px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e             =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 114.308px 8px; transform-origin: 114.308px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003eForbidden functions / expressions\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 81.7333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 40.8667px; transform-origin: 392px 40.8667px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 21.4px 8px; transform-origin: 21.4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eregexp\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 25.6833px 8px; transform-origin: 25.6833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eassignin\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 25.2833px 8px; transform-origin: 25.2833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003estr2num\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 15.175px 8px; transform-origin: 15.175px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eecho\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.3917px 8px; transform-origin: 28.3917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eSee also\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://fr.mathworks.com/matlabcentral/cody/groups/95630\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePrime numbers properties I\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function n = check_odd_primes_gen_formula(p)\r\n  n = p;\r\nend","test_suite":"%%\r\np = 17;\r\nn_correct = 4;\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%%\r\np = 19;\r\nn_correct = 5;\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%%\r\np = [3, 5, 7, 11, 13, 17, 19];\r\nn_correct = [1, 1, 2, 3, 3, 4, 5];\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%%\r\np = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];\r\nn_correct = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%% Forbidden functions\r\nfiletext = fileread('check_odd_primes_gen_formula.m');\r\nillegal = contains(filetext, 'regexp') || contains(filetext, 'str2num') || contains(filetext, 'assignin') || contains(filetext, 'echo')\r\nassert(~illegal);","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":149128,"edited_by":149128,"edited_at":"2025-07-20T05:09:52.000Z","deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-07-20T04:24:51.000Z","updated_at":"2026-02-12T07:13:21.000Z","published_at":"2025-07-20T05:09:52.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eProblem statement\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor all odd prime number \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, there exists a positive integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003esuch that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = 4n +/- 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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\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:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\forall p \\\\in \\\\mathbb{P}, p \u0026gt; 2 \\\\Rightarrow \\\\exists n   \\\\in \\\\mathbb{N}, p = 4n \\\\pm 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003eCheck this formula for some given odd primes in a vector by computing \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003eeach\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e p.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\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\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = 17 =\u0026gt; n = 4;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = 19 =\u0026gt; n = 5;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = [3, 5, 7, 11, 13, 17, 19] =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e             =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eForbidden functions / expressions\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassignin\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estr2num\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eecho\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSee also\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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:hyperlink w:docLocation=\\\"https://fr.mathworks.com/matlabcentral/cody/groups/95630\\\"\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003ePrime numbers properties I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2270,"title":"Bit calculation","description":"Give me the count of numbers from 1 to n having their last two bits as 0.\r\n\r\nFor example\r\n\r\nfunction y = ret_count(4)\r\n\r\n  y = x;\r\n\r\nend\r\n\r\nHere 4 means you have to check the numbers between 1 to 4.\r\n\r\n\r\nSo the answer will be 1 as binary value of 4 is 00000100.\r\n\r\nHere n in the function is the number of numbers to be checked starting from 1.","description_html":"\u003cp\u003eGive me the count of numbers from 1 to n having their last two bits as 0.\u003c/p\u003e\u003cp\u003eFor example\u003c/p\u003e\u003cp\u003efunction y = ret_count(4)\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ey = x;\r\n\u003c/pre\u003e\u003cp\u003eend\u003c/p\u003e\u003cp\u003eHere 4 means you have to check the numbers between 1 to 4.\u003c/p\u003e\u003cp\u003eSo the answer will be 1 as binary value of 4 is 00000100.\u003c/p\u003e\u003cp\u003eHere n in the function is the number of numbers to be checked starting from 1.\u003c/p\u003e","function_template":"function y = ret_count(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(ret_count(n),y_correct))\r\n\r\n\r\n%%\r\nn = 4;\r\ny_correct = 1;\r\nassert(isequal(ret_count(n),y_correct))\r\n\r\n%%\r\nn = 72;\r\ny_correct = 18;\r\nassert(isequal(ret_count(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":243,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":45,"created_at":"2014-04-08T07:33:36.000Z","updated_at":"2026-03-10T17:18:51.000Z","published_at":"2014-04-08T07:33:36.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGive me the count of numbers from 1 to n having their last two bits as 0.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efunction y = ret_count(4)\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 = x;]]\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\u003eend\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\u003eHere 4 means you have to check the numbers between 1 to 4.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the answer will be 1 as binary value of 4 is 00000100.\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\u003eHere n in the function is the number of numbers to be checked starting from 1.\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":3018,"title":"Calculator spelling - Numbers to Letters","description":"Using the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\r\n\r\n* 0 = O\r\n* 1 = I\r\n* 2 = Z\r\n* 3 = E\r\n* 4 = h\r\n* 5 = S\r\n* 6 = g\r\n* 7 = L\r\n* 8 = B\r\n\r\nThere are a few other options, but we'll stick with these. The number may be a have a decimal with a leading zero, to produce a trailing O. If this is the case, ignore the decimal point. Write a function that takes a number as input and returns the word spelled (upside down) by the calculator. Make sure to get the case (capital vs. lowercase) right for each number/letter.\r\n\r\nThis problem is related to \u003chttps://www.mathworks.com/matlabcentral/cody/problems/3019-calculator-spelling-letters-to-numbers Problem 3019\u003e.","description_html":"\u003cp\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/p\u003e\u003cul\u003e\u003cli\u003e0 = O\u003c/li\u003e\u003cli\u003e1 = I\u003c/li\u003e\u003cli\u003e2 = Z\u003c/li\u003e\u003cli\u003e3 = E\u003c/li\u003e\u003cli\u003e4 = h\u003c/li\u003e\u003cli\u003e5 = S\u003c/li\u003e\u003cli\u003e6 = g\u003c/li\u003e\u003cli\u003e7 = L\u003c/li\u003e\u003cli\u003e8 = B\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are a few other options, but we'll stick with these. The number may be a have a decimal with a leading zero, to produce a trailing O. If this is the case, ignore the decimal point. Write a function that takes a number as input and returns the word spelled (upside down) by the calculator. Make sure to get the case (capital vs. lowercase) right for each number/letter.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/3019-calculator-spelling-letters-to-numbers\"\u003eProblem 3019\u003c/a\u003e.\u003c/p\u003e","function_template":"function [word] = calc_spell_word(n)\r\n\r\nword = num2str(n);\r\n\r\nend\r\n","test_suite":"%%\r\nn = 35007;\r\ntxt = 'LOOSE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 77345;\r\ntxt = 'ShELL';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 36138;\r\ntxt = 'BEIgE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 378806;\r\ntxt = 'gOBBLE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 376006;\r\ntxt = 'gOOgLE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 57738461375;\r\ntxt = 'SLEIghBELLS';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 0.7734;\r\ntxt = 'hELLO';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 53045;\r\ntxt = 'ShOES';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 771;\r\ntxt = 'ILL';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 345;\r\ntxt = 'ShE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 7735;\r\ntxt = 'SELL';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nind = randi(4);\r\nn_arr = [36138 707 7714 57738];\r\nn = n_arr(ind);\r\ntxt_arr = {'BEIgE','LOL','hILL','BELLS'};\r\ntxt = txt_arr{ind};\r\nassert(isequal(calc_spell_word(n),txt))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":72,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2015-02-14T22:05:44.000Z","updated_at":"2026-03-19T20:03:05.000Z","published_at":"2015-02-14T22:05:44.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\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0 = O\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 = I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2 = Z\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3 = E\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4 = h\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e5 = S\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = g\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e7 = L\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e8 = B\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\u003eThere are a few other options, but we'll stick with these. The number may be a have a decimal with a leading zero, to produce a trailing O. If this is the case, ignore the decimal point. Write a function that takes a number as input and returns the word spelled (upside down) by the calculator. Make sure to get the case (capital vs. lowercase) right for each number/letter.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3019-calculator-spelling-letters-to-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3019\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3019,"title":"Calculator spelling - Letters to Numbers","description":"Using the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\r\n\r\n* 0 = O\r\n* 1 = I\r\n* 2 = Z\r\n* 3 = E\r\n* 4 = h\r\n* 5 = S\r\n* 6 = g\r\n* 7 = L\r\n* 8 = B\r\n\r\nThere are a few other options, but we'll stick with these. If the word has a trailing O, the number will need a decimal point to produce a leading zero. Write a function that takes a word (upside down) as input and returns the number entered into the calculator.\r\n\r\nThis problem is related to \u003chttps://www.mathworks.com/matlabcentral/cody/problems/3018-calculator-spelling-numbers-to-letters Problem 3018\u003e.","description_html":"\u003cp\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/p\u003e\u003cul\u003e\u003cli\u003e0 = O\u003c/li\u003e\u003cli\u003e1 = I\u003c/li\u003e\u003cli\u003e2 = Z\u003c/li\u003e\u003cli\u003e3 = E\u003c/li\u003e\u003cli\u003e4 = h\u003c/li\u003e\u003cli\u003e5 = S\u003c/li\u003e\u003cli\u003e6 = g\u003c/li\u003e\u003cli\u003e7 = L\u003c/li\u003e\u003cli\u003e8 = B\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are a few other options, but we'll stick with these. If the word has a trailing O, the number will need a decimal point to produce a leading zero. Write a function that takes a word (upside down) as input and returns the number entered into the calculator.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/3018-calculator-spelling-numbers-to-letters\"\u003eProblem 3018\u003c/a\u003e.\u003c/p\u003e","function_template":"function [n] = calc_spell_num(word)\r\n\r\nn = str2num(word);\r\n\r\nend\r\n","test_suite":"%%\r\nn = 35007;\r\nword = 'LOOSE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 77345;\r\nword = 'ShELL';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 36138;\r\nword = 'BEIgE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 378806;\r\nword = 'gOBBLE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 376006;\r\nword = 'gOOgLE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 57738461375;\r\nword = 'SLEIghBELLS';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 0.7734;\r\nword = 'hELLO';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 53045;\r\nword = 'ShOES';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 771;\r\nword = 'ILL';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 345;\r\nword = 'ShE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 7735;\r\nword = 'SELL';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nind = randi(4);\r\nn_arr = [36138 707 7714 57738];\r\nn = n_arr(ind);\r\nword_arr = {'BEIgE','LOL','hILL','BELLS'};\r\nword = word_arr{ind};\r\nassert(isequal(calc_spell_num(word),n))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2015-02-14T22:18:14.000Z","updated_at":"2026-03-23T20:41:48.000Z","published_at":"2015-02-14T22:18:14.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\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0 = O\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 = I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2 = Z\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3 = E\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4 = h\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e5 = S\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = g\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e7 = L\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e8 = B\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\u003eThere are a few other options, but we'll stick with these. If the word has a trailing O, the number will need a decimal point to produce a leading zero. Write a function that takes a word (upside down) as input and returns the number entered into the calculator.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3018-calculator-spelling-numbers-to-letters\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3018\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45246,"title":"Count digits","description":"Count total number of digits from 1 to n.\r\n\r\n* n=13\r\n* output=17\r\n\r\nsince from [1-9] total 9 digits.[10-13] total 4*2=8 digits.","description_html":"\u003cp\u003eCount total number of digits from 1 to n.\u003c/p\u003e\u003cul\u003e\u003cli\u003en=13\u003c/li\u003e\u003cli\u003eoutput=17\u003c/li\u003e\u003c/ul\u003e\u003cp\u003esince from [1-9] total 9 digits.[10-13] total 4*2=8 digits.\u003c/p\u003e","function_template":"function y=count_dig(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 13;\r\ny_correct = 17;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 1339;\r\ny_correct = 4249;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 0;\r\ny_correct = 0;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 299;\r\ny_correct = 789;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 10000;\r\ny_correct = 38894;\r\nassert(isequal(count_dig(n),y_correct))\r\n%\r\nn=10000675820025;\r\ny_correct = 128898350369253;\r\nassert(isequal(count_dig(n),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-26T23:42:51.000Z","updated_at":"2025-08-23T21:14:18.000Z","published_at":"2019-12-26T23:43:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCount total number of digits from 1 to n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en=13\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput=17\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003esince from [1-9] total 9 digits.[10-13] total 4*2=8 digits.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45223,"title":"find nth even fibonacci number","description":"1st even fibonacci number=2 ; \r\n2nd even fibonacci number=8 ..","description_html":"\u003cp\u003e1st even fibonacci number=2 ; \r\n2nd even fibonacci number=8 ..\u003c/p\u003e","function_template":"function y = even_fib(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 2;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 3;\r\ny_correct = 34;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 10;\r\ny_correct = 832040;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 20;\r\ny_correct = 1548008755920;\r\nassert(isequal(even_fib(n),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":93,"test_suite_updated_at":"2019-12-04T11:48:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-04T11:45:17.000Z","updated_at":"2026-03-02T19:12:20.000Z","published_at":"2019-12-04T11:48:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1st even fibonacci number=2 ; 2nd even fibonacci number=8 ..\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":54490,"title":"perfect square ","description":"Perfect square is amazing, so we have problems like 45183, 34482, 44683, and 44957. \r\nBut how can we find a large number is a pefect square or not? \r\nNote that here, input is a string and output is logical.","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: 81px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 40.5px; transform-origin: 407px 40.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 166.5px 8px; transform-origin: 166.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePerfect square is amazing, so we have problems like \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/45183\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e45183\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/34482\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e34482\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/44683\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e44683\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: 18px 8px; transform-origin: 18px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/44957\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e44957\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\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: 197.5px 8px; transform-origin: 197.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut how can we find a large number is a pefect square or not? \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 164px 8px; transform-origin: 164px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNote that here, input is a string and output is logical.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = perfectSquare(x)\r\n  tf = false ;\r\nend","test_suite":"%%\r\nfiletext = fileread('perfectSquare.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') ...\r\n    || contains(filetext, 'java') || contains(filetext, 'py'); \r\nassert(~illegal);\r\nassert(isempty(strfind(filetext, 'regexp')),'regexp() forbidden');\r\n%%\r\nx = '16';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '121';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '132233322321';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '313223221121';\r\ny_correct = false;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '6486486884468464644';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '6486486884468464646';\r\ny_correct = false;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '484468468684646864';\r\ny_correct = false;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":2197980,"edited_by":223089,"edited_at":"2022-06-25T09:48:36.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":"2022-06-25T09:48:36.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-04T08:17:57.000Z","updated_at":"2026-01-28T12:45:53.000Z","published_at":"2022-05-04T08:17:57.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePerfect square is amazing, so we have problems like \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://ww2.mathworks.cn/matlabcentral/cody/problems/45183\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e45183\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://ww2.mathworks.cn/matlabcentral/cody/problems/34482\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e34482\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://ww2.mathworks.cn/matlabcentral/cody/problems/44683\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44683\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://ww2.mathworks.cn/matlabcentral/cody/problems/44957\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44957\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\u003eBut how can we find a large number is a pefect square or not? \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote that here, input is a string and output is logical.\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":2283,"title":"Convert a number to its Roman representation","description":"Convert a given number to its Roman representation.\r\n\r\nFor example, if the number is 98, it should display 'XCVIII'","description_html":"\u003cp\u003eConvert a given number to its Roman representation.\u003c/p\u003e\u003cp\u003eFor example, if the number is 98, it should display 'XCVIII'\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 'I';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 98;\r\ny_correct = 'XCVIII';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 501;\r\ny_correct = 'DI';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 867;\r\ny_correct = 'DCCCLXVII';\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":22816,"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":"2014-04-14T05:55:54.000Z","updated_at":"2025-12-07T23:09:08.000Z","published_at":"2014-04-14T05:55:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConvert a given number to its Roman representation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if the number is 98, it should display 'XCVIII'\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":45267,"title":"Zero","description":"given an integer a, find the smallest possible integer b(b\u003e0) such that their bitwise logical AND is zero.\r\n\r\n*  if a=11(1011) then b=4(0100)","description_html":"\u003cp\u003egiven an integer a, find the smallest possible integer b(b\u0026gt;0) such that their bitwise logical AND is zero.\u003c/p\u003e\u003cul\u003e\u003cli\u003eif a=11(1011) then b=4(0100)\u003c/li\u003e\u003c/ul\u003e","function_template":"function b=zero_and(a)\r\nend","test_suite":"%%\r\na = 1;\r\ny_correct = 2;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 2;\r\ny_correct = 1;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 12;\r\ny_correct = 1;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 11;\r\ny_correct = 4;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 15;\r\ny_correct = 16;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 23;\r\ny_correct = 8;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 93;\r\ny_correct = 2;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 1455;\r\ny_correct = 16;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 255;\r\ny_correct = 256;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 435175;\r\ny_correct = 8;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\nfiletext = fileread('zero_and.m');\r\nassert(isempty(strfind(filetext, 'regexp')),'regexp() forbidden')\r\nassert(isempty(strfind(filetext, 'varargin')),'varargin() forbidden')\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2020-02-13T21:41:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-16T14:29:26.000Z","updated_at":"2026-01-03T11:47:45.000Z","published_at":"2020-01-16T14:30:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven an integer a, find the smallest possible integer b(b\u0026gt;0) such that their bitwise logical AND is zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif a=11(1011) then b=4(0100)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44360,"title":"Pentagonal Numbers","description":"Your function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\r\n\r\n [p,d] = pentagonal_numbers(10,40)\r\n\r\nshould return\r\n\r\n p = [12,22,35]\r\n d = [ 0, 0, 1]","description_html":"\u003cp\u003eYour function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\u003c/p\u003e\u003cpre\u003e [p,d] = pentagonal_numbers(10,40)\u003c/pre\u003e\u003cp\u003eshould return\u003c/p\u003e\u003cpre\u003e p = [12,22,35]\r\n d = [ 0, 0, 1]\u003c/pre\u003e","function_template":"function [p,d] = pentagonal_numbers(10,40)\r\n p = [5];\r\n d = [1];\r\nend","test_suite":"%%\r\nx1 = 1; x2 = 25;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1,5,12,22]))\r\nassert(isequal(d,[0,1,0,0]))\r\n\r\n%%\r\nx1 = 1; x2 = 4;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,1))\r\nassert(isequal(d,0))\r\n\r\n%%\r\nx1 = 10; x2 = 40;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[12,22,35]))\r\nassert(isequal(d,[0,0,1]))\r\n\r\n%%\r\nx1 = 10; x2 = 99;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[12,22,35,51,70,92]))\r\nassert(isequal(d,[0,0,1,0,1,0]))\r\n\r\n%%\r\nx1 = 100; x2 = 999;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925]))\r\nassert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1]))\r\n\r\n%%\r\nx1 = 40; x2 = 50;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isempty(p))\r\nassert(isempty(d))\r\n\r\n%%\r\nx1 = 1000; x2 = 1500;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1001,1080,1162,1247,1335,1426]))\r\nassert(isequal(d,[0,1,0,0,1,0]))\r\n\r\n%%\r\nx1 = 1500; x2 = 3000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882]))\r\nassert(isequal(d,[1,0,0,1,0,1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 1; x2 = 3000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882]))\r\nassert(isequal(d,[0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 10000; x2 = 12000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[10045,10292,10542,10795,11051,11310,11572,11837]))\r\nassert(isequal(d,[1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 100000; x2 = 110000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[100492,101270,102051,102835,103622,104412,105205,106001,106800,107602,108407,109215]))\r\nassert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1]))\r\n\r\n%%\r\nx1 = 1000000; x2 = 1010101;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1000825,1003277,1005732,1008190]))\r\nassert(isequal(d,[1,0,0,1]))","published":true,"deleted":false,"likes_count":12,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":677,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-05T17:43:36.000Z","updated_at":"2026-03-18T12:42:40.000Z","published_at":"2017-10-16T01:45:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ [p,d] = pentagonal_numbers(10,40)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eshould return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ p = [12,22,35]\\n d = [ 0, 0, 1]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45229,"title":"Bell Triangle","description":"Form the bell triangle upto nth bell number posotion;\r\n\r\n* if n=5\r\n* \r\n y= [1     0     0     0     0;\r\n     1     2     0     0     0;\r\n     2     3     5     0     0;\r\n     5     7    10    15     0;\r\n    15    20    27    37    52]\r\n\r\nsince 5th bell number is 52.\r\n","description_html":"\u003cp\u003eForm the bell triangle upto nth bell number posotion;\u003c/p\u003e\u003cul\u003e\u003cli\u003eif n=5\u003c/li\u003e\u003cli\u003ey= [1     0     0     0     0;\r\n     1     2     0     0     0;\r\n     2     3     5     0     0;\r\n     5     7    10    15     0;\r\n    15    20    27    37    52]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003esince 5th bell number is 52.\u003c/p\u003e","function_template":"function y = Bell_tri(n)\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 1;\r\nassert(isequal(Bell_tri(n),y_correct))\r\n%%\r\nn = 5;\r\ny_correct = [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52];\r\nassert(isequal(Bell_tri(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = [ 1           0           0           0           0           0           0           0           0;\r\n           1           2           0           0           0           0           0           0           0;\r\n           2           3           5           0           0           0           0           0           0;\r\n           5           7          10          15           0           0           0           0           0;\r\n          15          20          27          37          52           0           0           0           0;\r\n          52          67          87         114         151         203           0           0           0;\r\n         203         255         322         409         523         674         877           0           0;\r\n         877        1080        1335        1657        2066        2589        3263        4140           0;\r\n        4140        5017        6097        7432        9089       11155       13744       17007       21147];\r\nassert(isequal(Bell_tri(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2019-12-11T00:40:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-11T00:37:30.000Z","updated_at":"2026-01-13T23:37:08.000Z","published_at":"2019-12-11T00:40:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eForm the bell triangle upto nth bell number posotion;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif n=5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ey= [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003esince 5th bell number is 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3002,"title":"Not square-free number sequence","description":"Not square-free numbers are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ... For example, 4 = 2^2, 8 = 2^2 * 2, 9 = 3^2, 12 = 2^2 * 3, etc.\r\nReturn numbers from the square-free sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [9, 12, 16, 18, 20].\r\nThis problem is related to Problem 3001 and Problem 3003.","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: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 61.5px; transform-origin: 407px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eNot square-free numbers\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 296.5px 8px; transform-origin: 296.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ... For example, 4 = 2^2, 8 = 2^2 * 2, 9 = 3^2, 12 = 2^2 * 3, etc.\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: 365.5px 8px; transform-origin: 365.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn numbers from the square-free sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [9, 12, 16, 18, 20].\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: 80px 8px; transform-origin: 80px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is related to\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3001-sphenic-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3001\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3003-mobius-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3003\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [arr] = not_squarefree_seq(n)\r\n\r\narr = n;\r\n\r\nend\r\n","test_suite":"%%\r\nn = 1:5;\r\narr_corr = [4, 8, 9, 12, 16];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:10;\r\narr_corr = [4, 8, 9, 12, 16, 18, 20, 24, 25, 27];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 3:7;\r\narr_corr = [9    12    16    18    20];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 20:30;\r\narr_corr = [52    54    56    60    63    64    68    72    75    76    80];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 69;\r\narr_corr = 175;\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:62;\r\narr_corr = [4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, 44, 45, 48, 49, 50, 52, 54, 56, 60, 63, 64, 68, 72, 75, 76, 80, 81, 84, 88, 90, 92, 96, 98, 99, 100, 104, 108, 112, 116, 117, 120, 121, 124, 125, 126, 128, 132, 135, 136, 140, 144, 147, 148, 150, 152, 153, 156, 160];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%% prevents cheating\r\ni1 = randi(20,1);\r\nn = i1:(i1+randi(25,1));\r\narr_tot = [4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, 44, 45, 48, 49, 50, 52, 54, 56, 60, 63, 64, 68, 72, 75, 76, 80, 81, 84, 88, 90, 92, 96, 98, 99, 100, 104, 108, 112, 116, 117, 120, 121, 124, 125, 126, 128, 132, 135, 136, 140, 144, 147, 148, 150, 152, 153, 156, 160];\r\narr_corr = arr_tot(n);\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":26769,"edited_by":223089,"edited_at":"2022-10-09T05:12:26.000Z","deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":"2022-10-09T05:12:26.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-02-11T02:39:31.000Z","updated_at":"2026-03-16T14:13:50.000Z","published_at":"2015-02-11T02:39:31.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eNot square-free numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ... For example, 4 = 2^2, 8 = 2^2 * 2, 9 = 3^2, 12 = 2^2 * 3, etc.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn numbers from the square-free sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [9, 12, 16, 18, 20].\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 is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3001-sphenic-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3001\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/3003-mobius-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3003\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":3001,"title":"Sphenic number sequence","description":"Sphenic numbers are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, ... For example, 30 = 2*3*5, 42 = 2*3*7, etc.\r\nReturn the numbers from the sphenic sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [66, 70, 78, 102, 105].\r\nThis problem is related to Problem 3002 and Problem 3003.","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: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 61.5px; transform-origin: 407px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eSphenic numbers\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 317.5px 8px; transform-origin: 317.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, ... For example, 30 = 2*3*5, 42 = 2*3*7, etc.\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: 365px 8px; transform-origin: 365px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn the numbers from the sphenic sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [66, 70, 78, 102, 105].\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: 80px 8px; transform-origin: 80px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is related to\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3002-not-square-free-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3002\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3003-mobius-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3003\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [arr] = sphenic_seq(n)\r\n\r\narr = n;\r\n\r\nend","test_suite":"%%\r\nn = 1:5;\r\narr_corr = [30, 42, 66, 70, 78];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:10;\r\narr_corr = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 3:7;\r\narr_corr = [66, 70, 78, 102, 105];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 20:30;\r\narr_corr = [222   230   231   238   246   255   258   266   273   282   285];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 69;\r\narr_corr = 582;\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:53;\r\narr_corr = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310, 318, 322, 345, 354, 357, 366, 370, 374, 385, 399, 402, 406, 410, 418, 426, 429, 430, 434, 435, 438];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%% prevents cheating\r\ni1 = randi(20,1);\r\nn = i1:(i1+randi(25,1));\r\narr_tot = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310, 318, 322, 345, 354, 357, 366, 370, 374, 385, 399, 402, 406, 410, 418, 426, 429, 430, 434, 435, 438];\r\narr_corr = arr_tot(n);\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":223089,"edited_at":"2022-10-09T05:23:45.000Z","deleted_by":null,"deleted_at":null,"solvers_count":87,"test_suite_updated_at":"2022-10-09T05:23:45.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-02-11T02:19:47.000Z","updated_at":"2026-03-16T14:15:22.000Z","published_at":"2015-02-11T02:19:47.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=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSphenic numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, ... For example, 30 = 2*3*5, 42 = 2*3*7, etc.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the numbers from the sphenic sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [66, 70, 78, 102, 105].\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 is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3002-not-square-free-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3002\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/3003-mobius-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3003\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":45234,"title":"Calculating large fibonacci numbers","description":"The fibonacci sequence starts 1,1,2,3,5,8...\r\n\r\nFind the the n'th fibonacci number. Then calculate round(log10( . )) of that n'th fibonacci number. ","description_html":"\u003cp\u003eThe fibonacci sequence starts 1,1,2,3,5,8...\u003c/p\u003e\u003cp\u003eFind the the n'th fibonacci number. Then calculate round(log10( . )) of that n'th fibonacci number.\u003c/p\u003e","function_template":"function y = your_fcn_name(n)\r\n  y = n;\r\nend","test_suite":"%%\r\nx = 100;\r\ny_correct = 21;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 140;\r\ny_correct = 29;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 41;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 300;\r\ny_correct = 62;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 400;\r\ny_correct = 83;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\n\r\nx = 500;\r\ny_correct = 104;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\n\r\nx = 1000;\r\ny_correct = 209;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 1100;\r\ny_correct = 230;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 1100;\r\ny_correct = 230;\r\ntic\r\nassert(isequal(your_fcn_name(x),y_correct))\r\ntime = toc\r\nassert(time \u003c .01)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":65480,"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":"2019-12-14T00:30:26.000Z","updated_at":"2019-12-14T00:30:26.000Z","published_at":"2019-12-14T00:30:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe fibonacci sequence starts 1,1,2,3,5,8...\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 the n'th fibonacci number. Then calculate round(log10( . )) of that n'th fibonacci number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45376,"title":"Maya - 02 ","description":"\u003chttps://en.wikipedia.org/wiki/Maya_numerals\u003e\r\n\r\nPrev. prob. - \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\u003e\r\n\r\nNow u've to decode the number given in Maya representation.\r\n\r\nFor example,\r\n \r\n Maya = .._  becomes n=7\r\n Maya = . ...__ becomes n=33","description_html":"\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Maya_numerals\"\u003ehttps://en.wikipedia.org/wiki/Maya_numerals\u003c/a\u003e\u003c/p\u003e\u003cp\u003ePrev. prob. - \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\"\u003ehttps://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\u003c/a\u003e\u003c/p\u003e\u003cp\u003eNow u've to decode the number given in Maya representation.\u003c/p\u003e\u003cp\u003eFor example,\u003c/p\u003e\u003cpre\u003e Maya = .._  becomes n=7\r\n Maya = . ...__ becomes n=33\u003c/pre\u003e","function_template":"function y = maya_02(s)","test_suite":"%%\r\nassert(isequal(maya_02('..'),2))\r\n%%\r\nassert(isequal(maya_02('.. .'),41))\r\n%%\r\nassert(isequal(maya_02('... .. ....__'),1254))\r\n%%\r\nassert(isequal(maya_02('__ ....__ _'),4285))\r\n%%\r\nassert(isequal(maya_02('._ o ....__ __'),48290))\r\n%%\r\nassert(isequal(maya_02('. o o o o'),160000))\r\n%%\r\nassert(isequal(maya_02('__ .. _ ..._ o .___'),32363216))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2020-03-23T01:48:50.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-23T01:32:18.000Z","updated_at":"2020-03-23T01:48:50.000Z","published_at":"2020-03-23T01:48:50.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Maya_numerals\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Maya_numerals\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrev. prob. -\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/45375-maya-01\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNow u've to decode the number given in Maya representation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Maya = .._  becomes n=7\\n Maya = . ...__ becomes n=33]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43584,"title":"Find Pseudo-Cyclic Number","description":"A cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number https://en.wikipedia.org/wiki/Cyclic_number\u003e). The most widely known is 142857:\r\n\r\n\r\n    142857 × 1 = 142857\r\n    142857 × 2 = 285714\r\n    142857 × 3 = 428571\r\n    142857 × 4 = 571428\r\n    142857 × 5 = 714285\r\n    142857 × 6 = 857142 \r\n\r\n\r\nIn fact, 142857 is the only cyclic number in decimal, if leading zeros are not permitted on numerals.\r\n\r\nTherefore, instead of the pure cyclic number, we will find the integer in which *any* cyclic permutations of the digits are *any* multiples of the number.\r\n\r\nFor example, 230769 is the one, because 23076 *9* x 4 = *9* 23076.\r\n\r\n\r\n\r\nGiven an integer x, return whether x is a pesudo-cyclic number.\r\n\r\n","description_html":"\u003cp\u003eA cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number https://en.wikipedia.org/wiki/Cyclic_number\u0026gt;). The most widely known is 142857:\u003c/p\u003e\u003cpre\u003e    142857 × 1 = 142857\r\n    142857 × 2 = 285714\r\n    142857 × 3 = 428571\r\n    142857 × 4 = 571428\r\n    142857 × 5 = 714285\r\n    142857 × 6 = 857142 \u003c/pre\u003e\u003cp\u003eIn fact, 142857 is the only cyclic number in decimal, if leading zeros are not permitted on numerals.\u003c/p\u003e\u003cp\u003eTherefore, instead of the pure cyclic number, we will find the integer in which \u003cb\u003eany\u003c/b\u003e cyclic permutations of the digits are \u003cb\u003eany\u003c/b\u003e multiples of the number.\u003c/p\u003e\u003cp\u003eFor example, 230769 is the one, because 23076 \u003cb\u003e9\u003c/b\u003e x 4 = \u003cb\u003e9\u003c/b\u003e 23076.\u003c/p\u003e\u003cp\u003eGiven an integer x, return whether x is a pesudo-cyclic number.\u003c/p\u003e","function_template":"function y = cyclicNumber(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 230769;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 307692;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 307691;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 307693;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 285714;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 55;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 142857142857;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 142857;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":1,"created_by":83468,"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":"2016-10-21T09:35:07.000Z","updated_at":"2026-03-18T16:13:12.000Z","published_at":"2016-10-21T09:35:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Cyclic_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Cyclic_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;). The most widely known is 142857:\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[    142857 × 1 = 142857\\n    142857 × 2 = 285714\\n    142857 × 3 = 428571\\n    142857 × 4 = 571428\\n    142857 × 5 = 714285\\n    142857 × 6 = 857142]]\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\u003eIn fact, 142857 is the only cyclic number in decimal, if leading zeros are not permitted on numerals.\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\u003eTherefore, instead of the pure cyclic number, we will find the integer in which\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e cyclic permutations of the digits are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e multiples of the number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, 230769 is the one, because 23076\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e9\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e x 4 =\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e9\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 23076.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer x, return whether x is a pesudo-cyclic number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3003,"title":"Mobius function","description":"From wikipedia:\r\nFor any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, 0, 1} depending on the factorization of n into prime factors:\r\nμ(n) = 1 if n is a square-free positive integer with an even number of prime factors.\r\nμ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.\r\nμ(n) = 0 if n has a squared prime factor.\r\nReturn numbers from the Mobius function sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [-1, 0, -1, 1, -1].\r\nHint: solving Problem 3001 and Problem 3002 will provide much of the code needed for this problem. You'll need to add prime numbers to the sphenic number set (resulting from Problem 3001).","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: 256.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 128.15px; transform-origin: 407px 128.15px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 16.5px 8px; transform-origin: 16.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFrom\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\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: 2px 8px; transform-origin: 2px 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: 380px 8px; transform-origin: 380px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, 0, 1} depending on the factorization of n into prime factors:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30.65px; transform-origin: 391px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 259px 8px; transform-origin: 259px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eμ(n) = 1 if n is a square-free positive integer with an even number of prime factors.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 259.5px 8px; transform-origin: 259.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eμ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 125px 8px; transform-origin: 125px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eμ(n) = 0 if n has a squared prime factor.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 79px 8px; transform-origin: 79px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn numbers from 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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMobius function sequence\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: 214.5px 8px; transform-origin: 214.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e corresponding to the supplied indices. For example, if n = 3:7, your function should return [-1, 0, -1, 1, -1].\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: 38px 8px; transform-origin: 38px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHint: solving\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3001-sphenic-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3001\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3002-not-square-free-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3002\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: 232.5px 8px; transform-origin: 232.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e will provide much of the code needed for this problem. You'll need to add prime numbers to the sphenic number set (resulting from Problem 3001).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [arr] = mobius_func_seq(n)\r\n\r\narr =n;\r\n\r\nend\r\n","test_suite":"%%\r\nn = 1:5;\r\narr_corr = [1, -1, -1, 0, -1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:10;\r\narr_corr = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 3:7;\r\narr_corr = [-1, 0, -1, 1, -1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 20:30;\r\narr_corr = [0     1     1    -1     0     0     1     0     0    -1    -1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 99;\r\narr_corr = 0;\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:77;\r\narr_corr = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%% prevents cheating\r\ni1 = randi(20,1);\r\nn = i1:(i1+randi(25,1));\r\narr_tot = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1];\r\narr_corr = arr_tot(n);\r\nassert(isequal(mobius_func_seq(n),arr_corr))","published":true,"deleted":false,"likes_count":5,"comments_count":3,"created_by":26769,"edited_by":223089,"edited_at":"2022-10-09T11:44:37.000Z","deleted_by":null,"deleted_at":null,"solvers_count":63,"test_suite_updated_at":"2022-10-09T11:44:37.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-02-11T03:05:35.000Z","updated_at":"2026-03-16T14:39:18.000Z","published_at":"2015-02-11T03:05: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\u003eFrom\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\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\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, 0, 1} depending on the factorization of n into prime factors:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eμ(n) = 1 if n is a square-free positive integer with an even number of prime factors.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eμ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eμ(n) = 0 if n has a squared prime factor.\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 numbers from 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=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMobius function sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e corresponding to the supplied indices. For example, if n = 3:7, your function should return [-1, 0, -1, 1, -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\u003eHint: solving\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/3001-sphenic-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3001\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/3002-not-square-free-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3002\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e will provide much of the code needed for this problem. You'll need to add prime numbers to the sphenic number set (resulting from Problem 3001).\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":45250,"title":"Be happy","description":"check whether the given number is happy in b-base.\r\n\r\n* A happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\r\n\r\nThis is the case for base-10. For other bases, different scenerios would occur.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Happy_number\u003e\r\n\r\n","description_html":"\u003cp\u003echeck whether the given number is happy in b-base.\u003c/p\u003e\u003cul\u003e\u003cli\u003eA happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThis is the case for base-10. For other bases, different scenerios would occur.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Happy_number\"\u003ehttps://en.wikipedia.org/wiki/Happy_number\u003c/a\u003e\u003c/p\u003e","function_template":"function tf=be_happy(n,b)","test_suite":"%%\r\nn =11123;\r\nb=10;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 347;\r\nb=6;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 998;\r\nb=10;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%% \r\nn = 1234;\r\nb=4;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 149121303586;\r\nb=10;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn =742356;\r\nb=3;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 14916;\r\nb=7;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=6;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=7;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=13;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":13,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":36,"test_suite_updated_at":"2020-01-11T09:21:53.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-02T22:16:41.000Z","updated_at":"2026-03-22T22:09:02.000Z","published_at":"2020-01-03T04:25:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003echeck whether the given number is happy in b-base.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the case for base-10. For other bases, different scenerios would occur.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Happy_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Happy_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45249,"title":"Frugal number","description":"check whether n is a frugal number\r\n\r\n* a frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\r\n","description_html":"\u003cp\u003echeck whether n is a frugal number\u003c/p\u003e\u003cul\u003e\u003cli\u003ea frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = frugal_no(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 18;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 36;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 79;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))%%\r\nn = 105;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 106;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 125;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 128;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 243;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 344;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 11421;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 115248;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 111050;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn=97969;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":11,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":51,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-31T07:08:41.000Z","updated_at":"2026-04-01T15:15:43.000Z","published_at":"2019-12-31T07:09:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003echeck whether n is a frugal number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ea frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":172,"title":"Test if a Number is a Palindrome without using any String Operations","description":"*Description*\r\n\r\nGiven an integer _X_, determine if it is a palindrome number. That is, _X_ is equal to the _X_ with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either \"str\", \"eval\", \"flip\" or \"printf\" in it.\r\n\r\n*Example*\r\n\r\n    X = 123454321;\r\n    Y = true;\r\n\r\n    X = 1234;\r\n    Y = false;","description_html":"\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eGiven an integer \u003ci\u003eX\u003c/i\u003e, determine if it is a palindrome number. That is, \u003ci\u003eX\u003c/i\u003e is equal to the \u003ci\u003eX\u003c/i\u003e with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either \"str\", \"eval\", \"flip\" or \"printf\" in it.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e    X = 123454321;\r\n    Y = true;\u003c/pre\u003e\u003cpre\u003e    X = 1234;\r\n    Y = false;\u003c/pre\u003e","function_template":"function y = isNumPalindrome(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = 122131221;\r\ny_correct = true;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )\r\n\r\n%%\r\nx = 1221;\r\ny_correct = true;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )\r\n\r\n%%\r\nx = 12345;\r\ny_correct = false;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )\r\n\r\n%%\r\nx = 9849;\r\ny_correct = false;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":255,"test_suite_updated_at":"2012-04-18T18:19:32.000Z","rescore_all_solutions":false,"group_id":38,"created_at":"2012-01-30T05:24:23.000Z","updated_at":"2026-03-31T17:41:42.000Z","published_at":"2012-01-30T05:39:05.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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDescription\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\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\u003eX\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, determine if it is a palindrome number. That is,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eX\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is equal to 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\u003eX\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either \\\"str\\\", \\\"eval\\\", \\\"flip\\\" or \\\"printf\\\" in it.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    X = 123454321;\\n    Y = true;\\n\\n    X = 1234;\\n    Y = false;]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45487,"title":"Check Digit - 02","description":"Given a list of ISBN's, check whether they're valid or not.\r\n\r\nPrev Prob - \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45486\u003e\r\n","description_html":"\u003cp\u003eGiven a list of ISBN's, check whether they're valid or not.\u003c/p\u003e\u003cp\u003ePrev Prob - \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/45486\"\u003ehttps://www.mathworks.com/matlabcentral/cody/problems/45486\u003c/a\u003e\u003c/p\u003e","function_template":"function tf = ISBN_check_2(x)","test_suite":"%%\r\nassert(isequal( ISBN_check_2('1306406152'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('0306406152'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('014298115X'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('014298115S'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('0X306406152'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('978-0-306-40615-7'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('978-0-306-40615-X'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('978-306-40615-7'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('0-9752298-0-X'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('0-97R2298-0-328'),0))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-04-30T15:00:17.000Z","updated_at":"2020-04-30T15:00:17.000Z","published_at":"2020-04-30T15:00:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of ISBN's, check whether they're valid or not.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrev Prob -\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/45486\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.mathworks.com/matlabcentral/cody/problems/45486\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":54089,"title":"Ramanujan's Number","description":"About 1729\r\n\r\n1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways.\r\nCalculate the second, third, fourth ... positive integers which can be expressed as the sum of two positive cubes in two different ways.","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: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 66px; transform-origin: 406.5px 66px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/1729_(number)\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eAbout 1729\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVIAAAAmCAYAAACWEROMAAAAAXNSR0IArs4c6QAAC9RJREFUeF7tnQWs7UoVhr+HOzw0BIKEENwCwSV4cHd3hwCB4ME1PNwl+MPd3d0leLAAwSG4k4/M8CabaTvT9nR33z1Nbu7NOdN21t81/yybdQ+jXQ2BhkBDoCEwCYHDJt3dbm4INAQaAg0BGpE2JWgINAQaAhMRaEQ6EcB2e0OgIdAQaETadKAh0BBoCExEoBHpRADb7Q2BhkBDoBHpoakDJwVuD9wSOAvwPuDRwAeAfx+aIo+Sal9x2le5a5WkGKdGpLXQrn/8iYDHAJ8D3gacHXgEoFJcD/ja+kVYZIb7itO+yl2rVFU4NSKthXf9468F/AV4Z2J9Xht4HXBT4OXrF2GRGe4rTvsqd61SVeHUiLQW3nWPPxpwBuCHwD+SqV4MeAegcujm7/u1rzjtq9y1+l6NUymR+uCLhrjbo4Bvdszs2MDjgbsXzvxewJM2xh4DuDhwC+AiIcb3IeAtwCuAn/Y823leCLg1cDrg+ME6eyNwJPCrwnmtdZgy3Q34fJCnZJ5+4zsC5wTuC/yx5KYVjKmRVRnPCNwKuBxw4aCj7wJeDHwR+NeATLuM082BSwDHBI4HfAx4PvCNgpj4LstdsxbkpisD1wB+BJwa/ltH/xLgI1P1Y4hII4FKeFozXwJu0EOk5wBeA5ytYCFKiNcEPp2MNY5nPO/OHfdL4CZRPpz5vaT5AOCygWw+G5TorMBTgFMBdwI+UTC3tQ2RVMTkdiHWWeqi+30vDdwzYPL9tQmWmU+trG68NwGOCNhsPvL3QafcsFMrPR23izg5Z9fkY4HHAS8D/gqcMKyDu4S/n32IyV2rH37n0weD7ViAuPwgfHyNQzecN4RkbJeRMagffUQqKbpgfwxcDbjCAJH6LBfsFQGt1q6kxsmA5wC/AW4T/lYuF8T9gOuGRfF+4O/A+YLwVw3Cu9s6r5QUvPfeQamuA7x+YzVdEnhlcHm1Wr6+A4TiFE8C3BZwQzttIEN/XkKkZuvvGix7F5eb4Jo3krGyXgZ4YbAsXh08FsMbNwTuEIhFMr0Z8KbMd981nKIIlwrWtjLpaUii8Tol8LywieqN6I1tVmvsmtxj9eMUgW/0VOSWdyc4yVmur+cG7nliZtMpwqmPSGXvv4WX6jroIvVZpJrKEuiDA/l2cVWM1xkCcHz8wBcAnhAsr02i09p0fLRUFf4FyQsiUf68w2L2/qeHciDBeuCG4q2VV90gdEn9o2UtUZyrkEiVKcZ6JFQ3OXfedPMaK7culRvbMzvIacxzx8h6OPAs4M0ZslC3bwRokbmRvChsLDmr46BwGoNDyT2RKK/eowt+Z62tnOER33FQcq9FP9QBw4xP7tF9Q0JuNFq6br45b3cQpyHXPgKu66Tr0Eekms8qtvGorsv3SWLuoFcKH9mx8eff68kqp2ED3TStV4n+6MF1uz/w2rDD/C4zAa0TF9W3w8705RKNXdEYd8ZXAeepINI4fUs5ngZcPngXlkZNudwsHz5iHqXvLJXVTVnr3NDTnzMPTzfQjwM3Tty63FzmxqlU3tpxfkctK8Njeou573nusB7OHGLkeoFd19xyr0U/NO6MgWqNOqfUcItYHDe4/fLDUzPWfYpZJ05zEmmJMpwceGkYqKv1y/DvEwMPC7GermSSVsUzgoumUmhhuXgkb595lWDCx59vzsdF99HwQ92dPsUqkWXpMaXk0jWv6FWYyNNKmXKtZaHcA/jqQCVC3ECH4vsRjzlxmoJx370aDR6w6JPJEJqlbobaXB/GBg1x7JN+xA1HmU0y6bnkLjnDGHuJjmT1Y2ki7XLrSxQu3TkkXf8YFkgJJiXYzWemO3Rq0Za8ew1jphKpXoUKo/vynYkCrYVIS8SI3tR7g0X6i4Gb5sSpZH61Y9J10LfwU8OjxBqfU+616EckSDcQczyf7AA76oi/dtx7ej5KFqclibTLrS9VpFQx0t0lJZi+nbeUcEvns/S4KUQawx/GveeID69loZR8g2iRlmyec+NUMr/aMSmR9oWpSgnX988t9xr04ziA+RDzKkOWZuqt5koy4zfqxGlJIo1uvUkFzeO+etCcchmDtY70Txv3p659386bEpGJMxMwfyjQ4vS+guGdQx4SYrljn1FCpH5oM/OWgBkGsfJBq90SKM/d3wf42dgJJPetYaGUiOHGYXmQycn0MMKcOKUudMmcusb0eVOb90TX3p93uawpkZq8vX6oVtkX/bCe1rJHv30NkbpODZtU4bQkkUa33gyabvk/K7XOY45mXq0jtZQpXi4Wa09NYHnlyp/8+ViLdJeI1O9piYd4OG8LjVUi//bc/VzF+LtCpDEj+5mgHzEhNSdO2yBS8wFmmvXSuhIkOYv0W3ukH+l3qSFSNzStUjEuXkdLEWnq1o85pqjVqYDGt3KncyydMmOv1Wpdne5cann5fmMbMdFlUw/JoJbMK7l/1uElFumsL+x52C4QaSx9sQRql2qHS75hXA82obG43FOAnv5LLw/FSLZWeXww6P9PSh4+w5g16IcJbMu/NCxqiLQkBPR/EC1FpFPc+rggdE83CTIK5BhPXOnOejrqraEm1UMBZwqZfhXKY3Re+5i1r1kfafC95r7NsWMrBObYNNxcXUhm9jdJZopMa7lXjKyl1tPzxJ+nm94ejoh6YtAaUy1yjYuSrH2NXLugHzUx4jRGOioEtxSRRrfeovhaS9ATHA/tKNRPP76yWLRuTESzXEVTwXRrPfly3lBA3ld7V6NMS4+dg1xK57wLC6VPFo8DW6ivl5I71VOKw9rH6b5qcWt1uU5+DZgnUGZrss0FWEfal0AZI+Mu6EdaX15jkXrMXI+16lqCSKNbb7xhqLRgc/K6JwplcH3KsU5dIXdvwwp9J1yqwFt48JJEOiTaGly3rjlahK91FgllHxtZx+PaZq1dN0v3oV2LfpSWP+nNxrxLX71p57pYgkijW285gjtZaZwmkqgEPPUkjuCkBwFyZ667QNqlZNMQAc71+7UslE15Iol+IVhjXU1K5sLB52wj2TQ0f3sNeBJRT3AbR6LXoh/REzYpV1KQP3rTWYJIx7j1uiOWrVi+kDv7qiLZMkxrY2ixnCaQqDFWQwsmq3LHCRuRDi3Po36/loWSzjh2//ptOPKX0wvPTKs3aYOPcqnzI9dGpJYXWhWji/qpkB+w3nTJay36kR4R7QpvpPWmo73VgybSMW69wXGPa1nW0ZUkUFlMGFnSYyyoz82LzU5y2fwllWvqu5pr342giQU3SP9ngFwHn3innaJO0HNUcOo32vb9aaMW46W5bP4Sc1wLkabdnboSbrE+3WZAXR3CBjE7aCKNbr2H/YcaRjhZrUfrTO1yZDF57vJZdraxdMnGGV0lTLEvo81NBNE2e0PHAwcB2+KARqR58G3Yq7VhmzU9mJy16carR2IszJMutYdBtvjZi1+ttW0NtR3UtMq32TJxLUQqeLGNns2+N7s7pUQ7xlv938cpIVKV0K4p7vi5Zsx9Xzq69ZahxG5NXePNtForaixj6OqbhzLZw1T3xsatjwxdn2rc+aH3b+P3dsuyvMXLTcF6t20lUg56oZTKmvahLfkm28atZI5jxkgWyuYmYavEB4Uu8GOeNcc9a9GPKIuhQr1cjS6bt9hj2ev8oWTSHIxz1oofdfURqdakO5x9J2NTZV/iKRHLSuw0b3f7rnhT6tYPZcK0Mt0RNK1Lrly7PE84XTB0kbd+0ZZzts3z/y/a1UtrS3dU/My8WiPr5Qc3nmM3K8u7YhetpeQ8iIUyRlatLjP0eh9D166WvXXJFXtkmsD1+K9kYDjMaoWh/1ZlCKupv1+LfqRyGEN3HflHXTAc5DFS15EhxKFcSy8mJRbpVFCXuF8LVLfNHqMq1HenArPEpHf4HQfRuHeH4Vh86p7asW+CFTD+/11fmfH47xzC7J1+HCpEOsfHb89oCDQEGgKjEGhEOgq2dlNDoCHQEDgKgUakTRsaAg2BhsBEBBqRTgSw3d4QaAg0BBqRNh1oCDQEGgITEWhEOhHAdntDoCHQEGhE2nSgIdAQaAhMROA/8cbBVHU5abkAAAAASUVORK5CYII=\" width=\"169\" height=\"19\" style=\"width: 169px; height: 19px;\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space: 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=\"\"\u003e1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 21px; text-align: left; transform-origin: 383.5px 21px; white-space: 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=\"\"\u003eCalculate the second, third, fourth ... positive integers which can be expressed as the sum of two positive cubes in two different ways.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [n a b c d] = Ramanujans(x)\r\nn = 1729;\r\na = 1; b = 12; c = 9; d = 10;\r\nend","test_suite":"%%\r\n[n, a, b, c, d] = Ramanujans(1);\r\nn_correct = 1729;\r\nassert(isequal(Ramanujans(1),n_correct))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(2);\r\nassert(n\u003e1729)\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(3);\r\nassert(n\u003eRamanujans(2))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(4);\r\nassert(n\u003eRamanujans(3))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(5);\r\nassert(n\u003eRamanujans(4))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2022-03-04T07:47:05.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-03-04T06:21:56.000Z","updated_at":"2022-03-04T07:47:05.000Z","published_at":"2022-03-04T06:21:56.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://en.wikipedia.org/wiki/1729_(number)\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAbout 1729\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e1729 = 1^3 + 12^3=9^3+10^3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCalculate the second, third, fourth ... positive integers which can be expressed as the sum of two positive cubes in two different ways.\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":45251,"title":"Last non-zero digit","description":"Given a number n, find the last non-zero digit of the factorial of that number.\r\nYou need to take care of the large values of n.","description_html":"\u003cp\u003eGiven a number n, find the last non-zero digit of the factorial of that number.\r\nYou need to take care of the large values of n.\u003c/p\u003e","function_template":"function D = last_Factorial(n)\r\n  \r\nend","test_suite":"%%\r\nn = 66;\r\ny_correct = 6;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 52;\r\ny_correct = 4;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 8;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 109;\r\ny_correct = 2;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 425;\r\ny_correct = 4;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 14;\r\ny_correct = 2;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 719;\r\ny_correct = 8;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T05:19:45.000Z","updated_at":"2026-02-05T20:53:13.000Z","published_at":"2020-01-03T05:25:46.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a number n, find the last non-zero digit of the factorial of that number. You need to take care of the large values of n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45343,"title":"How lucky  r u ?","description":"Find the nth number in the following sequence\r\n\r\n\u003chttps://oeis.org/A264940\u003e","description_html":"\u003cp\u003eFind the nth number in the following sequence\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://oeis.org/A264940\"\u003ehttps://oeis.org/A264940\u003c/a\u003e\u003c/p\u003e","function_template":"function y = lucky(n)\r\n\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(lucky(1),0))\r\n%%\r\nassert(isequal(lucky(5),3))\r\n%%\r\nassert(isequal(lucky(12),2))\r\n%%\r\nassert(isequal(lucky(19),7))\r\n%%\r\nassert(isequal(lucky(27),9))\r\n%%\r\nassert(isequal(lucky(31),0))\r\n%%\r\nassert(isequal(lucky(37),0))\r\n%%\r\nassert(isequal(lucky(45),13))\r\n%%\r\nassert(isequal(lucky(55),15))\r\n%%\r\nassert(isequal(lucky(85),21))\r\n%%\r\nassert(isequal(lucky(185),3))\r\n%%\r\nassert(isequal(lucky(303),0))\r\n%%\r\nassert(isequal(lucky(555),13))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-19T07:42:17.000Z","updated_at":"2025-11-21T23:33:51.000Z","published_at":"2020-02-19T07:42: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\u003eFind the nth number in the following sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A264940\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://oeis.org/A264940\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44306,"title":"Is it really a 5?","description":"A number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\r\n\r\n n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\r\n\r\nThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\r\n\r\nSee the test suite for more examples.","description_html":"\u003cp\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\u003c/p\u003e\u003cpre\u003e n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\u003c/pre\u003e\u003cp\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\u003c/p\u003e\u003cp\u003eSee the test suite for more examples.\u003c/p\u003e","function_template":"function tf = is_it_really_a_5(n)\r\n tf = 0;\r\nend","test_suite":"%%\r\nn = 5;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 25;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 35;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 52;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 59;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 85;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 105;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 115;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 125;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 250;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 555;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000; %5,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000; %15,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55555; %55,555\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000; %50,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55000; %55,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50500; %50,500\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050; %50,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50005; %50,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 500000; %500,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000; %5,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000000; %15,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000000; %50,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 105000000; %105,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050050; %50,050,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000005; %50,000,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000015; %50,000,015\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500000000; %500,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000000; %5,000,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000000000; %50,000,000,000\r\nassert(isequal(is_it_really_a_5(n),0))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":316,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-08T22:07:48.000Z","updated_at":"2026-03-18T13:28:44.000Z","published_at":"2017-10-16T01:45:06.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \\\"five\\\" anywhere. For example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ n = 5; return true since it is spelled \\\"five\\\"\\n n = 15; return false since it is spelled \\\"fifteen\\\" and does not contain the four-letter string \\\"five\\\"]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \\\"five\\\" for this problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee the test suite for more examples.\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":44293,"title":"Write out numbers in words","description":"Write out numbers in words ( range [0-9999] ) with British spelling rules. For example;\r\n1 \u003e one\r\n56 \u003e fifty-six\r\n100 \u003e one hundred\r\n105 \u003e one hundred and five\r\n245 \u003e two hundred and forty-five\r\n1520 \u003e one thousand, five hundred and twenty\r\n9999 \u003e nine thousand, nine hundred and ninety-nine (maximum)","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: 174.033px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 87.0167px; transform-origin: 407px 87.0167px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 268px 8px; transform-origin: 268px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite out numbers in words ( range [0-9999] ) with British spelling rules. For example;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 143.033px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 71.5167px; transform-origin: 391px 71.5167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 24px 8px; transform-origin: 24px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e1 \u0026gt; one\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 37.5px 8px; transform-origin: 37.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e56 \u0026gt; fifty-six\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 60.5px 8px; transform-origin: 60.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e100 \u0026gt; one hundred\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 87.5px 8px; transform-origin: 87.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e105 \u0026gt; one hundred and five\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 102.5px 8px; transform-origin: 102.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e245 \u0026gt; two hundred and forty-five\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 147px 8px; transform-origin: 147px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e1520 \u0026gt; one thousand, five hundred and twenty\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 202px 8px; transform-origin: 202px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e9999 \u0026gt; nine thousand, nine hundred and ninety-nine (maximum)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = num2words(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('num2words.m');\r\nassert(isempty(strfind(filetext, 'six hundred and seventy-nine')))\r\nassert(isempty(strfind(filetext, 'one thousand, five hundred and twenty')))\r\n\r\n%%\r\nx = 0;\r\ny_correct = 'zero';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 1;\r\ny_correct = 'one';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 11;\r\ny_correct = 'eleven';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 56;\r\ny_correct = 'fifty-six'\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 100;\r\ny_correct = 'one hundred';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 105;\r\ny_correct = 'one hundred and five';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 245;\r\ny_correct = 'two hundred and forty-five';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 679;\r\ny_correct = 'six hundred and seventy-nine';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 1000;\r\ny_correct = 'one thousand';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 1520;\r\ny_correct = 'one thousand, five hundred and twenty';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 2357;\r\ny_correct = 'two thousand, three hundred and fifty-seven';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 3001;\r\ny_correct = 'three thousand and one';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 4321;\r\ny_correct = 'four thousand, three hundred and twenty-one';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 7030;\r\ny_correct = 'seven thousand and thirty';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% maximum value\r\nx = 9999;\r\ny_correct = 'nine thousand, nine hundred and ninety-nine';\r\nassert(isequal(num2words(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":8703,"edited_by":223089,"edited_at":"2023-03-26T13:36:41.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2023-03-26T13:36:41.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-01T17:46:19.000Z","updated_at":"2026-01-22T21:27:21.000Z","published_at":"2017-09-01T17:46:19.000Z","restored_at":"2017-09-11T18:42:34.000Z","restored_by":null,"spam":null,"simulink":false,"admin_reviewed":true,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite out numbers in words ( range [0-9999] ) with British spelling rules. For example;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 \u0026gt; one\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e56 \u0026gt; fifty-six\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e100 \u0026gt; one hundred\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e105 \u0026gt; one hundred and five\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e245 \u0026gt; two hundred and forty-five\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1520 \u0026gt; one thousand, five hundred and twenty\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e9999 \u0026gt; nine thousand, nine hundred and ninety-nine (maximum)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":43967,"title":"Compound interest - number e","description":"A moneylender wants to receive his annual interest of 12% more frequently.\r\n\r\nIf he receives his interest rate every six months, he will receive 6% each time (12%/2).\r\n\r\nHe wants to know how much will he win during a year if he received his interest every year (n=1), every six months (n=2), every month (n=12), every week (n=52), every day (n=365) and every second (n=31536000). These will be the test cases.","description_html":"\u003cp\u003eA moneylender wants to receive his annual interest of 12% more frequently.\u003c/p\u003e\u003cp\u003eIf he receives his interest rate every six months, he will receive 6% each time (12%/2).\u003c/p\u003e\u003cp\u003eHe wants to know how much will he win during a year if he received his interest every year (n=1), every six months (n=2), every month (n=12), every week (n=52), every day (n=365) and every second (n=31536000). These will be the test cases.\u003c/p\u003e","function_template":"function y = compound(n)\r\n  y = exp(0.12); % This would be the solution if n=inf;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_ok = 1.12;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 2;\r\ny_ok = 1.1236;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 12;\r\ny_ok = 1.126825030132;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 52;\r\ny_ok = 1.127340987167;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 365;\r\ny_ok = 1.127474615638;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);\r\n\r\n%%\r\nn = 31536000;\r\ny_ok = 1.1274968514306000;\r\nassert(abs(compound(n)-y_ok)\u003c1e-9);","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":12767,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":42,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-25T20:20:55.000Z","updated_at":"2026-02-24T10:16:47.000Z","published_at":"2016-12-25T20:20:55.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA moneylender wants to receive his annual interest of 12% more frequently.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf he receives his interest rate every six months, he will receive 6% each time (12%/2).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHe wants to know how much will he win during a year if he received his interest every year (n=1), every six months (n=2), every month (n=12), every week (n=52), every day (n=365) and every second (n=31536000). These will be the test cases.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44654,"title":"convert the number to binary format \u0026 count digits","description":"Convert the given number to the corresponding binary format and count the number of digits in that binary number","description_html":"\u003cp\u003eConvert the given number to the corresponding binary format and count the number of digits in that binary number\u003c/p\u003e","function_template":"function y = dec_2_bin(x)\r\n \r\nend","test_suite":"%%\r\nx = 23;\r\ny_correct = 5;\r\nassert(isequal(dec_2_bin(x),y_correct))\r\n\r\n%%\r\nx = 234;\r\ny_correct = 8;\r\nassert(isequal(dec_2_bin(x),y_correct))\r\n\r\n%%\r\nx = 22;\r\ny_correct = 5;\r\nassert(isequal(dec_2_bin(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 2;\r\nassert(isequal(dec_2_bin(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":171559,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":57,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-05-25T11:50:28.000Z","updated_at":"2026-02-10T18:29:49.000Z","published_at":"2018-05-25T11:50:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConvert the given number to the corresponding binary format and count the number of digits in that binary number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45412,"title":"Determina el número de cifras de un número","description":"Crea una función que te devuelva el número de cifras de un número.\r\n\r\nAlgunos ejemplos para ayudarte serían: \r\nEl número 125 tiene 3 cifras.\r\n\r\nEl número 8749023 tiene 7 cifras.\r\n\r\nEl número 4 tiene 1 cifra.\r\n\r\nY así sucesivamente.\r\n\r\n","description_html":"\u003cp\u003eCrea una función que te devuelva el número de cifras de un número.\u003c/p\u003e\u003cp\u003eAlgunos ejemplos para ayudarte serían: \r\nEl número 125 tiene 3 cifras.\u003c/p\u003e\u003cp\u003eEl número 8749023 tiene 7 cifras.\u003c/p\u003e\u003cp\u003eEl número 4 tiene 1 cifra.\u003c/p\u003e\u003cp\u003eY así sucesivamente.\u003c/p\u003e","function_template":"function y = compute_number(x)\r\n \r\nend","test_suite":"%%\r\nx = 1000;\r\ny_correct = 4;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%\r\nx = 0;\r\ny_correct = 1;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%%\r\nx = 7675483;\r\ny_correct = 7;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%%\r\nx=-2\r\ny_correct = 1;\r\nassert(isequal(compute_number(x),y_correct))\r\n%%%\r\nx=8476352689256\r\ny_correct = 13;\r\nassert(isequal(compute_number(x),y_correct))\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":394942,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":64,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-31T15:06:04.000Z","updated_at":"2026-02-18T09:33:27.000Z","published_at":"2020-04-03T07:06:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCrea una función que te devuelva el número de cifras de un número.\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\u003eAlgunos ejemplos para ayudarte serían: El número 125 tiene 3 cifras.\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\u003eEl número 8749023 tiene 7 cifras.\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\u003eEl número 4 tiene 1 cifra.\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\u003eY así sucesivamente.\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":2275,"title":"Palindrome numbers","description":"Find the palindrome numbers (two or more digits) from 1 to n where n is the number passed to the function.","description_html":"\u003cp\u003eFind the palindrome numbers (two or more digits) from 1 to n where n is the number passed to the function.\u003c/p\u003e","function_template":"function y = palin(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 100;\r\ny_correct = [11 22 33 44 55 66 77 88 99]; \r\nassert(isequal(palin(n),y_correct))\r\n\r\n%%\r\nfor n = 101:110\r\n y_correct = [11 22 33 44 55 66 77 88 99 101]; \r\n assert(isequal(palin(n),y_correct))\r\nend\r\n\r\n%%\r\nn = 200;\r\ny_correct = [11 22 33 44 55 66 77 88 99 101 111 121 131 141 151 161 171 181 191]; \r\nassert(isequal(palin(n),y_correct))\r\n\r\n%%\r\nn = 300;\r\ny_correct = [11 22 33 44 55 66 77 88 99 101 111 121 131 141 151 161 171 181 191 202 212 222 232 242 252 262 272 282 292];\r\nassert(isequal(palin(n),y_correct))\r\n\r\n%%\r\nn = 400;\r\ny_correct = [11 22 33 44 55 66 77 88 99 101 111 121 131 141 151 161 171 181 191 202 212 222 232 242 252 262 272 282 292 303 313 323 333 343 353 363 373 383 393];\r\nassert(isequal(palin(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":"2018-08-30T16:46:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-04-09T05:09:16.000Z","updated_at":"2025-11-21T16:32:11.000Z","published_at":"2014-04-09T05:09:16.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the palindrome numbers (two or more digits) from 1 to n where n is the number passed to the function.\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":57502,"title":"Determine if input is a Harshad number","description":"In mathematics a harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.\r\nExample: 2023 is a harshad number because 2023 / (2+0+2+3) = 289\r\nAssume all numbers in this problem are in 10 base","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: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 51px; transform-origin: 407px 51px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eIn\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e mathematics 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: 0px 0px; transform-origin: 0px 0px; \"\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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eharshad 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: 0px 0px; transform-origin: 0px 0px; \"\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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(or\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eNiven 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e) in a given\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e number base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eis an\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ethat is divisible by 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e sum of its digits \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ewhen written in that base.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eExample: 2023 is a harshad number because 2023 / (2+0+2+3) = 289\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eAssume all numbers in this problem are in 10 base\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = is_harshad(x)\r\n  y = 1;\r\nend","test_suite":"%%\r\nx = 5;\r\ny_correct = 1;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 13;\r\ny_correct = 0;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 199;\r\ny_correct = 0;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 1;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 89727;\r\ny_correct = 1;\r\nassert(isequal(is_harshad(x),y_correct))\r\n\r\n%%\r\nx = 89728;\r\ny_correct = 0;\r\nassert(isequal(is_harshad(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2686445,"edited_by":2686445,"edited_at":"2023-01-03T18:21:04.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-01-03T18:20:01.000Z","updated_at":"2026-03-17T07:31:55.000Z","published_at":"2023-01-03T18:21:04.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e mathematics a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eharshad number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e(or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNiven number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) in a given\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e number base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eis an\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ethat is divisible by the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e sum of its digits \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ewhen written in that base.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample: 2023 is a harshad number because 2023 / (2+0+2+3) = 289\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\u003eAssume all numbers in this problem are in 10 base\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":42380,"title":"Dice roll - opposite faces","description":"For this problem, you will be provided with the values of a dice roll (regular six-sided dice). The number of dice will be at least one. Your function should return the values on the opposite faces of the dice and in the same order. See the test suite for examples.","description_html":"\u003cp\u003eFor this problem, you will be provided with the values of a dice roll (regular six-sided dice). The number of dice will be at least one. Your function should return the values on the opposite faces of the dice and in the same order. See the test suite for examples.\u003c/p\u003e","function_template":"function y = dice_roll_opposite_face(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 6;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 5;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 4;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 3;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 2;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 6;\r\ny_correct = 1;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = 1:6;\r\ny_correct = 6:-1:1;\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [6,4,3];\r\ny_correct = [1,3,4];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [5,5,2];\r\ny_correct = [2,2,5];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [3,1,6];\r\ny_correct = [4,6,1];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [5,4,3];\r\ny_correct = [2,3,4];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [3,1,2,6,1,5,4,6,1,3];\r\ny_correct = [4,6,5,1,6,2,3,1,6,4];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [1,6,1,5,5,6,1,3,2,5];\r\ny_correct = [6,1,6,2,2,1,6,4,5,2];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n\r\n%%\r\nx = [3,6,2,2,1,1,6,4,4,1];\r\ny_correct = [4,1,5,5,6,6,1,3,3,6];\r\nassert(isequal(dice_roll_opposite_face(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-06-16T16:42:56.000Z","updated_at":"2026-03-04T15:36:22.000Z","published_at":"2015-06-16T16:42:56.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, you will be provided with the values of a dice roll (regular six-sided dice). The number of dice will be at least one. Your function should return the values on the opposite faces of the dice and in the same order. See the test suite for examples.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45191,"title":"generate nth pentatope number","description":"https://en.wikipedia.org/wiki/Pentatope_number","description_html":"\u003cp\u003ehttps://en.wikipedia.org/wiki/Pentatope_number\u003c/p\u003e","function_template":"function y = pentatope(x)\r\n  y = ;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(pentatope(x),y_correct))\r\n%%\r\nx = 4;\r\ny_correct = 35;\r\nassert(isequal(pentatope(x),y_correct))\r\n%%\r\nx = 12;\r\ny_correct = 1365;\r\nassert(isequal(pentatope(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":72,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-02T17:27:57.000Z","updated_at":"2026-03-05T11:53:55.000Z","published_at":"2019-11-02T17:28:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Pentatope_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45254,"title":"Tribonacci Sequence","description":"Generate the tribonacci sequence upto n","description_html":"\u003cp\u003eGenerate the tribonacci sequence upto n\u003c/p\u003e","function_template":"function t = tribonacci(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 5;\r\ny_correct = [0,0,1,1,2];\r\nassert(isequal(tribonacci(n),y_correct))\r\n%%\r\nn = 11;\r\ny_correct = [0     0     1     1     2     4     7    13    24    44  81  ];\r\nassert(isequal(tribonacci(n),y_correct))\r\n%%\r\nn = 21;\r\ny_correct = [0\t0\t1\t1\t2\t4\t7\t13\t24\t44\t81\t149\t274\t504\t927\t1705\t3136\t5768\t10609\t19513\t35890];\r\nassert(isequal(tribonacci(n),y_correct))\r\n%%\r\nn = 30;\r\ny_correct =[ 0\t0\t1\t1\t2\t4\t7\t13\t24\t44\t81\t149\t274\t504\t927\t1705\t3136\t5768\t10609\t19513\t35890\t66012\t121415\t223317\t410744\t755476\t1389537\t2555757\t4700770\t8646064];\r\nassert(isequal(tribonacci(n),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":45,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T19:15:46.000Z","updated_at":"2025-06-14T03:37:34.000Z","published_at":"2020-01-03T19:19:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGenerate the tribonacci sequence upto n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2274,"title":"Find the square of the sum of the digits of a number","description":"If a number (n) is provided as an input, find the square of the sum of the digits of the number.\r\n\r\nExample\r\n\r\nIf n = 21, the answer will be square of (2 + 1) = 9","description_html":"\u003cp\u003eIf a number (n) is provided as an input, find the square of the sum of the digits of the number.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cp\u003eIf n = 21, the answer will be square of (2 + 1) = 9\u003c/p\u003e","function_template":"function y = sq_sum(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 35431;\r\ny_correct = 256;\r\nassert(isequal(sq_sum(x),y_correct))\r\n\r\n%%\r\nx = -431;\r\ny_correct = 64;\r\nassert(isequal(sq_sum(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":161,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-04-09T05:05:28.000Z","updated_at":"2026-03-16T10:39:17.000Z","published_at":"2014-04-09T05:05:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf a number (n) is provided as an input, find the square of the sum of the digits of the number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf n = 21, the answer will be square of (2 + 1) = 9\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":60939,"title":"Frequencies of prime gaps","description":"Problem statement\r\n\r\nGiven two positive integers n and , write a function which computes the frequency of the gap   between two consecutive of the primes in the prime vector going from 2 to n.\r\n\r\nExamples\r\n\r\nFor n = 100 and = 2, your function should return f = 1/3 since one third of the prime gaps between 2 and 97 equal ;\r\nFor n = 1000 and = 6, your function should return f = 44/167;\r\n\r\n\r\nSee also\r\nProblem 60940. Find the first occurence of a given gap between two consecutive prime numbers\r\nPrime numbers properties II","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: 414.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 207.367px; transform-origin: 408px 207.367px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 63.0083px 8px; transform-origin: 63.0083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eProblem statement\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 85.575px 8px; transform-origin: 85.575px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven two positive integers \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 8px; transform-origin: 5.83333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en \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.675px 8px; transform-origin: 11.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\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 8px; transform-origin: 3.88333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 180.475px 8px; transform-origin: 180.475px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewrite a function which computes the frequency of the gap  \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\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: 81.7833px 8px; transform-origin: 81.7833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e between two consecutive of the primes in the prime vector going from \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e2\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: 9.71667px 8px; transform-origin: 9.71667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 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: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.675px 8px; transform-origin: 32.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExamples\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 81.7333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 40.8667px; transform-origin: 392px 40.8667px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 20.4333px; text-align: left; transform-origin: 364px 20.4333px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 12.4417px 8px; transform-origin: 12.4417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 25.4833px 8px; transform-origin: 25.4833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en = 100 \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 13.6167px 8px; transform-origin: 13.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\u003eΔ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.925px 8px; transform-origin: 9.925px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e= 2\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 86.7417px 8px; transform-origin: 86.7417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, your function should return\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 21.5833px 8px; transform-origin: 21.5833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e f = 1/3\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 133.808px 8px; transform-origin: 133.808px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e since one third of the prime gaps between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e2\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 13.6167px 8px; transform-origin: 13.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.725px 8px; transform-origin: 9.725px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e 97\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 21.0083px 8px; transform-origin: 21.0083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e equal \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\u003eΔ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 55.4333px 8px; transform-origin: 55.4333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor n = 1000 and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: normal; font-weight: 400; color: rgb(0, 0, 0);\"\u003eΔ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.925px 8px; transform-origin: 9.925px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e= 6\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 86.7417px 8px; transform-origin: 86.7417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, your function should return\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 11.8583px 8px; transform-origin: 11.8583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e f = \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 9.725px 8px; transform-origin: 9.725px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e44/\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 13.6167px 8px; transform-origin: 13.6167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e167;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.3917px 8px; transform-origin: 28.3917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eSee also\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://fr.mathworks.com/matlabcentral/cody/problems/60940-find-the-first-occurence-of-a-given-gap-between-two-consecutive-prime-numbers\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 60940. Find the first occurence of a given gap between two consecutive prime numbers\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://fr.mathworks.com/matlabcentral/cody/groups/95759\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePrime numbers properties II\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function f = frequencies_of_prime_gaps(delta, n)\r\n  f = delta*n;\r\nend","test_suite":"%%\r\ndelta = 2;\r\nn = 100;\r\nf_correct = 1/3;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 2;\r\nn = 200;\r\nf_correct = 15/45;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 6;\r\nn = 1000;\r\nf_correct = 44/167;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 4;\r\nn = 200;\r\nf_correct = 13/45;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 24;\r\nn = 10000;\r\nf_correct = 15/1228;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 1;\r\nn = 100;\r\nf_correct = 1/24;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%%\r\ndelta = 3;\r\nn = 100;\r\nf_correct = 0;\r\nfrequencies_of_prime_gaps(delta,n)\r\nassert(isequal(frequencies_of_prime_gaps(delta,n),f_correct))\r\n\r\n%% Forbidden functions\r\nfiletext = fileread('frequencies_of_prime_gaps.m');\r\nillegal = contains(filetext, 'regexp') || contains(filetext, 'str2num') || contains(filetext, 'assignin') || contains(filetext, 'echo')\r\nassert(~illegal);","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":149128,"edited_by":149128,"edited_at":"2025-07-26T06:48:50.000Z","deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":"2025-07-09T05:56:16.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2025-06-24T10:21:21.000Z","updated_at":"2026-03-16T13:25:01.000Z","published_at":"2025-06-24T11:07:25.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eProblem statement\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two positive integers \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eand\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: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\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\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:r\u003e\u003cw:t\u003ewrite a function which computes the frequency of the gap  \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\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e between two consecutive of the primes in the prime vector going from \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en = 100 \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eand \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\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e= 2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, your function should return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e f = 1/3\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e since one third of the prime gaps between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e 97\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e equal \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\\\\Delta\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor n = 1000 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\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\Delta\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e= 6\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, your function should return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e f = \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e44/\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e167;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\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\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSee also\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:hyperlink w:docLocation=\\\"https://fr.mathworks.com/matlabcentral/cody/problems/60940-find-the-first-occurence-of-a-given-gap-between-two-consecutive-prime-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 60940. Find the first occurence of a given gap between two consecutive prime numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://fr.mathworks.com/matlabcentral/cody/groups/95759\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ePrime numbers properties II\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45253,"title":"Pell numbers ","description":"Find the nth pell number\r\n\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Pell_number\u003e","description_html":"\u003cp\u003eFind the nth pell number\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Pell_number\"\u003ehttps://en.wikipedia.org/wiki/Pell_number\u003c/a\u003e\u003c/p\u003e","function_template":"function p=pell_seq(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 3;\r\ny_correct = 2;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 6;\r\ny_correct = 29;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 408;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 12;\r\ny_correct = 5741;\r\nassert(isequal(pell_seq(n),y_correct))\r\n%%\r\nn = 15;\r\ny_correct = 80782;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 19;\r\ny_correct = 2744210;\r\nassert(isequal(pell_seq(n),y_correct))\r\n\r\n%%\r\nn = 23;\r\ny_correct = 93222358;\r\nassert(isequal(pell_seq(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":77,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T18:34:11.000Z","updated_at":"2026-01-16T23:48:17.000Z","published_at":"2020-01-03T18:35:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the nth pell number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pell_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Pell_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":60969,"title":"Check p = 4n +/- 1, the generic formula for odd prime numbers","description":"Problem statement\r\n\r\nFor all odd prime number p, there exists a positive integer n, such that p = 4n +/- 1 :\r\n\r\n\r\n\r\nCheck this formula for some given odd primes in a vector by computing n for each p.\r\n\r\nExamples\r\n\r\np = 17 =\u003e n = 4;\r\n\r\np = 19 =\u003e n = 5;\r\n\r\n p = [3, 5, 7, 11, 13, 17, 19] =\u003e n = [1, 1, 2, 3, 3, 4, 5];\r\n\r\np = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\r\n             =\u003e n = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\r\n\r\n\r\nForbidden functions / expressions\r\n\r\nregexp\r\nassignin\r\nstr2num\r\necho\r\n\r\nSee also\r\n\r\nPrime numbers properties I","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: 919.467px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 459.733px; transform-origin: 408px 459.733px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 63.0083px 8px; transform-origin: 63.0083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eProblem statement\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 80.1333px 8px; transform-origin: 80.1333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor all 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: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 96.4583px 8px; transform-origin: 96.4583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, there exists a positive integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.775px 8px; transform-origin: 7.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.3333px 8px; transform-origin: 30.3333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003esuch that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.675px 8px; transform-origin: 39.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ep = 4n +/- 1 :\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAAAkCAYAAAAATtrgAAANzUlEQVR4Xu2dW+i+2RTHZ+7J6YqEcDFyLqdG5kKiRJJyuvrXyKkkiXChSWJyaJILhzT9U47FJKVIFJkYFIa4oJC4cop71sc831qz7ed59trPs5/f+/5+663V//DuZz97f/fa67v22mvv98Yb8pMIJAKJQCKQCCQCzQjc2FwyCyYCiUAikAgkAonADUmcqQSJQCKQCCQCiUAAgSTOAFhZNBFIBBKBRCARSOJMHUgEEoFEIBFIBAIIJHEGwMqiiUAikAgkAolAEmfqQCKQCCQCiUAiEECgJM4f2rPPNvm0yRsC9XzKyr7e5Ecmzwk8d65FP2QNf0dj4/9i5e41ucvkk43PZLH7EHihydtNbjZ5wAQKOnaHyZcuCUj08ZvBvrzHyn8w+My5Ff9P0eAP27/f2dgJ7Ng/TV7UWD6L3R+BZ9o/v2Ny9xXDkLn4PpOvrc2vkjjfaA98wgRj/4iANv1rMmxvsj+vAjlAnPT1FRNGGD6cja9UMKMMTsW/TcDpeSa/C2B7VYvKGZvrf9S5O1UckzjrIwNxak7dan9/5WTEv9UwkEmcDSAtFPm1fXeTCVhfBedDhMmikc+qY1oS50Ptob9ODwNYi5K+ysp9cSKGR9uff9s2ZmfxtIjzgVNrmeRzYMswgicG4MUmVwWn3sGUTqF/d5r83eSxJtdMpNxNCt7bgBN9ThGh1Yl9ou2PNIs55VeZGPNHNs6dJM4I0vcv6x3Wy06c8N27Jp16iv2Js9BkV2p7nITA8O6+bIIBW/tEy6/Vdw7f9xDns6xjrDR/afL9RmzPAYsRbWRl/nmT2nbBu+3/PzC9NBoZ6W0rEQUI/KLDw1eNOBmvx0/zJhI+TOLs03Ts/WdMmH8PN7kKxAlSLPZ85GfVMa0Rp7x9KmxJHlKY9tUnYFho8+NM2At5qolfnSypEqT244Cu9RIn78DwMzBarQZeeyFFIY2fT5ge0QC2C95q8txJoWvv/PM0sflOhnVk22S02cZo3Wcb0Z5TIU7G6OUmT3bjsNTfHgOsPU7vHGkrac2wJXHGtY/V1x9McEpfNtnOnnGLv/k0nthMnHRDhmmNDHv3REdBtbYvNvfeI4lTA3SEwd8DZxlr9miPIA5Wdd81Wdor9+McHbteTESe37AKWiIxve9Zeu6iiRMMSJxgNRL59BhgiJOoVxn9UoRradyTOCOjc19Zj5n0rGfc4m9uewKuuWbyPZMRzusuxCnDhLf3x4V+PWqaRJFEDSYfS2MlyLBCRNjHiqz6ymZpQvH/ZF5enybeiD3XLStODdAogw+WeI/Ckr8/YwKrZc+6xJX68EIxYHxEoLdP49im9vuWUlYzbXma06V93/L/tclR/I19tbQiHtWOiyROOQ5kN2MX2G74yMY5u4ST8gYog/4p8RB9/oEJ+51zUZvRxKk55ecT85rPTy5wXvTqHVGwt5g8aWr7KRKn5vwoMt+FOJkk9zSOAsbr+QsTiAaRWfpSE3mqhFq+bfJxEx9OXatrrkki+qNWRVuIE+NL0sNeoVqIjb1A8NXmNsr1GhNWiCI8Ydeb+VwSKPWxIqC+Ec7JkvppvCGwJzTq6R7FfPJcr65uaccccTLHSJ56uglbFDi0MoLM5febyLD3jD9j/zMTSBOnFCO7xcltwcAn3LFdQPtb9ztHECdzHmyFI84DGJNcAqY6LqV5cVFRiRZsfRk5RK+z/9Qe/hpxjta3Wh/OgjhpuFKS5/YTlKTRarx8eI0V6i0mt02D5fdVMUgRUmFS/3ZCOnLWK6pgvvwW4kQp+ex93tVjCKFx7IUzSfz9ISYyfLx7y2r3FAhUutlDApEzuC06srbf1lJHa5kacSoz0Bt1eeVy0ki0eq2JjHtL7oJvk6I5kMVRx6k8cdJHkur46Jic7E9NB0YQJ+/2jhMOxINMvm6CbSNiRhi/+UiDA1jj2qoHtXJRu6n+sHqnDz78uUScR+hbrX9nQ5xrxKh90FbDocnHAP/J5CUm/jyjjCGgRQy7AG0l8C3KqWd7ifMFVgF4sQLvCZsutV1hRMpg4K4V7/COS+uYLb3voghUjlLveO9NnGC09eKPqOGsjZ8PNUEmfEiy0jzTO7RSikQJlKizlvOwx9xSHeURL0XB/LZQuRLVs6OI0zvp2DFCyP4iCu+8RkKK0fGv4dxDnNgEHC6OyHl9WFtx8v6R+lbr39kQp1eSksikxJE9JhHt3DNeeSITVM8dtdpkUCPEqcmEcX2iCTcOjbgkwu/x1vDzhBHZk14zhkcTKP1koo9wPtb6Wn6P961w+JbQbdRw1ojT7/uCzXUTvzrU/Gs9Zqa+ykDSvyPPH9fORsuZl37XVqK0exRxeue0Noc8mfQ6dlEd7C2voye1bbYW4hylb3P9ORvipAPy6EolkZFu9bT9nuncxPXGI7LiLK/m6lGkyPvmiHPpvRidu00+arL3SlPv1bGgucQVT5x7rDjL/s4R6J4JJBgmbmca5Xz06A7P+GjJCGzVrqXkIH3H+PO5zUR7Vj7EGA1v77FCj6y+1Ne5S0WwSTebKClMtsXblVHEKXtIG2tZ8Z44e/rcq3/R53T0ZG4etRDn3vrmsYv2x5fvnX+7JAepIfKwyjBA9OymP7Q+dyOR6ox6tqdCnDgXtSv3tmYLtyiRd0zmVt5+0rfeCtXy7rKMPFntp9XCxj31arKzXxe5R7nnXdFnRJyjk9PmiNMTI20vHV2/UnqYfR8J054acWqVyV20Sgwr9ztHEads1NyCwdu5IyNgUX0FH85sziUwrRHnCH27VMTJgJQk6cm0NXQjoz23v+INf9RT25IoElU4lY+EanvfEXnOT9i51bPGsWePq6UtKD7JSEqOYOXzWRP2USKGuvYuHUHgDNcpkaYP1e7lICxhPUecfm+tNr7RCJFvg+o+6pYmvXvpGsu1/c7PWSV7X/LubdTcqsY7p9EoVssc26NML0F5uzxS3+b6eFahWjqhSSfg5sK3S4OqVeFcmNbvz0UVrmzfHsq1VsepEacPm9TOF/oVR28oYw6TGmF+zArvtY+7N2nusYIqsdDxn60OwprezRHn2v629jd7VkFLuQ5r7d3y/RJxUq+cRUVP/EoU0tybOL3e1MK0Hqeo8x/d467h2poctAdxjtS3S0OcHmhI7Z6pZ63hPv98LWlFIThCe9HEBZrivZ8o6fZO7FMjTjkmc0k/a8TagwNk/F4Tnc1lhbknYdKmVtKkXCtp7Umco0Oz5bjMEaeIsbba9Cul3vmhqE6UEHr0Ss+sESflwIOEO0W+Ru4x+jlUOzvsk2WWzrXXMDmSOFvGZC1UO1rfam08uxUnnfBAYSgjYRtvqGr7K1rBbrmNRe07KpNtBHFi4DhvGU0eWnNM5Jlvyfr0inwEYep9eLYPNln6aSP6B24jruEqJ7Df22EOcKfn6IsAfBtqxLm2v63xF6lSH4f2I3j5iEUk473FSM+VaSFOOd2/skp0LnrJwOqWsp7bfZacUz8G0eSrLRiNenaJOI/Qt0tDnKWXHgn5yFutkZo/K1qe64woxdFp4HsTp8c3mhzlz2eWjok/NrT1+EZJmBD8yCxhHTvhRhMSrGofzsViqI66dk8EQnJIefYtoq+9ZWvEuba/rflHNAesOPDO+c6og+ZXRUeQZwtxgqPmfvkTZFwV6h2uMkTZGjHjHT6qVfZdIWIWFHtvg/TqydbnlojzKH0r+3CWK87y4G9rKMJ76CVxCgjCi/x96487e68Y8hl5ZEFt18Rk1bxl0pShmsg5S38UwhOnslvxxrdckUY9d5goJDuaMJkwfg9lzQgcFT7U1WR7Z/X27Dl5XVuL2GilpGMqJGz5Q/tr+Op7hc1vmv4D3N+8w7yde38rcfK85iO4/NSELYOSOEvnPxKd8s6pJ050Ajy5Qehtk9624nnK5ZaI8yh9O5o4vX6s2t/I1Vsy0K1nN+m499RQ1F+Y/MPkMSa/N+G33/YMdUGeeJ7+3sgWBY3u/dT2ybYQZ3mEo5UMytDhvdZZfgKM20DA+as7TGY/iUauMDVO3ki1jN0Rqx/9KghXk+2d1buVONcS74QnoVqynrckbaFv/lq5lvGhTKs++/oixMlzpfNZvhPnn4vp5QC2JtNQtz9uhCNKdjf7qmwj3GXCar51j70Vs4sst0ScR+qbx2CvHwMpccWW+3u+9T08xzjfXhvbCHH2DKRfOUTPj/W8j2eY3Bg3/aZcSz1R4myps7cMSstPN7WsCo7Ye0KxuJA/Gtrr7f8pPocer/3U2Sm2e1SbIPtbTbiZSES09K4e4hzVdupFp3Eul/bO9X4fbVtdiYxsdNZ9OgiMJs6jk3ZOB9m+lmi/pPUi7YtwTPp6lk8lAqeDAM4p2w+6WWmpZUc4p6eDzMW1pCfyUmvtlshfc+9HEmd6as3D8L+CCoNdt7+3htPSMYlhnKUTAciSbYzWkHs6p8foTBLnhLPPvjpiH+qY4R3zFkjzCyZ3NnrBtMKnhWcIacy4ZK2XCwH2e7kYIXIUx98BXTu/ebkQyt40ITByxemzPWs3bTQ1MAvNIuCTaC7D2bEc6kTg1BAof+N27m7XU2t3tmcwAiOIU4kDZJ3pg5dHtmfE0xvc9bOtnhA4OJLc4D9kgEGmW4/1nC0w2fBEYEcESCC6pagPG8YPOVzlRLkdIT7fqkYQ5/mikS1PBBKBRCARSARWEEjiTBVJBBKBRCARSAQCCCRxBsDKoolAIpAIJAKJwH8BBNZTYc8CqCgAAAAASUVORK5CYII=\" width=\"231\" height=\"18\" style=\"width: 231px; height: 18px;\"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 222.1px 8px; transform-origin: 222.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCheck this formula for some given odd primes in a vector by computing \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: 15.9417px 8px; transform-origin: 15.9417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003en for \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: 15.175px 8px; transform-origin: 15.175px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eeach\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 7.775px 8px; transform-origin: 7.775px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e p.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.675px 8px; transform-origin: 32.675px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExamples\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 50.575px 8px; transform-origin: 50.575px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = 17 =\u0026gt; n = 4;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 50.575px 8px; transform-origin: 50.575px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = 19 =\u0026gt; n = 5;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 164.367px 8px; transform-origin: 164.367px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = [3, 5, 7, 11, 13, 17, 19] =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5];\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 10.2167px; transform-origin: 392px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 280.842px 8px; transform-origin: 280.842px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003ep = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 287.408px 8px; transform-origin: 287.408px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e             =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 114.308px 8px; transform-origin: 114.308px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003eForbidden functions / expressions\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; font-weight: 700; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 81.7333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 392px 40.8667px; transform-origin: 392px 40.8667px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 21.4px 8px; transform-origin: 21.4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eregexp\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 25.6833px 8px; transform-origin: 25.6833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eassignin\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 25.2833px 8px; transform-origin: 25.2833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003estr2num\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 364px 10.2167px; text-align: left; transform-origin: 364px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 15.175px 8px; transform-origin: 15.175px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eecho\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.3917px 8px; transform-origin: 28.3917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eSee also\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://fr.mathworks.com/matlabcentral/cody/groups/95630\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ePrime numbers properties I\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function n = check_odd_primes_gen_formula(p)\r\n  n = p;\r\nend","test_suite":"%%\r\np = 17;\r\nn_correct = 4;\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%%\r\np = 19;\r\nn_correct = 5;\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%%\r\np = [3, 5, 7, 11, 13, 17, 19];\r\nn_correct = [1, 1, 2, 3, 3, 4, 5];\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%%\r\np = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];\r\nn_correct = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\r\nassert(isequal(check_odd_primes_gen_formula(p),n_correct))\r\n\r\n\r\n%% Forbidden functions\r\nfiletext = fileread('check_odd_primes_gen_formula.m');\r\nillegal = contains(filetext, 'regexp') || contains(filetext, 'str2num') || contains(filetext, 'assignin') || contains(filetext, 'echo')\r\nassert(~illegal);","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":149128,"edited_by":149128,"edited_at":"2025-07-20T05:09:52.000Z","deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-07-20T04:24:51.000Z","updated_at":"2026-02-12T07:13:21.000Z","published_at":"2025-07-20T05:09:52.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eProblem statement\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor all odd prime number \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, there exists a positive integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003esuch that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = 4n +/- 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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\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:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\forall p \\\\in \\\\mathbb{P}, p \u0026gt; 2 \\\\Rightarrow \\\\exists n   \\\\in \\\\mathbb{N}, p = 4n \\\\pm 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003eCheck this formula for some given odd primes in a vector by computing \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003eeach\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e p.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\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\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = 17 =\u0026gt; n = 4;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = 19 =\u0026gt; n = 5;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = [3, 5, 7, 11, 13, 17, 19] =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e             =\u0026gt; n = [1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 17, 18, 18, 20, 21, 22, 24];\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eForbidden functions / expressions\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:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassignin\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estr2num\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eecho\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSee also\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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:hyperlink w:docLocation=\\\"https://fr.mathworks.com/matlabcentral/cody/groups/95630\\\"\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003ePrime numbers properties I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2270,"title":"Bit calculation","description":"Give me the count of numbers from 1 to n having their last two bits as 0.\r\n\r\nFor example\r\n\r\nfunction y = ret_count(4)\r\n\r\n  y = x;\r\n\r\nend\r\n\r\nHere 4 means you have to check the numbers between 1 to 4.\r\n\r\n\r\nSo the answer will be 1 as binary value of 4 is 00000100.\r\n\r\nHere n in the function is the number of numbers to be checked starting from 1.","description_html":"\u003cp\u003eGive me the count of numbers from 1 to n having their last two bits as 0.\u003c/p\u003e\u003cp\u003eFor example\u003c/p\u003e\u003cp\u003efunction y = ret_count(4)\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ey = x;\r\n\u003c/pre\u003e\u003cp\u003eend\u003c/p\u003e\u003cp\u003eHere 4 means you have to check the numbers between 1 to 4.\u003c/p\u003e\u003cp\u003eSo the answer will be 1 as binary value of 4 is 00000100.\u003c/p\u003e\u003cp\u003eHere n in the function is the number of numbers to be checked starting from 1.\u003c/p\u003e","function_template":"function y = ret_count(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(ret_count(n),y_correct))\r\n\r\n\r\n%%\r\nn = 4;\r\ny_correct = 1;\r\nassert(isequal(ret_count(n),y_correct))\r\n\r\n%%\r\nn = 72;\r\ny_correct = 18;\r\nassert(isequal(ret_count(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":243,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":45,"created_at":"2014-04-08T07:33:36.000Z","updated_at":"2026-03-10T17:18:51.000Z","published_at":"2014-04-08T07:33:36.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGive me the count of numbers from 1 to n having their last two bits as 0.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efunction y = ret_count(4)\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 = x;]]\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\u003eend\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\u003eHere 4 means you have to check the numbers between 1 to 4.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the answer will be 1 as binary value of 4 is 00000100.\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\u003eHere n in the function is the number of numbers to be checked starting from 1.\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":3018,"title":"Calculator spelling - Numbers to Letters","description":"Using the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\r\n\r\n* 0 = O\r\n* 1 = I\r\n* 2 = Z\r\n* 3 = E\r\n* 4 = h\r\n* 5 = S\r\n* 6 = g\r\n* 7 = L\r\n* 8 = B\r\n\r\nThere are a few other options, but we'll stick with these. The number may be a have a decimal with a leading zero, to produce a trailing O. If this is the case, ignore the decimal point. Write a function that takes a number as input and returns the word spelled (upside down) by the calculator. Make sure to get the case (capital vs. lowercase) right for each number/letter.\r\n\r\nThis problem is related to \u003chttps://www.mathworks.com/matlabcentral/cody/problems/3019-calculator-spelling-letters-to-numbers Problem 3019\u003e.","description_html":"\u003cp\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/p\u003e\u003cul\u003e\u003cli\u003e0 = O\u003c/li\u003e\u003cli\u003e1 = I\u003c/li\u003e\u003cli\u003e2 = Z\u003c/li\u003e\u003cli\u003e3 = E\u003c/li\u003e\u003cli\u003e4 = h\u003c/li\u003e\u003cli\u003e5 = S\u003c/li\u003e\u003cli\u003e6 = g\u003c/li\u003e\u003cli\u003e7 = L\u003c/li\u003e\u003cli\u003e8 = B\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are a few other options, but we'll stick with these. The number may be a have a decimal with a leading zero, to produce a trailing O. If this is the case, ignore the decimal point. Write a function that takes a number as input and returns the word spelled (upside down) by the calculator. Make sure to get the case (capital vs. lowercase) right for each number/letter.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/3019-calculator-spelling-letters-to-numbers\"\u003eProblem 3019\u003c/a\u003e.\u003c/p\u003e","function_template":"function [word] = calc_spell_word(n)\r\n\r\nword = num2str(n);\r\n\r\nend\r\n","test_suite":"%%\r\nn = 35007;\r\ntxt = 'LOOSE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 77345;\r\ntxt = 'ShELL';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 36138;\r\ntxt = 'BEIgE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 378806;\r\ntxt = 'gOBBLE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 376006;\r\ntxt = 'gOOgLE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 57738461375;\r\ntxt = 'SLEIghBELLS';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 0.7734;\r\ntxt = 'hELLO';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 53045;\r\ntxt = 'ShOES';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 771;\r\ntxt = 'ILL';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 345;\r\ntxt = 'ShE';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nn = 7735;\r\ntxt = 'SELL';\r\nassert(isequal(calc_spell_word(n),txt))\r\n\r\n%%\r\nind = randi(4);\r\nn_arr = [36138 707 7714 57738];\r\nn = n_arr(ind);\r\ntxt_arr = {'BEIgE','LOL','hILL','BELLS'};\r\ntxt = txt_arr{ind};\r\nassert(isequal(calc_spell_word(n),txt))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":72,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2015-02-14T22:05:44.000Z","updated_at":"2026-03-19T20:03:05.000Z","published_at":"2015-02-14T22:05:44.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\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0 = O\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 = I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2 = Z\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3 = E\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4 = h\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e5 = S\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = g\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e7 = L\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e8 = B\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\u003eThere are a few other options, but we'll stick with these. The number may be a have a decimal with a leading zero, to produce a trailing O. If this is the case, ignore the decimal point. Write a function that takes a number as input and returns the word spelled (upside down) by the calculator. Make sure to get the case (capital vs. lowercase) right for each number/letter.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3019-calculator-spelling-letters-to-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3019\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3019,"title":"Calculator spelling - Letters to Numbers","description":"Using the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\r\n\r\n* 0 = O\r\n* 1 = I\r\n* 2 = Z\r\n* 3 = E\r\n* 4 = h\r\n* 5 = S\r\n* 6 = g\r\n* 7 = L\r\n* 8 = B\r\n\r\nThere are a few other options, but we'll stick with these. If the word has a trailing O, the number will need a decimal point to produce a leading zero. Write a function that takes a word (upside down) as input and returns the number entered into the calculator.\r\n\r\nThis problem is related to \u003chttps://www.mathworks.com/matlabcentral/cody/problems/3018-calculator-spelling-numbers-to-letters Problem 3018\u003e.","description_html":"\u003cp\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/p\u003e\u003cul\u003e\u003cli\u003e0 = O\u003c/li\u003e\u003cli\u003e1 = I\u003c/li\u003e\u003cli\u003e2 = Z\u003c/li\u003e\u003cli\u003e3 = E\u003c/li\u003e\u003cli\u003e4 = h\u003c/li\u003e\u003cli\u003e5 = S\u003c/li\u003e\u003cli\u003e6 = g\u003c/li\u003e\u003cli\u003e7 = L\u003c/li\u003e\u003cli\u003e8 = B\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are a few other options, but we'll stick with these. If the word has a trailing O, the number will need a decimal point to produce a leading zero. Write a function that takes a word (upside down) as input and returns the number entered into the calculator.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/3018-calculator-spelling-numbers-to-letters\"\u003eProblem 3018\u003c/a\u003e.\u003c/p\u003e","function_template":"function [n] = calc_spell_num(word)\r\n\r\nn = str2num(word);\r\n\r\nend\r\n","test_suite":"%%\r\nn = 35007;\r\nword = 'LOOSE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 77345;\r\nword = 'ShELL';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 36138;\r\nword = 'BEIgE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 378806;\r\nword = 'gOBBLE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 376006;\r\nword = 'gOOgLE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 57738461375;\r\nword = 'SLEIghBELLS';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 0.7734;\r\nword = 'hELLO';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 53045;\r\nword = 'ShOES';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 771;\r\nword = 'ILL';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 345;\r\nword = 'ShE';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nn = 7735;\r\nword = 'SELL';\r\nassert(isequal(calc_spell_num(word),n))\r\n\r\n%%\r\nind = randi(4);\r\nn_arr = [36138 707 7714 57738];\r\nn = n_arr(ind);\r\nword_arr = {'BEIgE','LOL','hILL','BELLS'};\r\nword = word_arr{ind};\r\nassert(isequal(calc_spell_num(word),n))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2015-02-14T22:18:14.000Z","updated_at":"2026-03-23T20:41:48.000Z","published_at":"2015-02-14T22:18:14.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\u003eUsing the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following numbers can characterize the following letters:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0 = O\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 = I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2 = Z\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3 = E\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4 = h\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e5 = S\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = g\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e7 = L\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e8 = B\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\u003eThere are a few other options, but we'll stick with these. If the word has a trailing O, the number will need a decimal point to produce a leading zero. Write a function that takes a word (upside down) as input and returns the number entered into the calculator.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3018-calculator-spelling-numbers-to-letters\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3018\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45246,"title":"Count digits","description":"Count total number of digits from 1 to n.\r\n\r\n* n=13\r\n* output=17\r\n\r\nsince from [1-9] total 9 digits.[10-13] total 4*2=8 digits.","description_html":"\u003cp\u003eCount total number of digits from 1 to n.\u003c/p\u003e\u003cul\u003e\u003cli\u003en=13\u003c/li\u003e\u003cli\u003eoutput=17\u003c/li\u003e\u003c/ul\u003e\u003cp\u003esince from [1-9] total 9 digits.[10-13] total 4*2=8 digits.\u003c/p\u003e","function_template":"function y=count_dig(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 13;\r\ny_correct = 17;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 1339;\r\ny_correct = 4249;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 0;\r\ny_correct = 0;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 299;\r\ny_correct = 789;\r\nassert(isequal(count_dig(n),y_correct))\r\n%%\r\nn = 10000;\r\ny_correct = 38894;\r\nassert(isequal(count_dig(n),y_correct))\r\n%\r\nn=10000675820025;\r\ny_correct = 128898350369253;\r\nassert(isequal(count_dig(n),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-26T23:42:51.000Z","updated_at":"2025-08-23T21:14:18.000Z","published_at":"2019-12-26T23:43:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCount total number of digits from 1 to n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en=13\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput=17\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003esince from [1-9] total 9 digits.[10-13] total 4*2=8 digits.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45223,"title":"find nth even fibonacci number","description":"1st even fibonacci number=2 ; \r\n2nd even fibonacci number=8 ..","description_html":"\u003cp\u003e1st even fibonacci number=2 ; \r\n2nd even fibonacci number=8 ..\u003c/p\u003e","function_template":"function y = even_fib(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 2;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 3;\r\ny_correct = 34;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 10;\r\ny_correct = 832040;\r\nassert(isequal(even_fib(n),y_correct))\r\n%%\r\nn = 20;\r\ny_correct = 1548008755920;\r\nassert(isequal(even_fib(n),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":93,"test_suite_updated_at":"2019-12-04T11:48:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-04T11:45:17.000Z","updated_at":"2026-03-02T19:12:20.000Z","published_at":"2019-12-04T11:48:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1st even fibonacci number=2 ; 2nd even fibonacci number=8 ..\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":54490,"title":"perfect square ","description":"Perfect square is amazing, so we have problems like 45183, 34482, 44683, and 44957. \r\nBut how can we find a large number is a pefect square or not? \r\nNote that here, input is a string and output is logical.","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: 81px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 40.5px; transform-origin: 407px 40.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 166.5px 8px; transform-origin: 166.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePerfect square is amazing, so we have problems like \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/45183\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e45183\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/34482\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e34482\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/44683\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e44683\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: 18px 8px; transform-origin: 18px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://ww2.mathworks.cn/matlabcentral/cody/problems/44957\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e44957\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\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: 197.5px 8px; transform-origin: 197.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut how can we find a large number is a pefect square or not? \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 164px 8px; transform-origin: 164px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNote that here, input is a string and output is logical.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = perfectSquare(x)\r\n  tf = false ;\r\nend","test_suite":"%%\r\nfiletext = fileread('perfectSquare.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') ...\r\n    || contains(filetext, 'java') || contains(filetext, 'py'); \r\nassert(~illegal);\r\nassert(isempty(strfind(filetext, 'regexp')),'regexp() forbidden');\r\n%%\r\nx = '16';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '121';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '132233322321';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '313223221121';\r\ny_correct = false;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '6486486884468464644';\r\ny_correct = true;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '6486486884468464646';\r\ny_correct = false;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n%%\r\nx = '484468468684646864';\r\ny_correct = false;\r\nassert(isequal(perfectSquare(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":2197980,"edited_by":223089,"edited_at":"2022-06-25T09:48:36.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":"2022-06-25T09:48:36.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-04T08:17:57.000Z","updated_at":"2026-01-28T12:45:53.000Z","published_at":"2022-05-04T08:17:57.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePerfect square is amazing, so we have problems like \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://ww2.mathworks.cn/matlabcentral/cody/problems/45183\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e45183\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://ww2.mathworks.cn/matlabcentral/cody/problems/34482\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e34482\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://ww2.mathworks.cn/matlabcentral/cody/problems/44683\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44683\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://ww2.mathworks.cn/matlabcentral/cody/problems/44957\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44957\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\u003eBut how can we find a large number is a pefect square or not? \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote that here, input is a string and output is logical.\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":2283,"title":"Convert a number to its Roman representation","description":"Convert a given number to its Roman representation.\r\n\r\nFor example, if the number is 98, it should display 'XCVIII'","description_html":"\u003cp\u003eConvert a given number to its Roman representation.\u003c/p\u003e\u003cp\u003eFor example, if the number is 98, it should display 'XCVIII'\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 'I';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 98;\r\ny_correct = 'XCVIII';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 501;\r\ny_correct = 'DI';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 867;\r\ny_correct = 'DCCCLXVII';\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":22816,"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":"2014-04-14T05:55:54.000Z","updated_at":"2025-12-07T23:09:08.000Z","published_at":"2014-04-14T05:55:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConvert a given number to its Roman representation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if the number is 98, it should display 'XCVIII'\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":45267,"title":"Zero","description":"given an integer a, find the smallest possible integer b(b\u003e0) such that their bitwise logical AND is zero.\r\n\r\n*  if a=11(1011) then b=4(0100)","description_html":"\u003cp\u003egiven an integer a, find the smallest possible integer b(b\u0026gt;0) such that their bitwise logical AND is zero.\u003c/p\u003e\u003cul\u003e\u003cli\u003eif a=11(1011) then b=4(0100)\u003c/li\u003e\u003c/ul\u003e","function_template":"function b=zero_and(a)\r\nend","test_suite":"%%\r\na = 1;\r\ny_correct = 2;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 2;\r\ny_correct = 1;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 12;\r\ny_correct = 1;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 11;\r\ny_correct = 4;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 15;\r\ny_correct = 16;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 23;\r\ny_correct = 8;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 93;\r\ny_correct = 2;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 1455;\r\ny_correct = 16;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 255;\r\ny_correct = 256;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\na = 435175;\r\ny_correct = 8;\r\nassert(isequal(zero_and(a),y_correct))\r\n%%\r\nfiletext = fileread('zero_and.m');\r\nassert(isempty(strfind(filetext, 'regexp')),'regexp() forbidden')\r\nassert(isempty(strfind(filetext, 'varargin')),'varargin() forbidden')\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2020-02-13T21:41:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-16T14:29:26.000Z","updated_at":"2026-01-03T11:47:45.000Z","published_at":"2020-01-16T14:30:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven an integer a, find the smallest possible integer b(b\u0026gt;0) such that their bitwise logical AND is zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif a=11(1011) then b=4(0100)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44360,"title":"Pentagonal Numbers","description":"Your function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\r\n\r\n [p,d] = pentagonal_numbers(10,40)\r\n\r\nshould return\r\n\r\n p = [12,22,35]\r\n d = [ 0, 0, 1]","description_html":"\u003cp\u003eYour function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\u003c/p\u003e\u003cpre\u003e [p,d] = pentagonal_numbers(10,40)\u003c/pre\u003e\u003cp\u003eshould return\u003c/p\u003e\u003cpre\u003e p = [12,22,35]\r\n d = [ 0, 0, 1]\u003c/pre\u003e","function_template":"function [p,d] = pentagonal_numbers(10,40)\r\n p = [5];\r\n d = [1];\r\nend","test_suite":"%%\r\nx1 = 1; x2 = 25;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1,5,12,22]))\r\nassert(isequal(d,[0,1,0,0]))\r\n\r\n%%\r\nx1 = 1; x2 = 4;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,1))\r\nassert(isequal(d,0))\r\n\r\n%%\r\nx1 = 10; x2 = 40;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[12,22,35]))\r\nassert(isequal(d,[0,0,1]))\r\n\r\n%%\r\nx1 = 10; x2 = 99;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[12,22,35,51,70,92]))\r\nassert(isequal(d,[0,0,1,0,1,0]))\r\n\r\n%%\r\nx1 = 100; x2 = 999;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925]))\r\nassert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1]))\r\n\r\n%%\r\nx1 = 40; x2 = 50;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isempty(p))\r\nassert(isempty(d))\r\n\r\n%%\r\nx1 = 1000; x2 = 1500;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1001,1080,1162,1247,1335,1426]))\r\nassert(isequal(d,[0,1,0,0,1,0]))\r\n\r\n%%\r\nx1 = 1500; x2 = 3000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882]))\r\nassert(isequal(d,[1,0,0,1,0,1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 1; x2 = 3000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882]))\r\nassert(isequal(d,[0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 10000; x2 = 12000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[10045,10292,10542,10795,11051,11310,11572,11837]))\r\nassert(isequal(d,[1,0,0,1,0,1,0,0]))\r\n\r\n%%\r\nx1 = 100000; x2 = 110000;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[100492,101270,102051,102835,103622,104412,105205,106001,106800,107602,108407,109215]))\r\nassert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1]))\r\n\r\n%%\r\nx1 = 1000000; x2 = 1010101;\r\n[p,d] = pentagonal_numbers(x1,x2)\r\nassert(isequal(p,[1000825,1003277,1005732,1008190]))\r\nassert(isequal(d,[1,0,0,1]))","published":true,"deleted":false,"likes_count":12,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":677,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-05T17:43:36.000Z","updated_at":"2026-03-18T12:42:40.000Z","published_at":"2017-10-16T01:45:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascending order. Additionally, it should return an array that indicates those numbers that are divisible by 5. For example,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ [p,d] = pentagonal_numbers(10,40)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eshould return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ p = [12,22,35]\\n d = [ 0, 0, 1]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45229,"title":"Bell Triangle","description":"Form the bell triangle upto nth bell number posotion;\r\n\r\n* if n=5\r\n* \r\n y= [1     0     0     0     0;\r\n     1     2     0     0     0;\r\n     2     3     5     0     0;\r\n     5     7    10    15     0;\r\n    15    20    27    37    52]\r\n\r\nsince 5th bell number is 52.\r\n","description_html":"\u003cp\u003eForm the bell triangle upto nth bell number posotion;\u003c/p\u003e\u003cul\u003e\u003cli\u003eif n=5\u003c/li\u003e\u003cli\u003ey= [1     0     0     0     0;\r\n     1     2     0     0     0;\r\n     2     3     5     0     0;\r\n     5     7    10    15     0;\r\n    15    20    27    37    52]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003esince 5th bell number is 52.\u003c/p\u003e","function_template":"function y = Bell_tri(n)\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 1;\r\nassert(isequal(Bell_tri(n),y_correct))\r\n%%\r\nn = 5;\r\ny_correct = [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52];\r\nassert(isequal(Bell_tri(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = [ 1           0           0           0           0           0           0           0           0;\r\n           1           2           0           0           0           0           0           0           0;\r\n           2           3           5           0           0           0           0           0           0;\r\n           5           7          10          15           0           0           0           0           0;\r\n          15          20          27          37          52           0           0           0           0;\r\n          52          67          87         114         151         203           0           0           0;\r\n         203         255         322         409         523         674         877           0           0;\r\n         877        1080        1335        1657        2066        2589        3263        4140           0;\r\n        4140        5017        6097        7432        9089       11155       13744       17007       21147];\r\nassert(isequal(Bell_tri(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2019-12-11T00:40:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-11T00:37:30.000Z","updated_at":"2026-01-13T23:37:08.000Z","published_at":"2019-12-11T00:40:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eForm the bell triangle upto nth bell number posotion;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif n=5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ey= [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003esince 5th bell number is 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3002,"title":"Not square-free number sequence","description":"Not square-free numbers are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ... For example, 4 = 2^2, 8 = 2^2 * 2, 9 = 3^2, 12 = 2^2 * 3, etc.\r\nReturn numbers from the square-free sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [9, 12, 16, 18, 20].\r\nThis problem is related to Problem 3001 and Problem 3003.","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: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 61.5px; transform-origin: 407px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eNot square-free numbers\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 296.5px 8px; transform-origin: 296.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ... For example, 4 = 2^2, 8 = 2^2 * 2, 9 = 3^2, 12 = 2^2 * 3, etc.\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: 365.5px 8px; transform-origin: 365.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn numbers from the square-free sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [9, 12, 16, 18, 20].\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: 80px 8px; transform-origin: 80px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is related to\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3001-sphenic-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3001\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3003-mobius-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3003\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [arr] = not_squarefree_seq(n)\r\n\r\narr = n;\r\n\r\nend\r\n","test_suite":"%%\r\nn = 1:5;\r\narr_corr = [4, 8, 9, 12, 16];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:10;\r\narr_corr = [4, 8, 9, 12, 16, 18, 20, 24, 25, 27];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 3:7;\r\narr_corr = [9    12    16    18    20];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 20:30;\r\narr_corr = [52    54    56    60    63    64    68    72    75    76    80];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 69;\r\narr_corr = 175;\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:62;\r\narr_corr = [4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, 44, 45, 48, 49, 50, 52, 54, 56, 60, 63, 64, 68, 72, 75, 76, 80, 81, 84, 88, 90, 92, 96, 98, 99, 100, 104, 108, 112, 116, 117, 120, 121, 124, 125, 126, 128, 132, 135, 136, 140, 144, 147, 148, 150, 152, 153, 156, 160];\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n\r\n%% prevents cheating\r\ni1 = randi(20,1);\r\nn = i1:(i1+randi(25,1));\r\narr_tot = [4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, 44, 45, 48, 49, 50, 52, 54, 56, 60, 63, 64, 68, 72, 75, 76, 80, 81, 84, 88, 90, 92, 96, 98, 99, 100, 104, 108, 112, 116, 117, 120, 121, 124, 125, 126, 128, 132, 135, 136, 140, 144, 147, 148, 150, 152, 153, 156, 160];\r\narr_corr = arr_tot(n);\r\nassert(isequal(not_squarefree_seq(n),arr_corr))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":26769,"edited_by":223089,"edited_at":"2022-10-09T05:12:26.000Z","deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":"2022-10-09T05:12:26.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-02-11T02:39:31.000Z","updated_at":"2026-03-16T14:13:50.000Z","published_at":"2015-02-11T02:39:31.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eNot square-free numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ... For example, 4 = 2^2, 8 = 2^2 * 2, 9 = 3^2, 12 = 2^2 * 3, etc.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn numbers from the square-free sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [9, 12, 16, 18, 20].\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 is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3001-sphenic-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3001\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/3003-mobius-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3003\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":3001,"title":"Sphenic number sequence","description":"Sphenic numbers are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, ... For example, 30 = 2*3*5, 42 = 2*3*7, etc.\r\nReturn the numbers from the sphenic sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [66, 70, 78, 102, 105].\r\nThis problem is related to Problem 3002 and Problem 3003.","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: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 61.5px; transform-origin: 407px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eSphenic numbers\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 317.5px 8px; transform-origin: 317.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, ... For example, 30 = 2*3*5, 42 = 2*3*7, etc.\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: 365px 8px; transform-origin: 365px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn the numbers from the sphenic sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [66, 70, 78, 102, 105].\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: 80px 8px; transform-origin: 80px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is related to\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3002-not-square-free-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3002\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3003-mobius-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3003\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [arr] = sphenic_seq(n)\r\n\r\narr = n;\r\n\r\nend","test_suite":"%%\r\nn = 1:5;\r\narr_corr = [30, 42, 66, 70, 78];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:10;\r\narr_corr = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 3:7;\r\narr_corr = [66, 70, 78, 102, 105];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 20:30;\r\narr_corr = [222   230   231   238   246   255   258   266   273   282   285];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 69;\r\narr_corr = 582;\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:53;\r\narr_corr = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310, 318, 322, 345, 354, 357, 366, 370, 374, 385, 399, 402, 406, 410, 418, 426, 429, 430, 434, 435, 438];\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n\r\n%% prevents cheating\r\ni1 = randi(20,1);\r\nn = i1:(i1+randi(25,1));\r\narr_tot = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310, 318, 322, 345, 354, 357, 366, 370, 374, 385, 399, 402, 406, 410, 418, 426, 429, 430, 434, 435, 438];\r\narr_corr = arr_tot(n);\r\nassert(isequal(sphenic_seq(n),arr_corr))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":223089,"edited_at":"2022-10-09T05:23:45.000Z","deleted_by":null,"deleted_at":null,"solvers_count":87,"test_suite_updated_at":"2022-10-09T05:23:45.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-02-11T02:19:47.000Z","updated_at":"2026-03-16T14:15:22.000Z","published_at":"2015-02-11T02:19:47.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=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSphenic numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, ... For example, 30 = 2*3*5, 42 = 2*3*7, etc.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the numbers from the sphenic sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [66, 70, 78, 102, 105].\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 is related to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/3002-not-square-free-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3002\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/3003-mobius-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3003\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":45234,"title":"Calculating large fibonacci numbers","description":"The fibonacci sequence starts 1,1,2,3,5,8...\r\n\r\nFind the the n'th fibonacci number. Then calculate round(log10( . )) of that n'th fibonacci number. ","description_html":"\u003cp\u003eThe fibonacci sequence starts 1,1,2,3,5,8...\u003c/p\u003e\u003cp\u003eFind the the n'th fibonacci number. Then calculate round(log10( . )) of that n'th fibonacci number.\u003c/p\u003e","function_template":"function y = your_fcn_name(n)\r\n  y = n;\r\nend","test_suite":"%%\r\nx = 100;\r\ny_correct = 21;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 140;\r\ny_correct = 29;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 41;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 300;\r\ny_correct = 62;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 400;\r\ny_correct = 83;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\n\r\nx = 500;\r\ny_correct = 104;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\n\r\nx = 1000;\r\ny_correct = 209;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 1100;\r\ny_correct = 230;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 1100;\r\ny_correct = 230;\r\ntic\r\nassert(isequal(your_fcn_name(x),y_correct))\r\ntime = toc\r\nassert(time \u003c .01)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":65480,"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":"2019-12-14T00:30:26.000Z","updated_at":"2019-12-14T00:30:26.000Z","published_at":"2019-12-14T00:30:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe fibonacci sequence starts 1,1,2,3,5,8...\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 the n'th fibonacci number. Then calculate round(log10( . )) of that n'th fibonacci number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45376,"title":"Maya - 02 ","description":"\u003chttps://en.wikipedia.org/wiki/Maya_numerals\u003e\r\n\r\nPrev. prob. - \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\u003e\r\n\r\nNow u've to decode the number given in Maya representation.\r\n\r\nFor example,\r\n \r\n Maya = .._  becomes n=7\r\n Maya = . ...__ becomes n=33","description_html":"\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Maya_numerals\"\u003ehttps://en.wikipedia.org/wiki/Maya_numerals\u003c/a\u003e\u003c/p\u003e\u003cp\u003ePrev. prob. - \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\"\u003ehttps://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\u003c/a\u003e\u003c/p\u003e\u003cp\u003eNow u've to decode the number given in Maya representation.\u003c/p\u003e\u003cp\u003eFor example,\u003c/p\u003e\u003cpre\u003e Maya = .._  becomes n=7\r\n Maya = . ...__ becomes n=33\u003c/pre\u003e","function_template":"function y = maya_02(s)","test_suite":"%%\r\nassert(isequal(maya_02('..'),2))\r\n%%\r\nassert(isequal(maya_02('.. .'),41))\r\n%%\r\nassert(isequal(maya_02('... .. ....__'),1254))\r\n%%\r\nassert(isequal(maya_02('__ ....__ _'),4285))\r\n%%\r\nassert(isequal(maya_02('._ o ....__ __'),48290))\r\n%%\r\nassert(isequal(maya_02('. o o o o'),160000))\r\n%%\r\nassert(isequal(maya_02('__ .. _ ..._ o .___'),32363216))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2020-03-23T01:48:50.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-23T01:32:18.000Z","updated_at":"2020-03-23T01:48:50.000Z","published_at":"2020-03-23T01:48:50.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Maya_numerals\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Maya_numerals\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrev. prob. -\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/45375-maya-01\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.mathworks.com/matlabcentral/cody/problems/45375-maya-01\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNow u've to decode the number given in Maya representation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Maya = .._  becomes n=7\\n Maya = . ...__ becomes n=33]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43584,"title":"Find Pseudo-Cyclic Number","description":"A cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number https://en.wikipedia.org/wiki/Cyclic_number\u003e). The most widely known is 142857:\r\n\r\n\r\n    142857 × 1 = 142857\r\n    142857 × 2 = 285714\r\n    142857 × 3 = 428571\r\n    142857 × 4 = 571428\r\n    142857 × 5 = 714285\r\n    142857 × 6 = 857142 \r\n\r\n\r\nIn fact, 142857 is the only cyclic number in decimal, if leading zeros are not permitted on numerals.\r\n\r\nTherefore, instead of the pure cyclic number, we will find the integer in which *any* cyclic permutations of the digits are *any* multiples of the number.\r\n\r\nFor example, 230769 is the one, because 23076 *9* x 4 = *9* 23076.\r\n\r\n\r\n\r\nGiven an integer x, return whether x is a pesudo-cyclic number.\r\n\r\n","description_html":"\u003cp\u003eA cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number https://en.wikipedia.org/wiki/Cyclic_number\u0026gt;). The most widely known is 142857:\u003c/p\u003e\u003cpre\u003e    142857 × 1 = 142857\r\n    142857 × 2 = 285714\r\n    142857 × 3 = 428571\r\n    142857 × 4 = 571428\r\n    142857 × 5 = 714285\r\n    142857 × 6 = 857142 \u003c/pre\u003e\u003cp\u003eIn fact, 142857 is the only cyclic number in decimal, if leading zeros are not permitted on numerals.\u003c/p\u003e\u003cp\u003eTherefore, instead of the pure cyclic number, we will find the integer in which \u003cb\u003eany\u003c/b\u003e cyclic permutations of the digits are \u003cb\u003eany\u003c/b\u003e multiples of the number.\u003c/p\u003e\u003cp\u003eFor example, 230769 is the one, because 23076 \u003cb\u003e9\u003c/b\u003e x 4 = \u003cb\u003e9\u003c/b\u003e 23076.\u003c/p\u003e\u003cp\u003eGiven an integer x, return whether x is a pesudo-cyclic number.\u003c/p\u003e","function_template":"function y = cyclicNumber(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 230769;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 307692;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 307691;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 307693;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 285714;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 55;\r\ny_correct = false;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 142857142857;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n%%\r\nx = 142857;\r\ny_correct = true;\r\nassert(isequal(cyclicNumber(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":1,"created_by":83468,"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":"2016-10-21T09:35:07.000Z","updated_at":"2026-03-18T16:13:12.000Z","published_at":"2016-10-21T09:35:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Cyclic_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Cyclic_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;). The most widely known is 142857:\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[    142857 × 1 = 142857\\n    142857 × 2 = 285714\\n    142857 × 3 = 428571\\n    142857 × 4 = 571428\\n    142857 × 5 = 714285\\n    142857 × 6 = 857142]]\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\u003eIn fact, 142857 is the only cyclic number in decimal, if leading zeros are not permitted on numerals.\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\u003eTherefore, instead of the pure cyclic number, we will find the integer in which\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e cyclic permutations of the digits are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e multiples of the number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, 230769 is the one, because 23076\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e9\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e x 4 =\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e9\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 23076.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer x, return whether x is a pesudo-cyclic number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3003,"title":"Mobius function","description":"From wikipedia:\r\nFor any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, 0, 1} depending on the factorization of n into prime factors:\r\nμ(n) = 1 if n is a square-free positive integer with an even number of prime factors.\r\nμ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.\r\nμ(n) = 0 if n has a squared prime factor.\r\nReturn numbers from the Mobius function sequence corresponding to the supplied indices. For example, if n = 3:7, your function should return [-1, 0, -1, 1, -1].\r\nHint: solving Problem 3001 and Problem 3002 will provide much of the code needed for this problem. You'll need to add prime numbers to the sphenic number set (resulting from Problem 3001).","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: 256.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 128.15px; transform-origin: 407px 128.15px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 16.5px 8px; transform-origin: 16.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFrom\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\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: 2px 8px; transform-origin: 2px 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: 380px 8px; transform-origin: 380px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, 0, 1} depending on the factorization of n into prime factors:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30.65px; transform-origin: 391px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 259px 8px; transform-origin: 259px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eμ(n) = 1 if n is a square-free positive integer with an even number of prime factors.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 259.5px 8px; transform-origin: 259.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eμ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 125px 8px; transform-origin: 125px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eμ(n) = 0 if n has a squared prime factor.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 79px 8px; transform-origin: 79px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn numbers from 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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMobius function sequence\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: 214.5px 8px; transform-origin: 214.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e corresponding to the supplied indices. For example, if n = 3:7, your function should return [-1, 0, -1, 1, -1].\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: 38px 8px; transform-origin: 38px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHint: solving\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3001-sphenic-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3001\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/3002-not-square-free-number-sequence\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 3002\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: 232.5px 8px; transform-origin: 232.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e will provide much of the code needed for this problem. You'll need to add prime numbers to the sphenic number set (resulting from Problem 3001).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [arr] = mobius_func_seq(n)\r\n\r\narr =n;\r\n\r\nend\r\n","test_suite":"%%\r\nn = 1:5;\r\narr_corr = [1, -1, -1, 0, -1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:10;\r\narr_corr = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 3:7;\r\narr_corr = [-1, 0, -1, 1, -1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 20:30;\r\narr_corr = [0     1     1    -1     0     0     1     0     0    -1    -1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 99;\r\narr_corr = 0;\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%%\r\nn = 1:77;\r\narr_corr = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1];\r\nassert(isequal(mobius_func_seq(n),arr_corr))\r\n\r\n%% prevents cheating\r\ni1 = randi(20,1);\r\nn = i1:(i1+randi(25,1));\r\narr_tot = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1];\r\narr_corr = arr_tot(n);\r\nassert(isequal(mobius_func_seq(n),arr_corr))","published":true,"deleted":false,"likes_count":5,"comments_count":3,"created_by":26769,"edited_by":223089,"edited_at":"2022-10-09T11:44:37.000Z","deleted_by":null,"deleted_at":null,"solvers_count":63,"test_suite_updated_at":"2022-10-09T11:44:37.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-02-11T03:05:35.000Z","updated_at":"2026-03-16T14:39:18.000Z","published_at":"2015-02-11T03:05: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\u003eFrom\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\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\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, 0, 1} depending on the factorization of n into prime factors:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eμ(n) = 1 if n is a square-free positive integer with an even number of prime factors.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eμ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eμ(n) = 0 if n has a squared prime factor.\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 numbers from 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=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMobius function sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e corresponding to the supplied indices. For example, if n = 3:7, your function should return [-1, 0, -1, 1, -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\u003eHint: solving\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/3001-sphenic-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3001\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/3002-not-square-free-number-sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 3002\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e will provide much of the code needed for this problem. You'll need to add prime numbers to the sphenic number set (resulting from Problem 3001).\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":45250,"title":"Be happy","description":"check whether the given number is happy in b-base.\r\n\r\n* A happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\r\n\r\nThis is the case for base-10. For other bases, different scenerios would occur.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Happy_number\u003e\r\n\r\n","description_html":"\u003cp\u003echeck whether the given number is happy in b-base.\u003c/p\u003e\u003cul\u003e\u003cli\u003eA happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThis is the case for base-10. For other bases, different scenerios would occur.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Happy_number\"\u003ehttps://en.wikipedia.org/wiki/Happy_number\u003c/a\u003e\u003c/p\u003e","function_template":"function tf=be_happy(n,b)","test_suite":"%%\r\nn =11123;\r\nb=10;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 347;\r\nb=6;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 998;\r\nb=10;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%% \r\nn = 1234;\r\nb=4;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 149121303586;\r\nb=10;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn =742356;\r\nb=3;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 14916;\r\nb=7;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=6;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=7;\r\ny_correct = 0;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n%%\r\nn = 3148;\r\nb=13;\r\ny_correct = 1;\r\nassert(isequal(be_happy(n,b),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":13,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":36,"test_suite_updated_at":"2020-01-11T09:21:53.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-02T22:16:41.000Z","updated_at":"2026-03-22T22:09:02.000Z","published_at":"2020-01-03T04:25:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003echeck whether the given number is happy in b-base.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4, then the number is called an unhappy number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the case for base-10. For other bases, different scenerios would occur.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Happy_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Happy_number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45249,"title":"Frugal number","description":"check whether n is a frugal number\r\n\r\n* a frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\r\n","description_html":"\u003cp\u003echeck whether n is a frugal number\u003c/p\u003e\u003cul\u003e\u003cli\u003ea frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = frugal_no(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 18;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 36;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 79;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))%%\r\nn = 105;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 106;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 125;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 128;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 243;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 344;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 11421;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 115248;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn = 111050;\r\ny_correct = 0;\r\nassert(isequal(frugal_no(n),y_correct))\r\n%%\r\nn=97969;\r\ny_correct = 1;\r\nassert(isequal(frugal_no(n),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":11,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":51,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-31T07:08:41.000Z","updated_at":"2026-04-01T15:15:43.000Z","published_at":"2019-12-31T07:09:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003echeck whether n is a frugal number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ea frugal number is a natural number in a given number base that has more digits than the number of digits in its prime factorization in the given number base\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":172,"title":"Test if a Number is a Palindrome without using any String Operations","description":"*Description*\r\n\r\nGiven an integer _X_, determine if it is a palindrome number. That is, _X_ is equal to the _X_ with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either \"str\", \"eval\", \"flip\" or \"printf\" in it.\r\n\r\n*Example*\r\n\r\n    X = 123454321;\r\n    Y = true;\r\n\r\n    X = 1234;\r\n    Y = false;","description_html":"\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eGiven an integer \u003ci\u003eX\u003c/i\u003e, determine if it is a palindrome number. That is, \u003ci\u003eX\u003c/i\u003e is equal to the \u003ci\u003eX\u003c/i\u003e with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either \"str\", \"eval\", \"flip\" or \"printf\" in it.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e    X = 123454321;\r\n    Y = true;\u003c/pre\u003e\u003cpre\u003e    X = 1234;\r\n    Y = false;\u003c/pre\u003e","function_template":"function y = isNumPalindrome(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = 122131221;\r\ny_correct = true;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )\r\n\r\n%%\r\nx = 1221;\r\ny_correct = true;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )\r\n\r\n%%\r\nx = 12345;\r\ny_correct = false;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )\r\n\r\n%%\r\nx = 9849;\r\ny_correct = false;\r\nassert( isequal(isNumPalindrome(x),y_correct) \u0026\u0026 isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":255,"test_suite_updated_at":"2012-04-18T18:19:32.000Z","rescore_all_solutions":false,"group_id":38,"created_at":"2012-01-30T05:24:23.000Z","updated_at":"2026-03-31T17:41:42.000Z","published_at":"2012-01-30T05:39:05.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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDescription\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\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\u003eX\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, determine if it is a palindrome number. That is,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eX\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is equal to 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\u003eX\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either \\\"str\\\", \\\"eval\\\", \\\"flip\\\" or \\\"printf\\\" in it.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    X = 123454321;\\n    Y = true;\\n\\n    X = 1234;\\n    Y = false;]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45487,"title":"Check Digit - 02","description":"Given a list of ISBN's, check whether they're valid or not.\r\n\r\nPrev Prob - \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45486\u003e\r\n","description_html":"\u003cp\u003eGiven a list of ISBN's, check whether they're valid or not.\u003c/p\u003e\u003cp\u003ePrev Prob - \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/45486\"\u003ehttps://www.mathworks.com/matlabcentral/cody/problems/45486\u003c/a\u003e\u003c/p\u003e","function_template":"function tf = ISBN_check_2(x)","test_suite":"%%\r\nassert(isequal( ISBN_check_2('1306406152'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('0306406152'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('014298115X'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('014298115S'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('0X306406152'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('978-0-306-40615-7'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('978-0-306-40615-X'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('978-306-40615-7'),0))\r\n%%\r\nassert(isequal( ISBN_check_2('0-9752298-0-X'),1))\r\n%%\r\nassert(isequal( ISBN_check_2('0-97R2298-0-328'),0))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-04-30T15:00:17.000Z","updated_at":"2020-04-30T15:00:17.000Z","published_at":"2020-04-30T15:00:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of ISBN's, check whether they're valid or not.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrev Prob -\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/45486\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.mathworks.com/matlabcentral/cody/problems/45486\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":54089,"title":"Ramanujan's Number","description":"About 1729\r\n\r\n1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways.\r\nCalculate the second, third, fourth ... positive integers which can be expressed as the sum of two positive cubes in two different ways.","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: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 66px; transform-origin: 406.5px 66px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/1729_(number)\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eAbout 1729\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVIAAAAmCAYAAACWEROMAAAAAXNSR0IArs4c6QAAC9RJREFUeF7tnQWs7UoVhr+HOzw0BIKEENwCwSV4cHd3hwCB4ME1PNwl+MPd3d0leLAAwSG4k4/M8CabaTvT9nR33z1Nbu7NOdN21t81/yybdQ+jXQ2BhkBDoCEwCYHDJt3dbm4INAQaAg0BGpE2JWgINAQaAhMRaEQ6EcB2e0OgIdAQaETadKAh0BBoCExEoBHpRADb7Q2BhkBDoBHpoakDJwVuD9wSOAvwPuDRwAeAfx+aIo+Sal9x2le5a5WkGKdGpLXQrn/8iYDHAJ8D3gacHXgEoFJcD/ja+kVYZIb7itO+yl2rVFU4NSKthXf9468F/AV4Z2J9Xht4HXBT4OXrF2GRGe4rTvsqd61SVeHUiLQW3nWPPxpwBuCHwD+SqV4MeAegcujm7/u1rzjtq9y1+l6NUymR+uCLhrjbo4Bvdszs2MDjgbsXzvxewJM2xh4DuDhwC+AiIcb3IeAtwCuAn/Y823leCLg1cDrg+ME6eyNwJPCrwnmtdZgy3Q34fJCnZJ5+4zsC5wTuC/yx5KYVjKmRVRnPCNwKuBxw4aCj7wJeDHwR+NeATLuM082BSwDHBI4HfAx4PvCNgpj4LstdsxbkpisD1wB+BJwa/ltH/xLgI1P1Y4hII4FKeFozXwJu0EOk5wBeA5ytYCFKiNcEPp2MNY5nPO/OHfdL4CZRPpz5vaT5AOCygWw+G5TorMBTgFMBdwI+UTC3tQ2RVMTkdiHWWeqi+30vDdwzYPL9tQmWmU+trG68NwGOCNhsPvL3QafcsFMrPR23izg5Z9fkY4HHAS8D/gqcMKyDu4S/n32IyV2rH37n0weD7ViAuPwgfHyNQzecN4RkbJeRMagffUQqKbpgfwxcDbjCAJH6LBfsFQGt1q6kxsmA5wC/AW4T/lYuF8T9gOuGRfF+4O/A+YLwVw3Cu9s6r5QUvPfeQamuA7x+YzVdEnhlcHm1Wr6+A4TiFE8C3BZwQzttIEN/XkKkZuvvGix7F5eb4Jo3krGyXgZ4YbAsXh08FsMbNwTuEIhFMr0Z8KbMd981nKIIlwrWtjLpaUii8Tol8LywieqN6I1tVmvsmtxj9eMUgW/0VOSWdyc4yVmur+cG7nliZtMpwqmPSGXvv4WX6jroIvVZpJrKEuiDA/l2cVWM1xkCcHz8wBcAnhAsr02i09p0fLRUFf4FyQsiUf68w2L2/qeHciDBeuCG4q2VV90gdEn9o2UtUZyrkEiVKcZ6JFQ3OXfedPMaK7culRvbMzvIacxzx8h6OPAs4M0ZslC3bwRokbmRvChsLDmr46BwGoNDyT2RKK/eowt+Z62tnOER33FQcq9FP9QBw4xP7tF9Q0JuNFq6br45b3cQpyHXPgKu66Tr0Eekms8qtvGorsv3SWLuoFcKH9mx8eff68kqp2ED3TStV4n+6MF1uz/w2rDD/C4zAa0TF9W3w8705RKNXdEYd8ZXAeepINI4fUs5ngZcPngXlkZNudwsHz5iHqXvLJXVTVnr3NDTnzMPTzfQjwM3Tty63FzmxqlU3tpxfkctK8Njeou573nusB7OHGLkeoFd19xyr0U/NO6MgWqNOqfUcItYHDe4/fLDUzPWfYpZJ05zEmmJMpwceGkYqKv1y/DvEwMPC7GermSSVsUzgoumUmhhuXgkb595lWDCx59vzsdF99HwQ92dPsUqkWXpMaXk0jWv6FWYyNNKmXKtZaHcA/jqQCVC3ECH4vsRjzlxmoJx370aDR6w6JPJEJqlbobaXB/GBg1x7JN+xA1HmU0y6bnkLjnDGHuJjmT1Y2ki7XLrSxQu3TkkXf8YFkgJJiXYzWemO3Rq0Za8ew1jphKpXoUKo/vynYkCrYVIS8SI3tR7g0X6i4Gb5sSpZH61Y9J10LfwU8OjxBqfU+616EckSDcQczyf7AA76oi/dtx7ej5KFqclibTLrS9VpFQx0t0lJZi+nbeUcEvns/S4KUQawx/GveeID69loZR8g2iRlmyec+NUMr/aMSmR9oWpSgnX988t9xr04ziA+RDzKkOWZuqt5koy4zfqxGlJIo1uvUkFzeO+etCcchmDtY70Txv3p659386bEpGJMxMwfyjQ4vS+guGdQx4SYrljn1FCpH5oM/OWgBkGsfJBq90SKM/d3wf42dgJJPetYaGUiOHGYXmQycn0MMKcOKUudMmcusb0eVOb90TX3p93uawpkZq8vX6oVtkX/bCe1rJHv30NkbpODZtU4bQkkUa33gyabvk/K7XOY45mXq0jtZQpXi4Wa09NYHnlyp/8+ViLdJeI1O9piYd4OG8LjVUi//bc/VzF+LtCpDEj+5mgHzEhNSdO2yBS8wFmmvXSuhIkOYv0W3ukH+l3qSFSNzStUjEuXkdLEWnq1o85pqjVqYDGt3KncyydMmOv1Wpdne5cann5fmMbMdFlUw/JoJbMK7l/1uElFumsL+x52C4QaSx9sQRql2qHS75hXA82obG43FOAnv5LLw/FSLZWeXww6P9PSh4+w5g16IcJbMu/NCxqiLQkBPR/EC1FpFPc+rggdE83CTIK5BhPXOnOejrqraEm1UMBZwqZfhXKY3Re+5i1r1kfafC95r7NsWMrBObYNNxcXUhm9jdJZopMa7lXjKyl1tPzxJ+nm94ejoh6YtAaUy1yjYuSrH2NXLugHzUx4jRGOioEtxSRRrfeovhaS9ATHA/tKNRPP76yWLRuTESzXEVTwXRrPfly3lBA3ld7V6NMS4+dg1xK57wLC6VPFo8DW6ivl5I71VOKw9rH6b5qcWt1uU5+DZgnUGZrss0FWEfal0AZI+Mu6EdaX15jkXrMXI+16lqCSKNbb7xhqLRgc/K6JwplcH3KsU5dIXdvwwp9J1yqwFt48JJEOiTaGly3rjlahK91FgllHxtZx+PaZq1dN0v3oV2LfpSWP+nNxrxLX71p57pYgkijW285gjtZaZwmkqgEPPUkjuCkBwFyZ667QNqlZNMQAc71+7UslE15Iol+IVhjXU1K5sLB52wj2TQ0f3sNeBJRT3AbR6LXoh/REzYpV1KQP3rTWYJIx7j1uiOWrVi+kDv7qiLZMkxrY2ixnCaQqDFWQwsmq3LHCRuRDi3Po36/loWSzjh2//ptOPKX0wvPTKs3aYOPcqnzI9dGpJYXWhWji/qpkB+w3nTJay36kR4R7QpvpPWmo73VgybSMW69wXGPa1nW0ZUkUFlMGFnSYyyoz82LzU5y2fwllWvqu5pr342giQU3SP9ngFwHn3innaJO0HNUcOo32vb9aaMW46W5bP4Sc1wLkabdnboSbrE+3WZAXR3CBjE7aCKNbr2H/YcaRjhZrUfrTO1yZDF57vJZdraxdMnGGV0lTLEvo81NBNE2e0PHAwcB2+KARqR58G3Yq7VhmzU9mJy16carR2IszJMutYdBtvjZi1+ttW0NtR3UtMq32TJxLUQqeLGNns2+N7s7pUQ7xlv938cpIVKV0K4p7vi5Zsx9Xzq69ZahxG5NXePNtForaixj6OqbhzLZw1T3xsatjwxdn2rc+aH3b+P3dsuyvMXLTcF6t20lUg56oZTKmvahLfkm28atZI5jxkgWyuYmYavEB4Uu8GOeNcc9a9GPKIuhQr1cjS6bt9hj2ev8oWTSHIxz1oofdfURqdakO5x9J2NTZV/iKRHLSuw0b3f7rnhT6tYPZcK0Mt0RNK1Lrly7PE84XTB0kbd+0ZZzts3z/y/a1UtrS3dU/My8WiPr5Qc3nmM3K8u7YhetpeQ8iIUyRlatLjP0eh9D166WvXXJFXtkmsD1+K9kYDjMaoWh/1ZlCKupv1+LfqRyGEN3HflHXTAc5DFS15EhxKFcSy8mJRbpVFCXuF8LVLfNHqMq1HenArPEpHf4HQfRuHeH4Vh86p7asW+CFTD+/11fmfH47xzC7J1+HCpEOsfHb89oCDQEGgKjEGhEOgq2dlNDoCHQEDgKgUakTRsaAg2BhsBEBBqRTgSw3d4QaAg0BBqRNh1oCDQEGgITEWhEOhHAdntDoCHQEGhE2nSgIdAQaAhMROA/8cbBVHU5abkAAAAASUVORK5CYII=\" width=\"169\" height=\"19\" style=\"width: 169px; height: 19px;\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 10.5px; white-space: 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=\"\"\u003e1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 21px; text-align: left; transform-origin: 383.5px 21px; white-space: 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=\"\"\u003eCalculate the second, third, fourth ... positive integers which can be expressed as the sum of two positive cubes in two different ways.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [n a b c d] = Ramanujans(x)\r\nn = 1729;\r\na = 1; b = 12; c = 9; d = 10;\r\nend","test_suite":"%%\r\n[n, a, b, c, d] = Ramanujans(1);\r\nn_correct = 1729;\r\nassert(isequal(Ramanujans(1),n_correct))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(2);\r\nassert(n\u003e1729)\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(3);\r\nassert(n\u003eRamanujans(2))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(4);\r\nassert(n\u003eRamanujans(3))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)\r\n\r\n\r\n%%\r\n[n, a, b, c, d] = Ramanujans(5);\r\nassert(n\u003eRamanujans(4))\r\nassert(isequal(a^3+b^3, c^3+d^3))\r\nassert(isequal(n,a^3+b^3))\r\nassert(length(unique([a b c d]))==4)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2022-03-04T07:47:05.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-03-04T06:21:56.000Z","updated_at":"2022-03-04T07:47:05.000Z","published_at":"2022-03-04T06:21:56.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://en.wikipedia.org/wiki/1729_(number)\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAbout 1729\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e1729 = 1^3 + 12^3=9^3+10^3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCalculate the second, third, fourth ... positive integers which can be expressed as the sum of two positive cubes in two different ways.\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":45251,"title":"Last non-zero digit","description":"Given a number n, find the last non-zero digit of the factorial of that number.\r\nYou need to take care of the large values of n.","description_html":"\u003cp\u003eGiven a number n, find the last non-zero digit of the factorial of that number.\r\nYou need to take care of the large values of n.\u003c/p\u003e","function_template":"function D = last_Factorial(n)\r\n  \r\nend","test_suite":"%%\r\nn = 66;\r\ny_correct = 6;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 52;\r\ny_correct = 4;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 9;\r\ny_correct = 8;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 109;\r\ny_correct = 2;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 425;\r\ny_correct = 4;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 14;\r\ny_correct = 2;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n%%\r\nn = 719;\r\ny_correct = 8;\r\nassert(isequal(last_Factorial(n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-03T05:19:45.000Z","updated_at":"2026-02-05T20:53:13.000Z","published_at":"2020-01-03T05:25:46.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a number n, find the last non-zero digit of the factorial of that number. You need to take care of the large values of n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45343,"title":"How lucky  r u ?","description":"Find the nth number in the following sequence\r\n\r\n\u003chttps://oeis.org/A264940\u003e","description_html":"\u003cp\u003eFind the nth number in the following sequence\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://oeis.org/A264940\"\u003ehttps://oeis.org/A264940\u003c/a\u003e\u003c/p\u003e","function_template":"function y = lucky(n)\r\n\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(lucky(1),0))\r\n%%\r\nassert(isequal(lucky(5),3))\r\n%%\r\nassert(isequal(lucky(12),2))\r\n%%\r\nassert(isequal(lucky(19),7))\r\n%%\r\nassert(isequal(lucky(27),9))\r\n%%\r\nassert(isequal(lucky(31),0))\r\n%%\r\nassert(isequal(lucky(37),0))\r\n%%\r\nassert(isequal(lucky(45),13))\r\n%%\r\nassert(isequal(lucky(55),15))\r\n%%\r\nassert(isequal(lucky(85),21))\r\n%%\r\nassert(isequal(lucky(185),3))\r\n%%\r\nassert(isequal(lucky(303),0))\r\n%%\r\nassert(isequal(lucky(555),13))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-19T07:42:17.000Z","updated_at":"2025-11-21T23:33:51.000Z","published_at":"2020-02-19T07:42: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\u003eFind the nth number in the following sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A264940\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://oeis.org/A264940\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44306,"title":"Is it really a 5?","description":"A number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\r\n\r\n n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\r\n\r\nThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\r\n\r\nSee the test suite for more examples.","description_html":"\u003cp\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\u003c/p\u003e\u003cpre\u003e n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\u003c/pre\u003e\u003cp\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\u003c/p\u003e\u003cp\u003eSee the test suite for more examples.\u003c/p\u003e","function_template":"function tf = is_it_really_a_5(n)\r\n tf = 0;\r\nend","test_suite":"%%\r\nn = 5;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 25;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 35;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 52;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 59;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 85;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 105;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 115;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 125;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 250;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 555;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000; %5,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000; %15,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55555; %55,555\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000; %50,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55000; %55,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50500; %50,500\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050; %50,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50005; %50,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 500000; %500,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000; %5,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000000; %15,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000000; %50,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 105000000; %105,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050050; %50,050,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000005; %50,000,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000015; %50,000,015\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500000000; %500,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000000; %5,000,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000000000; %50,000,000,000\r\nassert(isequal(is_it_really_a_5(n),0))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":316,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-08T22:07:48.000Z","updated_at":"2026-03-18T13:28:44.000Z","published_at":"2017-10-16T01:45:06.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \\\"five\\\" anywhere. For example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ n = 5; return true since it is spelled \\\"five\\\"\\n n = 15; return false since it is spelled \\\"fifteen\\\" and does not contain the four-letter string \\\"five\\\"]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \\\"five\\\" for this problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee the test suite for more examples.\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":44293,"title":"Write out numbers in words","description":"Write out numbers in words ( range [0-9999] ) with British spelling rules. For example;\r\n1 \u003e one\r\n56 \u003e fifty-six\r\n100 \u003e one hundred\r\n105 \u003e one hundred and five\r\n245 \u003e two hundred and forty-five\r\n1520 \u003e one thousand, five hundred and twenty\r\n9999 \u003e nine thousand, nine hundred and ninety-nine (maximum)","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: 174.033px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 87.0167px; transform-origin: 407px 87.0167px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 268px 8px; transform-origin: 268px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite out numbers in words ( range [0-9999] ) with British spelling rules. For example;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 143.033px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 71.5167px; transform-origin: 391px 71.5167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 24px 8px; transform-origin: 24px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e1 \u0026gt; one\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 37.5px 8px; transform-origin: 37.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e56 \u0026gt; fifty-six\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 60.5px 8px; transform-origin: 60.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e100 \u0026gt; one hundred\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 87.5px 8px; transform-origin: 87.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e105 \u0026gt; one hundred and five\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 102.5px 8px; transform-origin: 102.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e245 \u0026gt; two hundred and forty-five\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 147px 8px; transform-origin: 147px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e1520 \u0026gt; one thousand, five hundred and twenty\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 202px 8px; transform-origin: 202px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e9999 \u0026gt; nine thousand, nine hundred and ninety-nine (maximum)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = num2words(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('num2words.m');\r\nassert(isempty(strfind(filetext, 'six hundred and seventy-nine')))\r\nassert(isempty(strfind(filetext, 'one thousand, five hundred and twenty')))\r\n\r\n%%\r\nx = 0;\r\ny_correct = 'zero';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 1;\r\ny_correct = 'one';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 11;\r\ny_correct = 'eleven';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 56;\r\ny_correct = 'fifty-six'\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 100;\r\ny_correct = 'one hundred';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 105;\r\ny_correct = 'one hundred and five';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 245;\r\ny_correct = 'two hundred and forty-five';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 679;\r\ny_correct = 'six hundred and seventy-nine';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 1000;\r\ny_correct = 'one thousand';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 1520;\r\ny_correct = 'one thousand, five hundred and twenty';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%%\r\nx = 2357;\r\ny_correct = 'two thousand, three hundred and fifty-seven';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 3001;\r\ny_correct = 'three thousand and one';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 4321;\r\ny_correct = 'four thousand, three hundred and twenty-one';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% \r\nx = 7030;\r\ny_correct = 'seven thousand and thirty';\r\nassert(isequal(num2words(x),y_correct))\r\n\r\n%% maximum value\r\nx = 9999;\r\ny_correct = 'nine thousand, nine hundred and ninety-nine';\r\nassert(isequal(num2words(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":8703,"edited_by":223089,"edited_at":"2023-03-26T13:36:41.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2023-03-26T13:36:41.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-01T17:46:19.000Z","updated_at":"2026-01-22T21:27:21.000Z","published_at":"2017-09-01T17:46:19.000Z","restored_at":"2017-09-11T18:42:34.000Z","restored_by":null,"spam":null,"simulink":false,"admin_reviewed":true,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite out numbers in words ( range [0-9999] ) with British spelling rules. For example;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 \u0026gt; one\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e56 \u0026gt; fifty-six\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e100 \u0026gt; one hundred\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e105 \u0026gt; one hundred and five\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e245 \u0026gt; two hundred and forty-five\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1520 \u0026gt; one thousand, five hundred and twenty\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e9999 \u0026gt; nine thousand, nine hundred and ninety-nine (maximum)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"number\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"number\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"number\"","","\"","number","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f5350408e90\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f5350408df0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f5350408030\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f5350409110\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f5350409070\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f5350408fd0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f5350408f30\u003e":"tag:\"number\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f5350408f30\u003e":"tag:\"number\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"number\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"number\"","","\"","number","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f5350408e90\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f5350408df0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f5350408030\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f5350409110\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f5350409070\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f5350408fd0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f5350408f30\u003e":"tag:\"number\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f5350408f30\u003e":"tag:\"number\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":43967,"difficulty_rating":"easy"},{"id":44654,"difficulty_rating":"easy"},{"id":45412,"difficulty_rating":"easy"},{"id":2275,"difficulty_rating":"easy"},{"id":57502,"difficulty_rating":"easy"},{"id":42380,"difficulty_rating":"easy"},{"id":45191,"difficulty_rating":"easy"},{"id":45254,"difficulty_rating":"easy"},{"id":2274,"difficulty_rating":"easy"},{"id":60939,"difficulty_rating":"easy-medium"},{"id":45253,"difficulty_rating":"easy-medium"},{"id":60969,"difficulty_rating":"easy-medium"},{"id":2270,"difficulty_rating":"easy-medium"},{"id":3018,"difficulty_rating":"easy-medium"},{"id":3019,"difficulty_rating":"easy-medium"},{"id":45246,"difficulty_rating":"easy-medium"},{"id":45223,"difficulty_rating":"easy-medium"},{"id":54490,"difficulty_rating":"easy-medium"},{"id":2283,"difficulty_rating":"easy-medium"},{"id":45267,"difficulty_rating":"easy-medium"},{"id":44360,"difficulty_rating":"easy-medium"},{"id":45229,"difficulty_rating":"easy-medium"},{"id":3002,"difficulty_rating":"easy-medium"},{"id":3001,"difficulty_rating":"easy-medium"},{"id":45234,"difficulty_rating":"easy-medium"},{"id":45376,"difficulty_rating":"easy-medium"},{"id":43584,"difficulty_rating":"easy-medium"},{"id":3003,"difficulty_rating":"easy-medium"},{"id":45250,"difficulty_rating":"easy-medium"},{"id":45249,"difficulty_rating":"easy-medium"},{"id":172,"difficulty_rating":"medium"},{"id":45487,"difficulty_rating":"medium"},{"id":54089,"difficulty_rating":"medium"},{"id":45251,"difficulty_rating":"medium"},{"id":45343,"difficulty_rating":"medium"},{"id":44306,"difficulty_rating":"medium"},{"id":44293,"difficulty_rating":"medium-hard"}]}}