{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":47078,"title":"Sum of infinite series.","description":null,"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: 169.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 84.9px; transform-origin: 407px 84.9px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eA series T(k,x,n), whose k-th term is given b:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eT(k,x,n) = (x^k)* [ n*(n-1)*....(n-k+1)]/ [k*(k-1).....1] and T(0,x,n) = 1\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eFind the sum S = sum(T(k,x,n)) for k = 0 to inf.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003ex will greater than -1 and n will be negative.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eHint: Try binomial expansion or something like binomial compression.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function S = binomial(x,n)\r\n  S = (1-n)^(x) % something similar can be an easy solution.\r\nend","test_suite":"%%\r\nx = 1;\r\nn = -1;\r\ny_correct = 0.5;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = -1;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = -1;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 0;\r\nn = -3;\r\ny_correct = 1;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = -1;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 1;\r\nn = -2;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":442401,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-25T09:23:00.000Z","updated_at":"2026-03-01T15:20:05.000Z","published_at":"2020-10-25T09:23:00.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA series T(k,x,n), whose k-th term is given 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eT(k,x,n) = (x^k)* [ n*(n-1)*....(n-k+1)]/ [k*(k-1).....1] and T(0,x,n) = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the sum S = sum(T(k,x,n)) for k = 0 to inf.\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\u003ex will greater than -1 and n will be negative.\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: Try binomial expansion or something like binomial compression.\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":57595,"title":"Find alternating sum","description":"Given an array, find alternating sum i.e. – y = x (1) – x (2) + x (3) – x (4) + x (5) - …","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: 21.0085px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.989px 10.4972px; transform-origin: 406.996px 10.5043px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.991px 10.4972px; text-align: left; transform-origin: 383.999px 10.5043px; 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=\"\"\u003eGiven an array, find alternating sum i.e. – y = x (1) – x (2) + x (3) – x (4) + x (5) - …\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [2,5,4,6,1];\r\ny_correct = -4;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = repmat([1,0],1,20);\r\ny_correct = 20;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1:100;\r\ny_correct = -50;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1000:23:1000000;\r\ny_correct = 500491;\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":2294940,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-01-20T10:52:03.000Z","updated_at":"2026-03-22T02:51:48.000Z","published_at":"2023-01-20T10:52:03.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an array, find alternating sum i.e. – y = x (1) – x (2) + x (3) – x (4) + x (5) - …\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":134,"title":"Geometric series","description":"Find the sum, given the first term t1, the common ratio r, and number of terms n. \r\n\r\nExamples\r\n\r\n If input t1=1,  r=1,  n=7 then output y=7\r\n\r\n If input t1=10, r=10, n=5 then output y=111110.","description_html":"\u003cp\u003eFind the sum, given the first term t1, the common ratio r, and number of terms n.\u003c/p\u003e\u003cp\u003eExamples\u003c/p\u003e\u003cpre\u003e If input t1=1,  r=1,  n=7 then output y=7\u003c/pre\u003e\u003cpre\u003e If input t1=10, r=10, n=5 then output y=111110.\u003c/pre\u003e","function_template":"function y = your_fcn_name(t1,r,n)\r\n  y = n;\r\nend","test_suite":"%%\r\nt1=1; r=1; n=7;\r\ny_correct = 7;\r\nassert(isequal(your_fcn_name(t1,r,n),y_correct))\r\n%%\r\nt1=10; r=10; n=5;\r\ny_correct = 111110;\r\nassert(isequal(your_fcn_name(t1,r,n),y_correct))\r\n%%\r\nt1=7; r=3; n=5;\r\ny_correct = 847;\r\nassert(isequal(your_fcn_name(t1,r,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":285,"test_suite_updated_at":"2012-02-03T03:26:45.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-28T06:21:39.000Z","updated_at":"2026-02-16T16:20:14.000Z","published_at":"2012-02-03T03:34:30.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 sum, given the first term t1, the common ratio r, and number of terms n.\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\u003eExamples\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[ If input t1=1,  r=1,  n=7 then output y=7\\n\\n If input t1=10, r=10, n=5 then output y=111110.]]\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":44860,"title":"Sum of a geometric series","description":"Give the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.","description_html":"\u003cp\u003eGive the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.\u003c/p\u003e","function_template":"function y = your_fcn_name(a,r,n)\r\n  y = x;\r\nend","test_suite":"%%\r\na = 1;\r\nr= 0.1;\r\nn=10;\r\ny_correct = a*(1 - r^n)/(1-r);\r\nassert(isequal(your_fcn_name(a,r,n),y_correct))\r\n\r\n%%\r\na = 0.2;\r\nr= 0.2;\r\nn=5;\r\ny_correct = a*(1 - r^n)/(1-r);\r\nassert(isequal(your_fcn_name(a,r,n),y_correct))\r\n\r\n%%\r\na = 0.4;\r\nr= 0.3;\r\nn=7;\r\ny_correct = a*(1 - r^n)/(1-r);\r\nassert(isequal(your_fcn_name(a,r,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":274816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":"2019-03-01T22:02:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-03-01T22:00:57.000Z","updated_at":"2026-02-18T09:36:25.000Z","published_at":"2019-03-01T22:00: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\u003eGive the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.\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":47083,"title":"sum of binomial series","description":null,"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: 199.6px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 99.8px; transform-origin: 407px 99.8px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eThe k-th term of the series T(k,x,n) is given as:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eT(k,x,n) =k* (x^(k-1))*((n!)/(k!*(n-k)!)).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003ewhere n! = 1*2*3......n\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eFind the sum S = sum(T(k,x,n)) for k = 1 to n.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eHint : try binomial expansion of (1+x)^n and its derivative, for a smarter solution.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function S = derivative_binomial(x,n)\r\n  S = (x-1)*(1-n)^(x+1) % Try something similar\r\nend","test_suite":"%%\r\nx = 0;\r\nn = 3;\r\ny_correct = 3;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 0;\r\nn = 4;\r\ny_correct = 4;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 1;\r\nn = 3;\r\ny_correct = 12;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = 4;\r\ny_correct = 256;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 4;\r\nn = 3;\r\ny_correct = 75;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":442401,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-25T16:53:49.000Z","updated_at":"2026-03-02T09:20:40.000Z","published_at":"2020-10-25T16:53:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe k-th term of the series T(k,x,n) is given as:\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\u003eT(k,x,n) =k* (x^(k-1))*((n!)/(k!*(n-k)!)).\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\u003ewhere n! = 1*2*3......n\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 sum S = sum(T(k,x,n)) for k = 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=\\\"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\u003eHint : try binomial expansion of (1+x)^n and its derivative, for a smarter solution.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44225,"title":"Sum of self power series","description":"The series, 1^1,2^2,3^3,4^4,....\r\n\r\nFind the sum of such series when x terms are given.","description_html":"\u003cp\u003eThe series, 1^1,2^2,3^3,4^4,....\u003c/p\u003e\u003cp\u003eFind the sum of such series when x terms are given.\u003c/p\u003e","function_template":"function y = sumofseries(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(sumofseries(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 5;\r\nassert(isequal(sumofseries(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 288;\r\nassert(isequal(sumofseries(x),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":134801,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-05-25T05:40:41.000Z","updated_at":"2026-03-10T15:08:41.000Z","published_at":"2017-05-25T05:40:51.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 series, 1^1,2^2,3^3,4^4,....\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the sum of such series when x terms are given.\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":3015,"title":"Sum all integers from 1 to 2^x","description":"Given a number x, your function must return the summation of all integers from 1 to 2^x.","description_html":"\u003cp\u003eGiven a number x, your function must return the summation of all integers from 1 to 2^x.\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 2;\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 36;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 136;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 528;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 6;\r\ny_correct = 2080;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 7;\r\ny_correct = 8256;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 8;\r\ny_correct = 32896;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 15;\r\ny_correct = 536887296;\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":34017,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":115,"test_suite_updated_at":"2016-09-30T03:21:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-02-14T00:13:24.000Z","updated_at":"2026-02-17T15:56:22.000Z","published_at":"2015-02-14T00:13:24.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 x, your function must return the summation of all integers from 1 to 2^x.\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":47234,"title":"Find Logic 4","description":null,"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: 212.619px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 174px 106.31px; transform-origin: 174px 106.31px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 41.9048px; 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: 151px 20.9524px; text-align: left; transform-origin: 151px 20.9524px; 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=\"\"\u003eMake a function by finding logic from this problem\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(1) = 2\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(2) = 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(3) = 12\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(4) = 20\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 41.9048px; 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: 151px 20.9524px; text-align: left; transform-origin: 151px 20.9524px; 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=\"\"\u003eGuess the logic and make function logic(x) which will return 'x' th term of series\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = logic(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 2;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 20;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 7;\r\ny_correct = 56;\r\nassert(isequal(logic(x),y_correct))","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":293792,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":499,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-03T13:56:59.000Z","updated_at":"2026-02-27T08:11:55.000Z","published_at":"2020-11-03T13:56:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMake a function by finding logic from 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003elogic(1) = 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\u003elogic(2) = 6\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\u003elogic(3) = 12\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\u003elogic(4) = 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\u003eGuess the logic and make function logic(x) which will return 'x' th term of series\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":58658,"title":"Even Sum","description":"Calculate the sum of all even numbers between 1 and a given positive integer n. Write a function that takes n as input and returns the sum of even numbers.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; 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; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 21px; transform-origin: 332px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 21px; text-align: left; transform-origin: 309px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCalculate the sum of all even numbers between 1 and a given positive integer n. Write a function that takes n as input and returns the sum of even numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = calculateEvenSum(n)\r\n  y = n;\r\nend","test_suite":"%%\r\nn = 5;\r\ny_correct = 6;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 10;\r\ny_correct = 30;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 11;\r\ny_correct = 30;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 20;\r\ny_correct = 110;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 40;\r\ny_correct = 420;\r\nassert(isequal(calculateEvenSum(n),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3469833,"edited_by":26769,"edited_at":"2023-12-01T16:32:35.000Z","deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2023-12-01T16:32:35.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2023-07-18T15:13:46.000Z","updated_at":"2026-03-06T13:52:38.000Z","published_at":"2023-07-18T15:13:46.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\u003eCalculate the sum of all even numbers between 1 and a given positive integer n. Write a function that takes n as input and returns the sum of even numbers.\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":47239,"title":"Find Logic 5","description":null,"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: 191.667px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 174px 95.8333px; transform-origin: 174px 95.8333px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003eGuess the logic\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(1) = 2\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(2) = 5\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(3) = 9\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(4) = 14\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 41.9048px; 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: 151px 20.9524px; text-align: left; transform-origin: 151px 20.9524px; 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=\"\"\u003eMake a function logic(x) which returns 'x' th term of logic\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = logic(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 2;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 20;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 8;\r\ny_correct = 44;\r\nassert(isequal(logic(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":293792,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-03T16:42:59.000Z","updated_at":"2026-03-16T11:57:14.000Z","published_at":"2020-11-03T16:42:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGuess the logic\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\u003elogic(1) = 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\u003elogic(2) = 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003elogic(3) = 9\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003elogic(4) = 14\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\u003eMake a function logic(x) which returns 'x' th term of logic\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":57795,"title":"Armstrong Number","description":"Write a function name armstrong_check that checks whether the given input is an Armstrong Number or not. It returns logical True or False.\r\nAn Armstrong number is one whose sum of digits raised to the power of the number of digits equals the number itself. For example, 371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371.\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440000534057617px; 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; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eWrite a function name armstrong_check that checks whether the given input is an Armstrong Number or not. It returns logical True or False.\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eAn \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://web.archive.org/web/20171228054132/https://everything2.net/index.pl?node_id=1407017\u0026amp;displaytype=printable\u0026amp;lastnode_id=1407017\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eArmstrong number\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; \"\u003e\u003cspan style=\"\"\u003e is one whose sum of digits raised to the power of the number of digits equals the number itself. For example, 371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371.\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = armstrong_check(n)\r\n  out = n;\r\nend","test_suite":"%%\r\nn = 371;\r\nout_correct = true;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn = 21;\r\nout_correct = false;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn= 548834;\r\nout_correct = true;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn= 68955;\r\nout_correct = false;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn= 1741725;\r\nout_correct = true;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":2294940,"edited_by":26769,"edited_at":"2023-04-19T21:12:05.000Z","deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-03-17T08:49:07.000Z","updated_at":"2026-02-05T05:42:50.000Z","published_at":"2023-03-17T08:49:07.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\u003eWrite a function name armstrong_check that checks whether the given input is an Armstrong Number or not. It returns logical True or False.\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\u003eAn \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://web.archive.org/web/20171228054132/https://everything2.net/index.pl?node_id=1407017\u0026amp;displaytype=printable\u0026amp;lastnode_id=1407017\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eArmstrong number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is one whose sum of digits raised to the power of the number of digits equals the number itself. For example, 371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2579,"title":"Sum of series V","description":"What is the sum of the following sequence:\r\n\r\n Σk(k+1) for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σk(k+1) for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesV(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 2;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 20;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 4;\r\ns_correct = 40;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 440;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 21;\r\ns_correct = 3542;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 26488;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 88;\r\ns_correct = 234960;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 99;\r\ns_correct = 333300;\r\nassert(isequal(sumOfSeriesV(n),s_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1715,"test_suite_updated_at":"2017-06-13T18:07:53.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:08:14.000Z","updated_at":"2026-03-28T09:27:09.000Z","published_at":"2014-09-10T10:08:47.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σk(k+1) for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":2575,"title":"Sum of series I","description":"What is the sum of the following sequence:\r\n\r\n Σ(2k-1) for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(2k-1) for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesI(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 4;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 100;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 15;\r\ns_correct = 225;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 1764;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 101;\r\ns_correct = 10201;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 12345;\r\ns_correct = 152399025;\r\nassert(isequal(sumOfSeriesI(n),s_correct))","published":true,"deleted":false,"likes_count":14,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2250,"test_suite_updated_at":"2017-06-13T17:57:57.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T09:37:47.000Z","updated_at":"2026-04-11T00:27:15.000Z","published_at":"2014-09-10T09:38:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(2k-1) for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":2577,"title":"Sum of series III","description":"What is the sum of the following sequence:\r\n\r\n Σ(2k-1)^3 for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(2k-1)^3 for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesIII(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 28;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 5;\r\ns_correct = 1225;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 19900;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 6221628;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 99;\r\ns_correct = 192109401;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 124;\r\ns_correct = 472827376;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 222;\r\ns_correct = 4857776028;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1824,"test_suite_updated_at":"2017-06-13T18:03:10.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T09:51:33.000Z","updated_at":"2026-04-10T20:01:36.000Z","published_at":"2014-09-10T09:52:07.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(2k-1)^3 for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":43968,"title":"Concatenated roots","description":"Which is the value of this infinte concatenated roots?\r\n\r\n\u003c\u003chttps://s27.postimg.org/i4hkin7xf/Code_Cogs_Eqn.gif\u003e\u003e\r\n\r\n\r\nNote: If image server is not available, the equation was:\r\n\r\n  x*sqrt(x*cuberoot(x*fourthroot(x*fifthroot(x*sixthroot(...)))))\r\n\r\nTip: sum(1/n!)","description_html":"\u003cp\u003eWhich is the value of this infinte concatenated roots?\u003c/p\u003e\u003cimg src = \"https://s27.postimg.org/i4hkin7xf/Code_Cogs_Eqn.gif\"\u003e\u003cp\u003eNote: If image server is not available, the equation was:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex*sqrt(x*cuberoot(x*fourthroot(x*fifthroot(x*sixthroot(...)))))\r\n\u003c/pre\u003e\u003cp\u003eTip: sum(1/n!)\u003c/p\u003e","function_template":"function y = infinteroots(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny = 1;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx = 10;\r\ny = 52.2735299670437;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=5;\r\ny=15.8864718332426;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=6;\r\ny=21.7311722059576;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=4;\r\ny=10.827015106694;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=3.2;\r\ny=7.37887287693964;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":12767,"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":"2016-12-25T20:58:32.000Z","updated_at":"2026-04-03T02:58:43.000Z","published_at":"2016-12-25T20:59: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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.gif\"}],\"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\u003eWhich is the value of this infinte concatenated roots?\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:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\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\u003eNote: If image server is not available, the equation was:\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*sqrt(x*cuberoot(x*fourthroot(x*fifthroot(x*sixthroot(...)))))]]\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\u003eTip: sum(1/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\"},{\"partUri\":\"/media/image1.gif\",\"contentType\":\"image/gif\",\"content\":\"data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAC1QTFRFeHh4k5OT9vb2gYGBnJycwMDAt7e3ioqK0tLS7e3t29vb5OTkycnJ////b29vvCMpXwAAAKZJREFUeNq8k0sWwyAIAEXzh3D/41ZrahASklXZ6cxTEAz8EOGFsDvxTyECM0RHgJIwOEIt6VFYX19BAd0kKe8vTpn0vY9uheXoQjGYrICtf9mg3Qgo+kt12fE4sxQwaGFQXCdJmmshaV4EnKYxmgMO/pvJVJ92NrwNbSpnrJafUz1kYbRcjP121ii4EKDVIPnVx+n4hdBzKyhuBM21YLgSLOePAAMAW0UziCh1I3kAAAAASUVORK5CYII=\"}]}"},{"id":45384,"title":"Sum! Sum! Sum!","description":"Calculate the sum of the sequence up to nth term \u003e\u003e \r\n\r\n  a,aa,aaa,aaaa,... \r\n  2,22,222,2222,...  [for a=2]","description_html":"\u003cp\u003eCalculate the sum of the sequence up to nth term \u0026gt;\u0026gt;\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ea,aa,aaa,aaaa,... \r\n2,22,222,2222,...  [for a=2]\r\n\u003c/pre\u003e","function_template":"function  y = series_sum(a,n)","test_suite":"%%\r\nassert(isequal(series_sum(3,4),3702))\r\n%%\r\nassert(isequal(series_sum(2,15),246913580246910))\r\n%%\r\nassert(isequal(series_sum(9,9),1111111101))\r\n%%\r\nassert(isequal(series_sum(1,12),123456790122))\r\n%%\r\nassert(isequal(series_sum(5,5),61725))","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":42,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-24T13:05:35.000Z","updated_at":"2026-04-14T13:08:04.000Z","published_at":"2020-03-24T13:05: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\",\"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\u003eCalculate the sum of the sequence up to nth term \u0026gt;\u0026gt;\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[a,aa,aaa,aaaa,... \\n2,22,222,2222,...  [for a=2]]]\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":2576,"title":"Sum of series II","description":"What is the sum of the following sequence:\r\n\r\n Σ(2k-1)^2 for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(2k-1)^2 for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesII(n)\r\n  s = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 10;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 35;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 4;\r\ns_correct = 84;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 5;\r\ns_correct = 165;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 11;\r\ns_correct = 1771;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 98770;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 71;\r\ns_correct = 477191;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 123;\r\ns_correct = 2481115;\r\nassert(isequal(sumOfSeriesII(n),s_correct))","published":true,"deleted":false,"likes_count":11,"comments_count":2,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1921,"test_suite_updated_at":"2017-06-13T18:00:48.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T09:44:53.000Z","updated_at":"2026-04-10T19:47:55.000Z","published_at":"2014-09-10T09:45: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\",\"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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(2k-1)^2 for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":45248,"title":"Aquiles y la tortuga","description":"Contaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tortuga en una carrera. Todo parecía apuntar a que Aquiles vencería sin ninguna duda, pero las matemáticas parece que tenían algo que decir... \r\n\r\nAquiles, al ser más veloz, le da una ventaja a la tortuga de medio kilómetro (1/2 = 0.5 km). En esta carrera, Aquiles corre a la mitad de la velocidad que la tortuga, y ambos mantienen su velocidad constante. Por ello, cuando Aquiles recorra medio kilómetro, la tortuga habrá avanzado la mitad de esa distancia (1/4 = 0.25 km). Y cuando Aquiles recorra el siguiente cuarto de kilómetro (0.25 km), la tortuga habrá avanzado la mitad de ésta (1/8 = 0.125 km). Si esta sucesión de distancias, cada vez más pequeñas, se repite hasta el infinito, entonces la tortuga siempre estará ligeramente más avanzada que Aquiles (aunque sea por una distancia infinitesimal) y, por lo tanto, la tortuga siempre ganará la carrera.\r\n\r\nSegún Zenón, las infinitas distancias _{1, 1/2, 1/4, 1/8, 1/16, ...}_ que tiene que recorrer Aquiles impiden que alcance a la tortuga, precisamente porque son infinitas. Sin embargo, en la realidad, es evidente que Aquiles alcanzará a la tortuga.\r\n\r\nEn este problema se propone descubrir el secreto de la paradoja mediante una función que reciba como entrada el parámetro _n_ y devuelva:\r\n\r\n* La suma de las distancias de la sucesión _{1/2^n}_ desde _1_ hasta _n_. Las sumas anteriores deben almacenarse en un vector _suma = [s1, s2, ..., sn]_.\r\n\r\n\u003c\u003chttps://imgur.com/GZcLHQu.png\u003e\u003e\r\n\r\n\r\n* Una gráfica con la _suma_ de las distancias (en km) frente a _n_.\r\n\r\n¿A qué valor se aproxima la suma cuando _n_ tiende a infinito (prueba con un número _n_ muy grande)? Por lo tanto, ¿a qué distancia alcanzará Aquiles a la tortuga?\r\n\r\n\r\n","description_html":"\u003cp\u003eContaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tortuga en una carrera. Todo parecía apuntar a que Aquiles vencería sin ninguna duda, pero las matemáticas parece que tenían algo que decir...\u003c/p\u003e\u003cp\u003eAquiles, al ser más veloz, le da una ventaja a la tortuga de medio kilómetro (1/2 = 0.5 km). En esta carrera, Aquiles corre a la mitad de la velocidad que la tortuga, y ambos mantienen su velocidad constante. Por ello, cuando Aquiles recorra medio kilómetro, la tortuga habrá avanzado la mitad de esa distancia (1/4 = 0.25 km). Y cuando Aquiles recorra el siguiente cuarto de kilómetro (0.25 km), la tortuga habrá avanzado la mitad de ésta (1/8 = 0.125 km). Si esta sucesión de distancias, cada vez más pequeñas, se repite hasta el infinito, entonces la tortuga siempre estará ligeramente más avanzada que Aquiles (aunque sea por una distancia infinitesimal) y, por lo tanto, la tortuga siempre ganará la carrera.\u003c/p\u003e\u003cp\u003eSegún Zenón, las infinitas distancias \u003ci\u003e{1, 1/2, 1/4, 1/8, 1/16, ...}\u003c/i\u003e que tiene que recorrer Aquiles impiden que alcance a la tortuga, precisamente porque son infinitas. Sin embargo, en la realidad, es evidente que Aquiles alcanzará a la tortuga.\u003c/p\u003e\u003cp\u003eEn este problema se propone descubrir el secreto de la paradoja mediante una función que reciba como entrada el parámetro \u003ci\u003en\u003c/i\u003e y devuelva:\u003c/p\u003e\u003cul\u003e\u003cli\u003eLa suma de las distancias de la sucesión \u003ci\u003e{1/2^n}\u003c/i\u003e desde \u003ci\u003e1\u003c/i\u003e hasta \u003ci\u003en\u003c/i\u003e. Las sumas anteriores deben almacenarse en un vector \u003ci\u003esuma = [s1, s2, ..., sn]\u003c/i\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cimg src = \"https://imgur.com/GZcLHQu.png\"\u003e\u003cul\u003e\u003cli\u003eUna gráfica con la \u003ci\u003esuma\u003c/i\u003e de las distancias (en km) frente a \u003ci\u003en\u003c/i\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e¿A qué valor se aproxima la suma cuando \u003ci\u003en\u003c/i\u003e tiende a infinito (prueba con un número \u003ci\u003en\u003c/i\u003e muy grande)? Por lo tanto, ¿a qué distancia alcanzará Aquiles a la tortuga?\u003c/p\u003e","function_template":"function suma = mi_funcion(n)\r\n  % Resuelve el problema\r\nend","test_suite":"%%\r\nn = 3;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8)];\r\nassert(isequal(mi_funcion(n),suma));\r\n%%\r\nn = 4;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16)];\r\nassert(isequal(mi_funcion(n),suma))\r\n%%\r\nn = 6;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16) (1/2+1/4+1/8+1/16+1/32) (1/2+1/4+1/8+1/16+1/32+1/64)];\r\nassert(isequal(mi_funcion(n),suma))\r\n%%\r\nn = 10;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16) (1/2+1/4+1/8+1/16+1/32) (1/2+1/4+1/8+1/16+1/32+1/64) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8+1/2^9) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8+1/2^9+1/2^10)];\r\nassert(isequal(mi_funcion(n),suma))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":385299,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":29,"test_suite_updated_at":"2019-12-28T19:14:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-28T18:34:40.000Z","updated_at":"2020-07-22T23:45:03.000Z","published_at":"2019-12-28T18:34: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\",\"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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.JPEG\"}],\"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\u003eContaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tortuga en una carrera. Todo parecía apuntar a que Aquiles vencería sin ninguna duda, pero las matemáticas parece que tenían algo que decir...\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\u003eAquiles, al ser más veloz, le da una ventaja a la tortuga de medio kilómetro (1/2 = 0.5 km). En esta carrera, Aquiles corre a la mitad de la velocidad que la tortuga, y ambos mantienen su velocidad constante. Por ello, cuando Aquiles recorra medio kilómetro, la tortuga habrá avanzado la mitad de esa distancia (1/4 = 0.25 km). Y cuando Aquiles recorra el siguiente cuarto de kilómetro (0.25 km), la tortuga habrá avanzado la mitad de ésta (1/8 = 0.125 km). Si esta sucesión de distancias, cada vez más pequeñas, se repite hasta el infinito, entonces la tortuga siempre estará ligeramente más avanzada que Aquiles (aunque sea por una distancia infinitesimal) y, por lo tanto, la tortuga siempre ganará la carrera.\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\u003eSegún Zenón, las infinitas distancias\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e{1, 1/2, 1/4, 1/8, 1/16, ...}\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e que tiene que recorrer Aquiles impiden que alcance a la tortuga, precisamente porque son infinitas. Sin embargo, en la realidad, es evidente que Aquiles alcanzará a la tortuga.\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\u003eEn este problema se propone descubrir el secreto de la paradoja mediante una función que reciba como entrada el parámetro\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e y devuelva:\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\u003eLa suma de las distancias de la sucesión\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e{1/2^n}\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e desde\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\u003e1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e hasta\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Las sumas anteriores deben almacenarse en un vector\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\u003esuma = [s1, s2, ..., sn]\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\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\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\u003eUna gráfica con la\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\u003esuma\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e de las distancias (en km) frente 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: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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e¿A qué valor se aproxima la suma cuando\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e tiende a infinito (prueba con un número\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e muy grande)? Por lo tanto, ¿a qué distancia alcanzará Aquiles a la tortuga?\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\"},{\"partUri\":\"/media/image1.JPEG\",\"contentType\":\"image/JPEG\",\"content\":\"data:image/JPEG;base64,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\"}]}"},{"id":45364,"title":"Sum of series","description":" a(n) = n^2 - (n-1)^2\r\n\r\nfind the summation of the series upto n i.e. \r\n\r\n   a(1)+a(2)+...+a(n)","description_html":"\u003cpre\u003e a(n) = n^2 - (n-1)^2\u003c/pre\u003e\u003cp\u003efind the summation of the series upto n i.e.\u003c/p\u003e\u003cpre\u003e   a(1)+a(2)+...+a(n)\u003c/pre\u003e","function_template":"function y=seq_sum(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(seq_sum(236),55696))\r\n%%\r\nassert(isequal(seq_sum(881224),776555738176))\r\n%%\r\nassert(isequal(seq_sum(10199),104019601))\r\n%%\r\nassert(isequal(seq_sum(8812249),77655732438001))","published":true,"deleted":false,"likes_count":11,"comments_count":2,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1255,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-14T12:34:14.000Z","updated_at":"2026-03-22T02:49:55.000Z","published_at":"2020-03-14T12:34: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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ a(n) = n^2 - (n-1)^2]]\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\u003efind the summation of the series upto n i.e.\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[   a(1)+a(2)+...+a(n)]]\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":1913,"title":"GJam 2013 Veterans: Ocean View (Small)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p2 GJam 2013 Veterans Ocean View\u003e. This is the Small data set witn N\u003c=50 and Q\u003c=4, guaranteed.\r\n\r\nThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\r\n\r\n*Succinct Challenge statement:* Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\r\n\r\n*Input:* V , Vector length N\u003c=50 with values 1 thru 1000.\r\n\r\n*Output:* Q , minimum quantity of removed values to produce a valid vector [0:4]\r\n\r\n*Examples:* [V] [Q]\r\n\r\n  [1 4 3 3] [2]  for [1 4] or [1 3]\r\n  [1 2 3 4 5] [0]\r\n  [4 3 2 1] [3]\r\n\r\n*Commentary:*\r\n\r\n  1) The GJam Small test suite is not robust\r\n  2) nchoosek(50,4) is too slow for Cody and the 100 cases\r\n  3) The Large test suite is N\u003c=1000 with some delete cases \u003e4\r\n  4) A Good Algorithm that solves the Large case is usually best to pursue\r\n  5) GJam Competition allows one Large submission within 10 minutes of download \r\n  6) \u003cLarge Suite Challenge\u003e","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\"\u003eGJam 2013 Veterans Ocean View\u003c/a\u003e. This is the Small data set witn N\u0026lt;=50 and Q\u0026lt;=4, guaranteed.\u003c/p\u003e\u003cp\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\u003c/p\u003e\u003cp\u003e\u003cb\u003eSuccinct Challenge statement:\u003c/b\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V , Vector length N\u0026lt;=50 with values 1 thru 1000.\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Q , minimum quantity of removed values to produce a valid vector [0:4]\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [V] [Q]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 4 3 3] [2]  for [1 4] or [1 3]\r\n[1 2 3 4 5] [0]\r\n[4 3 2 1] [3]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) The GJam Small test suite is not robust\r\n2) nchoosek(50,4) is too slow for Cody and the 100 cases\r\n3) The Large test suite is N\u0026lt;=1000 with some delete cases \u003e4\r\n4) A Good Algorithm that solves the Large case is usually best to pursue\r\n5) GJam Competition allows one Large submission within 10 minutes of download \r\n6) \u0026lt;Large Suite Challenge\u003e\r\n\u003c/pre\u003e","function_template":"function Q = Monotonic_V(vin)\r\n  Q=0;\r\nend","test_suite":"%%\r\ntic\r\nvin=[4 33 36 47 63 79 146 159 176 191 178 215 226 228 261 262 291 295 322 368 456 461 465 473 479 500 512 527 570 572 613 639 641 654 667 684 699 701 746 751 763 767 786 819 872 925 932 959 965 972 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 33 63 78 82 85 92 101 113 125 138 175 183 196 211 224 250 287 345 368 388 426 447 477 491 504 524 575 579 581 621 694 712 720 737 745 747 784 793 802 813 827 829 853 858 919 924 929 939 960 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 19 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 35 63 72 76 122 103 171 185 221 238 294 318 325 341 355 350 359 365 407 409 438 467 514 548 592 585 599 606 636 646 652 697 708 737 770 773 798 819 832 835 849 881 879 893 904 907 932 967 983 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 72 94 114 136 147 177 185 199 216 214 230 243 252 264 417 285 426 428 445 450 463 465 467 482 485 495 531 537 547 575 558 598 654 677 678 692 685 785 853 891 894 897 905 906 910 918 933 963 979 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[21 18 33 53 158 179 200 225 230 259 261 262 280 319 338 368 369 376 423 449 481 505 517 531 545 588 598 614 607 615 647 655 657 684 702 706 734 756 768 791 806 792 834 889 895 896 957 960 971 995 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[52 53 66 83 119 129 132 145 202 237 274 281 284 296 298 326 442 386 451 456 475 476 486 493 499 520 523 525 589 605 612 626 630 638 694 718 740 763 791 798 800 801 811 839 868 874 895 891 971 984 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 9 21 43 89 106 117 141 150 211 158 220 233 282 296 311 324 353 372 376 407 452 414 455 482 494 503 522 527 531 545 548 552 563 568 586 593 629 673 691 682 703 724 738 787 822 861 882 907 937 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 51 80 105 109 114 129 154 175 167 188 198 227 266 270 437 345 446 459 469 470 478 479 520 582 587 591 611 618 619 658 677 670 683 686 689 710 758 728 815 821 852 870 912 937 946 960 969 985 998 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 34 65 81 83 91 105 114 125 127 132 162 154 176 198 201 222 269 272 296 297 321 345 355 377 402 403 407 444 454 450 493 517 533 546 589 592 593 639 698 700 729 764 798 785 850 909 917 950 988 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[30 94 106 118 125 136 151 161 162 176 233 240 272 290 320 337 347 352 370 433 412 499 504 510 513 572 593 621 629 640 646 710 712 721 735 741 750 786 804 812 814 817 822 844 893 932 944 945 954 972 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 5 6 1 7 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[25 37 40 56 62 81 86 136 95 140 225 228 274 236 297 332 417 516 545 549 573 582 583 595 600 601 603 624 673 699 714 716 719 720 746 737 762 790 802 814 821 835 852 868 860 871 899 910 923 984 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 1000 1000 1000 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 15 42 44 68 69 108 109 126 120 145 148 154 176 199 221 245 266 271 299 325 309 326 411 514 518 552 568 589 607 663 692 723 711 746 754 771 776 780 818 840 843 858 868 878 882 883 904 906 975 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[17 13 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 21 82 107 99 135 136 144 174 183 211 222 259 283 304 333 348 353 366 399 412 491 512 507 526 557 590 593 613 619 634 663 683 689 710 714 719 720 738 754 807 832 885 880 932 934 941 984 990 996 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[5 37 46 52 54 79 125 140 192 294 318 323 333 343 346 354 360 361 372 403 414 435 445 454 471 480 482 503 514 527 583 624 645 632 726 746 760 764 771 791 801 803 812 819 846 885 893 956 976 1000 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 12 36 45 50 101 113 119 131 168 237 250 254 261 281 324 343 401 421 437 442 499 500 501 512 522 523 529 532 545 561 585 586 590 623 679 695 782 798 823 830 843 852 878 891 902 923 922 972 981 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 23 111 61 127 138 144 147 174 194 261 262 279 272 288 318 350 356 396 425 439 441 454 466 473 487 482 590 615 617 632 637 662 688 699 704 734 780 800 803 814 808 828 843 868 922 943 985 987 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[49 73 118 140 194 202 218 249 261 342 272 347 355 403 438 462 466 469 473 488 499 511 514 515 525 532 538 545 588 665 610 707 714 719 716 723 739 751 763 789 809 868 874 899 916 937 939 947 979 994 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 14 67 76 98 107 125 150 151 194 244 248 251 270 289 271 309 354 434 453 468 454 484 487 507 523 526 569 578 601 624 684 690 696 725 752 765 800 813 815 826 906 888 948 963 970 984 993 996 1000 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[15 57 92 105 110 172 125 182 202 213 233 263 282 291 289 293 353 404 421 440 447 469 491 495 504 498 505 543 549 579 597 633 655 671 693 748 768 801 798 811 838 858 859 865 883 889 901 945 959 964 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[30 61 112 126 137 147 154 158 224 266 282 294 303 307 328 320 377 379 391 411 430 423 446 453 461 463 468 493 517 531 536 546 588 613 667 643 683 684 712 722 784 821 848 889 900 919 921 928 931 1000 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[34 18 92 103 108 110 143 200 248 283 284 297 326 365 369 400 439 470 489 498 526 593 596 605 631 684 720 687 754 770 781 793 803 826 811 855 863 886 888 901 916 928 943 954 968 972 982 983 984 987 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 24 74 48 137 172 199 209 224 227 234 293 297 305 324 336 338 377 418 395 432 437 446 474 505 510 529 536 541 568 613 641 645 695 677 735 792 797 805 830 853 869 882 883 888 925 910 970 982 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[25 39 54 55 57 101 117 124 142 143 185 161 196 210 214 237 243 267 282 288 304 394 435 427 458 491 509 519 550 557 582 607 608 634 652 640 681 705 695 753 785 840 871 889 903 912 918 921 966 987 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[30 75 123 160 156 176 202 215 254 264 310 318 354 368 390 435 453 457 474 476 479 510 529 532 603 623 635 637 644 671 686 706 723 725 726 730 732 767 806 807 829 852 869 902 897 912 927 957 994 996 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[40 44 45 46 121 89 141 155 167 179 207 226 263 265 327 337 338 364 373 453 456 478 512 537 543 561 568 577 637 604 641 648 672 687 697 709 701 737 789 808 813 819 820 828 835 911 921 938 947 964 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[40 42 43 60 63 70 78 124 103 131 133 149 161 164 170 227 232 260 266 275 316 323 368 335 372 377 413 418 420 441 553 463 574 576 643 656 665 678 733 741 743 815 762 883 908 928 930 968 974 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[16 78 79 134 151 219 224 240 251 280 295 388 406 483 489 505 507 534 538 539 549 554 555 564 573 583 609 660 672 681 687 711 732 738 745 746 783 792 812 834 837 841 887 866 908 957 961 978 987 994 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[18 20 33 34 35 54 94 123 140 162 169 220 205 250 258 278 299 320 349 362 397 434 492 449 499 504 508 515 531 552 606 647 652 678 695 703 714 735 763 785 836 799 854 858 863 864 929 933 960 984 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 17 37 50 66 96 99 155 107 184 218 257 260 279 285 327 332 337 354 369 398 430 423 437 574 631 656 660 668 676 680 700 709 750 747 761 789 774 813 857 860 886 898 904 949 952 964 976 984 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 78 23 90 101 106 132 141 146 191 206 222 244 270 304 325 332 379 383 392 401 412 417 436 454 465 487 551 499 553 557 562 570 581 613 650 682 691 732 781 782 789 814 816 844 890 965 971 986 998 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[20 65 69 128 131 157 173 175 211 194 216 229 266 278 286 292 320 335 377 358 423 424 463 472 529 531 545 553 557 576 589 585 601 613 657 672 699 711 725 786 789 810 897 923 936 960 996 969 997 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 54 61 67 119 131 153 167 178 199 197 246 256 273 329 321 348 350 353 392 394 402 413 486 511 530 515 539 569 582 586 594 686 763 819 821 829 840 832 848 858 864 870 904 933 944 947 952 967 998 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 40 106 68 118 132 148 162 180 182 200 207 246 283 287 288 320 295 321 325 338 343 349 362 364 371 378 418 503 535 554 562 568 571 577 587 682 699 760 709 769 844 920 938 941 948 960 973 977 983 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 38 43 45 67 75 150 154 173 178 184 189 254 227 278 282 289 315 297 365 373 396 403 505 509 513 521 555 580 583 600 614 643 649 667 678 695 722 732 761 801 824 805 841 879 894 915 926 930 975 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[56 65 94 119 149 165 157 166 198 220 297 302 305 316 321 327 351 347 359 368 380 386 387 403 431 447 448 449 463 528 533 556 562 590 634 610 640 658 693 750 786 759 792 800 825 842 864 889 911 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[5 11 40 95 110 134 138 160 187 208 228 210 240 278 352 354 381 390 414 503 440 507 513 526 528 534 540 543 570 604 609 613 625 632 647 653 658 661 668 708 718 780 846 855 862 860 891 910 936 949 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[6 57 71 73 100 112 134 165 173 189 190 194 197 227 239 229 246 252 278 288 316 319 371 393 450 462 521 585 567 620 625 636 654 689 675 694 701 716 720 741 743 746 820 868 873 879 935 938 979 989 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[5 50 77 74 113 128 129 169 173 179 201 210 228 236 242 251 255 262 279 283 301 369 373 387 380 412 417 441 444 459 476 492 493 532 541 574 644 646 665 720 728 773 802 810 821 853 849 860 912 964 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[10 21 84 97 107 109 123 120 128 137 143 161 254 266 278 301 307 315 361 389 395 408 492 517 549 584 551 597 602 603 618 648 653 657 658 682 723 753 790 799 820 824 831 844 855 866 858 894 916 918 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 4 3 3 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 43 49 54 80 84 104 107 149 171 180 197 210 226 312 340 347 356 363 387 407 420 439 463 478 465 485 499 568 590 598 627 646 654 656 675 693 707 760 761 776 798 840 853 856 909 929 947 951 984 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[49 60 70 76 80 96 144 161 203 269 274 296 343 346 400 359 401 428 430 451 454 455 477 480 500 506 522 591 573 598 653 655 657 733 748 736 763 771 784 813 835 855 869 894 920 932 948 956 981 986 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 4 6 7 10 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[26 37 95 122 117 149 183 194 195 239 245 253 272 285 287 330 300 335 349 371 380 390 401 421 489 426 519 521 538 598 626 640 645 665 685 698 704 712 723 791 822 834 859 860 920 900 960 977 986 997 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[70 76 80 97 102 105 113 157 141 161 163 217 251 295 310 320 323 350 355 357 390 391 397 422 428 460 486 472 487 536 570 579 631 665 666 676 681 683 690 693 705 726 813 819 821 850 874 916 935 999 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[51 58 63 80 90 120 157 164 172 190 208 259 278 336 324 348 368 374 379 383 426 436 446 506 536 553 569 589 591 596 637 607 645 708 716 725 735 741 745 764 773 831 884 853 902 905 956 978 982 997 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[33 40 65 72 122 84 130 137 156 227 255 314 333 335 343 345 350 372 373 374 387 417 404 422 433 469 470 495 499 532 571 580 603 630 622 653 660 681 698 752 801 808 816 836 859 889 909 931 961 962 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 42 34 53 59 87 98 141 143 158 188 221 317 319 324 351 346 359 374 390 393 407 430 458 485 488 502 514 559 567 595 598 596 610 629 631 647 719 699 759 769 782 803 805 907 928 934 943 983 987 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[59 61 82 96 100 160 176 194 242 223 259 266 275 282 318 328 357 349 367 370 376 409 416 442 447 475 489 504 507 553 598 603 637 616 684 710 722 712 756 776 783 784 806 814 833 847 879 922 973 992 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 87 98 120 173 139 184 187 214 222 276 310 333 348 356 364 376 382 401 461 422 475 501 509 524 575 579 588 594 596 622 624 652 683 699 751 737 781 827 831 844 863 868 875 892 909 910 975 977 980 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[119 152 207 221 215 245 250 257 269 327 336 345 370 371 382 404 408 440 443 448 458 492 498 509 609 580 614 620 623 653 692 709 713 723 743 760 770 812 784 814 830 862 875 877 916 926 932 947 963 984 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[6 25 46 48 85 102 114 126 179 223 233 238 243 294 276 330 338 386 349 387 418 423 434 463 470 474 487 523 546 559 591 634 667 671 681 696 739 752 772 791 808 830 840 873 862 882 959 965 978 995 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 35 39 58 88 73 89 108 143 186 196 243 253 270 297 271 349 358 368 369 402 420 453 459 464 489 499 568 607 646 653 705 710 712 717 716 721 780 743 793 826 849 916 918 947 950 958 959 961 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 57 88 92 162 186 187 268 297 307 310 342 332 368 391 402 408 422 435 487 447 522 530 535 546 558 571 574 594 628 631 648 651 660 664 675 693 707 715 738 718 762 794 851 853 854 870 902 935 980 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[16 36 61 88 110 205 120 230 243 264 265 270 297 313 316 317 342 346 391 368 401 411 441 472 574 584 587 591 605 645 618 670 675 693 695 736 741 796 804 801 811 824 829 884 915 929 934 984 989 990 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[27 41 59 70 96 145 149 175 274 264 278 297 298 358 361 392 403 413 432 444 480 498 520 542 544 622 626 631 636 641 692 704 715 736 740 805 818 823 828 856 865 875 890 891 913 931 941 966 977 991 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[39 44 48 56 62 94 105 109 195 210 199 211 223 272 311 317 419 435 446 448 467 472 492 483 536 540 609 610 646 638 710 719 740 781 795 798 814 835 858 861 869 876 903 913 936 931 948 965 968 999 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[17 19 42 49 88 94 130 149 215 250 251 288 297 326 334 335 344 372 377 411 406 425 429 436 440 478 488 496 550 554 560 578 585 594 603 607 608 610 631 796 813 820 850 901 937 979 955 989 990 997 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 5 7 21 26 52 128 154 168 192 195 209 225 282 227 284 352 355 363 395 406 432 443 478 501 513 553 577 625 624 658 672 696 699 733 739 750 760 768 817 822 861 869 870 883 913 978 931 993 994 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 18 20 78 110 111 114 117 123 126 138 180 198 214 235 250 286 316 335 409 422 475 476 525 527 593 615 634 657 672 664 682 711 727 729 740 761 781 790 820 837 840 842 853 868 896 971 981 986 995 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 17 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[8 4 42 77 104 141 158 169 192 217 234 244 340 356 343 367 374 393 427 430 433 468 475 477 481 483 507 526 549 557 609 616 611 644 645 678 695 704 758 745 772 794 803 806 825 836 841 858 885 943 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[15 49 77 101 107 140 129 151 156 158 185 219 224 235 236 243 264 271 302 304 329 335 346 435 436 453 472 479 480 496 563 568 571 591 633 673 651 712 718 741 765 775 782 815 859 893 912 918 935 988 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[26 69 77 115 121 141 151 217 243 244 275 293 301 309 313 341 345 366 365 372 391 398 510 516 518 520 542 522 553 572 652 657 660 661 674 705 717 723 789 799 810 849 856 859 876 900 906 942 996 1000 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[7 26 40 48 55 100 118 139 205 246 235 248 269 292 297 356 361 372 393 403 417 435 491 533 544 555 569 572 582 599 597 636 676 692 730 702 758 767 802 807 808 850 884 889 903 911 912 946 968 975 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 48 100 115 131 180 204 205 214 218 247 284 316 289 335 362 382 391 399 403 410 468 469 546 479 550 559 571 592 603 647 654 735 746 751 768 796 795 808 853 859 881 882 905 936 938 941 949 968 981 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[23 57 72 82 90 121 131 165 149 228 243 252 274 285 289 290 306 349 366 385 399 394 405 464 473 530 562 568 604 665 684 693 741 759 797 800 804 805 860 861 866 881 872 885 891 904 905 972 985 995 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[84 29 96 105 134 147 175 179 224 238 255 263 281 290 295 331 332 357 366 406 422 427 442 474 495 509 510 578 606 613 635 665 676 695 714 719 722 726 732 816 819 820 886 915 957 972 975 984 985 991 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 61 76 82 106 122 128 142 136 164 182 183 251 263 332 325 334 385 400 402 410 446 490 504 508 556 571 609 623 629 638 644 660 709 694 714 726 776 793 794 834 842 847 857 899 901 944 919 990 997 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 28 34 47 37 66 116 143 171 213 235 247 309 320 351 330 370 386 397 415 416 474 484 495 512 513 522 572 594 642 681 643 689 707 732 756 760 773 777 799 795 800 830 840 853 866 867 899 951 975 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 12 16 63 79 82 104 121 109 123 141 152 164 208 243 277 327 358 363 382 410 451 483 502 516 524 590 630 633 657 687 658 696 703 706 739 745 761 774 769 780 841 872 880 883 926 929 954 956 986 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 10 17 73 102 122 188 246 252 299 318 325 336 338 343 363 388 401 402 410 419 425 433 435 463 524 535 567 590 637 671 677 698 716 752 753 773 779 797 874 893 896 895 918 921 923 928 940 957 969 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[41 53 50 80 104 122 127 131 148 171 198 235 254 258 299 300 312 334 355 390 404 442 424 445 469 509 545 544 598 639 647 651 653 692 702 747 800 810 822 826 865 868 871 921 938 942 949 948 960 965 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[51 60 84 94 114 121 125 128 138 134 178 192 195 252 277 328 342 333 418 419 462 482 512 550 578 582 584 607 611 612 614 636 680 659 714 733 735 736 743 783 791 792 798 824 864 879 866 910 951 961 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 55 33 60 118 148 253 278 287 289 308 337 339 350 359 385 392 398 417 420 462 511 555 568 587 596 602 643 655 670 692 700 696 734 766 770 793 817 818 855 859 874 884 897 911 915 920 923 938 999 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[9 22 26 48 38 98 110 132 135 156 160 163 180 220 262 266 283 292 316 311 335 363 411 412 424 436 484 502 540 541 571 545 572 585 610 633 656 679 743 764 754 812 814 870 880 902 949 964 985 997 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 3 2 1 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[10 23 27 39 56 73 125 164 171 184 195 209 213 232 244 260 264 447 459 465 478 486 519 520 543 554 556 570 579 586 595 596 621 637 644 673 657 677 678 680 688 704 754 763 880 891 910 912 942 984 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[18 16 37 54 59 75 91 101 142 154 194 199 205 234 259 268 317 284 342 351 363 378 417 418 425 491 505 536 563 608 617 624 649 688 709 716 727 821 824 829 850 832 893 903 950 955 957 964 979 988 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[12 61 20 64 70 81 150 158 170 175 201 282 304 307 338 391 366 397 407 428 432 473 492 501 508 533 563 557 579 589 603 631 636 645 648 656 714 685 718 740 742 814 824 842 863 871 927 941 965 986 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[6 14 24 31 39 48 52 60 82 125 164 141 195 213 234 239 255 287 318 334 357 387 369 410 417 421 431 444 446 510 514 547 680 653 684 709 720 765 791 802 823 840 858 871 891 892 950 927 983 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[12 15 37 48 71 74 101 95 104 148 153 162 208 215 269 227 320 356 359 372 406 455 463 477 486 498 559 596 645 651 664 693 665 751 756 779 785 827 804 844 852 874 887 904 905 936 961 982 983 991 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 65 68 71 124 173 181 190 195 204 221 220 304 339 321 352 362 363 368 369 403 415 490 514 520 536 548 550 586 589 592 623 655 638 700 744 755 762 779 789 842 850 865 881 916 924 956 938 987 998 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[48 52 94 107 134 113 186 202 231 233 253 257 274 296 324 332 338 351 356 357 358 393 489 482 519 527 534 537 560 568 604 612 611 617 705 707 730 755 782 812 784 828 867 916 937 948 966 967 971 988 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[55 15 107 117 155 157 198 236 240 245 285 288 302 364 376 380 402 416 421 434 478 488 501 504 567 568 629 644 646 673 657 686 690 740 744 755 769 770 783 792 818 860 855 865 904 905 917 935 971 984 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[80 30 92 103 143 182 200 202 217 222 229 245 273 278 283 303 360 445 446 466 486 489 505 516 547 576 614 630 624 643 671 695 697 709 715 730 739 743 746 768 786 810 872 888 949 938 951 952 959 982 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[41 61 83 126 142 188 214 218 242 249 269 265 315 334 362 369 371 438 454 459 484 464 485 497 501 522 548 568 586 605 614 686 654 701 706 726 732 736 742 765 792 810 823 842 832 846 853 877 891 980 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[20 22 27 74 91 77 144 147 154 269 287 327 328 348 349 386 432 433 438 470 491 550 556 586 588 592 610 640 686 716 722 733 734 736 740 758 779 796 804 805 836 857 901 912 938 940 942 981 990 989 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 13 52 28 149 156 187 223 262 268 269 292 309 332 347 379 373 462 484 501 505 506 524 527 539 544 627 656 660 666 669 677 704 679 712 752 780 783 863 877 882 891 904 937 910 970 979 988 993 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[16 46 60 67 71 77 81 102 123 140 143 145 178 249 271 260 336 366 409 470 471 489 497 529 536 596 597 610 664 662 673 677 694 698 718 742 755 759 783 807 850 844 879 880 903 913 915 922 945 959 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[988 988 988 988 988 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[7 13 14 122 128 154 170 184 193 191 224 241 260 296 299 305 311 316 375 381 424 425 429 437 476 477 488 503 546 532 564 585 665 669 677 689 823 838 831 857 859 877 883 897 918 927 935 948 973 987 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-05T02:13:07.000Z","updated_at":"2026-03-11T10:04:13.000Z","published_at":"2013-10-05T03:12: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\",\"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\u003eThis Challenge is derived from\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=\\\"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Ocean View\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. This is the Small data set witn N\u0026lt;=50 and Q\u0026lt;=4, guaranteed.\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\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\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\u003eSuccinct Challenge statement:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V , Vector length N\u0026lt;=50 with values 1 thru 1000.\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Q , minimum quantity of removed values to produce a valid vector [0: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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [V] [Q]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 4 3 3] [2]  for [1 4] or [1 3]\\n[1 2 3 4 5] [0]\\n[4 3 2 1] [3]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCommentary:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) The GJam Small test suite is not robust\\n2) nchoosek(50,4) is too slow for Cody and the 100 cases\\n3) The Large test suite is N\u003c=1000 with some delete cases \u003e4\\n4) A Good Algorithm that solves the Large case is usually best to pursue\\n5) GJam Competition allows one Large submission within 10 minutes of download \\n6) \u003cLarge Suite Challenge\u003e]]\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":2580,"title":"Sum of series VI","description":"What is the sum of the following sequence:\r\n\r\n Σk⋅k! for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σk⋅k! for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesVI(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 5;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 23;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 5;\r\ns_correct = 719;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 8;\r\ns_correct = 362879;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 39916799;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 12;\r\ns_correct = 6227020799;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 15;\r\ns_correct = 20922789887999;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1627,"test_suite_updated_at":"2017-06-13T18:10:27.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:14:09.000Z","updated_at":"2026-03-28T09:16:37.000Z","published_at":"2014-09-10T10:14:54.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σk⋅k! for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":2578,"title":"Sum of series IV","description":"What is the sum of the following sequence:\r\n\r\n Σ(-1)^(k+1) (2k-1)^2 for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(-1)^(k+1) (2k-1)^2 for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesIV(n)\r\n  s = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = -8;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 17;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 4;\r\ns_correct = -32;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 7;\r\ns_correct = 97;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 12;\r\ns_correct = -288;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 33;\r\ns_correct = 2177;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 59;\r\ns_correct = 6961;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1718,"test_suite_updated_at":"2017-06-13T18:05:44.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:01:03.000Z","updated_at":"2026-04-11T00:28:05.000Z","published_at":"2014-09-10T10:01:33.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(-1)^(k+1) (2k-1)^2 for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":566,"title":"Sum of first n terms of a harmonic progression","description":"Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; 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: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; transform-origin: 332px 21px; vertical-align: baseline; perspective-origin: 332px 21px; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; transform-origin: 309px 21px; white-space: pre-wrap; perspective-origin: 309px 21px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; transform-origin: 0px 0px; perspective-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = harmonicSum(a,d,n)\r\n  s=0;\r\nend","test_suite":"%%\r\na=1;d=1;n=1;\r\ny_correct = 1;\r\nassert(isequal(harmonicSum(a,d,n),y_correct));\r\n\r\n%%\r\na=2;d=2;n=5;\r\ny_correct = round(3.5746,4);\r\nassert(isequal(round(harmonicSum(a,d,n),4),y_correct));\r\n\r\n%%\r\na=4;d=5;n=2;\r\ny_correct = round(4.6667,4);\r\nassert(isequal(round(harmonicSum(a,d,n),4),y_correct));","published":true,"deleted":false,"likes_count":3,"comments_count":14,"created_by":2974,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":501,"test_suite_updated_at":"2020-09-29T02:43:20.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2012-04-08T16:38:19.000Z","updated_at":"2026-04-01T16:06:03.000Z","published_at":"2012-04-08T18:58:53.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\u003eGiven inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....\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":52779,"title":"Easy Sequences 25: Product of Series","description":"The function 'P(n)' is defined as the series product:\r\n                            \r\nwhere 'T(n)' is the triangular sum:\r\n                            \r\nIt can be proven that P(n) is convergent, with:\r\n                            \r\nWrite a function that outputs the integer value of 'n' when '3 - P(n)' first becomes less than or equal to a given tolerance 't'.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440000534057617px; 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: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 256px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eThe function 'P(n)' is defined as the series product:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 46px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-17px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"124.5\" height=\"46\" style=\"width: 124.5px; height: 46px;\"\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003ewhere 'T(n)' is the triangular sum:\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAAmCAYAAADducBhAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABcKADAAQAAAABAAAAJgAAAACGg907AAAMCklEQVR4Ae1cfdBWRRU3fCWkwAjUEZRQKEIZ1CF0wI8S8IvApg9sFM03HbQcI8sx6w9DyxgiSVNrRLNQrCbyIwd1wigNSkgHP5JIFKUMfImw8hMx1H6/993DbJfdvfc+d5+HvS/nzPze3XvO2b3nnN177u7eB3bbTUkjoBHQCGgENAIaAY2ARkAjoBHQCGgENAIaAY2ARkAjoBHQCGgENAIaAY2ARkAjoBHQCGgEOiPQH38XATMjxWMa+nkQODBSf9qNRkAjoBFIOgLv2EnW9cN9lwP/BY4GXgSqUhs6uAsYA4wFngG6Cw2BIzOAWcBmoC40FIaOA0YBvYA/Ahz3Oo0N5+cRwHBgA0D7VwAvA3WlATB8DvAscEVdnVC7/RE4DqL/VMA/0fY9/u47E+3zkA8O6DQiejcaPQI8CjBh1J0OgAPzgDeAt4FhQB1oDxjJnZXYTdttzMf17kDKNAjG3Q3YdkudiXxkysbn2PZL4xd3rErdMAKz4ZNM1n+g/jNgLvANi0/5H4CLge8DawFpwze7j74EwTZgtE+hIn8g2m8EbqrYz85szuRxHbAVkJiyrEsCvzFjt+2D1O+ETk8gReoNo7gIoK0rgV+YUmxn+S8gtEiBOEmaDqvED03gSQ5RdaO4iuXxBgfbPmZhcpTBZ3kGYNO5uCD/Bptp1bkV5arsRxavGdUZ6JR2nN2MzlvQ5+24xzeBMwGOg8S8Dgn8eGPvKpQTAO6E9gJOAP4EiC8sJwMp0tUwagtwasY4fl/5MyA+fCIjT/3y/TDwFct+TeCpj1gD9u2NNm8Bn3e0PQs8mbzU2SejsweumXCmZvi85ItgDcAEPgRoJjFpbAA4WXmsUmdiIpSYNyOBn4L+lwL8oByDFqOT9cC+js72BM/eqV3l0GmEFdOHvjCA59sf9xjCuS3jcaVHpxF2TB9c928Dk98g1gGvA/QhdgLnropzqW4vNphciJo9RoWMyFPiBF0NuM4obwVfJi+3li7itr+/Q3AMeGz7Y4esGayLzP3qugqXmKwwfjB2zUjg55n+N8sNK5R8WXL8Twv0wV2FzKFHAnplRDF9OAw35u7HR8dCIPZ/wafUAD+mD67b06c3AT6HmwD6EDuBd5h+L0DZHanZY1Q6Zj0cLe4B7ziAg20TV9DcHgtxpZUl6vAt9UJWgGs+uCT23wq619ykvRU303t0RuAg/OUKbGEgHjxbFuIuLjV6DAZdGjCKCZxE25d01tL/cxRM/BrAX54sS99ctbBoBLitytJrYBBZGgXGPhbzV1ZdqnyruxI7jzROBSi/H8ijAVA43OBplNyakd4HTAGGAncDvwF89BcINgLHAFy5cuuu1NwI8Izbfsm77sbtu9CzUqlJySNCOR7gipZzLHXqAwMXABybr6du7C5qX4x8lxu6i6HBBEy8BHAyFyWu6Nkub8s8Fzrrja7caxquSZ8FXgGEz3IMEKKfQki96SGlxGV1OkIpEsqJUJIxPL1IgwI6rdja8pcp9xrbZxawqaxKs3y4GYbwg+zBlkGbUOcY6BGKFZQC1dhjVDnfuY5QfH7YKyuufPmxsigNNoqrcxrw1ytfBqTvbajzoZkB3Ghgr/w/BF6InjTCA0JKHtkd4L8QARM8/e+q7CnGcf48lTFOnfiMnAz83pS0l99XOCdTp6kw8DPAJUDes5e6L93Rvsr5rq1gVHgEwqMIITuJCi9U7m+ETIghWgMht9VbAa7wlwEfAWYDk4D7gC8CJwGkdV2F96/cT+7vVXQI+oD3Xge/LKvMTqVs33XT5yr2NGM0E6B9nJKiL7T3CeCgjHGcG98D+M2HZYrEOT8P+DVwbYoGqk2dv8qrlO+KJnAmbyZxocVSKVgOMnpFfukwFrr8NQOJ53bcAp4LMHmTRnUVnX8ft+quapUEzpcG/wFHVVpZtYNu1J5HD3sDCw1Sd+01GHg0wH+wMwy4EBgPCF2OCo/p+C+PUyK+WPjc8Jik3ZQolBKMQMx853VvDiScDIQcS3iVHQJ+hGTbIj8vusLoUv9vALcZNq3BBWWrbKanzpU6dR/2yOvAXmF8oB9MImXpSDTgi8yHVyFj328FdNh2EVCFeNzFo7GHAP4evAyl4gMT4+eAlwHGjDgdKEKt9OEiGETbeITiok1gUl72DJxHXr55RD7nEPvlnArp8aWYIrVyjMT/SvmuTXrJKU+w5GVX32zKj4+kXl1F8K99r63Q5KpHaDAqHzAXReyQRLFNOtgFS45xkaMgJqeQXt8KseN2/i7gOeAUYAtQhlLwgfYyOV0PDAEuAUgf7Cpy/7bKB9ozC+BC5yXgRCBLfQyDOwuRc7fBI8sQsV1ojkjb3qgQPkr1WLFVY2THpVK+o8F5tC8U7GOLsuff7H+9uUl/U/oKykdbQq52OLGEbGflSEVkrlLuJ/d36XR3Hn93PR3o4XF0CviTAb4sZ3h0yO4IyEIiJv5FRmEiyo0hZY9sZ/uQNYvPgCTwflmh57pVPjCB9wSGA3nP6ghLh2exQ4EQXQZh6Fhxnml8G0qevfuIL5cUqVVjJL7HznfS7/+V03DFlQfxOhB6s0LspPPBZfvscUhW+dNGj7qLs0Jc/9zIt6CU1bVDbTvrq0b/qu2c4pU7oBraBhaVTSh+S6fmCnAl/sOcGtWY55n+N1frxtmaY/Q7gH0f7NSIw2ymDy4LmSDfBDguoZeeq62PF8uHj+EGtC0EmU8sRe8pn2El+B3QZZ8XlGhTJ9VYYyQ+V853bdJToDzeki1F3V4RW6JgVVbAA4NaXf/hkahcLRVTcgUpyZBbPSbxPNrPKMj98/RtedHtot3GVU91u+iyNSaPfnMldjjAcVsNuKgdTMoecgkT5fHoQXY0TyRmI4+qds+xaRPk/Ji8HBiXo6vi5kXAPlFoKN+VTeD3N+jLk6YdJwsnPj92uEgc4lf97BaMiUCORO4zjW9CuQB4wFxni2MN4/GsoMD1bOiEtosFuuhUWVlU0aPHs+m6Ecf4VmA8cDLg+4jM8bkeOBSoE33UGPsYygfqZHgNbeX3k1HAEuCNjP18UXGOrQPWZmS8DLV1qLecFTvf7eAAHzBuiQQTd9AozuAKi/2M9jQZYeTUucGhc6ElZzL/FvA0sBfgogFg8kWxAWBCqSv9FYZL/Ec2wYnY20K+cH5obH4e5XwHbgHvUYDb96VAVYrpAxcJtJ8LgyMdhnHlyh3dNqDK85DtOqYP2b6z11yBc049mBVUvO4w/cY6QhmL/hhn2nonkKV7wKCMz/lhGWFe24x6ocuYYxQ73+3gAH/2tQaQ5MHyKwC3xo3Q+Wgkfbja2wl6skNhjmnPPpYBLwJ8M/toKgTU/Y5PIXE+Vxd2TOjLXKDR+PvcjTkpeY/vArS1KM5ko4oU04dzYIvYzsTwE4A7hIHAp4DnAH4L+iQQk2L6kGdXXRL4t+GIjAVf9r0sx96FOsdH5LMsGauhthnVwpcxx8h+tmPku+1O8Cv2vwEJTLbkGfh8oCz1QwNO/KcAJqcsLQSD93oV2DMrxPUkQAZsA+rjHDo2awku2F8oydv6KdV5fMOfXmZjz2u+uFYBsSjmpDwKRrls9vE4z1xjXda3mD70xc3/7vCDc+8Z4AfA/kBsiulDnm18CXFMfpunWFLeYfqNtQI/Cf3JM589UqVpy839uEr/MBkW5bW1VAtXY45R7HxX2IkqitegMSdOe4OdHIJ23BrlPfQcTN6HQVIKR2A6xIzV5rBa0tLYPvSCtycCZwNnAWMArviaSbF9aKatvr65sOJcipXAeZ8RwHigBy8y1BvXTNSDMny5DLUVnTJlq8eoaL4r40Ml3Xei9cMAVzI9K/UUbrwU4rUAV1NK4QjwIeBu5oiwWtJS9SGN4RkOMziX9kvDnOhWdId5VjkoQ9ADf0O9oHJP7g4uBXsr4PtY6m6lXI2ARkAjoBEoFIFJ0OLZ1uWFtIsrTYNq7C1c8burpkZAI6AR2EUi0A4/uVLmr0ViED+g8SPpzBidaR8aAY2ARkAjEI7ASIj5m+4YJOdvMfrSPjQCGgGNgEZAI6AR0AhoBDQCGgGNgEZAI6AR0AhoBDQCGgGNgEZAI6AR0AhoBDQCGgGNgEZAI6AR0AhoBMpE4H9KaYXHY1N8mwAAAABJRU5ErkJggg==\" width=\"184\" height=\"19\" style=\"width: 184px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eIt can be proven that P(n) is convergent, with:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 30px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-15px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"83.5\" height=\"29\" style=\"width: 83.5px; height: 29px;\"\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; text-align: left; 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; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eWrite a function that outputs the integer value of 'n' when '3 - P(n)' \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; \"\u003e\u003cspan style=\"font-weight: bold; text-decoration: underline; text-decoration-line: underline; \"\u003efirst\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; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003e becomes less than or equal to a given tolerance 't'.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function n = N(t)\r\n    n = N(t); \r\nend","test_suite":"%%\r\nt = 1;\r\nn_correct = 4;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.5;\r\nn_correct = 10;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.01;\r\nn_correct = 598;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.007;\r\nn_correct = 856;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.00032;\r\nn_correct = 18748;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nts = 10.^[-1:-1:-8]*3;\r\nns = arrayfun(@(t) N(t),ts); \r\nss_correct = 222222205;\r\nassert(isequal(sum(ns),ss_correct))\r\n%%\r\nt = 0.0000000026;\r\nn_correct = 2307692306;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nfiletext = fileread('n.m');\r\nnot_allowed = contains(filetext, 'persistent') || contains(filetext, 'global') || contains(filetext, 'BigInteger') || contains(filetext, 'java'); \r\nassert(~not_allowed)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":255988,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2021-09-24T21:04:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-09-24T20:12:14.000Z","updated_at":"2025-12-22T16:55:44.000Z","published_at":"2021-09-24T20:44:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe function 'P(n)' is defined as the series product:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eP(n)=\\\\prod_{k=2}^{n}\\\\frac{T(k)}{T(k)-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\u003ewhere 'T(n)' is the triangular sum:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eT(n) = 1 + 2 + 3 + 4 + ...+n\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\u003eIt can be proven that P(n) is convergent, with:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\lim_{n\\\\rightarrow \\\\infty}P(n) = 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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWrite a function that outputs the integer value of 'n' when '3 - P(n)' \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efirst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e becomes less than or equal to a given tolerance 't'.\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":45339,"title":"XOR fibonacci","description":"a \u0026 b are the first two terms in the xor fibonacci sequence. Find the nth term of that sequence.\r\n\r\nXOR fib sequence is that in which any term is the xor of the previous two terms.","description_html":"\u003cp\u003ea \u0026 b are the first two terms in the xor fibonacci sequence. Find the nth term of that sequence.\u003c/p\u003e\u003cp\u003eXOR fib sequence is that in which any term is the xor of the previous two terms.\u003c/p\u003e","function_template":"function y = fib_xor(a,b,n)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(fib_xor(1,2,34),1))\r\n\r\n%%\r\nassert(isequal(fib_xor(123,22,57),109))\r\n\r\n%%\r\nassert(isequal(fib_xor(3,7,98),7))\r\n\r\n%%\r\nassert(isequal(fib_xor(3,7,1),3))\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":22,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-17T07:46:31.000Z","updated_at":"2026-01-19T18:17:31.000Z","published_at":"2020-02-17T07:46:58.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 \u0026amp; b are the first two terms in the xor fibonacci sequence. Find the nth term of that 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eXOR fib sequence is that in which any term is the xor of the previous two terms.\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":44523,"title":"Pattern Sum","description":"Write a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: \r\nk + kk + kkk + .... (the last number in the sequence should have m digits) \r\nFor example, if the two integers are:\r\n(4, 5).\r\nYour function should return the total sum of: \r\n4 + 44 + 444 + 4444 + 44444.\r\nNotice the last number in this sequence has 5 digits. The return value should be 49380.","description_html":"\u003cp\u003eWrite a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: \r\nk + kk + kkk + .... (the last number in the sequence should have m digits) \r\nFor example, if the two integers are:\r\n(4, 5).\r\nYour function should return the total sum of: \r\n4 + 44 + 444 + 4444 + 44444.\r\nNotice the last number in this sequence has 5 digits. The return value should be 49380.\u003c/p\u003e","function_template":"function y = pattern_sum(a,b)\r\n    \r\nend","test_suite":"%%\r\na = 4;\r\nb = 5;\r\ny_correct = 49380;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 7;\r\nb = 4;\r\ny_correct = 8638;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 5;\r\nb = 3;\r\ny_correct = 615;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 1;\r\nb = 1;\r\ny_correct = 1;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 2;\r\nb = 2;\r\ny_correct = 24;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 9;\r\nb = 9;\r\ny_correct = 1111111101;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 0;\r\nb = 0;\r\ny_correct = 0;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 3;\r\nb = 8;\r\ny_correct = 37037034;\r\nassert(isequal(pattern_sum(a,b),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":181342,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":237,"test_suite_updated_at":"2018-07-13T17:24:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-02-15T01:05:11.000Z","updated_at":"2026-03-24T20:17:24.000Z","published_at":"2018-02-15T01:18:20.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\u003eWrite a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: k + kk + kkk + .... (the last number in the sequence should have m digits) For example, if the two integers are: (4, 5). Your function should return the total sum of: 4 + 44 + 444 + 4444 + 44444. Notice the last number in this sequence has 5 digits. The return value should be 49380.\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":54265,"title":"n-th digit of write-down all numbers","description":"Write down number as\r\n123456789101112131415161718192021222324252627282930...\r\nwhat's the n-th digit? input n and get the digit.","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: 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite down number as\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=\"\"\u003e123456789101112131415161718192021222324252627282930...\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=\"\"\u003ewhat's the n-th digit? input n and get the digit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = ndigit(x)\r\n  y = 3; % whatever\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 9;\r\ny_correct = 9;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = 1;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 11;\r\ny_correct = 0;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 190;\r\ny_correct = 1;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 191;\r\ny_correct = 0;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 1001;\r\ny_correct = 7;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 10000001;\r\ny_correct = 3;\r\nassert(isequal(ndigit(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-04-13T01:16:09.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":"2022-04-13T01:16:09.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-13T01:11:32.000Z","updated_at":"2026-01-28T12:32:50.000Z","published_at":"2022-04-13T01:11:58.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite down number as\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\u003e123456789101112131415161718192021222324252627282930...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhat's the n-th digit? input n and get the digit.\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":45383,"title":"$10,000 sequence","description":"Find the nth term of the Hofstadter–Conway sequence and its chaotic cousin.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Hofstadter_sequence\u003e\r\n\r\n","description_html":"\u003cp\u003eFind the nth term of the Hofstadter–Conway sequence and its chaotic cousin.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Hofstadter_sequence\"\u003ehttps://en.wikipedia.org/wiki/Hofstadter_sequence\u003c/a\u003e\u003c/p\u003e","function_template":"function y= Hofstadter(n)","test_suite":"%%\r\nassert(isequal(Hofstadter(50),[29,26]))\r\n%%\r\nassert(isequal(Hofstadter(5),[3,2]))\r\n%%\r\nassert(isequal(Hofstadter(500),[255,254]))\r\n%%\r\nassert(isequal(Hofstadter(73),[40,34]))\r\n%%\r\nassert(isequal(Hofstadter(1489),[819   695]))\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":15,"test_suite_updated_at":"2020-03-24T12:27:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-24T12:16:16.000Z","updated_at":"2020-03-24T12:27:19.000Z","published_at":"2020-03-24T12:27:19.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 term of the Hofstadter–Conway sequence and its chaotic cousin.\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/Hofstadter_sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Hofstadter_sequence\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":60837,"title":"Project Euler Problem 48: Self Powers","description":"The series,.\r\nReturn a string of the last ten digits of the series:.\r\n\r\nHint: Use modular arithmetic! \r\nSpoiler: The solution is in the test suite\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(255, 255, 255); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(255, 255, 255); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 171px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 85.5px; transform-origin: 408px 85.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: 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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe series,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"245.5\" height=\"19\" style=\"width: 245.5px; height: 19px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn a string of the last ten digits of the series:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"169.5\" height=\"19\" style=\"width: 169.5px; height: 19px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\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 0px; transform-origin: 0px 0px; 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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHint: Use modular arithmetic! \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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSpoiler: The solution is in the test suite\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 0px; transform-origin: 0px 0px; 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 digits_string = selfPowerSeries()\r\n  digits_string = '0123456789';\r\nend","test_suite":"%% \r\nm = 10^10\r\nsum = 0;\r\nfor i = 1:1000\r\n    \r\n    modulo = mod(i, m);\r\n\r\n    for j = 1:i-1\r\n        modulo = mod(modulo * i, m);\r\n    end\r\n    \r\n    sum = sum + modulo;\r\nend\r\n\r\ny_correct = num2str(sum)\r\ny_correct = y_correct(end-9:end)\r\n\r\nassert(isequal(selfPowerSeries(),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":2601620,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-04-02T00:34:14.000Z","updated_at":"2025-07-18T08:50:42.000Z","published_at":"2025-04-02T00:34:14.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe series,\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\u003e1^1+2^2+3^3+...+10^{10}=10405071317\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn a string of the last ten digits of the series:\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\u003e1^1+2^2+3^3+...+1000^{1000}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003eHint: Use modular arithmetic! \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\u003eSpoiler: The solution is in the test suite\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2581,"title":"Sum of series VII","description":"What is the sum of the following sequence:\r\n\r\n Σ(km^k)/(k+m)! for k=1...n\r\n\r\nfor different n and m?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(km^k)/(k+m)! for k=1...n\u003c/pre\u003e\u003cp\u003efor different n and m?\u003c/p\u003e","function_template":"function s = sumOfSeriesVII(n,m)\r\ns = n+m;\r\nend","test_suite":"%%\r\nn = 1; m = 1;\r\ns_correct = 1/2;\r\nassert(isequal(sumOfSeriesVII(n,m),s_correct))\r\n\r\n%%\r\nn = 1; m = 2;\r\ns_correct = 1/3;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003ceps)\r\n\r\n%%\r\nn = 3; m = 3;\r\ns_correct = 0.3875;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003ceps)\r\n\r\n%%\r\nn = 4; m = 2;\r\ns_correct = 0.955555555555556;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 7; m = 5;\r\ns_correct = 0.0408511683468281;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 5; m = 7;\r\ns_correct = 0.00114327593060232;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 10; m = 3;\r\ns_correct = 0.499971551885614;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 14; m = 4;\r\ns_correct = 0.166666498956709;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 15; m = 11;\r\ns_correct = 2.75459255461393e-07;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)","published":true,"deleted":false,"likes_count":17,"comments_count":6,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1601,"test_suite_updated_at":"2017-06-13T18:13:20.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:26:13.000Z","updated_at":"2026-04-03T06:43:32.000Z","published_at":"2014-09-10T10:26:41.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(km^k)/(k+m)! for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different n and m?\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":45761,"title":"Sum of terms in a series 1 (★★★)","description":"Given x and n, compute the following sum:\r\n\r\n  |x|+|x|^(1/2)+|x|^(1/3)+|x|^(1/4)+|x|^(1/5) ... + |x|^(1/n)\r\n\r\nwhere ||x|| indicates the absolute value of x. Thus, if x = -5 and n = 3, then the sum is (up to n =3 terms)\r\n\r\n  |-5|+|-5|^(1/2)+|-5|^(1/3)\r\n= 5+5^(1/2)+5^(1/3)\r\n= 8.946\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 191.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 95.65px; transform-origin: 407px 95.65px; 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: 131.525px 10.5px; transform-origin: 131.525px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven x and n, compute the following sum:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 26px; 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 13px; text-align: left; transform-origin: 384px 13px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"data:image/gif;base64,R0lGODlhoAEWALMAAP///wAAALq6unZ2doiIiJiYmNzc3KqqqhAQEGZmZiIiIkRERFRUVDIyMszMzO7u7iH5BAEAAAAALAAAAACgARYAAAT+EMhJq7046827/2AojmRpnmiqrmzrvuRzLNcAHMWQwJ5MW7aD4JB48Dq+GoVx5CSBgMTBkDA0r6ZnxYbtwg6HhqVgMBAkDK6XAhZXyAAE+ryutMdWCcFdn9zfVgwBCAV9hhl/FHCHUR47Ko8ckQAGfBM7Dm4FPyiTGpOVFo95DQ4rnhmglhKRBmGnjhShFY+FjDCoGKqiHgIDBANktiicG8UnxxnFsxMGwxIDasgey6vOzQR0KskY1RXXEgUPqybcF96ytr85ty3mFujNhQ/AQ0VbBxMCCALb1CvvKsSDZmTCAwUFif1rtmpAwgcC7vnrMBCAQwkHHowDuFACM4L+HqE9azeNoqyGRgoFMDUgnz5PCjiadDKTQ0VPDEzRtNmR0ipUCQIarGnsJC0/ADbuLEr0Y6M3QiUkNDRVWU+nkRz8yEkhwUhpJXlyKNCPqViPlgSU1WMqjwayZ836pKAW448CMceutdo0bVkCBQoQIKQ3roaBdQFotdsB7iHHh6/6nZBNghwKC5jIkmkYA2S+cQ3kZUX3b2G5kZuNfgpAAJ0EYD3v7XZ1NapMjWefq91VHquRshl9pt3U9hJTAhgYWHsgQAMCOlkUs7e8gMSoAIbv1kek+nV9AwhZodcsgPkAscfohke3uwDrBTn5Ep9UW/bA6S9oZ8+9yvvvEsz+Bwd5siRA2Ab7CdSef/BJIF94A9qHQ2W5Cbeegv15Fx949BHooFQMjKSVeQjpwsCJKKaYHycO5KNVIQqUhV2CmE3QomILwChjBgS4JQKNE7DoYo4AxPghBj2aAOSRig2pI5MWJEnCkgAIieOTVfLo448XYkGllS8WuSOSW3YggAKaTQQAHQ4EkFKQFZrFppvZwamLkl3auaYEbb4J5VF4njWnn1neWcKXlPFJ5zDv5AIClTwgqoeihDbqwZavcEZZmnrSkmIDDai4HQUEcPpnMy59kMCnoaKYXjKl8meBKyKsiiKoosq6qa6ypOoIq7liSKqphc7q66+3tnpifqf+AOvqqLsK+82xGDgwW3LSWdAAtTPmeeq2vK4gKQXgStvCuBOUW+ML6EqgbqfnentEuwC8e2oIBBzLwIW2phissP0YQOee96p3VsADa4PdCOMiXJDCkcorHyUJwyuuxPpQ/LDFF1t4sMaTFvxBZorYl8JdMeGVklvdioVXdiUuUmy8LqccM8sR1wzzyhynIOnLKmeHMwxLGsBAQUYjfbRHS1PSdAY/28yzyB7YEE008orwgwEtLddSdDNDjTElXftyANgLcykW11OYjXbOTLHt9dnruiCp3G7Xbbe3DiCQR99/+82n4IoRLvbaZX+tN0nEdabf2I77DDlqLNDbOM1plF+OuSGWQ8u456BpoFHk4aoweuagr3B6aqSfsHrorLvweh2zp27751QvXk5PfSycNgy+3xI87r3zTnzPpZMw/CHLM2/8Gs0fj0X00ivmAdgnYJ+B9mtwf4H3XoBfgfhXkG9j9eFfb0IEADs=\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 24px; 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 12px; text-align: left; transform-origin: 384px 12px; 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: 18.9833px 10.5px; transform-origin: 18.9833px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewhere\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 10.5px; transform-origin: 1.95px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 8.4px 10.5px; transform-origin: 8.4px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 8.4px 8.5px; transform-origin: 8.4px 8.5px; \"\u003e|x\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: 291.358px 10.5px; transform-origin: 291.358px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e| indicates the absolute value of x. Thus, if x = -5 and n = 3, then the sum is (up to n = 3 terms)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 61.3px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30.65px; transform-origin: 404px 30.65px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 109.633px 8.5px; transform-origin: 109.633px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e|-5|+|-5|^(1/2)+|-5|^(1/3)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 80.1167px 8.5px; transform-origin: 80.1167px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e= 5+5^(1/2)+5^(1/3)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 29.5167px 8.5px; transform-origin: 29.5167px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e= 8.946\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 84.4167px 10.5px; transform-origin: 84.4167px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAvoid using for/while loops.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x,n)\r\n  y = 0;\r\nend","test_suite":"%%\r\nx = -5; n = 3;\r\ny_correct = 8.946043924176486;\r\nassert(isequal(your_fcn_name(x,n),y_correct))\r\n%%\r\nx = 1; n = 10;\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x,n),y_correct))\r\n%%\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, 'for')),'for forbidden')\r\nassert(isempty(strfind(filetext, 'while')),'while forbidden')","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":428668,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":"2020-10-17T01:24:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-05T22:48:11.000Z","updated_at":"2026-03-31T09:45:39.000Z","published_at":"2020-06-05T22:54:04.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\u003eGiven x and n, compute the following sum:\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=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"22\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"416\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\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\u003ewhere\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e|x\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e| indicates the absolute value of x. Thus, if x = -5 and n = 3, then the sum is (up to n = 3 terms)\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[|-5|+|-5|^(1/2)+|-5|^(1/3)\\n= 5+5^(1/2)+5^(1/3)\\n= 8.946]]\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\u003eAvoid using for/while loops.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.gif\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.gif\",\"contentType\":\"image/gif\",\"content\":\"data:image/gif;base64,R0lGODlhoAEWALMAAP///wAAALq6unZ2doiIiJiYmNzc3KqqqhAQEGZmZiIiIkRERFRUVDIyMszMzO7u7iH5BAEAAAAALAAAAACgARYAAAT+EMhJq7046827/2AojmRpnmiqrmzrvuRzLNcAHMWQwJ5MW7aD4JB48Dq+GoVx5CSBgMTBkDA0r6ZnxYbtwg6HhqVgMBAkDK6XAhZXyAAE+ryutMdWCcFdn9zfVgwBCAV9hhl/FHCHUR47Ko8ckQAGfBM7Dm4FPyiTGpOVFo95DQ4rnhmglhKRBmGnjhShFY+FjDCoGKqiHgIDBANktiicG8UnxxnFsxMGwxIDasgey6vOzQR0KskY1RXXEgUPqybcF96ytr85ty3mFujNhQ/AQ0VbBxMCCALb1CvvKsSDZmTCAwUFif1rtmpAwgcC7vnrMBCAQwkHHowDuFACM4L+HqE9azeNoqyGRgoFMDUgnz5PCjiadDKTQ0VPDEzRtNmR0ipUCQIarGnsJC0/ADbuLEr0Y6M3QiUkNDRVWU+nkRz8yEkhwUhpJXlyKNCPqViPlgSU1WMqjwayZ836pKAW448CMceutdo0bVkCBQoQIKQ3roaBdQFotdsB7iHHh6/6nZBNghwKC5jIkmkYA2S+cQ3kZUX3b2G5kZuNfgpAAJ0EYD3v7XZ1NapMjWefq91VHquRshl9pt3U9hJTAhgYWHsgQAMCOlkUs7e8gMSoAIbv1kek+nV9AwhZodcsgPkAscfohke3uwDrBTn5Ep9UW/bA6S9oZ8+9yvvvEsz+Bwd5siRA2Ab7CdSef/BJIF94A9qHQ2W5Cbeegv15Fx949BHooFQMjKSVeQjpwsCJKKaYHycO5KNVIQqUhV2CmE3QomILwChjBgS4JQKNE7DoYo4AxPghBj2aAOSRig2pI5MWJEnCkgAIieOTVfLo448XYkGllS8WuSOSW3YggAKaTQQAHQ4EkFKQFZrFppvZwamLkl3auaYEbb4J5VF4njWnn1neWcKXlPFJ5zDv5AIClTwgqoeihDbqwZavcEZZmnrSkmIDDai4HQUEcPpnMy59kMCnoaKYXjKl8meBKyKsiiKoosq6qa6ypOoIq7liSKqphc7q66+3tnpifqf+AOvqqLsK+82xGDgwW3LSWdAAtTPmeeq2vK4gKQXgStvCuBOUW+ML6EqgbqfnentEuwC8e2oIBBzLwIW2phissP0YQOee96p3VsADa4PdCOMiXJDCkcorHyUJwyuuxPpQ/LDFF1t4sMaTFvxBZorYl8JdMeGVklvdioVXdiUuUmy8LqccM8sR1wzzyhynIOnLKmeHMwxLGsBAQUYjfbRHS1PSdAY/28yzyB7YEE008orwgwEtLddSdDNDjTElXftyANgLcykW11OYjXbOTLHt9dnruiCp3G7Xbbe3DiCQR99/+82n4IoRLvbaZX+tN0nEdabf2I77DDlqLNDbOM1plF+OuSGWQ8u456BpoFHk4aoweuagr3B6aqSfsHrorLvweh2zp27751QvXk5PfSycNgy+3xI87r3zTnzPpZMw/CHLM2/8Gs0fj0X00ivmAdgnYJ+B9mtwf4H3XoBfgfhXkG9j9eFfb0IEADs=\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1730,"title":"GJam: 2013 Rd1a Bullseye Painting","description":"\u003chttp://code.google.com/codejam/contests.html Google Code Jam\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\r\n\r\nGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\r\n\r\n\u003c\u003chttp://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\u003e\u003e\r\n\r\n*Input:* [r, p]  Integer values, 1\u003c=r,P\u003c=1000. Always enough P for one ring\r\n\r\n\r\n*Output:* Rings\r\n\r\n*Examples:*\r\n\r\n  [1 9] 1;\r\n  [1 10] 2;\r\n  [3 40] 3;\r\n  \r\n  [1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n\r\n*Google Code Jam:*\r\n\r\nThe next competition starts in April 2014. See details from above link.\r\n\r\nThis contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.\r\n\r\nSolutions to the various past Challenges in Matlab can be found via \u003chttp://www.go-hero.net/jam/13/solutions GJam Solutions\u003e.\r\n\r\nThe Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java  BigInteger.\r\n\r\n*Related Challenges:*\r\n\r\n  1) Reading 64 bit input file\r\n  2) Bullseye Large Numbers r\u003c1E18, P\u003c2E18\r\n\r\n*Usage of regexp is verboten*\r\n\r\n","description_html":"\u003cp\u003e\u003ca href = \"http://code.google.com/codejam/contests.html\"\u003eGoogle Code Jam\u003c/a\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\u003c/p\u003e\u003cp\u003eGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\u003c/p\u003e\u003cimg src = \"http://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\"\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [r, p]  Integer values, 1\u0026lt;=r,P\u0026lt;=1000. Always enough P for one ring\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Rings\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 9] 1;\r\n[1 10] 2;\r\n[3 40] 3;\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eGoogle Code Jam:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe next competition starts in April 2014. See details from above link.\u003c/p\u003e\u003cp\u003eThis contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.\u003c/p\u003e\u003cp\u003eSolutions to the various past Challenges in Matlab can be found via \u003ca href = \"http://www.go-hero.net/jam/13/solutions\"\u003eGJam Solutions\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThe Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java  BigInteger.\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Reading 64 bit input file\r\n2) Bullseye Large Numbers r\u0026lt;1E18, P\u0026lt;2E18\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eUsage of regexp is verboten\u003c/b\u003e\u003c/p\u003e","function_template":"function rings=solve_rings(r,p)\r\n rings=0;\r\nend","test_suite":"%%\r\nr=138;p=844;rings=3;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=21;p=197;rings=4;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=214;p=862;rings=2;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=20;p=845;rings=13;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=20;p=844;rings=12;\r\nassert(isequal(solve_rings(r,p),rings))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-20T20:30:52.000Z","updated_at":"2025-12-31T13:40:54.000Z","published_at":"2013-07-20T21:02:01.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=\\\"http://code.google.com/codejam/contests.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGoogle Code Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\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 a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\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\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [r, p] Integer values, 1\u0026lt;=r,P\u0026lt;=1000. Always enough P for one ring\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Rings\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\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 9] 1;\\n[1 10] 2;\\n[3 40] 3;\\n\\n[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGoogle Code Jam:\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\u003eThe next competition starts in April 2014. See details from above link.\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 contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.\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\u003eSolutions to the various past Challenges in Matlab can be found via\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=\\\"http://www.go-hero.net/jam/13/solutions\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam Solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java BigInteger.\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\u003eRelated Challenges:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Reading 64 bit input file\\n2) Bullseye Large Numbers r\u003c1E18, P\u003c2E18]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eUsage of regexp is verboten\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":52462,"title":"Easy Sequences 1: Find the index of an element","description":"The nth element of a series  is defined by: . Obviously, the first element . Given the nth element , find the value of the corresponding index .","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: 66px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 33px; transform-origin: 407px 33px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 33px; text-align: left; transform-origin: 384px 33px; 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: 88.5px 8px; transform-origin: 88.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe nth element of a series \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eA\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46px 8px; transform-origin: 46px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is defined by: \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-17px\"\u003e\u003cimg src=\"data:image/png;base64,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\" style=\"width: 155.5px; height: 45px;\" width=\"155.5\" height=\"45\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 91px 8px; transform-origin: 91px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Obviously, the first element \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAAAlCAYAAACXvR1IAAACl0lEQVR4nO2aXbHDIBCFj4c4wEAMREEUxEEdxEEtREMlxEMtXA210PsAe0N707KwQH5mvxlm+lAg4cBylgAoiqIoinJmLgCaTG0ZAH2mthQBE4Ahc5uja1cR0iFtxU2wqzUGw+xrwjnFbWt1NAB4woobwwhgjvi/gRXqCf7LzcgfDbaig32fR43OGgA/sIMdM4Cdq2OYfZCgVLjCtrADwelnr7SwgtK7VxF29Dq8RtSbwQuTveujB3BHvLBw/cREhj1xwfL+D1QS1uB1Fd2Z9WJWq48/iWKEpf6q7U2FoFVbXNgZSxh+ut8cU3MDfxL4pAoL2Gc7upGqIqy/6vxVGxK2QXzYJiTCTqi0NxWkirA/WMTx977QwUDP/N8aEmEvifX2RHFhR9c4rc4blgEP5aQkTmxq5NdNEYgiTErqY1x9aZGerBUVtnEN+wLGOGOaBCnkEHYU9isp0mhRVNgJ/40PhVeOM6aHS0EiLFy9FAM1wD63tEhz6WLC0qx/3x9b8J3x1sIeNZ8FCgo7w67Itf2D64xV2HSKCEvnwZ/CDJ2KhBzvVsJK0qy9kF1YMkzfBoXrjOnMN4WtzNNpXTEN6LcH4zrjrdMdaf58GldMJ0uhEEahOuSMJfmkRFiqm+JMT+mKKcSGwohvoELOOBTWPyER9uae68hkE5bE4uR+fsoTWhkT0gZZImzq/ronsghLH6i5wvqHFKFBpAkTs88avH5JihGJtokjf2x/TylTPMrfFQy/jFgfmA7LFRduHYD/od3Ahu219rn3pWYcN83psFwUeC9X7PA2poGNCEkzLwK6eZDraqvCYIB10KUGnfLv0pNHWaHk/d8z3VA8JAPyi1viErqSQI4jN8Lg2DclFEVRFEVRlNr8AmdhZHBxYd9KAAAAAElFTkSuQmCC\" style=\"width: 59px; height: 18.5px;\" width=\"59\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 36.5px 8px; transform-origin: 36.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Given the nth element \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAlCAYAAAD2pT8KAAACZklEQVRoge2ZYZGDMBCFPw84wEANoKAKcFAHODgLaEACHmqhGmqB+wFv2NKUbHoJcz94M525uZZs9mX3vSTAiRMnTvx/3IAq01g1cM001qHogTbzmN0y7uFo+G5Fe+ZqKIGeg8logYmZjBR0wJh/Oi8YyV9tQVTAg5mIlIDN8kxdYlIGF+B5QBw65oQm4CfhuZHjyrancOXVrCRMwN353FHVsI13KRVgZG2LafnbI5gDftJy4UGhCrSraqsiRkRFehvlQM+sFdnxYE3mzkpEbCNzdf5ui4r30q6ZF8TTYjcKtEfHzK5Wf2AlIrYnkLjGrPbKaq/Pzdj18n/FfBJPUBWczUqrJbBNOMU5RFoMWm2rQTWrHXaJcUVE54jtQs+70KncPc6hlfRCbTcyE2FXX8l5V3oik2Aq8La/L2ZCMedIIULCqra485rwzXzvcSsR+meMy2SawMfrHClE2EoLbcB60pLLQoTOE+OHjwQt5ggpRChRVdoWiunp+yy2LYHcG8TrHErOAyuUe+3oscQsYil13it5r4J77dMmOgS+lz54N0mf9M0N7RxjJaXWiTmH18+tEIYmrxbzuoAW4OvzjUo+pspWMGPOEWszWBMNrbh1ExE6sN8iA2GdcUHJeVi3pRxjvndMSuOEYtvqq5bfxIj9Wh+0g/MSYa0uFlQEf9IJO1aoLWzb3AlriIWIS26Lhnd77D4M1LCeCbzPwP7FTGvGCKFiTt57DTdy/GnXDW2XU+85U3Hl9YD4L9Eyl3apSWr/U5rsLCj5/uGwG+xcaMlPRomXRofg2xdEIeje4sSJEydO5MYvnSP5KzErv3UAAAAASUVORK5CYII=\" style=\"width: 33px; height: 18.5px;\" width=\"33\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 134.5px 8px; transform-origin: 134.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, find the value of the corresponding index \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function n = index(a)\r\n  n = a;\r\nend","test_suite":"%%\r\na = 1;\r\nn = index(a);\r\nassert(isequal(1,n))\r\n%%\r\na = 25;\r\nn = index(a);\r\nbs = arrayfun(@(x) sum(arrayfun(@(k) k*(-1)^(k^3+1),1:x)),1:n);\r\nb = bs(end);\r\nassert(isequal(a,b))\r\n%%\r\na = 100;\r\nn = index(a);\r\nbs = arrayfun(@(x) sum(arrayfun(@(k) k*(-1)^(k^3+1),1:x)),1:n);\r\nb = bs(end);\r\nassert(isequal(a,b))\r\n%%\r\na = randi([1000,ceil(exp(log(double(intmax)/2)))]);\r\nn = index(a);\r\nassert(isequal(index(-a+(1-(-1)^(n+1))/2),n+1))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":9,"created_by":255988,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52,"test_suite_updated_at":"2021-08-11T04:47:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-08-10T10:31:40.000Z","updated_at":"2026-04-01T20:40:04.000Z","published_at":"2021-08-10T10:34:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe nth element of a series \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\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is defined by: \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\u003eA(n) = \\\\displaystyle\\\\sum\\\\limits_{k=1}^n (k\\\\cdot(-1)^{k^3+1})\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Obviously, the first element \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\u003eA(1) = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Given the nth element \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\u003eA(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, find the value of the corresponding index \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\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":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":679,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-05T17:43:36.000Z","updated_at":"2026-04-07T13:59:33.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":42769,"title":"GJam March 2016 IOW: Cody's Jams ","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/8274486/dashboard GJam March 2016 Annual I/O for Women Cody's Jam\u003e. This is a mix of the small and large data sets.\r\n\r\nThe GJam story goes that a store is having a 25% off sale and ordered original and sale price labels. Unfortunately the labels came commingled in increasing numeric value. Find the sale prices.\r\n\r\n*Input:* m , Vector length N\u003c=100 with values \u003c=10^9.\r\n\r\n*Output:* v , Vector containing the Sale price tags\r\n\r\n*Examples:* [m] [v]\r\n\r\n  [15 20 60 75 80 100] creates v=[15 60 75]\r\n  [9 9 12 12 12 15 16 20] creates v=[9 9 12 15]\r\n \r\n\r\n*Google Code Jam 2016 Open Qualifier: April 8, 2016*\r\n\r\nComplete Code Jam Input/Output included in Test Suite.\r\nThe women's competition had 500 entrants. The qualifier winner was USA Stacy992 using Java. The top 60 show strength in USA, Russia, China, and South Korea under \u003chttp://code.google.com/codejam/contest/8274486/scoreboard?c=8274486# Contest Dashboard\u003e. ","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/8274486/dashboard\"\u003eGJam March 2016 Annual I/O for Women Cody's Jam\u003c/a\u003e. This is a mix of the small and large data sets.\u003c/p\u003e\u003cp\u003eThe GJam story goes that a store is having a 25% off sale and ordered original and sale price labels. Unfortunately the labels came commingled in increasing numeric value. Find the sale prices.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m , Vector length N\u0026lt;=100 with values \u0026lt;=10^9.\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e v , Vector containing the Sale price tags\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [m] [v]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[15 20 60 75 80 100] creates v=[15 60 75]\r\n[9 9 12 12 12 15 16 20] creates v=[9 9 12 15]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eGoogle Code Jam 2016 Open Qualifier: April 8, 2016\u003c/b\u003e\u003c/p\u003e\u003cp\u003eComplete Code Jam Input/Output included in Test Suite.\r\nThe women's competition had 500 entrants. The qualifier winner was USA Stacy992 using Java. The top 60 show strength in USA, Russia, China, and South Korea under \u003ca href = \"http://code.google.com/codejam/contest/8274486/scoreboard?c=8274486#\"\u003eContest Dashboard\u003c/a\u003e.\u003c/p\u003e","function_template":"function v=CodyJams(m)\r\n% m is increasing value vector of length 2L\r\n% v is length L vector of Sale Price Tags\r\n v=[];\r\nend","test_suite":"%%\r\nm=[15 20 60 75 80 100 ];\r\nv=CodyJams(m);\r\nvexp=[15 60 75 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[9 9 12 12 12 15 16 20 ];\r\nv=CodyJams(m);\r\nvexp=[9 9 12 15 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[480 640 1047 1396 1638 2184 2481 3308 ];\r\nv=CodyJams(m);\r\nvexp=[480 1047 1638 2481 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[495 660 1953 2559 2604 2685 3412 3580 ];\r\nv=CodyJams(m);\r\nvexp=[495 1953 2559 2685 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[384 512 1005 1340 2037 2716 2973 3964 ];\r\nv=CodyJams(m);\r\nvexp=[384 1005 2037 2973 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[270624780 336144033 360833040 448192044 736130808 745857189 981507744 994476252 ];\r\nv=CodyJams(m);\r\nvexp=[270624780 336144033 736130808 745857189 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[147 196 267 330 356 440 810 1080 ];\r\nv=CodyJams(m);\r\nvexp=[147 267 330 810 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[222 296 1533 1767 2044 2356 2541 3388 ];\r\nv=CodyJams(m);\r\nvexp=[222 1533 1767 2541 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[450 600 804 1072 1137 1497 1516 1996 ];\r\nv=CodyJams(m);\r\nvexp=[450 804 1137 1497 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[1788 2384 2697 2967 2991 3596 3956 3988 ];\r\nv=CodyJams(m);\r\nvexp=[1788 2697 2967 2991 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[4131 5508 7344 7803 8397 8667 9792 10404 11196 11556 13872 14553 14742 14928 15408 17631 18496 19404 19656 19904 20544 20925 21816 23508 23598 23949 25872 26208 27900 29088 31344 31464 31932 34496 34944 37200 38784 41792 41952 42576 49600 51712 55936 56768 7440174 8148762 8601471 8837667 9290376 9664353 9920232 9920232 10865016 10865016 11468628 11468628 11783556 11783556 12387168 12387168 12885804 12885804 13187610 13226976 13226976 13443489 14309541 14486688 14486688 15291504 15291504 15711408 15711408 16516224 16516224 17181072 17181072 17583480 17583480 17635968 17635968 17924652 17924652 19079388 19079388 19315584 19315584 20388672 20388672 20948544 20948544 22021632 22021632 22908096 22908096 23444640 23444640 23514624 23514624 23899536 23899536 25439184 25439184 25754112 25754112 27184896 27184896 27931392 29362176 29362176 30544128 30544128 31259520 31259520 31352832 31352832 31866048 31866048 33918912 33918912 34338816 34338816 36246528 36246528 39149568 39149568 40725504 40725504 41679360 41679360 41803776 41803776 42488064 42488064 45225216 45225216 45785088 45785088 48328704 48328704 52199424 52199424 54300672 54300672 55572480 55572480 55738368 55738368 56650752 56650752 60300288 60300288 61046784 61046784 64438272 64438272 69599232 69599232 72400896 72400896 74096640 74096640 74317824 74317824 75534336 75534336 80400384 80400384 81395712 81395712 85917696 85917696 92798976 92798976 96534528 96534528 98795520 98795520 99090432 100712448 100712448 107200512 107200512 108527616 108527616 114556928 123731968 128712704 131727360 131727360 134283264 134283264 142934016 142934016 144703488 144703488 175636480 179044352 190578688 192937984 ];\r\nv=CodyJams(m);\r\nvexp=[4131 7344 7803 8397 8667 13872 14553 14742 14928 15408 17631 20925 21816 23598 23949 25872 26208 31344 37200 38784 41952 42576 7440174 8148762 8601471 8837667 9290376 9664353 9920232 10865016 11468628 11783556 12387168 12885804 13187610 13226976 13443489 14309541 14486688 15291504 15711408 16516224 17181072 17583480 17635968 17924652 19079388 19315584 20388672 20948544 22021632 22908096 23444640 23514624 23899536 25439184 25754112 27184896 29362176 30544128 31259520 31352832 31866048 33918912 34338816 36246528 39149568 40725504 41679360 41803776 42488064 45225216 45785088 48328704 52199424 54300672 55572480 55738368 56650752 60300288 61046784 64438272 69599232 72400896 74096640 74317824 75534336 80400384 81395712 85917696 92798976 96534528 98795520 100712448 107200512 108527616 131727360 134283264 142934016 144703488 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[47652765 63537020 67915215 69349602 72816921 73024614 82232592 90005040 90280239 90553620 92466136 94414812 97089228 97366152 103779192 109643456 111106431 111164235 120006720 120373652 125886416 135665742 136205178 138372256 138890175 141176913 142430418 148141908 148218980 151625514 165274734 180887656 181606904 185186900 186382386 188235884 189907224 191652879 197100096 200131203 202167352 220366312 228636354 230018664 233064210 248509848 252322995 253203684 255537172 262800128 266522562 266752464 266841604 276629997 284197221 289714236 292147407 298051953 304848472 306691552 310752280 315722328 323249112 326482563 331581687 336430660 337604912 341668035 343831008 350075772 355363416 355669952 368839996 377457843 378929628 380744748 386285648 389529876 394930203 397402604 398376315 398670747 400335744 403277814 417169314 420741072 420963104 429730527 430998816 431599908 435310084 437438880 442108916 446485650 455557380 456522042 456986763 458441344 458579964 462594018 466767696 473333373 473409816 498541914 500694354 502642542 502680435 503277124 507659664 526573604 531168420 531512730 531560996 533780992 537703752 554512398 556085664 556225752 559312521 560988096 572974036 575466544 576554121 582854961 583251840 595314200 603269448 608696056 609315684 609830100 611439952 616792024 622311657 630908808 631111164 631213088 640087608 662978055 664722552 666189831 667592472 668044893 670190056 670240580 670949520 676510731 678398706 680890563 683321925 683396070 686473173 698833314 701501745 704706354 706326441 708683640 712094160 717827469 719130264 721789842 730229028 732531111 739232499 739349864 740488395 741447552 743207979 745750028 747639918 768738828 777139948 804359264 813106800 829748876 841211744 853450144 883970740 888253108 890726524 894599360 902014308 904531608 907854084 911095900 911194760 915297564 931777752 935335660 939608472 941768588 949458880 957103292 958840352 962386456 973638704 976708148 985643332 987317860 990943972 996853224 ];\r\nv=CodyJams(m);\r\nvexp=[47652765 67915215 69349602 72816921 73024614 82232592 90005040 90280239 94414812 103779192 111106431 111164235 135665742 136205178 138890175 141176913 142430418 151625514 165274734 186382386 191652879 197100096 200131203 228636354 230018664 233064210 252322995 253203684 266522562 266752464 276629997 284197221 289714236 292147407 298051953 315722328 323249112 326482563 331581687 341668035 343831008 350075772 377457843 380744748 394930203 398376315 398670747 400335744 403277814 417169314 420741072 429730527 431599908 437438880 446485650 456522042 456986763 458579964 462594018 473333373 473409816 498541914 500694354 502642542 502680435 531512730 554512398 556085664 559312521 576554121 582854961 603269448 609830100 622311657 630908808 640087608 662978055 666189831 668044893 670949520 676510731 678398706 680890563 683321925 683396070 686473173 698833314 701501745 704706354 706326441 712094160 717827469 719130264 721789842 730229028 732531111 739232499 740488395 743207979 747639918 ];\r\nassert(isequal(vexp,v))\r\n%%\r\n% function GJam_IOW_2016a\r\n% % \r\n% fn='A-large-practice.in';\r\n% %fn='A-small-practice.in';\r\n% [data] = read_file(fn); % create cell array\r\n% \r\n% fidG = fopen('A-large-output.out', 'w');\r\n%  \r\n% tic\r\n% for i=1:size(data,2) % Cell array has N rows of cases\r\n%  v = Rd1A(data{i});\r\n%  m=data{i};\r\n%  \r\n%  fprintf(fidG,'Case #%i:',i);\r\n%  fprintf(fidG,' %i',v);fprintf(fidG,'\\n');\r\n%  fprintf('Case #%i:',i);\r\n%  fprintf(' %i',v);fprintf('\\n');\r\n%  \r\n% end\r\n% toc\r\n% \r\n% fclose(fidG);\r\n% end\r\n% \r\n% function v=Rd1A(m)\r\n%  L=length(m);\r\n%  v=zeros(1,L/2);\r\n%  for i=1:L/2\r\n%   vptr=find(m\u003e0,1,'first');\r\n%   v(i)=m(vptr);\r\n%   m(find(m==round(m(vptr)*4/3),1,'first'))=0;\r\n%   m(vptr)=0;\r\n%  end\r\n% end\r\n% \r\n% \r\n% function [d] = read_file(fn)\r\n% d={};\r\n% fid=fopen(fn);\r\n% fgetl(fid); % Total Count ignore\r\n% ptr=0;\r\n% while ~feof(fid)\r\n%  ptr=ptr+1;\r\n%  fgetl(fid); % Data set countIgnore\r\n%  v=str2num(fgetl(fid)); \r\n%  \r\n%  d{ptr}=v;\r\n%  \r\n% end % feof\r\n%  fclose(fid);\r\n% \r\n% end % read_file\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"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":"2016-03-13T05:45:39.000Z","updated_at":"2016-03-15T16:31:00.000Z","published_at":"2016-03-13T06:32: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\u003eThis Challenge is derived from\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=\\\"http://code.google.com/codejam/contest/8274486/dashboard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam March 2016 Annual I/O for Women Cody's Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. This is a mix of the small and large data sets.\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\u003eThe GJam story goes that a store is having a 25% off sale and ordered original and sale price labels. Unfortunately the labels came commingled in increasing numeric value. Find the sale prices.\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m , Vector length N\u0026lt;=100 with values \u0026lt;=10^9.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e v , Vector containing the Sale price tags\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\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [m] [v]\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[[15 20 60 75 80 100] creates v=[15 60 75]\\n[9 9 12 12 12 15 16 20] creates v=[9 9 12 15]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGoogle Code Jam 2016 Open Qualifier: April 8, 2016\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\u003eComplete Code Jam Input/Output included in Test Suite. The women's competition had 500 entrants. The qualifier winner was USA Stacy992 using Java. The top 60 show strength in USA, Russia, China, and South Korea under\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=\\\"http://code.google.com/codejam/contest/8274486/scoreboard?c=8274486#\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eContest Dashboard\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":44466,"title":"The twelve days of Christmas","description":"Traditionally there are twelve days of Christmas to celebrate (\"Twelvetide\"), typically starting with Christmas Day (25 December) as the \"First Day of Christmas\" and finishing on the 5th of January.  \r\n\r\nIn the traditional Christmas carol, helpfully entitled \u003chttp://christmas-lyrics.com/christmas-carols-lyrics/the-twelve-days-of-christmas-lyrics/ _The Twelve Days of Christmas_\u003e, the singer recounts receiving gifts on each day, sent to them by their True Love.  \r\n\r\nOn the *first* day, they receive *one* gift (1 × \"partridge in a pear tree\").  \r\n\r\nOn the *second* day they receive *two* _new_ gifts (2 × \"turtle doves\") *plus* a repeat of each gift corresponding to the previous days — in this case meaning plus *one* _repeat_ gift (1 × \"partridge in a pear tree\").  Therefore they have _accumulated_ a total of four gifts:  one from the first day, and three from the second day.  \r\n\r\nOn the *third* day they receive *three* _new_ gifts (3 × \"French hens\") *plus* a repeat of each gift corresponding to the previous days — in this case meaning plus *three* _repeat_ gifts (1 × \"partridge in a pear tree\" and 2 × \"turtle doves\").  By now they have _accumulated_ a total of ten gifts:  one from the first day, three from the second day, and six from the third day.  \r\n\r\nThis continues until the twelfth day (the _last_ day of Christmas).  \r\n\r\nFor this problem you must calculate the cumulative total of all gifts received up to the specified day that is provided as input.  (Day 1 is the 25th of December, day 2 is the 26th of December, and so on.)\r\n\r\nEXAMPLE\r\n\r\n day = 2\r\n accumulatedGifts = 4\r\n","description_html":"\u003cp\u003eTraditionally there are twelve days of Christmas to celebrate (\"Twelvetide\"), typically starting with Christmas Day (25 December) as the \"First Day of Christmas\" and finishing on the 5th of January.\u003c/p\u003e\u003cp\u003eIn the traditional Christmas carol, helpfully entitled \u003ca href = \"http://christmas-lyrics.com/christmas-carols-lyrics/the-twelve-days-of-christmas-lyrics/\"\u003e\u003ci\u003eThe Twelve Days of Christmas\u003c/i\u003e\u003c/a\u003e, the singer recounts receiving gifts on each day, sent to them by their True Love.\u003c/p\u003e\u003cp\u003eOn the \u003cb\u003efirst\u003c/b\u003e day, they receive \u003cb\u003eone\u003c/b\u003e gift (1 × \"partridge in a pear tree\").\u003c/p\u003e\u003cp\u003eOn the \u003cb\u003esecond\u003c/b\u003e day they receive \u003cb\u003etwo\u003c/b\u003e \u003ci\u003enew\u003c/i\u003e gifts (2 × \"turtle doves\") \u003cb\u003eplus\u003c/b\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus \u003cb\u003eone\u003c/b\u003e \u003ci\u003erepeat\u003c/i\u003e gift (1 × \"partridge in a pear tree\").  Therefore they have \u003ci\u003eaccumulated\u003c/i\u003e a total of four gifts:  one from the first day, and three from the second day.\u003c/p\u003e\u003cp\u003eOn the \u003cb\u003ethird\u003c/b\u003e day they receive \u003cb\u003ethree\u003c/b\u003e \u003ci\u003enew\u003c/i\u003e gifts (3 × \"French hens\") \u003cb\u003eplus\u003c/b\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus \u003cb\u003ethree\u003c/b\u003e \u003ci\u003erepeat\u003c/i\u003e gifts (1 × \"partridge in a pear tree\" and 2 × \"turtle doves\").  By now they have \u003ci\u003eaccumulated\u003c/i\u003e a total of ten gifts:  one from the first day, three from the second day, and six from the third day.\u003c/p\u003e\u003cp\u003eThis continues until the twelfth day (the \u003ci\u003elast\u003c/i\u003e day of Christmas).\u003c/p\u003e\u003cp\u003eFor this problem you must calculate the cumulative total of all gifts received up to the specified day that is provided as input.  (Day 1 is the 25th of December, day 2 is the 26th of December, and so on.)\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e day = 2\r\n accumulatedGifts = 4\u003c/pre\u003e","function_template":"% Comments...\r\nfunction accumulatedGifts = twelvetide(day)\r\n        accumulatedGifts = 12\r\nend","test_suite":"%% Please do not try to hack the Test Suite.  \r\n% The Test Suite will be updated if inappropriate submissions are received.  \r\n% This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'.\r\n\r\n% EDIT (2019-06-24).  Anti-hacking provision\r\n% Ensure builtin function will be called.  (Probably only the second of these will work.)  \r\n! del fileread.m\r\n! rm -v fileread.m\r\n% Probably only the second of these will work.  \r\nRE = regexp(fileread('twelvetide.m'), '\\w+', 'match');\r\n%tabooWords = {'ans', 'assert', 'freepass', 'tic'};\r\ntabooWords = {'assert', 'freepass'};\r\ntestResult = cellfun( @(z) ismember(z, tabooWords), RE );\r\nmsg = ['Please do not do that in your code!' char([10 13]) ...\r\n    'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...\r\n    'Banned word.' char([10 13])];\r\nassert(~any(  cellfun( @(z) ismember(z, tabooWords), RE )  ), msg)\r\n% END EDIT (2019-06-24)\r\n\r\n\r\n%% Anti-hardcoding test\r\n% Adapted from the code of Alfonso Nieto-Castanon in a comment at \r\n% https://www.mathworks.com/matlabcentral/cody/problems/44343 .\r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[120,165,220,286]),regexp(fileread('twelvetide.m'),'[\\d\\.\\+\\-\\*\\/]+','match'))), 'Please do not hard-code your ''solution''.') \r\n%assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[120,165,220,286,364]),regexp(fileread('twelvetide.m'),'[\\d\\.\\+\\-\\*\\/]+','match'))), 'Please do not hard-code your ''solution''.')  \u003c-- prior to 2018-01-02.\r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[55,66,78]),regexp(fileread('twelvetide.m'),'[\\d\\.\\+\\-\\*\\/]+','match'))), 'No, really: please do not hard-code your ''solution''.')  % Added on 2018-01-06.\r\n\r\n%% Before Christmas\r\nday = 0 - randi(50);\r\naccumulatedGifts = 0;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%% Before Christmas\r\nday = 0;\r\naccumulatedGifts = 0;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%% First day of Christmas\r\nday = 1;\r\naccumulatedGifts = 1;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 2;\r\naccumulatedGifts = 4;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 3;\r\naccumulatedGifts = 10;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 4;\r\naccumulatedGifts = 20;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 5;\r\naccumulatedGifts = 35;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 6;\r\naccumulatedGifts = 56;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 7;\r\naccumulatedGifts = 84;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 8;\r\naccumulatedGifts = 120;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 9;\r\naccumulatedGifts = 165;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 10;\r\naccumulatedGifts = 220;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 11;\r\naccumulatedGifts = 286;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%% Last day of Christmas\r\nday = 12;\r\naccumulatedGifts = 364;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 13;\r\naccumulatedGifts = 364;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 100;\r\naccumulatedGifts = 364;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nfor i = 1 : 10\r\n    day = 12 + randi(300);\r\n    accumulatedGifts = 364;\r\n    assert( isequal(twelvetide(day), accumulatedGifts) )\r\nend;","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":158,"test_suite_updated_at":"2019-06-24T08:48:56.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2017-12-23T07:03:22.000Z","updated_at":"2026-02-02T10:48:27.000Z","published_at":"2017-12-23T07:42:59.000Z","restored_at":"2018-02-06T15:11:41.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"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\u003eTraditionally there are twelve days of Christmas to celebrate (\\\"Twelvetide\\\"), typically starting with Christmas Day (25 December) as the \\\"First Day of Christmas\\\" and finishing on the 5th of January.\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 the traditional Christmas carol, helpfully entitled\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=\\\"http://christmas-lyrics.com/christmas-carols-lyrics/the-twelve-days-of-christmas-lyrics/\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eThe Twelve Days of Christmas\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, the singer recounts receiving gifts on each day, sent to them by their True Love.\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\u003eOn 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efirst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day, they receive\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\u003eone\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gift (1 × \\\"partridge in a pear tree\\\").\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\u003eOn 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esecond\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day they receive\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\u003etwo\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\u003enew\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gifts (2 × \\\"turtle doves\\\")\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\u003eplus\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus\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\u003eone\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\u003erepeat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gift (1 × \\\"partridge in a pear tree\\\"). Therefore they have\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\u003eaccumulated\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a total of four gifts: one from the first day, and three from the second day.\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\u003eOn 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ethird\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day they receive\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\u003ethree\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\u003enew\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gifts (3 × \\\"French hens\\\")\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\u003eplus\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus\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\u003ethree\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\u003erepeat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gifts (1 × \\\"partridge in a pear tree\\\" and 2 × \\\"turtle doves\\\"). By now they have\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\u003eaccumulated\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a total of ten gifts: one from the first day, three from the second day, and six from the third day.\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 continues until the twelfth day (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\u003elast\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day of Christmas).\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 this problem you must calculate the cumulative total of all gifts received up to the specified day that is provided as input. (Day 1 is the 25th of December, day 2 is the 26th of December, and so on.)\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\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[ day = 2\\n accumulatedGifts = 4]]\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":44732,"title":"Highly divisible triangular number (inspired by Project Euler 12)","description":"Triangular numbers can be calculated by the sum from 1 to n. For example, the first 10 triangular numbers are:\r\n\r\n 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\r\n\r\nAll divisors for each of these numbers are listed below\r\n\r\n 1: 1\r\n 3: 1,3\r\n 6: 1,2,3,6\r\n 10: 1,2,5,10\r\n 15: 1,3,5,15\r\n 21: 1,3,7,21\r\n 28: 1,2,4,7,14,28\r\n 36: 1,2,3,4,6,9,12,18,36\r\n 45: 1,3,5,9,15,45\r\n 55: 1,5,11,55\r\n\r\nYour challenge is to write a function that will return the value of the first triangular number to have over d divisors (d will be passed to your function).","description_html":"\u003cp\u003eTriangular numbers can be calculated by the sum from 1 to n. For example, the first 10 triangular numbers are:\u003c/p\u003e\u003cpre\u003e 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\u003c/pre\u003e\u003cp\u003eAll divisors for each of these numbers are listed below\u003c/p\u003e\u003cpre\u003e 1: 1\r\n 3: 1,3\r\n 6: 1,2,3,6\r\n 10: 1,2,5,10\r\n 15: 1,3,5,15\r\n 21: 1,3,7,21\r\n 28: 1,2,4,7,14,28\r\n 36: 1,2,3,4,6,9,12,18,36\r\n 45: 1,3,5,9,15,45\r\n 55: 1,5,11,55\u003c/pre\u003e\u003cp\u003eYour challenge is to write a function that will return the value of the first triangular number to have over d divisors (d will be passed to your function).\u003c/p\u003e","function_template":"function y = div_tri_n(d)\r\n y = d;\r\nend","test_suite":"%%\r\nassessFunctionAbsence({'regexp', 'regexpi', 'str2num'},'FileName','div_tri_n.m')\r\n\r\n%%\r\nassert(isequal(div_tri_n(2),6))\r\n\r\n%%\r\nassert(isequal(div_tri_n(4),28))\r\n\r\n%%\r\nassert(isequal(div_tri_n(8),36))\r\n\r\n%%\r\nassert(isequal(div_tri_n(10),120))\r\n\r\n%%\r\nassert(isequal(div_tri_n(20),630))\r\n\r\n%%\r\nassert(isequal(div_tri_n(25),2016))\r\n\r\n%%\r\nassert(isequal(div_tri_n(39),3240))\r\n\r\n%%\r\nassert(isequal(div_tri_n(40),5460))\r\n\r\n%%\r\nassert(isequal(div_tri_n(50),25200))\r\n\r\n%%\r\nassert(isequal(div_tri_n(70),25200))\r\n\r\n%%\r\nassert(isequal(div_tri_n(80),25200))\r\n\r\n%%\r\nassert(isequal(div_tri_n(100),73920))\r\n\r\n%%\r\nassert(isequal(div_tri_n(115),157080))\r\n\r\n%%\r\nassert(isequal(div_tri_n(120),157080))\r\n\r\n%%\r\nassert(isequal(div_tri_n(130),437580))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":164,"test_suite_updated_at":"2018-08-20T16:04:49.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-08-20T15:15:06.000Z","updated_at":"2026-01-05T00:21:49.000Z","published_at":"2018-08-20T16:04:49.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\u003eTriangular numbers can be calculated by the sum from 1 to n. For example, the first 10 triangular numbers are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...]]\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\u003eAll divisors for each of these numbers are listed below\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1: 1\\n 3: 1,3\\n 6: 1,2,3,6\\n 10: 1,2,5,10\\n 15: 1,3,5,15\\n 21: 1,3,7,21\\n 28: 1,2,4,7,14,28\\n 36: 1,2,3,4,6,9,12,18,36\\n 45: 1,3,5,9,15,45\\n 55: 1,5,11,55]]\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\u003eYour challenge is to write a function that will return the value of the first triangular number to have over d divisors (d will be passed to your 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":58463,"title":"Recurssive serie","description":"let the numerical serie U(n) such as U(n+1)= 0.2U(n) + 0.3U(n-1) ; U(0) = a ; U(1) = b\r\nthe goal is to plot the elements of this serie in a 2D graph after solving for the serie using matrix manipulation\r\nSteps for solving : create the matrix \r\n(0     1\r\n0.3 0. 2)\r\nFind the eigen values ,create a diagonal matrix using those eigen values\r\nFind the matrix whose colomns are the eigen vectors\r\nHINT ( there is only two eigen values. The first element of the diagonal matrix is the negative eigen value!) \r\nCalculate the vector U for every n \u003e=2 such as U(n) = x(2,1)*U(0) + X(2,2)*U(1)\r\nHINT (the matrix X = P * D^n * P^-1 such as D is the diagonal eigen values matrix and P is the eigen vectors matrix.)\r\nplot the vector U with n being the length of U, you don't need to round the values of the serie.","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: 321px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 160.5px; transform-origin: 407px 160.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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003elet the numerical serie U(n) such as U(n+1)= 0.2U(n) + 0.3U(n-1) ; U(0) = a ; U(1) = b\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ethe goal is to plot the elements of this serie in a 2D graph after solving for the serie using matrix manipulation\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSteps for solving : create the matrix \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(0     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: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e0.3 0. 2)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFind the eigen values ,create a diagonal matrix using those eigen values\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFind the matrix whose colomns are the eigen vectors\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eHINT ( \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=\"\"\u003ethere is only two eigen values. The first element of the diagonal matrix is the negative eigen value!\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; \"\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 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCalculate the vector U for every n \u0026gt;=2 such as U(n) = x(2,1)*U(0) + X(2,2)*U(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: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eHINT (\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=\"\"\u003ethe matrix X = P * D^n * P^-1 such as D is the diagonal eigen values matrix and P is the eigen vectors matrix.\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; \"\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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eplot the vector U with n being the length of U, you don't need to round the values of the serie.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function U = recurrence(a,b,n)\r\n  U=[a,b];\r\n  \r\n  \r\n  plot([1:n],U,\"*\");\r\nend","test_suite":"%%\r\na = 0;\r\nb = 1;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(2),1))\r\n%%\r\na = 1;\r\nb = 0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(2),0))\r\n%%\r\na = 3;\r\nb = 1;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(5),3),0.179))\r\n%%\r\na = 9;\r\nb = 7;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(6),3),0.530))\r\n%%\r\na = 5;\r\nb = 5;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(3),3),1.15))\r\n%%\r\na = 0.6;\r\nb = -4;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(4),3),-0.487))\r\n%%\r\na=0;\r\nb=0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(4),0))\r\n%%\r\na=0;\r\nb=0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(5),0))\r\n%%\r\na=0;\r\nb=0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(7),0))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3437689,"edited_by":3437689,"edited_at":"2023-06-24T21:36:27.000Z","deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-06-24T20:47:31.000Z","updated_at":"2023-06-24T21:36:27.000Z","published_at":"2023-06-24T21:36:27.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\u003elet the numerical serie U(n) such as U(n+1)= 0.2U(n) + 0.3U(n-1) ; U(0) = a ; U(1) = 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe goal is to plot the elements of this serie in a 2D graph after solving for the serie using matrix manipulation\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\u003eSteps for solving : create the matrix \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(0     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\u003e0.3 0. 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\u003eFind the eigen values ,create a diagonal matrix using those eigen values\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 matrix whose colomns are the eigen vectors\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\u003eHINT ( \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003ethere is only two eigen values. The first element of the diagonal matrix is the negative eigen value!\u003c/w:t\u003e\u003c/w:r\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: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\u003eCalculate the vector U for every n \u0026gt;=2 such as U(n) = x(2,1)*U(0) + X(2,2)*U(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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHINT (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ethe matrix X = P * D^n * P^-1 such as D is the diagonal eigen values matrix and P is the eigen vectors matrix.\u003c/w:t\u003e\u003c/w:r\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:t\u003eplot the vector U with n being the length of U, you don't need to round the values of the serie.\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":54275,"title":"Get twenty-four","description":"Inpur four integers in 1 to 10, you may use plus, minus, multiply and divid to get 24. Note that every integer should be used once and only once. Brackets are of no limit, and the result should exactly be 24 once you calculate by hand. (Calculation in computer will lead to a tolerance to the computer precision.) \r\nYou need to return a format and a vector with the same four integers, such that you can print the expression.\r\nE.g., input                            x = [5 5 7 7]\r\n        you may return            f  = '(%d*%d)-(%d/%d)'\r\n                     and                 z = [5 5 7 7]\r\n      so  24 is obatined by     eval(sprintf(f,z)).\r\n     The answer is not necessary unique, e.g., other acceptable answers are\r\n                                            f  = '(%d*%d)-(%d*%d)'  \r\n                                            z =  [7 7 5 5]\r\n                   and                   f = '(%d-%d)*(%d+%d)'\r\n                                            z = [7 5 7 5]","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: 363px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 181.5px; transform-origin: 407px 181.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInpur four integers in 1 to 10, you may use plus, minus, multiply and divid to get 24. Note that every integer should be used once and only once. Brackets are of no limit, and the result should exactly be 24 once you calculate by hand. (Calculation in computer will lead to a tolerance to the computer precision.) \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou need to return a format and a vector with the same four integers, such that you can print the expression.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eE.g., input                            x = [5 5 7 7]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e        you may return            f  = '(%d*%d)-(%d/%d)'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                     and                 z = [5 5 7 7]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e      so  24 is obatined by     eval(sprintf(f,z)).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e     The answer is not necessary unique, e.g., other acceptable answers are\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                                            f  = '(%d*%d)-(%d*%d)'  \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                                            z =  [7 7 5 5]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                   and                   f = '(%d-%d)*(%d+%d)'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                                            z = [7 5 7 5]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [f,z] = get24(x)\r\n  z = 23;\r\n  f = '(%d%d+%s%s)'\r\nend","test_suite":"%%\r\nx = [1 2 3 4];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [6 9 9 10];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e=9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [4 4 10 10];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [3 3 7 7];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [1 4 5 6];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":2197980,"edited_by":2197980,"edited_at":"2024-08-29T05:32:43.000Z","deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":"2024-08-29T05:32:43.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-13T12:52:09.000Z","updated_at":"2024-08-29T05:32:43.000Z","published_at":"2022-04-13T12:52:22.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\u003eInpur four integers in 1 to 10, you may use plus, minus, multiply and divid to get 24. Note that every integer should be used once and only once. Brackets are of no limit, and the result should exactly be 24 once you calculate by hand. (Calculation in computer will lead to a tolerance to the computer precision.) \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou need to return a format and a vector with the same four integers, such that you can print the expression.\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\u003eE.g., input                            x = [5 5 7 7]\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        you may return            f  = '(%d*%d)-(%d/%d)'\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                     and                 z = [5 5 7 7]\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      so  24 is obatined by     eval(sprintf(f,z)).\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     The answer is not necessary unique, e.g., other acceptable answers are\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                                            f  = '(%d*%d)-(%d*%d)'  \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                                            z =  [7 7 5 5]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                   and                   f = '(%d-%d)*(%d+%d)'\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                                            z = [7 5 7 5]\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":54430,"title":"factorial","description":"There are really some cody problems related to factorial of n, e.g., 42667, 45184, 46054, and etc. It is interesting to ask why dont we just write the number n! down and do any kind of analysis later.\r\nSo this problem asks you to write it down as:\r\ninput 3:   write  3!=6\r\ninput 5:  write 5!=120\r\nbut n may be as large as 100 or even more.  Write the result with no spaces.","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: 162px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 81px; transform-origin: 407px 81px; 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=\"\"\u003eThere are really some cody problems related to factorial of n, e.g., \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/42267-factorial-of-a-number-x\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e42667\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45184-factorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e45184\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46054\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, and etc. It is interesting to ask why dont we just write the number n! down and do any kind of analysis later.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSo this problem asks you to write it down as:\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=\"\"\u003einput 3:   write  3!=6\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=\"\"\u003einput 5:  write 5!=120\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=\"\"\u003ebut n may be as large as 100 or even more.  Write the result with no spaces.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = factorial2(x)\r\n    \r\nend","test_suite":"%%\r\nfiletext = fileread('factorial2.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 = 0;\r\ny_correct = '0!=1';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 1;\r\ny_correct = '1!=1';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 4;\r\ny_correct = '4!=24';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = '10!=3628800';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 100;\r\ny_correct = '100!=93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 1000;\r\ny_correct = '1000!=402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(factorial2(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-05-03T22:58:06.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2022-05-03T13:40:27.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-03T13:38:41.000Z","updated_at":"2022-05-03T22:58:06.000Z","published_at":"2022-05-03T13:38:41.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\u003eThere are really some cody problems related to factorial of n, e.g., \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/42267-factorial-of-a-number-x\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e42667\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45184-factorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e45184\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46054\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and etc. It is interesting to ask why dont we just write the number n! down and do any kind of analysis later.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo this problem asks you to write it down as:\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\u003einput 3:   write  3!=6\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\u003einput 5:  write 5!=120\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 n may be as large as 100 or even more.  Write the result with no spaces.\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":54260,"title":"Concatenate input positive integers to obtain a maximum.","description":"Input some integers, you need to concatenate them to obtain a maximum integer. Neither use library function \"perms\" to list all possible solution, nor use to switch your data between numbers and strings. Therefore, any function, with substring \"perm\" or \"str\" is forbidden. Since possibly you get a super large number, return the string format of the answer.\r\nE.g., input [2 4 41 27], \r\n        you get '441272';\r\nand input [ 2 27 272 27272 ]\r\n     you get '27272722722'","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: 183px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 91.5px; transform-origin: 407px 91.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eInput some integers, you need to concatenate them to obtain a maximum integer. Neither use library function \"perms\" to list all possible solution, nor use to switch your data between numbers and strings. Therefore, any function, with substring \"perm\" or \"str\" is forbidden. Since possibly you get a super large number, return the string format of the answer.\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=\"\"\u003eE.g., input [2 4 41 27], \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=\"\"\u003e        you get '441272';\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=\"\"\u003eand input [ 2 27 272 27272 ]\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=\"\"\u003e     you get '27272722722'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = comax(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [2 4 41 27];\r\ny_correct = '441272';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nx = [ 2 27 272 27272 ];\r\ny_correct = '27272722722';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nx = [93 74 35 59 11 91 88 82 27 60 3 43 32 17 18 9 10 60 48 919];\r\ny_correct = '993919918882746060594843353322718171110';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nx = [93 74 35 59 11 91 88 82 27 60 3 43 32 17 18 9 10 1 100 1000 60 48 919];\r\ny_correct = '99391991888274606059484335332271817111101001000';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nfiletext = fileread('comax.m');\r\nassert(isempty(strfind(filetext, 'perm')))\r\n\r\n%%\r\nfiletext = fileread('comax.m');\r\nassert(isempty(strfind(filetext, 'str'))\u0026isempty(strfind(filetext, 'eval')))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-08-18T13:56:25.000Z","deleted_by":null,"deleted_at":null,"solvers_count":43,"test_suite_updated_at":"2022-08-18T13:56:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-12T02:32:25.000Z","updated_at":"2025-12-02T16:34:12.000Z","published_at":"2022-04-12T02:33:10.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\u003eInput some integers, you need to concatenate them to obtain a maximum integer. Neither use library function \\\"perms\\\" to list all possible solution, nor use to switch your data between numbers and strings. Therefore, any function, with substring \\\"perm\\\" or \\\"str\\\" is forbidden. Since possibly you get a super large number, return the string format of the answer.\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\u003eE.g., input [2 4 41 27], \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        you get '441272';\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\u003eand input [ 2 27 272 27272 ]\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     you get '27272722722'\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":54295,"title":"prime consecutive sums","description":"Create a number sequence of 1 to n, such that the sums of every two consecutive numbers are all primes.\r\nE.g. if n = 5, you may write the sequence as 1,4,3,2,5 or  3,4,1,2,5\r\n       if n = 6, you may wrtie the sequence as 2,3,4,1,6,5\r\nThe answer is not unique, so one correct answer enough.","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: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 55.5px; transform-origin: 407px 55.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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCreate a number sequence of 1 to n, such that the sums of every two consecutive numbers are all primes.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: 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=\"\"\u003eE.g. if n = 5, you may write the sequence as 1,4,3,2,5 or  3,4,1,2,5\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=\"\"\u003e       if n = 6, you may wrtie the sequence as 2,3,4,1,6,5\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=\"\"\u003eThe answer is not unique, so one correct answer enough.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = seq1(n)\r\n  y = 1:n;\r\nend","test_suite":"%%\r\nn = 3;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 4;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 5;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 6;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 100;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 2000;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-04-17T10:57:03.000Z","deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":"2022-04-17T10:57:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-17T10:16:01.000Z","updated_at":"2024-12-08T19:33:40.000Z","published_at":"2022-04-17T10:16:01.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate a number sequence of 1 to n, such that the sums of every two consecutive numbers are all primes.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eE.g. if n = 5, you may write the sequence as 1,4,3,2,5 or  3,4,1,2,5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e       if n = 6, you may wrtie the sequence as 2,3,4,1,6,5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer is not unique, so one correct answer enough.\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":1914,"title":"GJam 2013 Veterans: Ocean View (Large)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p2 GJam 2013 Veterans Ocean View\u003e. This is the Large data set with N\u003c=1000 and Q\u003cN\u003c=1000, with typical 80.\r\n\r\nThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\r\n\r\n*Succinct Challenge statement:* Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\r\n\r\n*Input:* V , Vector length N\u003c=1000 with values 1 thru 1000.\r\n\r\n*Output:* Q , minimum quantity of removed values to produce a valid vector (typical 80)\r\n\r\n*Examples:* [V] [Q]\r\n\r\n  [1 4 3 3] [2]  for [1 4] or [1 3]\r\n  [1 2 3 4 5] [0]\r\n  [4 3 2 1] [3]\r\n\r\n*Commentary:*\r\n\r\n  1) nchoosek(1000,80) is a little big\r\n  2) The Large test suite is N\u003c=1000 with some delete cases \u003e4\r\n  3) A Good Algorithm that solves the Large case is usually best to pursue\r\n  4) GJam Competition allows one Large submission within 10 minutes of download \r\n  5) This was only solved by one entrant.\r\n\r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/1913-gjam-2013-veterans-ocean-view-small Small Suite Challenge\u003e\r\n\r\n*Algorithm Spoiler:*\r\nA general method is to start at the end and build all unique length valid vectors. It is only necessary to maintain a Min Value and length for the potential solutions. Once all values are checked find the maximum solution length.  There are three key steps in this method: 1) If vin(j)\u003e Max of all solutions, start a new solution with length 1. 2) Find solutions that are 1 greater than vin(j). Update minimums of these solutions with vin(j) and increase length values.  3) Find solutions where mins\u003evin(j). Augment solution set by a single line of [vin(j),max length found +1]. 4) Find maximum length solution.  This method solved all 100 large cases in \u003c 2 seconds on Cody.\r\n","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\"\u003eGJam 2013 Veterans Ocean View\u003c/a\u003e. This is the Large data set with N\u0026lt;=1000 and Q\u0026lt;N\u0026lt;=1000, with typical 80.\u003c/p\u003e\u003cp\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\u003c/p\u003e\u003cp\u003e\u003cb\u003eSuccinct Challenge statement:\u003c/b\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V , Vector length N\u0026lt;=1000 with values 1 thru 1000.\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Q , minimum quantity of removed values to produce a valid vector (typical 80)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [V] [Q]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 4 3 3] [2]  for [1 4] or [1 3]\r\n[1 2 3 4 5] [0]\r\n[4 3 2 1] [3]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) nchoosek(1000,80) is a little big\r\n2) The Large test suite is N\u0026lt;=1000 with some delete cases \u003e4\r\n3) A Good Algorithm that solves the Large case is usually best to pursue\r\n4) GJam Competition allows one Large submission within 10 minutes of download \r\n5) This was only solved by one entrant.\r\n\u003c/pre\u003e\u003cp\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1913-gjam-2013-veterans-ocean-view-small\"\u003eSmall Suite Challenge\u003c/a\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eAlgorithm Spoiler:\u003c/b\u003e\r\nA general method is to start at the end and build all unique length valid vectors. It is only necessary to maintain a Min Value and length for the potential solutions. Once all values are checked find the maximum solution length.  There are three key steps in this method: 1) If vin(j)\u003e Max of all solutions, start a new solution with length 1. 2) Find solutions that are 1 greater than vin(j). Update minimums of these solutions with vin(j) and increase length values.  3) Find solutions where mins\u003evin(j). Augment solution set by a single line of [vin(j),max length found +1]. 4) Find maximum length solution.  This method solved all 100 large cases in \u0026lt; 2 seconds on Cody.\u003c/p\u003e","function_template":"function Q = Monotonic_V(vin)\r\n  Q=0;\r\nend","test_suite":"%%\r\ntic\r\nvin=[636 246 970 933 361 461 584 712 636 765 900 534 318 948 214 664 649 649 218 159 962 712 215 173 238 112 898 670 665 321 652 653 918 621 585 631 433 520 694 68 285 593 954 954 540 167 970 188 167 187 346 480 899 912 652 488 375 550 157 40 222 808 692 492 781 628 122 565 147 167 985 783 759 938 89 651 104 58 838 623 244 536 102 494 799 106 981 526 7 137 917 228 297 608 71 77 587 544 641 85 ];\r\nvexp=[87 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[985 569 223 420 941 721 504 441 137 145 386 238 4 330 967 408 312 508 90 528 598 922 865 273 505 167 830 764 724 854 486 60 422 60 479 715 781 983 507 269 479 892 506 482 573 472 241 884 331 330 412 929 603 628 553 108 795 383 223 870 236 61 929 10 120 759 76 900 93 582 520 571 825 378 405 397 201 645 632 532 327 395 812 929 23 716 36 169 98 259 38 686 671 966 47 790 724 122 42 817 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[135 80 276 388 795 610 328 961 849 699 154 297 970 548 332 87 647 929 231 574 290 843 993 572 407 364 828 688 492 986 8 979 417 636 366 212 597 45 524 445 744 29 93 65 577 424 152 575 705 382 500 994 576 844 566 334 208 745 21 51 731 29 29 499 16 746 710 612 791 585 56 886 614 148 950 542 924 453 116 980 834 615 973 761 810 890 95 17 635 115 68 717 495 448 215 510 194 277 473 336 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[864 390 641 710 429 314 838 487 749 444 866 162 381 48 901 119 756 642 595 851 197 72 856 600 290 187 648 679 619 273 739 834 14 379 895 442 692 733 928 792 528 145 305 908 193 205 378 300 847 973 150 395 396 357 995 685 896 994 716 514 618 454 699 631 832 594 73 875 678 352 666 205 497 970 464 41 526 193 340 724 165 842 471 561 550 465 597 445 810 312 310 427 117 9 57 300 954 481 174 631 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[522 452 169 41 289 988 837 890 666 829 487 3 346 671 544 443 177 411 525 643 380 167 717 566 460 105 253 724 179 487 742 700 290 263 93 578 602 929 467 267 757 306 270 454 976 165 896 153 927 773 147 307 939 864 872 750 320 476 473 498 314 567 550 603 829 994 180 430 922 647 48 30 304 669 483 279 834 730 783 760 854 282 66 144 145 290 893 816 765 366 665 79 932 214 33 112 207 213 541 480 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 18 20 21 22 23 24 25 26 28 30 31 32 33 34 35 37 38 39 40 41 43 44 45 46 47 48 51 53 54 55 56 57 58 59 60 61 62 63 65 66 67 68 69 71 72 73 74 78 79 80 82 83 84 85 87 88 89 90 93 94 95 96 99 100 101 102 103 104 105 106 107 109 110 111 112 113 114 115 116 117 118 119 120 122 123 124 125 126 127 128 129 134 138 140 141 142 143 144 145 146 147 148 149 150 151 152 155 157 158 160 164 165 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 184 185 186 187 189 190 191 192 193 194 195 196 197 198 199 200 202 203 204 205 206 207 208 209 210 212 213 214 215 216 218 220 221 222 223 224 225 226 227 228 229 230 231 233 234 235 236 237 238 242 243 244 246 247 248 249 250 251 252 254 255 256 258 259 261 262 263 265 266 267 268 269 270 271 272 273 274 275 276 277 279 280 281 282 283 284 286 287 288 289 292 294 295 297 298 299 300 302 303 304 306 307 308 309 310 311 312 313 314 315 316 318 321 324 325 327 328 330 331 334 335 336 337 339 340 342 343 344 345 346 348 349 350 351 352 353 354 355 357 358 359 363 364 365 366 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 388 390 391 393 394 395 397 398 399 401 402 403 404 405 406 407 408 409 410 413 415 416 418 419 420 421 422 423 424 425 427 428 430 431 432 433 435 437 438 440 441 442 443 445 446 447 449 451 452 453 455 457 458 459 460 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 504 505 507 508 509 510 511 512 513 514 515 516 517 518 520 521 524 525 527 528 529 530 531 533 536 537 540 541 542 543 544 545 546 547 549 550 551 552 553 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 577 579 580 581 582 584 585 586 587 588 590 591 592 593 595 597 598 599 600 603 604 605 606 607 610 611 615 616 617 619 620 621 622 623 624 625 626 627 628 630 632 633 634 635 638 641 642 643 644 645 646 648 649 651 653 654 655 656 657 658 659 661 663 664 665 666 667 668 669 670 671 672 673 675 677 678 680 682 683 684 685 686 687 688 689 690 691 692 693 694 696 697 698 700 702 704 705 706 709 710 711 712 713 714 715 717 718 719 720 721 722 723 724 725 726 727 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 748 749 750 751 752 753 754 755 756 757 758 759 761 762 764 766 767 768 769 771 772 773 774 776 777 778 779 780 781 782 783 785 786 788 789 790 791 792 793 794 795 796 797 798 800 801 802 803 804 805 806 807 808 809 810 812 813 815 816 817 818 819 820 821 822 823 824 826 827 829 830 831 832 833 837 838 839 840 841 842 843 844 845 846 847 848 849 851 852 853 854 855 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 877 879 881 882 883 884 887 888 890 891 892 893 894 895 896 898 899 900 901 903 904 905 906 908 909 911 912 913 914 915 916 917 918 919 920 921 922 923 924 927 928 929 930 931 932 933 935 936 937 938 941 942 943 944 945 946 949 950 951 952 953 954 955 956 957 958 960 961 962 963 965 966 967 970 971 972 973 974 975 978 979 980 981 982 983 984 985 986 989 991 992 993 994 995 996 997 998 1000 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[656 151 894 432 577 271 474 259 534 441 734 522 365 493 942 532 175 900 688 139 374 59 422 443 326 64 804 69 733 90 372 740 240 265 172 168 536 997 778 421 437 511 942 801 4 236 685 530 487 372 21 860 430 442 302 107 857 458 175 941 899 899 32 138 163 555 657 50 551 435 471 987 945 764 140 300 351 176 182 837 547 202 48 329 995 350 435 203 159 962 495 57 860 526 546 374 81 202 424 631 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[160 284 529 233 858 58 181 837 14 284 240 425 835 57 402 496 430 135 982 713 622 716 909 963 253 31 790 307 273 291 321 432 574 201 16 431 259 196 620 624 479 211 49 666 268 450 161 49 936 494 762 558 561 22 520 814 404 662 120 676 952 792 459 877 993 474 308 603 670 279 578 500 489 978 517 108 427 30 157 363 523 270 272 84 643 791 249 47 804 720 74 107 863 533 984 207 6 643 809 27 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[717 997 953 616 739 418 429 967 875 551 327 828 991 994 841 796 268 640 537 215 847 996 558 831 282 117 696 696 386 518 188 103 867 140 70 957 557 498 923 783 400 601 962 391 595 803 538 214 794 74 428 640 70 337 823 351 454 518 398 191 388 585 293 254 724 715 562 280 564 484 414 964 436 376 706 30 530 243 595 323 668 375 314 89 711 136 792 516 6 189 707 745 774 351 350 497 65 911 129 629 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[339 92 136 280 51 932 913 389 388 240 645 424 760 147 8 880 39 875 953 822 525 377 243 505 978 181 421 497 443 665 862 133 108 998 412 158 281 677 898 668 916 543 91 675 689 451 906 79 677 210 901 201 587 495 705 564 27 477 60 469 493 274 601 600 623 365 110 903 41 7 922 956 901 364 982 941 166 888 20 842 97 272 43 35 766 99 598 792 576 10 613 420 283 565 20 905 929 129 159 969 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 4 6 7 10 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[902 371 99 852 750 675 90 760 805 58 948 19 245 440 484 372 354 920 794 849 927 838 454 61 432 979 709 266 797 673 155 698 395 253 902 144 927 991 256 731 400 203 101 996 642 936 719 348 856 512 196 134 701 649 194 484 628 255 102 424 927 256 122 673 508 375 169 434 365 424 517 765 978 969 112 971 905 831 318 112 694 514 245 395 162 791 878 789 45 331 565 323 586 38 347 93 412 515 879 776 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[745 222 207 664 944 756 340 17 820 810 426 512 977 342 97 68 374 759 193 308 24 106 963 317 227 746 262 260 405 645 380 149 866 938 164 162 694 504 178 865 313 955 376 641 297 824 60 22 583 252 330 958 358 644 274 936 389 535 195 145 179 575 646 397 512 809 558 557 312 87 422 977 393 149 617 41 973 677 63 907 280 744 864 989 387 489 924 127 23 119 623 554 45 268 302 556 77 859 465 740 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[483 135 335 407 908 857 578 767 378 156 248 269 292 372 111 5 821 150 426 334 446 615 791 5 517 928 677 194 68 908 122 550 42 808 309 302 664 886 420 41 41 668 309 684 39 771 688 212 921 465 545 366 79 687 722 595 614 398 140 33 657 261 583 698 420 891 999 84 128 771 476 520 438 137 203 828 907 242 391 179 706 287 544 784 973 617 730 939 14 869 971 670 481 905 720 900 147 70 335 274 ];\r\nvexp=[80 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[449 699 779 845 562 962 785 857 407 939 248 891 282 197 497 444 329 886 476 573 390 526 492 686 583 679 622 471 498 176 415 946 875 545 143 788 506 927 644 264 218 244 155 851 440 651 646 768 888 121 693 277 998 184 314 580 214 935 50 63 110 816 9 336 712 503 123 217 429 119 481 646 362 987 848 153 989 493 272 876 613 964 504 962 499 817 893 64 751 294 127 860 461 487 196 172 989 670 389 769 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[506 358 525 125 131 493 597 657 174 465 212 984 660 340 197 879 464 893 546 146 446 858 66 893 292 295 771 364 324 233 803 830 591 327 306 73 819 254 81 345 70 644 328 729 984 524 960 447 768 505 944 566 362 10 458 653 304 228 369 628 812 523 809 754 849 466 827 20 719 259 716 789 903 43 869 238 919 828 36 38 685 980 603 46 989 60 51 292 639 771 271 803 293 431 556 141 896 382 512 967 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 201 457 409 579 138 659 919 860 512 119 881 554 984 460 612 370 104 453 607 792 323 877 982 906 932 419 986 615 397 771 618 950 580 378 528 69 37 446 280 900 917 160 806 900 972 417 269 75 222 227 219 896 455 200 801 386 618 138 1000 367 909 970 316 840 699 195 908 87 992 187 987 908 699 792 807 670 560 428 744 133 654 314 29 461 514 829 846 483 967 198 201 227 519 516 418 217 62 325 656 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[536 287 975 835 202 487 189 178 104 222 6 933 565 70 493 646 121 949 836 462 586 175 876 615 42 687 243 401 489 327 78 24 613 404 858 166 890 398 344 345 620 701 629 536 770 121 533 242 421 368 703 7 894 930 973 935 968 215 688 457 893 117 480 857 872 690 23 113 87 718 458 58 770 86 945 891 559 477 132 979 196 186 337 90 467 309 376 434 875 415 890 767 531 722 624 402 763 998 867 849 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[833 191 187 681 160 2 73 38 194 412 113 711 605 583 623 155 399 219 599 208 883 909 986 999 269 395 299 222 875 824 204 59 15 390 91 526 743 163 563 936 927 676 646 531 610 268 37 9 839 636 568 721 896 554 71 516 948 369 89 174 193 292 585 559 33 675 84 775 838 647 62 764 674 708 646 283 327 683 643 517 670 211 237 917 764 660 784 63 28 872 236 572 515 820 130 899 495 214 673 684 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 3 2 1 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[544 765 207 299 570 502 839 142 76 830 438 777 696 718 720 628 215 31 72 544 666 606 940 218 865 169 973 254 550 831 129 446 948 335 744 517 188 582 10 616 764 447 392 459 164 464 438 731 846 509 626 511 114 565 80 331 85 52 584 634 235 64 79 534 750 174 50 937 108 411 552 871 858 296 681 373 759 119 455 956 979 432 466 93 348 898 775 432 301 358 66 887 421 496 420 522 22 821 458 129 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[785 582 933 107 851 569 822 33 992 796 966 99 985 62 5 70 257 409 548 674 546 105 824 71 10 447 326 723 819 799 22 955 380 306 62 582 874 883 966 217 30 931 316 15 993 320 84 601 728 983 626 273 87 801 695 96 247 373 819 65 171 192 372 902 497 433 835 723 667 800 939 697 83 606 63 427 925 498 27 4 480 653 629 919 453 323 366 52 695 536 116 217 727 839 118 576 623 304 650 290 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[379 605 855 323 94 992 160 884 141 954 836 48 258 937 651 919 261 967 418 311 554 590 622 688 538 87 844 682 520 888 740 250 845 594 925 938 586 436 822 78 390 9 477 647 297 128 918 557 94 335 220 1000 276 193 687 165 279 882 846 151 122 585 752 966 531 676 255 468 112 76 545 501 436 21 147 733 500 416 641 594 750 860 945 377 52 983 542 331 865 739 833 986 676 584 303 206 260 557 673 371 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[954 932 241 707 209 356 476 772 941 695 374 528 156 421 13 187 443 842 884 139 129 463 369 117 721 356 808 952 976 529 501 929 812 93 987 20 449 814 143 741 508 516 620 16 936 985 202 730 826 85 868 954 548 589 422 620 296 230 923 271 110 423 551 922 516 889 941 316 703 84 408 210 951 27 577 239 11 778 968 836 215 188 141 114 776 915 85 71 144 8 693 253 782 595 526 649 483 467 964 537 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ];\r\nvexp=[999 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[861 880 573 826 28 522 719 303 975 834 282 160 800 606 921 962 496 15 978 482 481 397 198 328 845 412 189 390 688 662 77 901 541 649 78 920 522 797 222 848 982 855 8 134 461 280 95 956 294 424 437 126 821 986 453 17 397 642 758 437 303 186 689 195 186 766 115 707 914 688 907 248 895 914 381 355 193 827 662 838 250 450 315 422 435 768 438 183 761 547 971 415 732 659 609 269 777 75 328 690 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[212 86 799 237 145 796 871 824 830 514 340 499 724 577 767 487 236 550 901 615 773 136 539 639 308 20 537 802 585 561 837 148 647 987 384 143 782 607 966 612 120 306 462 843 234 229 681 821 130 581 435 255 68 325 893 375 697 782 528 281 342 364 429 340 350 164 483 484 770 448 95 241 753 556 435 338 136 467 158 266 399 945 872 467 269 764 841 965 897 721 598 239 436 378 930 138 541 412 621 663 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[153 433 497 818 590 42 657 625 619 100 678 271 684 627 284 600 980 569 862 178 530 692 225 1 239 891 474 710 719 529 477 872 313 973 689 255 15 697 879 633 148 909 255 831 535 890 430 866 459 644 44 340 335 620 340 925 510 165 986 229 694 462 100 358 434 140 612 800 836 843 784 984 751 391 166 637 280 948 855 90 943 250 429 629 869 768 905 379 285 890 959 330 351 410 687 136 549 299 288 736 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[422 107 359 466 750 64 127 249 677 702 213 920 568 385 70 37 787 149 971 26 915 76 17 851 728 43 738 163 767 379 341 540 838 51 357 939 466 483 188 143 184 752 62 751 137 484 139 275 632 462 300 898 537 316 749 265 359 838 779 477 569 471 368 758 521 724 696 987 558 883 481 741 987 542 843 123 25 334 749 9 147 48 906 683 715 6 299 73 196 78 901 764 900 268 521 421 343 216 759 900 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[830 800 491 470 290 893 711 316 603 32 241 822 608 314 513 533 514 537 19 447 670 582 20 35 543 428 35 411 413 882 8 594 33 498 63 674 743 125 990 697 156 230 870 764 895 735 648 408 271 19 207 292 952 578 326 846 5 712 257 769 945 264 362 329 114 776 3 856 900 344 904 407 925 774 522 819 508 170 579 130 540 785 773 843 714 450 688 70 161 944 838 458 560 551 786 673 678 788 880 929 ];\r\nvexp=[79 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[43 360 9 945 127 32 574 617 273 710 476 930 679 187 746 569 725 493 693 539 527 933 487 508 562 719 739 403 813 707 484 855 67 493 151 545 876 725 162 500 434 989 429 112 176 526 32 252 19 77 790 545 9 629 404 922 699 143 676 864 849 511 70 267 3 221 164 230 297 325 730 730 313 158 194 840 684 577 443 54 653 585 598 13 565 353 934 263 847 609 478 48 120 548 314 474 120 477 704 416 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[290 747 892 267 715 356 238 619 186 555 82 879 420 327 625 582 469 855 722 865 185 638 187 771 675 533 215 86 400 93 214 689 839 457 956 906 812 545 876 349 451 958 580 871 284 204 804 104 410 877 968 947 515 506 69 189 38 283 627 789 728 840 478 918 296 785 823 460 329 699 808 779 656 739 649 291 943 804 394 704 681 713 650 195 218 718 383 607 353 9 396 80 200 225 997 848 9 820 307 337 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[226 923 398 567 407 187 615 980 2 14 380 144 628 177 231 799 501 612 159 124 261 636 742 374 458 143 404 885 207 225 671 784 147 420 703 905 958 669 236 312 682 615 455 309 144 37 460 996 648 618 119 909 605 212 282 414 354 37 651 561 261 321 696 759 93 398 663 50 419 251 361 100 865 167 761 8 203 220 3 851 837 473 111 793 685 392 206 38 781 856 950 393 529 998 152 973 747 166 22 165 ];\r\nvexp=[80 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[456 940 338 538 898 400 964 822 249 990 178 80 994 806 998 799 480 364 850 175 899 317 743 978 156 861 905 778 516 906 419 971 845 108 508 742 859 823 916 107 165 445 187 158 250 184 956 81 899 157 255 150 474 998 127 981 210 383 110 77 288 529 48 484 988 907 578 847 730 845 953 894 289 139 403 890 675 711 970 573 867 577 722 692 926 200 672 135 934 134 563 221 14 610 57 1 517 986 847 598 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[416 735 265 633 901 377 640 456 596 995 306 784 819 768 576 855 159 133 245 939 341 546 332 221 543 835 193 290 1000 566 806 416 300 70 48 201 446 39 656 393 385 313 176 204 80 103 410 590 236 654 881 928 200 564 148 94 398 340 735 749 905 541 164 557 962 563 109 408 954 116 152 338 780 328 893 859 782 303 800 369 956 680 296 507 595 443 953 992 134 687 741 391 227 256 947 189 171 407 948 124 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 33 63 78 82 85 92 101 113 125 138 175 183 196 211 224 250 287 345 368 388 426 447 477 491 504 524 575 579 581 621 694 712 720 737 745 747 784 793 802 813 827 829 853 858 919 924 929 939 960 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[751 767 289 186 348 753 835 126 830 440 200 582 596 824 917 356 380 767 870 274 279 308 426 749 518 607 719 233 246 57 756 348 823 396 885 170 500 719 647 329 158 198 263 753 21 179 461 752 297 682 26 927 989 803 28 858 762 746 442 7 154 197 706 977 593 590 498 92 308 497 773 818 46 35 922 419 565 734 170 861 416 547 140 404 702 167 262 463 264 703 821 417 252 526 745 196 115 595 287 774 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 2 4 3 5 6 8 7 10 9 11 12 14 13 15 16 17 19 18 20 21 22 24 23 25 26 28 27 30 29 31 32 33 34 36 35 37 38 40 39 41 43 42 44 45 46 48 47 50 49 51 52 53 55 54 56 57 58 60 59 61 63 62 64 65 66 68 67 69 71 70 72 73 74 76 75 78 77 79 80 82 81 83 84 85 87 86 88 89 91 90 92 93 94 96 95 98 97 99 100 101 102 104 103 106 105 107 108 110 109 111 112 114 113 115 116 118 117 119 120 121 123 122 124 125 127 126 128 130 129 131 132 134 133 135 136 137 139 138 140 141 142 144 143 145 146 148 147 149 151 150 152 154 153 155 156 157 158 160 159 162 161 163 164 165 166 168 167 169 170 172 171 173 174 176 175 178 177 179 180 181 182 184 183 186 185 187 188 190 189 191 192 194 193 195 196 198 197 199 200 201 203 202 204 206 205 207 208 209 210 212 211 214 213 215 216 217 219 218 220 221 222 224 223 226 225 227 228 229 230 232 231 233 235 234 236 237 239 238 240 242 241 243 244 246 245 247 248 250 249 251 252 254 253 255 256 257 259 258 260 261 263 262 264 265 266 268 267 269 270 272 271 274 273 275 276 278 277 279 280 281 283 282 284 285 287 286 288 290 289 291 292 293 295 294 296 298 297 299 300 301 303 302 304 305 307 306 308 309 310 312 311 313 315 314 316 317 318 320 319 321 322 324 323 326 325 327 328 330 329 331 332 334 333 335 336 337 339 338 340 341 342 344 343 346 345 347 348 349 350 352 351 353 354 356 355 357 359 358 360 362 361 363 364 365 366 368 367 370 369 371 372 373 375 374 376 377 378 380 379 381 383 382 384 386 385 387 388 390 389 391 392 393 395 394 396 397 399 398 400 401 403 402 404 406 405 407 408 409 410 412 411 413 415 414 416 417 418 420 419 421 423 422 424 426 425 427 428 430 429 431 432 433 435 434 436 437 439 438 440 442 441 443 444 445 447 446 448 450 449 451 452 453 455 454 456 457 459 458 460 461 462 464 463 465 467 466 468 469 470 472 471 473 475 474 476 478 477 479 480 481 483 482 484 486 485 487 488 490 489 491 492 493 495 494 496 497 499 498 500 501 502 504 503 505 507 506 508 509 511 510 512 514 513 515 516 517 518 520 519 522 521 523 524 525 527 526 528 530 529 531 532 533 535 534 536 538 537 539 540 542 541 543 544 545 546 548 547 550 549 551 552 553 555 554 556 557 559 558 560 562 561 563 564 565 566 568 567 569 570 572 571 574 573 575 576 578 577 579 580 581 583 582 584 585 586 588 587 589 590 592 591 593 595 594 596 597 599 598 600 601 602 604 603 605 606 608 607 609 611 610 612 614 613 615 616 617 618 620 619 622 621 623 624 626 625 627 628 629 631 630 632 633 634 636 635 638 637 639 640 641 643 642 644 646 645 647 648 650 649 651 652 653 654 656 655 657 659 658 660 662 661 663 664 666 665 667 668 669 671 670 672 673 675 674 676 677 679 678 680 682 681 683 684 685 686 688 687 689 691 690 692 693 694 696 695 697 698 700 699 701 702 704 703 705 707 706 708 709 710 712 711 713 714 716 715 717 718 720 719 722 721 723 724 725 726 728 727 730 729 731 732 734 733 735 736 738 737 739 740 741 742 744 743 746 745 747 748 749 751 750 752 753 755 754 756 758 757 759 760 761 763 762 764 765 766 768 767 769 771 770 772 773 775 774 776 777 778 780 779 782 781 783 784 785 786 788 787 789 790 792 791 793 794 796 795 797 799 798 800 801 802 804 803 805 806 808 807 810 809 811 812 814 813 815 816 817 818 820 819 822 821 823 824 826 825 827 828 829 831 830 832 834 833 835 836 837 838 840 839 841 843 842 844 846 845 847 848 849 850 852 851 853 854 856 855 857 859 858 860 861 862 864 863 865 866 868 867 869 870 872 871 873 875 874 876 878 877 879 880 882 881 883 884 885 886 888 887 889 890 892 891 893 895 894 896 897 898 900 899 902 901 903 904 905 906 908 907 909 910 912 911 914 913 915 916 917 918 920 919 921 923 922 924 925 926 928 927 929 930 932 931 933 935 934 936 938 937 939 940 941 942 944 943 945 946 948 947 949 951 950 952 954 953 955 956 957 958 960 959 962 961 963 964 965 967 966 968 970 969 971 972 974 973 975 976 977 979 978 980 981 982 984 983 986 985 987 988 990 989 991 992 993 995 994 996 997 999 998 1000 ];\r\nvexp=[250 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 19 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 4 3 3 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[815 768 572 413 61 287 382 520 43 814 125 344 903 447 878 702 868 762 461 590 511 448 907 997 74 333 918 953 644 230 54 810 349 625 222 409 264 955 280 306 120 756 1 22 203 878 76 422 991 536 12 853 983 918 850 57 603 767 361 598 348 766 408 696 743 981 104 6 936 383 663 55 138 15 429 692 244 504 114 234 39 477 87 21 394 288 429 996 406 141 594 753 907 1 448 649 333 903 6 268 ];\r\nvexp=[87 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[715 324 259 836 409 555 726 967 384 857 298 931 42 986 20 508 647 748 941 873 162 183 992 45 256 967 798 18 964 664 218 30 987 828 865 748 383 590 66 118 446 715 48 839 701 420 346 347 519 638 571 680 172 562 76 779 528 874 796 843 537 366 872 876 193 88 623 927 677 40 44 474 755 444 312 455 863 9 153 381 999 723 412 522 637 488 301 164 361 96 7 249 461 230 124 6 318 98 932 346 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[522 99 461 301 778 354 511 560 8 662 280 315 694 576 174 288 370 126 632 856 812 724 246 391 979 544 931 501 950 230 624 823 328 437 475 458 142 985 369 149 646 648 463 339 223 988 979 945 113 610 800 277 333 45 19 663 940 949 164 241 178 787 63 857 223 537 666 716 873 34 864 870 682 679 209 256 666 187 200 131 148 351 407 480 395 425 142 686 725 305 926 254 444 340 110 18 876 776 734 100 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[986 869 904 402 636 104 209 757 705 337 301 740 169 404 572 415 22 827 117 133 872 263 503 640 737 654 616 432 752 268 954 737 136 858 138 772 313 698 528 18 386 180 109 906 583 32 320 956 859 436 88 82 50 591 73 138 596 41 570 347 308 523 83 443 380 572 566 45 621 445 62 6 625 522 911 559 554 230 515 764 18 954 197 67 896 269 205 491 661 774 837 968 648 271 763 28 194 328 424 814 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[835 78 7 863 573 841 832 653 720 351 56 298 397 179 562 636 299 542 569 853 327 320 54 147 328 355 444 206 343 100 546 529 529 904 392 102 96 575 106 816 926 514 465 674 692 27 309 990 568 229 195 246 900 248 392 579 954 187 785 648 638 330 177 519 233 920 972 329 494 77 496 771 590 960 796 634 986 105 975 905 685 521 150 585 768 893 515 74 432 299 73 421 980 601 939 565 520 910 245 14 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[626 750 682 840 23 620 651 542 846 79 714 942 624 759 272 636 101 647 505 954 823 212 398 949 431 870 68 568 133 370 720 758 471 753 949 845 725 952 387 570 382 452 864 6 210 135 641 662 133 145 615 307 708 365 255 138 586 675 706 718 396 777 828 866 882 776 710 606 727 448 527 461 900 390 466 461 877 458 123 361 954 89 668 662 805 922 799 390 948 856 108 343 985 287 208 866 62 270 471 141 ];\r\nvexp=[79 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[235 228 987 190 889 791 317 684 110 217 895 566 657 188 402 731 514 485 602 606 767 410 328 583 701 500 772 884 333 161 654 919 740 993 461 629 135 129 312 244 346 206 161 2 394 562 84 259 399 685 865 165 447 544 99 499 395 870 382 79 382 388 997 122 732 457 750 866 938 413 109 283 971 270 636 716 183 72 974 581 108 190 97 554 733 196 405 479 417 786 557 799 525 554 272 256 362 373 121 299 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[993 227 107 247 622 327 484 892 155 519 281 839 498 884 236 838 295 638 482 286 408 752 88 700 535 643 193 782 377 56 748 721 635 206 967 608 533 802 499 39 320 779 229 170 14 464 7 661 454 840 946 213 592 385 265 478 27 457 259 755 864 7 475 498 564 793 105 96 594 955 134 266 86 362 787 99 178 145 759 983 985 56 195 928 440 459 405 819 267 663 573 131 21 400 980 585 544 437 32 138 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[637 668 675 126 34 103 818 277 606 283 510 996 759 948 368 504 587 149 500 992 289 445 744 547 797 543 195 129 445 552 749 81 571 423 207 604 877 376 880 834 10 742 829 120 41 196 975 628 696 474 619 985 270 715 883 66 257 430 547 702 981 647 134 552 69 692 155 945 419 35 130 780 776 958 251 816 505 226 795 201 699 766 537 321 480 419 738 736 848 636 789 829 282 275 732 350 318 886 646 737 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[520 971 78 333 535 918 930 357 193 69 399 244 246 841 552 833 468 478 785 476 173 296 215 260 277 366 692 711 363 448 381 235 418 459 919 304 728 848 660 272 916 410 868 513 602 419 346 70 249 482 545 421 130 111 681 758 828 724 468 190 171 201 776 940 659 694 244 738 893 255 361 161 17 228 673 618 999 18 687 247 852 583 667 981 693 699 738 520 423 557 710 945 757 837 237 767 531 832 856 775 ];\r\nvexp=[78 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[161 949 970 194 627 530 802 645 68 353 775 215 704 181 694 450 957 187 136 33 844 61 286 287 753 747 656 628 874 389 80 35 690 49 228 316 578 381 312 645 734 86 211 437 618 904 886 574 442 21 606 285 434 243 923 186 990 579 165 863 319 244 897 8 644 477 676 221 857 987 217 590 425 427 378 42 682 264 968 124 636 573 760 421 168 683 958 157 613 123 19 283 718 268 643 362 744 670 934 952 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[921 739 879 409 716 747 869 495 776 25 857 651 646 480 86 288 622 686 334 426 757 408 532 619 292 515 826 649 157 986 28 429 724 906 838 440 4 706 934 132 82 142 782 727 973 219 366 594 256 700 19 12 459 903 982 750 769 807 398 278 145 425 706 868 682 543 659 686 600 944 817 33 437 950 759 409 520 477 355 775 176 725 786 634 627 767 735 396 926 132 673 70 909 378 289 590 273 300 275 224 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[211 588 861 514 609 695 144 442 425 927 553 630 208 971 774 704 612 666 871 376 31 535 806 314 101 839 425 659 403 965 139 613 905 999 126 513 694 269 306 470 547 210 99 106 180 872 161 791 890 31 519 272 566 676 586 666 866 10 324 268 327 814 880 583 165 5 95 858 626 752 679 172 961 777 630 141 1 790 283 242 821 801 513 738 829 98 403 694 460 78 962 786 244 841 368 408 198 814 617 175 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[345 356 192 379 626 146 339 157 374 419 580 561 192 746 68 231 668 760 231 149 516 13 702 426 515 688 214 702 980 729 501 324 436 692 55 414 189 745 922 914 515 501 827 58 246 894 288 265 654 519 766 521 883 819 298 397 507 512 98 838 240 951 513 28 642 919 441 183 663 362 448 530 215 274 587 812 168 227 77 173 745 194 693 979 12 991 375 518 854 825 355 93 775 220 472 768 138 912 302 153 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[55 561 739 879 938 143 627 491 788 610 374 114 357 185 42 379 252 430 547 702 40 936 387 710 253 785 499 328 258 892 496 312 453 235 542 742 377 520 232 516 129 605 981 485 141 375 215 745 804 113 446 195 48 184 904 652 968 754 980 225 646 475 888 450 709 429 191 438 300 775 953 428 731 934 265 224 308 831 968 463 944 413 657 343 596 912 995 563 665 326 139 662 152 26 111 213 806 654 650 105 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[115 234 289 9 499 669 715 43 847 376 880 97 177 546 518 963 313 308 145 425 206 468 839 290 126 800 558 254 874 885 296 988 470 584 348 968 605 62 10 451 789 241 547 317 787 417 279 451 76 776 876 281 243 714 570 368 513 480 622 739 364 917 78 186 852 426 153 456 839 163 907 980 403 453 296 189 221 575 992 296 350 867 929 592 580 498 311 445 329 284 183 45 552 260 230 404 37 382 859 876 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[377 312 592 156 382 321 20 986 965 831 995 59 736 919 383 679 650 258 427 674 392 926 663 374 319 161 553 406 353 268 485 729 931 428 237 664 100 256 649 64 439 995 474 526 266 857 204 915 114 631 940 857 908 955 230 578 115 134 335 819 753 172 548 35 951 784 698 403 391 698 818 181 693 292 706 310 500 262 576 613 892 515 821 151 469 402 80 935 888 414 754 992 937 301 27 888 436 724 290 178 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 5 6 1 7 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[702 390 16 146 565 919 452 746 471 596 64 700 367 25 892 634 431 175 691 493 279 938 37 406 397 833 103 910 422 299 743 475 41 759 621 605 677 424 702 499 371 117 550 737 141 442 370 923 968 412 415 246 349 804 3 97 636 105 6 409 755 749 236 795 859 208 751 535 631 804 386 1 921 935 89 413 376 458 336 695 222 102 940 570 905 294 667 540 398 24 301 505 124 536 651 982 743 402 517 373 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[294 606 149 273 390 992 232 883 106 284 406 537 904 323 960 281 898 282 973 120 668 189 94 950 572 109 382 247 197 864 338 490 470 838 762 859 829 345 93 287 629 850 823 884 173 783 165 422 416 489 541 84 677 634 33 600 94 415 847 290 630 184 779 99 373 892 310 201 589 754 487 217 604 662 452 128 444 968 549 859 456 89 294 485 74 327 84 520 93 930 809 722 465 940 173 837 183 482 390 771 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[138 328 820 892 771 483 698 985 844 850 717 842 924 128 363 560 967 15 76 679 111 434 928 923 663 51 280 980 149 564 326 286 891 497 177 13 331 874 349 174 75 65 367 350 544 82 262 863 96 689 541 558 122 468 833 784 519 112 116 19 675 441 304 917 289 832 281 619 57 629 145 483 45 863 184 941 944 445 803 392 133 343 949 254 811 781 390 681 893 505 51 919 297 706 188 585 889 468 555 945 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 17 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[976 853 243 180 658 979 923 226 893 655 966 40 37 892 748 564 93 396 415 245 255 203 54 735 935 446 55 146 523 568 947 850 420 541 29 429 519 304 655 411 310 972 450 347 863 550 262 956 945 676 200 199 231 605 933 165 50 339 662 924 906 608 773 678 500 154 106 18 457 112 428 766 436 230 464 298 779 726 605 723 753 805 273 983 761 557 499 163 895 512 86 153 471 211 830 970 364 287 987 172 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 ];\r\nvexp=[999 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[493 423 719 243 813 237 231 93 184 85 534 478 686 963 106 555 82 362 285 366 251 243 695 953 652 382 440 552 32 79 287 524 502 6 118 314 594 348 758 777 785 292 606 470 254 711 376 335 424 660 53 674 254 747 978 257 480 417 808 511 848 95 34 349 452 503 662 45 851 772 173 987 63 778 808 668 840 184 2 263 195 406 288 449 153 265 705 632 33 513 495 880 959 880 228 410 383 242 454 585 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[297 238 716 689 386 333 730 710 361 144 616 992 887 831 981 625 319 904 103 694 374 725 599 418 345 900 326 421 110 790 160 406 27 876 446 764 560 527 474 272 22 441 263 260 624 243 236 942 499 338 987 872 415 937 290 759 836 967 531 297 756 690 54 134 917 500 897 828 378 722 99 400 163 714 659 786 308 895 79 158 584 418 30 350 354 671 108 542 637 990 838 744 32 892 877 948 743 125 128 120 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[961 238 790 232 341 217 876 109 914 771 275 778 761 924 820 756 37 283 58 200 170 971 229 962 481 406 83 173 107 819 779 419 409 921 651 749 137 878 857 403 648 483 180 760 406 351 515 794 986 924 345 155 246 925 469 726 331 551 251 789 369 29 208 777 301 210 877 438 87 85 840 87 568 371 198 325 73 65 471 58 340 167 565 586 92 33 663 774 583 913 562 303 294 121 432 594 682 660 383 121 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[17 13 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[847 578 871 9 291 882 146 951 776 224 108 711 993 489 61 347 511 520 240 147 510 77 242 541 320 470 840 62 595 967 534 441 545 404 801 187 285 946 137 412 521 597 123 866 85 535 564 596 54 803 94 915 879 336 455 199 157 295 612 751 613 145 543 157 549 343 696 185 640 184 597 513 780 71 730 865 605 293 460 658 95 905 573 973 592 379 523 749 25 135 499 638 631 394 146 179 88 193 716 80 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[595 443 257 384 392 367 144 911 843 498 37 18 223 174 3 201 293 89 596 570 221 620 639 129 350 279 70 622 930 697 197 877 139 453 260 883 820 403 145 14 253 182 384 827 355 386 27 999 827 975 568 47 594 558 527 295 837 948 268 118 644 465 994 783 917 605 665 88 360 809 102 612 342 485 438 49 222 816 47 48 790 615 446 736 172 324 30 360 272 298 478 267 114 471 49 30 428 65 470 787 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[780 954 884 510 239 148 85 898 331 52 360 274 464 368 968 411 279 314 325 296 991 463 957 143 840 420 355 645 73 4 749 852 309 985 713 548 132 798 445 814 849 157 439 665 524 407 427 155 72 752 450 63 566 406 205 758 825 911 402 249 914 503 452 222 487 165 121 970 314 918 784 514 74 222 178 597 980 957 103 404 60 552 466 977 310 22 734 486 932 488 735 197 990 186 770 828 702 243 149 15 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 978 571 427 755 378 94 946 913 447 208 108 853 495 908 5 111 964 988 143 828 482 23 786 362 602 195 96 195 1000 680 559 329 250 985 83 979 430 28 892 877 587 999 729 433 258 85 543 221 424 38 49 258 412 834 971 13 381 66 560 732 745 118 61 994 455 495 972 884 875 215 760 461 565 840 246 822 924 788 43 700 177 91 957 588 276 927 953 8 344 512 740 88 629 152 433 435 646 756 319 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[451 239 992 437 132 835 911 157 520 659 517 666 58 774 700 772 780 999 197 975 428 97 90 327 717 962 99 59 529 857 959 979 447 950 767 579 136 29 87 7 687 603 672 96 376 372 868 507 722 64 833 149 512 922 827 228 883 926 639 412 134 597 742 933 898 861 511 386 889 949 744 928 903 416 23 278 139 242 137 860 305 969 360 817 891 538 396 125 463 34 888 949 982 630 881 880 842 743 617 730 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[54 863 642 961 561 785 120 582 696 547 678 829 552 991 857 12 856 37 210 339 355 407 539 933 277 407 350 845 820 26 500 873 241 493 834 153 629 305 735 325 851 412 505 402 754 713 414 610 749 975 948 456 381 838 740 9 596 442 853 416 467 705 640 59 197 825 212 826 129 298 502 979 61 6 733 814 718 498 423 818 472 722 625 204 912 365 212 507 806 416 274 624 120 914 683 669 90 246 846 219 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[557 254 725 829 188 813 242 916 622 929 610 843 30 902 765 935 195 783 826 945 806 126 449 282 661 99 263 755 852 131 479 761 384 203 589 924 367 182 191 989 110 800 183 140 53 947 74 600 81 899 544 239 377 344 520 37 442 782 792 646 913 622 406 648 825 994 571 191 176 761 531 637 913 714 776 965 12 201 916 93 452 459 331 828 802 850 864 596 983 7 241 895 629 998 543 805 991 465 347 518 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[382 165 739 167 38 451 342 38 166 455 245 754 118 285 706 466 81 767 408 279 675 398 220 142 598 521 210 991 413 174 676 794 690 767 312 79 217 653 116 382 459 360 487 928 997 193 745 429 311 505 59 985 254 279 478 852 799 687 842 563 212 869 708 901 635 19 980 851 24 447 584 834 159 71 762 155 263 858 935 925 362 994 909 616 272 386 819 422 424 660 984 636 880 691 888 515 61 219 717 84 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[91 411 591 488 445 865 258 361 598 428 574 13 326 713 417 379 879 30 193 142 84 13 910 335 890 655 530 356 249 169 130 691 579 72 530 376 288 788 736 886 567 309 250 892 373 666 623 251 47 815 744 131 180 654 817 69 660 347 425 908 867 906 950 797 977 479 524 617 266 260 502 832 920 751 76 293 769 698 895 815 864 639 297 43 644 114 112 303 812 536 562 30 793 511 826 121 341 350 737 607 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[773 485 819 749 358 729 307 911 311 821 26 680 127 222 98 22 843 654 513 503 779 701 823 427 972 585 806 165 264 229 331 36 65 149 136 422 230 443 685 892 615 710 571 741 284 668 763 126 322 627 980 100 327 802 878 650 738 683 167 2 911 497 389 327 645 525 749 226 967 433 117 581 494 687 674 129 707 436 606 380 62 586 831 740 387 709 390 477 743 556 478 6 52 866 332 48 390 80 274 708 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[840 811 793 629 947 995 457 205 236 199 384 941 486 279 76 810 896 157 100 909 377 71 931 209 327 2 461 474 71 795 747 911 957 892 539 903 886 347 108 474 898 491 766 383 769 842 192 16 350 292 925 727 714 207 935 40 560 395 865 630 542 612 892 498 503 783 753 740 481 860 213 378 702 979 112 822 172 304 838 521 947 114 599 12 672 886 403 231 280 268 212 173 879 456 671 733 238 423 824 70 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[666 301 270 824 723 31 330 985 240 264 909 602 257 169 217 880 554 35 653 329 46 988 964 925 30 204 791 91 422 508 526 439 808 795 262 530 177 943 866 417 207 126 370 815 294 586 695 199 972 347 527 369 687 843 645 716 46 436 806 467 295 684 906 102 478 519 983 7 462 200 775 668 677 144 834 970 81 528 168 404 227 46 772 913 888 768 628 933 555 786 752 849 469 657 302 298 527 636 304 988 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[140 221 767 853 559 614 357 547 107 629 774 71 944 277 33 795 93 277 858 843 571 984 702 31 470 249 203 458 919 943 227 410 515 345 263 73 958 619 971 64 599 744 135 895 20 519 689 464 795 546 306 365 882 359 748 351 960 302 161 230 596 739 639 110 83 901 534 392 872 504 456 470 599 942 716 618 460 404 433 606 302 738 971 183 448 70 885 407 371 397 636 318 487 627 427 569 879 960 313 750 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[895 347 549 955 352 281 120 421 130 543 238 601 616 863 156 527 579 719 386 384 135 11 359 606 276 393 626 366 638 471 584 884 817 484 190 168 765 310 940 246 204 178 847 819 392 354 698 970 73 435 705 559 797 63 516 73 456 142 790 445 612 725 329 429 208 518 948 972 827 888 570 382 417 768 201 808 121 250 129 193 36 833 103 832 895 619 904 350 760 45 147 371 769 475 799 977 344 747 300 523 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[212 715 903 316 622 690 654 758 156 811 375 555 755 246 21 376 361 213 692 258 285 289 496 721 666 777 858 559 189 830 573 752 896 827 67 517 516 720 274 672 883 648 578 637 893 950 364 254 514 56 511 799 696 358 871 714 134 80 272 674 909 196 425 804 22 844 320 538 915 946 561 797 593 490 786 838 439 149 443 952 556 305 102 252 662 972 965 147 51 588 173 959 783 949 114 156 792 434 693 707 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 2 3 4 5 7 8 9 10 12 13 14 15 16 17 19 20 21 24 25 26 27 30 31 32 33 34 36 37 38 39 40 41 42 43 44 45 46 47 49 52 53 54 55 58 59 60 61 62 63 64 65 66 67 69 70 72 74 75 76 77 79 80 81 82 83 84 85 87 89 90 93 95 96 97 98 100 101 102 104 105 108 109 110 112 115 117 116 118 119 120 121 122 123 124 125 126 128 132 133 134 135 136 137 139 142 143 145 146 147 148 149 150 151 153 154 155 156 159 157 160 161 162 163 164 165 167 168 170 171 174 177 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 196 197 198 199 201 202 203 204 205 206 207 208 212 213 214 216 217 219 220 221 223 224 225 226 227 228 229 230 231 232 233 234 235 237 238 239 241 242 245 246 248 249 250 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 270 271 272 275 278 279 280 282 283 284 286 287 288 289 291 292 293 295 296 297 299 300 301 302 303 304 305 307 308 310 312 313 314 315 317 319 320 322 323 324 325 327 328 330 329 331 332 333 334 335 336 337 338 339 340 341 342 343 344 346 347 348 349 350 351 352 354 355 357 358 359 360 361 362 363 364 365 367 368 369 370 373 374 375 378 379 383 384 386 387 388 389 390 392 394 396 398 399 400 401 403 404 405 406 407 408 409 410 411 412 413 414 416 420 417 421 422 424 426 427 428 429 430 432 433 434 436 437 438 439 440 442 443 444 445 446 448 449 450 452 454 455 456 457 458 459 460 461 462 463 464 465 466 468 469 471 472 474 475 476 477 478 479 480 481 483 484 485 486 487 489 490 491 492 493 494 496 497 498 499 500 501 502 504 505 506 507 508 509 510 511 514 515 517 518 519 520 521 522 526 527 529 530 531 532 533 534 535 536 537 538 539 540 541 543 545 546 547 548 549 550 552 553 554 555 557 558 559 560 561 565 566 567 568 569 570 571 574 575 576 577 579 580 581 582 583 586 587 588 589 590 591 593 594 595 596 597 599 601 602 603 604 605 606 607 608 609 610 612 614 613 615 616 617 618 619 620 621 623 624 625 626 627 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 647 648 649 651 654 652 655 656 657 659 662 663 664 665 666 667 668 670 671 672 673 674 675 676 677 678 679 680 681 684 685 687 688 689 690 691 693 694 696 697 700 702 703 704 705 706 707 708 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 745 746 748 749 750 751 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 770 771 773 774 775 776 777 778 779 780 781 783 784 785 786 787 788 790 791 792 793 794 796 797 798 799 800 801 802 803 804 805 807 806 809 811 812 813 814 815 816 818 819 820 822 823 824 825 826 827 828 829 830 831 832 833 834 836 839 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 863 864 865 866 867 868 869 870 871 872 873 874 876 877 878 881 882 883 886 888 889 891 892 893 895 896 897 898 899 900 901 903 904 905 906 907 908 909 910 911 912 914 915 916 919 920 921 922 923 924 925 926 927 928 929 930 931 933 934 935 937 938 939 940 943 944 946 947 948 949 950 951 954 955 958 959 960 962 964 963 965 966 967 968 969 970 971 973 974 976 977 978 979 980 981 982 983 985 987 989 990 991 992 993 994 995 996 997 998 999 1000 ];\r\nvexp=[8 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[232 362 351 89 9 383 813 119 501 620 74 832 51 891 276 399 788 50 830 441 407 247 327 179 95 747 700 116 567 509 596 798 870 946 238 230 680 51 348 533 22 421 364 72 312 639 470 451 688 652 891 446 898 570 624 992 316 675 107 882 183 54 680 405 999 269 634 31 671 982 563 692 754 926 764 417 564 585 220 251 236 462 48 486 31 671 477 346 697 936 228 231 989 259 635 340 879 621 370 550 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[743 518 755 828 879 541 927 408 37 37 390 21 445 937 948 884 395 704 54 14 367 979 496 739 378 827 675 921 263 707 410 6 224 164 185 454 56 111 214 93 500 603 465 944 891 765 179 286 468 233 651 186 211 146 925 940 972 951 212 587 657 622 944 232 137 128 686 545 591 899 989 442 853 805 385 744 569 563 381 389 147 31 926 357 528 202 296 851 153 860 437 809 481 732 41 969 860 78 513 802 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[86 217 935 102 796 608 72 794 977 758 392 828 341 411 808 33 109 545 905 883 454 614 180 210 450 416 977 332 247 832 107 332 400 41 786 196 1000 857 341 977 966 733 804 658 495 964 43 603 860 947 838 313 912 17 523 361 432 851 45 678 682 503 361 434 895 498 629 895 706 321 871 672 405 26 329 899 341 723 854 201 669 691 513 580 59 387 293 490 237 689 519 271 191 231 704 85 81 684 979 786 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[473 794 229 24 568 883 911 820 507 554 938 670 729 241 831 64 196 280 334 572 853 361 223 365 866 48 748 528 116 865 442 941 658 670 964 225 904 226 44 410 131 982 79 859 574 261 275 770 540 608 693 392 320 915 109 186 962 208 713 430 72 154 370 82 176 685 306 79 262 702 841 744 35 271 955 960 532 229 729 71 836 421 815 156 688 923 693 1 130 405 430 554 910 151 635 437 187 292 516 448 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[746 542 944 181 269 649 563 798 243 157 472 262 531 138 351 242 625 142 109 630 330 815 726 455 518 75 952 582 985 432 562 82 973 857 263 594 505 825 743 99 981 567 361 512 704 711 105 328 852 213 310 533 380 35 988 897 462 291 830 446 722 392 880 46 248 142 639 105 318 734 203 298 300 915 161 355 625 617 682 828 830 343 713 209 730 52 457 191 342 286 988 415 29 867 460 629 360 451 733 677 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":"2013-10-05T04:03:17.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-05T03:14:32.000Z","updated_at":"2013-10-06T00:40:15.000Z","published_at":"2013-10-05T03:49:00.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\u003eThis Challenge is derived from\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=\\\"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Ocean View\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. This is the Large data set with N\u0026lt;=1000 and Q\u0026lt;N\u0026lt;=1000, with typical 80.\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\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\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\u003eSuccinct Challenge statement:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V , Vector length N\u0026lt;=1000 with values 1 thru 1000.\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Q , minimum quantity of removed values to produce a valid vector (typical 80)\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\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [V] [Q]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 4 3 3] [2]  for [1 4] or [1 3]\\n[1 2 3 4 5] [0]\\n[4 3 2 1] [3]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCommentary:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) nchoosek(1000,80) is a little big\\n2) The Large test suite is N\u003c=1000 with some delete cases \u003e4\\n3) A Good Algorithm that solves the Large case is usually best to pursue\\n4) GJam Competition allows one Large submission within 10 minutes of download \\n5) This was only solved by one entrant.]]\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1913-gjam-2013-veterans-ocean-view-small\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSmall Suite Challenge\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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAlgorithm Spoiler:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A general method is to start at the end and build all unique length valid vectors. It is only necessary to maintain a Min Value and length for the potential solutions. Once all values are checked find the maximum solution length. There are three key steps in this method: 1) If vin(j)\u0026gt; Max of all solutions, start a new solution with length 1. 2) Find solutions that are 1 greater than vin(j). Update minimums of these solutions with vin(j) and increase length values. 3) Find solutions where mins\u0026gt;vin(j). Augment solution set by a single line of [vin(j),max length found +1]. 4) Find maximum length solution. This method solved all 100 large cases in \u0026lt; 2 seconds on Cody.\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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":47078,"title":"Sum of infinite series.","description":null,"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: 169.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 84.9px; transform-origin: 407px 84.9px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eA series T(k,x,n), whose k-th term is given b:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eT(k,x,n) = (x^k)* [ n*(n-1)*....(n-k+1)]/ [k*(k-1).....1] and T(0,x,n) = 1\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eFind the sum S = sum(T(k,x,n)) for k = 0 to inf.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003ex will greater than -1 and n will be negative.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eHint: Try binomial expansion or something like binomial compression.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function S = binomial(x,n)\r\n  S = (1-n)^(x) % something similar can be an easy solution.\r\nend","test_suite":"%%\r\nx = 1;\r\nn = -1;\r\ny_correct = 0.5;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = -1;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = -1;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 0;\r\nn = -3;\r\ny_correct = 1;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = -1;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 1;\r\nn = -2;\r\ny_correct = 0.25;\r\nassert(abs(binomial(x,n)-y_correct)\u003c1e-5)","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":442401,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-25T09:23:00.000Z","updated_at":"2026-03-01T15:20:05.000Z","published_at":"2020-10-25T09:23:00.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA series T(k,x,n), whose k-th term is given 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eT(k,x,n) = (x^k)* [ n*(n-1)*....(n-k+1)]/ [k*(k-1).....1] and T(0,x,n) = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the sum S = sum(T(k,x,n)) for k = 0 to inf.\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\u003ex will greater than -1 and n will be negative.\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: Try binomial expansion or something like binomial compression.\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":57595,"title":"Find alternating sum","description":"Given an array, find alternating sum i.e. – y = x (1) – x (2) + x (3) – x (4) + x (5) - …","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: 21.0085px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.989px 10.4972px; transform-origin: 406.996px 10.5043px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.991px 10.4972px; text-align: left; transform-origin: 383.999px 10.5043px; 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=\"\"\u003eGiven an array, find alternating sum i.e. – y = x (1) – x (2) + x (3) – x (4) + x (5) - …\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [2,5,4,6,1];\r\ny_correct = -4;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = repmat([1,0],1,20);\r\ny_correct = 20;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1:100;\r\ny_correct = -50;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1000:23:1000000;\r\ny_correct = 500491;\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":2294940,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-01-20T10:52:03.000Z","updated_at":"2026-03-22T02:51:48.000Z","published_at":"2023-01-20T10:52:03.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an array, find alternating sum i.e. – y = x (1) – x (2) + x (3) – x (4) + x (5) - …\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":134,"title":"Geometric series","description":"Find the sum, given the first term t1, the common ratio r, and number of terms n. \r\n\r\nExamples\r\n\r\n If input t1=1,  r=1,  n=7 then output y=7\r\n\r\n If input t1=10, r=10, n=5 then output y=111110.","description_html":"\u003cp\u003eFind the sum, given the first term t1, the common ratio r, and number of terms n.\u003c/p\u003e\u003cp\u003eExamples\u003c/p\u003e\u003cpre\u003e If input t1=1,  r=1,  n=7 then output y=7\u003c/pre\u003e\u003cpre\u003e If input t1=10, r=10, n=5 then output y=111110.\u003c/pre\u003e","function_template":"function y = your_fcn_name(t1,r,n)\r\n  y = n;\r\nend","test_suite":"%%\r\nt1=1; r=1; n=7;\r\ny_correct = 7;\r\nassert(isequal(your_fcn_name(t1,r,n),y_correct))\r\n%%\r\nt1=10; r=10; n=5;\r\ny_correct = 111110;\r\nassert(isequal(your_fcn_name(t1,r,n),y_correct))\r\n%%\r\nt1=7; r=3; n=5;\r\ny_correct = 847;\r\nassert(isequal(your_fcn_name(t1,r,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":285,"test_suite_updated_at":"2012-02-03T03:26:45.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-28T06:21:39.000Z","updated_at":"2026-02-16T16:20:14.000Z","published_at":"2012-02-03T03:34:30.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 sum, given the first term t1, the common ratio r, and number of terms n.\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\u003eExamples\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[ If input t1=1,  r=1,  n=7 then output y=7\\n\\n If input t1=10, r=10, n=5 then output y=111110.]]\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":44860,"title":"Sum of a geometric series","description":"Give the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.","description_html":"\u003cp\u003eGive the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.\u003c/p\u003e","function_template":"function y = your_fcn_name(a,r,n)\r\n  y = x;\r\nend","test_suite":"%%\r\na = 1;\r\nr= 0.1;\r\nn=10;\r\ny_correct = a*(1 - r^n)/(1-r);\r\nassert(isequal(your_fcn_name(a,r,n),y_correct))\r\n\r\n%%\r\na = 0.2;\r\nr= 0.2;\r\nn=5;\r\ny_correct = a*(1 - r^n)/(1-r);\r\nassert(isequal(your_fcn_name(a,r,n),y_correct))\r\n\r\n%%\r\na = 0.4;\r\nr= 0.3;\r\nn=7;\r\ny_correct = a*(1 - r^n)/(1-r);\r\nassert(isequal(your_fcn_name(a,r,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":274816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":"2019-03-01T22:02:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-03-01T22:00:57.000Z","updated_at":"2026-02-18T09:36:25.000Z","published_at":"2019-03-01T22:00: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\u003eGive the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.\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":47083,"title":"sum of binomial series","description":null,"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: 199.6px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 99.8px; transform-origin: 407px 99.8px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eThe k-th term of the series T(k,x,n) is given as:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eT(k,x,n) =k* (x^(k-1))*((n!)/(k!*(n-k)!)).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003ewhere n! = 1*2*3......n\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eFind the sum S = sum(T(k,x,n)) for k = 1 to n.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003eHint : try binomial expansion of (1+x)^n and its derivative, for a smarter solution.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.8px; 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.4px; text-align: left; transform-origin: 384px 10.4px; 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function S = derivative_binomial(x,n)\r\n  S = (x-1)*(1-n)^(x+1) % Try something similar\r\nend","test_suite":"%%\r\nx = 0;\r\nn = 3;\r\ny_correct = 3;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 0;\r\nn = 4;\r\ny_correct = 4;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 1;\r\nn = 3;\r\ny_correct = 12;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 3;\r\nn = 4;\r\ny_correct = 256;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n%%\r\nx = 4;\r\nn = 3;\r\ny_correct = 75;\r\nassert(abs(derivative_binomial(x,n)-y_correct)\u003c1e-5)\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":442401,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-25T16:53:49.000Z","updated_at":"2026-03-02T09:20:40.000Z","published_at":"2020-10-25T16:53:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe k-th term of the series T(k,x,n) is given as:\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\u003eT(k,x,n) =k* (x^(k-1))*((n!)/(k!*(n-k)!)).\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\u003ewhere n! = 1*2*3......n\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 sum S = sum(T(k,x,n)) for k = 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=\\\"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\u003eHint : try binomial expansion of (1+x)^n and its derivative, for a smarter solution.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44225,"title":"Sum of self power series","description":"The series, 1^1,2^2,3^3,4^4,....\r\n\r\nFind the sum of such series when x terms are given.","description_html":"\u003cp\u003eThe series, 1^1,2^2,3^3,4^4,....\u003c/p\u003e\u003cp\u003eFind the sum of such series when x terms are given.\u003c/p\u003e","function_template":"function y = sumofseries(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(sumofseries(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 5;\r\nassert(isequal(sumofseries(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 288;\r\nassert(isequal(sumofseries(x),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":134801,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-05-25T05:40:41.000Z","updated_at":"2026-03-10T15:08:41.000Z","published_at":"2017-05-25T05:40:51.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 series, 1^1,2^2,3^3,4^4,....\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the sum of such series when x terms are given.\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":3015,"title":"Sum all integers from 1 to 2^x","description":"Given a number x, your function must return the summation of all integers from 1 to 2^x.","description_html":"\u003cp\u003eGiven a number x, your function must return the summation of all integers from 1 to 2^x.\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 2;\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 36;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 136;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 528;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 6;\r\ny_correct = 2080;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 7;\r\ny_correct = 8256;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 8;\r\ny_correct = 32896;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 15;\r\ny_correct = 536887296;\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":34017,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":115,"test_suite_updated_at":"2016-09-30T03:21:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-02-14T00:13:24.000Z","updated_at":"2026-02-17T15:56:22.000Z","published_at":"2015-02-14T00:13:24.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 x, your function must return the summation of all integers from 1 to 2^x.\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":47234,"title":"Find Logic 4","description":null,"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: 212.619px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 174px 106.31px; transform-origin: 174px 106.31px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 41.9048px; 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: 151px 20.9524px; text-align: left; transform-origin: 151px 20.9524px; 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=\"\"\u003eMake a function by finding logic from this problem\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(1) = 2\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(2) = 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(3) = 12\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(4) = 20\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 41.9048px; 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: 151px 20.9524px; text-align: left; transform-origin: 151px 20.9524px; 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=\"\"\u003eGuess the logic and make function logic(x) which will return 'x' th term of series\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = logic(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 2;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 20;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 7;\r\ny_correct = 56;\r\nassert(isequal(logic(x),y_correct))","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":293792,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":499,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-03T13:56:59.000Z","updated_at":"2026-02-27T08:11:55.000Z","published_at":"2020-11-03T13:56:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMake a function by finding logic from 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003elogic(1) = 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\u003elogic(2) = 6\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\u003elogic(3) = 12\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\u003elogic(4) = 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\u003eGuess the logic and make function logic(x) which will return 'x' th term of series\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":58658,"title":"Even Sum","description":"Calculate the sum of all even numbers between 1 and a given positive integer n. Write a function that takes n as input and returns the sum of even numbers.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; 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; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 21px; transform-origin: 332px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 21px; text-align: left; transform-origin: 309px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCalculate the sum of all even numbers between 1 and a given positive integer n. Write a function that takes n as input and returns the sum of even numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = calculateEvenSum(n)\r\n  y = n;\r\nend","test_suite":"%%\r\nn = 5;\r\ny_correct = 6;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 1;\r\ny_correct = 0;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 10;\r\ny_correct = 30;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 11;\r\ny_correct = 30;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 20;\r\ny_correct = 110;\r\nassert(isequal(calculateEvenSum(n),y_correct))\r\n%%\r\nn = 40;\r\ny_correct = 420;\r\nassert(isequal(calculateEvenSum(n),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3469833,"edited_by":26769,"edited_at":"2023-12-01T16:32:35.000Z","deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2023-12-01T16:32:35.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2023-07-18T15:13:46.000Z","updated_at":"2026-03-06T13:52:38.000Z","published_at":"2023-07-18T15:13:46.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\u003eCalculate the sum of all even numbers between 1 and a given positive integer n. Write a function that takes n as input and returns the sum of even numbers.\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":47239,"title":"Find Logic 5","description":null,"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: 191.667px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 174px 95.8333px; transform-origin: 174px 95.8333px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003eGuess the logic\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(1) = 2\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(2) = 5\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(3) = 9\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 20.9524px; 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: 151px 10.4762px; text-align: left; transform-origin: 151px 10.4762px; 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=\"\"\u003elogic(4) = 14\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 41.9048px; 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: 151px 20.9524px; text-align: left; transform-origin: 151px 20.9524px; 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=\"\"\u003eMake a function logic(x) which returns 'x' th term of logic\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = logic(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 2;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 20;\r\nassert(isequal(logic(x),y_correct))\r\n\r\n%%\r\nx = 8;\r\ny_correct = 44;\r\nassert(isequal(logic(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":293792,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-03T16:42:59.000Z","updated_at":"2026-03-16T11:57:14.000Z","published_at":"2020-11-03T16:42:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGuess the logic\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\u003elogic(1) = 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\u003elogic(2) = 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003elogic(3) = 9\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003elogic(4) = 14\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\u003eMake a function logic(x) which returns 'x' th term of logic\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":57795,"title":"Armstrong Number","description":"Write a function name armstrong_check that checks whether the given input is an Armstrong Number or not. It returns logical True or False.\r\nAn Armstrong number is one whose sum of digits raised to the power of the number of digits equals the number itself. For example, 371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371.\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440000534057617px; 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; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eWrite a function name armstrong_check that checks whether the given input is an Armstrong Number or not. It returns logical True or False.\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eAn \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://web.archive.org/web/20171228054132/https://everything2.net/index.pl?node_id=1407017\u0026amp;displaytype=printable\u0026amp;lastnode_id=1407017\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eArmstrong number\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; \"\u003e\u003cspan style=\"\"\u003e is one whose sum of digits raised to the power of the number of digits equals the number itself. For example, 371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371.\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = armstrong_check(n)\r\n  out = n;\r\nend","test_suite":"%%\r\nn = 371;\r\nout_correct = true;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn = 21;\r\nout_correct = false;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn= 548834;\r\nout_correct = true;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn= 68955;\r\nout_correct = false;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n%%\r\nn= 1741725;\r\nout_correct = true;\r\nassert(isequal(armstrong_check(n),out_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":2294940,"edited_by":26769,"edited_at":"2023-04-19T21:12:05.000Z","deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-03-17T08:49:07.000Z","updated_at":"2026-02-05T05:42:50.000Z","published_at":"2023-03-17T08:49:07.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\u003eWrite a function name armstrong_check that checks whether the given input is an Armstrong Number or not. It returns logical True or False.\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\u003eAn \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://web.archive.org/web/20171228054132/https://everything2.net/index.pl?node_id=1407017\u0026amp;displaytype=printable\u0026amp;lastnode_id=1407017\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eArmstrong number\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is one whose sum of digits raised to the power of the number of digits equals the number itself. For example, 371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2579,"title":"Sum of series V","description":"What is the sum of the following sequence:\r\n\r\n Σk(k+1) for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σk(k+1) for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesV(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 2;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 20;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 4;\r\ns_correct = 40;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 440;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 21;\r\ns_correct = 3542;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 26488;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 88;\r\ns_correct = 234960;\r\nassert(isequal(sumOfSeriesV(n),s_correct))\r\n\r\n%%\r\nn = 99;\r\ns_correct = 333300;\r\nassert(isequal(sumOfSeriesV(n),s_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1715,"test_suite_updated_at":"2017-06-13T18:07:53.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:08:14.000Z","updated_at":"2026-03-28T09:27:09.000Z","published_at":"2014-09-10T10:08:47.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σk(k+1) for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":2575,"title":"Sum of series I","description":"What is the sum of the following sequence:\r\n\r\n Σ(2k-1) for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(2k-1) for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesI(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 4;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 100;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 15;\r\ns_correct = 225;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 1764;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 101;\r\ns_correct = 10201;\r\nassert(isequal(sumOfSeriesI(n),s_correct))\r\n\r\n%%\r\nn = 12345;\r\ns_correct = 152399025;\r\nassert(isequal(sumOfSeriesI(n),s_correct))","published":true,"deleted":false,"likes_count":14,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2250,"test_suite_updated_at":"2017-06-13T17:57:57.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T09:37:47.000Z","updated_at":"2026-04-11T00:27:15.000Z","published_at":"2014-09-10T09:38:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(2k-1) for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":2577,"title":"Sum of series III","description":"What is the sum of the following sequence:\r\n\r\n Σ(2k-1)^3 for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(2k-1)^3 for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesIII(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 28;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 5;\r\ns_correct = 1225;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 19900;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 6221628;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 99;\r\ns_correct = 192109401;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 124;\r\ns_correct = 472827376;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))\r\n\r\n%%\r\nn = 222;\r\ns_correct = 4857776028;\r\nassert(isequal(sumOfSeriesIII(n),s_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1824,"test_suite_updated_at":"2017-06-13T18:03:10.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T09:51:33.000Z","updated_at":"2026-04-10T20:01:36.000Z","published_at":"2014-09-10T09:52:07.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(2k-1)^3 for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":43968,"title":"Concatenated roots","description":"Which is the value of this infinte concatenated roots?\r\n\r\n\u003c\u003chttps://s27.postimg.org/i4hkin7xf/Code_Cogs_Eqn.gif\u003e\u003e\r\n\r\n\r\nNote: If image server is not available, the equation was:\r\n\r\n  x*sqrt(x*cuberoot(x*fourthroot(x*fifthroot(x*sixthroot(...)))))\r\n\r\nTip: sum(1/n!)","description_html":"\u003cp\u003eWhich is the value of this infinte concatenated roots?\u003c/p\u003e\u003cimg src = \"https://s27.postimg.org/i4hkin7xf/Code_Cogs_Eqn.gif\"\u003e\u003cp\u003eNote: If image server is not available, the equation was:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex*sqrt(x*cuberoot(x*fourthroot(x*fifthroot(x*sixthroot(...)))))\r\n\u003c/pre\u003e\u003cp\u003eTip: sum(1/n!)\u003c/p\u003e","function_template":"function y = infinteroots(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny = 1;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx = 10;\r\ny = 52.2735299670437;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=5;\r\ny=15.8864718332426;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=6;\r\ny=21.7311722059576;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=4;\r\ny=10.827015106694;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n\r\n%%\r\nx=3.2;\r\ny=7.37887287693964;\r\nassert(abs(infinteroots(x)-y)\u003c1e-11)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":12767,"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":"2016-12-25T20:58:32.000Z","updated_at":"2026-04-03T02:58:43.000Z","published_at":"2016-12-25T20:59: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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.gif\"}],\"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\u003eWhich is the value of this infinte concatenated roots?\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:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\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\u003eNote: If image server is not available, the equation was:\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*sqrt(x*cuberoot(x*fourthroot(x*fifthroot(x*sixthroot(...)))))]]\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\u003eTip: sum(1/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\"},{\"partUri\":\"/media/image1.gif\",\"contentType\":\"image/gif\",\"content\":\"data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAC1QTFRFeHh4k5OT9vb2gYGBnJycwMDAt7e3ioqK0tLS7e3t29vb5OTkycnJ////b29vvCMpXwAAAKZJREFUeNq8k0sWwyAIAEXzh3D/41ZrahASklXZ6cxTEAz8EOGFsDvxTyECM0RHgJIwOEIt6VFYX19BAd0kKe8vTpn0vY9uheXoQjGYrICtf9mg3Qgo+kt12fE4sxQwaGFQXCdJmmshaV4EnKYxmgMO/pvJVJ92NrwNbSpnrJafUz1kYbRcjP121ii4EKDVIPnVx+n4hdBzKyhuBM21YLgSLOePAAMAW0UziCh1I3kAAAAASUVORK5CYII=\"}]}"},{"id":45384,"title":"Sum! Sum! Sum!","description":"Calculate the sum of the sequence up to nth term \u003e\u003e \r\n\r\n  a,aa,aaa,aaaa,... \r\n  2,22,222,2222,...  [for a=2]","description_html":"\u003cp\u003eCalculate the sum of the sequence up to nth term \u0026gt;\u0026gt;\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ea,aa,aaa,aaaa,... \r\n2,22,222,2222,...  [for a=2]\r\n\u003c/pre\u003e","function_template":"function  y = series_sum(a,n)","test_suite":"%%\r\nassert(isequal(series_sum(3,4),3702))\r\n%%\r\nassert(isequal(series_sum(2,15),246913580246910))\r\n%%\r\nassert(isequal(series_sum(9,9),1111111101))\r\n%%\r\nassert(isequal(series_sum(1,12),123456790122))\r\n%%\r\nassert(isequal(series_sum(5,5),61725))","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":42,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-24T13:05:35.000Z","updated_at":"2026-04-14T13:08:04.000Z","published_at":"2020-03-24T13:05: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\",\"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\u003eCalculate the sum of the sequence up to nth term \u0026gt;\u0026gt;\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[a,aa,aaa,aaaa,... \\n2,22,222,2222,...  [for a=2]]]\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":2576,"title":"Sum of series II","description":"What is the sum of the following sequence:\r\n\r\n Σ(2k-1)^2 for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(2k-1)^2 for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesII(n)\r\n  s = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 10;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 35;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 4;\r\ns_correct = 84;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 5;\r\ns_correct = 165;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 11;\r\ns_correct = 1771;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 42;\r\ns_correct = 98770;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 71;\r\ns_correct = 477191;\r\nassert(isequal(sumOfSeriesII(n),s_correct))\r\n\r\n%%\r\nn = 123;\r\ns_correct = 2481115;\r\nassert(isequal(sumOfSeriesII(n),s_correct))","published":true,"deleted":false,"likes_count":11,"comments_count":2,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1921,"test_suite_updated_at":"2017-06-13T18:00:48.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T09:44:53.000Z","updated_at":"2026-04-10T19:47:55.000Z","published_at":"2014-09-10T09:45: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\",\"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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(2k-1)^2 for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":45248,"title":"Aquiles y la tortuga","description":"Contaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tortuga en una carrera. Todo parecía apuntar a que Aquiles vencería sin ninguna duda, pero las matemáticas parece que tenían algo que decir... \r\n\r\nAquiles, al ser más veloz, le da una ventaja a la tortuga de medio kilómetro (1/2 = 0.5 km). En esta carrera, Aquiles corre a la mitad de la velocidad que la tortuga, y ambos mantienen su velocidad constante. Por ello, cuando Aquiles recorra medio kilómetro, la tortuga habrá avanzado la mitad de esa distancia (1/4 = 0.25 km). Y cuando Aquiles recorra el siguiente cuarto de kilómetro (0.25 km), la tortuga habrá avanzado la mitad de ésta (1/8 = 0.125 km). Si esta sucesión de distancias, cada vez más pequeñas, se repite hasta el infinito, entonces la tortuga siempre estará ligeramente más avanzada que Aquiles (aunque sea por una distancia infinitesimal) y, por lo tanto, la tortuga siempre ganará la carrera.\r\n\r\nSegún Zenón, las infinitas distancias _{1, 1/2, 1/4, 1/8, 1/16, ...}_ que tiene que recorrer Aquiles impiden que alcance a la tortuga, precisamente porque son infinitas. Sin embargo, en la realidad, es evidente que Aquiles alcanzará a la tortuga.\r\n\r\nEn este problema se propone descubrir el secreto de la paradoja mediante una función que reciba como entrada el parámetro _n_ y devuelva:\r\n\r\n* La suma de las distancias de la sucesión _{1/2^n}_ desde _1_ hasta _n_. Las sumas anteriores deben almacenarse en un vector _suma = [s1, s2, ..., sn]_.\r\n\r\n\u003c\u003chttps://imgur.com/GZcLHQu.png\u003e\u003e\r\n\r\n\r\n* Una gráfica con la _suma_ de las distancias (en km) frente a _n_.\r\n\r\n¿A qué valor se aproxima la suma cuando _n_ tiende a infinito (prueba con un número _n_ muy grande)? Por lo tanto, ¿a qué distancia alcanzará Aquiles a la tortuga?\r\n\r\n\r\n","description_html":"\u003cp\u003eContaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tortuga en una carrera. Todo parecía apuntar a que Aquiles vencería sin ninguna duda, pero las matemáticas parece que tenían algo que decir...\u003c/p\u003e\u003cp\u003eAquiles, al ser más veloz, le da una ventaja a la tortuga de medio kilómetro (1/2 = 0.5 km). En esta carrera, Aquiles corre a la mitad de la velocidad que la tortuga, y ambos mantienen su velocidad constante. Por ello, cuando Aquiles recorra medio kilómetro, la tortuga habrá avanzado la mitad de esa distancia (1/4 = 0.25 km). Y cuando Aquiles recorra el siguiente cuarto de kilómetro (0.25 km), la tortuga habrá avanzado la mitad de ésta (1/8 = 0.125 km). Si esta sucesión de distancias, cada vez más pequeñas, se repite hasta el infinito, entonces la tortuga siempre estará ligeramente más avanzada que Aquiles (aunque sea por una distancia infinitesimal) y, por lo tanto, la tortuga siempre ganará la carrera.\u003c/p\u003e\u003cp\u003eSegún Zenón, las infinitas distancias \u003ci\u003e{1, 1/2, 1/4, 1/8, 1/16, ...}\u003c/i\u003e que tiene que recorrer Aquiles impiden que alcance a la tortuga, precisamente porque son infinitas. Sin embargo, en la realidad, es evidente que Aquiles alcanzará a la tortuga.\u003c/p\u003e\u003cp\u003eEn este problema se propone descubrir el secreto de la paradoja mediante una función que reciba como entrada el parámetro \u003ci\u003en\u003c/i\u003e y devuelva:\u003c/p\u003e\u003cul\u003e\u003cli\u003eLa suma de las distancias de la sucesión \u003ci\u003e{1/2^n}\u003c/i\u003e desde \u003ci\u003e1\u003c/i\u003e hasta \u003ci\u003en\u003c/i\u003e. Las sumas anteriores deben almacenarse en un vector \u003ci\u003esuma = [s1, s2, ..., sn]\u003c/i\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cimg src = \"https://imgur.com/GZcLHQu.png\"\u003e\u003cul\u003e\u003cli\u003eUna gráfica con la \u003ci\u003esuma\u003c/i\u003e de las distancias (en km) frente a \u003ci\u003en\u003c/i\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e¿A qué valor se aproxima la suma cuando \u003ci\u003en\u003c/i\u003e tiende a infinito (prueba con un número \u003ci\u003en\u003c/i\u003e muy grande)? Por lo tanto, ¿a qué distancia alcanzará Aquiles a la tortuga?\u003c/p\u003e","function_template":"function suma = mi_funcion(n)\r\n  % Resuelve el problema\r\nend","test_suite":"%%\r\nn = 3;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8)];\r\nassert(isequal(mi_funcion(n),suma));\r\n%%\r\nn = 4;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16)];\r\nassert(isequal(mi_funcion(n),suma))\r\n%%\r\nn = 6;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16) (1/2+1/4+1/8+1/16+1/32) (1/2+1/4+1/8+1/16+1/32+1/64)];\r\nassert(isequal(mi_funcion(n),suma))\r\n%%\r\nn = 10;\r\nsuma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16) (1/2+1/4+1/8+1/16+1/32) (1/2+1/4+1/8+1/16+1/32+1/64) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8+1/2^9) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8+1/2^9+1/2^10)];\r\nassert(isequal(mi_funcion(n),suma))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":385299,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":29,"test_suite_updated_at":"2019-12-28T19:14:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-28T18:34:40.000Z","updated_at":"2020-07-22T23:45:03.000Z","published_at":"2019-12-28T18:34: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\",\"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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.JPEG\"}],\"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\u003eContaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tortuga en una carrera. Todo parecía apuntar a que Aquiles vencería sin ninguna duda, pero las matemáticas parece que tenían algo que decir...\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\u003eAquiles, al ser más veloz, le da una ventaja a la tortuga de medio kilómetro (1/2 = 0.5 km). En esta carrera, Aquiles corre a la mitad de la velocidad que la tortuga, y ambos mantienen su velocidad constante. Por ello, cuando Aquiles recorra medio kilómetro, la tortuga habrá avanzado la mitad de esa distancia (1/4 = 0.25 km). Y cuando Aquiles recorra el siguiente cuarto de kilómetro (0.25 km), la tortuga habrá avanzado la mitad de ésta (1/8 = 0.125 km). Si esta sucesión de distancias, cada vez más pequeñas, se repite hasta el infinito, entonces la tortuga siempre estará ligeramente más avanzada que Aquiles (aunque sea por una distancia infinitesimal) y, por lo tanto, la tortuga siempre ganará la carrera.\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\u003eSegún Zenón, las infinitas distancias\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e{1, 1/2, 1/4, 1/8, 1/16, ...}\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e que tiene que recorrer Aquiles impiden que alcance a la tortuga, precisamente porque son infinitas. Sin embargo, en la realidad, es evidente que Aquiles alcanzará a la tortuga.\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\u003eEn este problema se propone descubrir el secreto de la paradoja mediante una función que reciba como entrada el parámetro\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e y devuelva:\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\u003eLa suma de las distancias de la sucesión\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e{1/2^n}\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e desde\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\u003e1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e hasta\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Las sumas anteriores deben almacenarse en un vector\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\u003esuma = [s1, s2, ..., sn]\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\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\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\u003eUna gráfica con la\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\u003esuma\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e de las distancias (en km) frente 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: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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e¿A qué valor se aproxima la suma cuando\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e tiende a infinito (prueba con un número\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\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e muy grande)? Por lo tanto, ¿a qué distancia alcanzará Aquiles a la tortuga?\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\"},{\"partUri\":\"/media/image1.JPEG\",\"contentType\":\"image/JPEG\",\"content\":\"data:image/JPEG;base64,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\"}]}"},{"id":45364,"title":"Sum of series","description":" a(n) = n^2 - (n-1)^2\r\n\r\nfind the summation of the series upto n i.e. \r\n\r\n   a(1)+a(2)+...+a(n)","description_html":"\u003cpre\u003e a(n) = n^2 - (n-1)^2\u003c/pre\u003e\u003cp\u003efind the summation of the series upto n i.e.\u003c/p\u003e\u003cpre\u003e   a(1)+a(2)+...+a(n)\u003c/pre\u003e","function_template":"function y=seq_sum(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(seq_sum(236),55696))\r\n%%\r\nassert(isequal(seq_sum(881224),776555738176))\r\n%%\r\nassert(isequal(seq_sum(10199),104019601))\r\n%%\r\nassert(isequal(seq_sum(8812249),77655732438001))","published":true,"deleted":false,"likes_count":11,"comments_count":2,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1255,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-14T12:34:14.000Z","updated_at":"2026-03-22T02:49:55.000Z","published_at":"2020-03-14T12:34: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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ a(n) = n^2 - (n-1)^2]]\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\u003efind the summation of the series upto n i.e.\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[   a(1)+a(2)+...+a(n)]]\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":1913,"title":"GJam 2013 Veterans: Ocean View (Small)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p2 GJam 2013 Veterans Ocean View\u003e. This is the Small data set witn N\u003c=50 and Q\u003c=4, guaranteed.\r\n\r\nThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\r\n\r\n*Succinct Challenge statement:* Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\r\n\r\n*Input:* V , Vector length N\u003c=50 with values 1 thru 1000.\r\n\r\n*Output:* Q , minimum quantity of removed values to produce a valid vector [0:4]\r\n\r\n*Examples:* [V] [Q]\r\n\r\n  [1 4 3 3] [2]  for [1 4] or [1 3]\r\n  [1 2 3 4 5] [0]\r\n  [4 3 2 1] [3]\r\n\r\n*Commentary:*\r\n\r\n  1) The GJam Small test suite is not robust\r\n  2) nchoosek(50,4) is too slow for Cody and the 100 cases\r\n  3) The Large test suite is N\u003c=1000 with some delete cases \u003e4\r\n  4) A Good Algorithm that solves the Large case is usually best to pursue\r\n  5) GJam Competition allows one Large submission within 10 minutes of download \r\n  6) \u003cLarge Suite Challenge\u003e","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\"\u003eGJam 2013 Veterans Ocean View\u003c/a\u003e. This is the Small data set witn N\u0026lt;=50 and Q\u0026lt;=4, guaranteed.\u003c/p\u003e\u003cp\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\u003c/p\u003e\u003cp\u003e\u003cb\u003eSuccinct Challenge statement:\u003c/b\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V , Vector length N\u0026lt;=50 with values 1 thru 1000.\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Q , minimum quantity of removed values to produce a valid vector [0:4]\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [V] [Q]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 4 3 3] [2]  for [1 4] or [1 3]\r\n[1 2 3 4 5] [0]\r\n[4 3 2 1] [3]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) The GJam Small test suite is not robust\r\n2) nchoosek(50,4) is too slow for Cody and the 100 cases\r\n3) The Large test suite is N\u0026lt;=1000 with some delete cases \u003e4\r\n4) A Good Algorithm that solves the Large case is usually best to pursue\r\n5) GJam Competition allows one Large submission within 10 minutes of download \r\n6) \u0026lt;Large Suite Challenge\u003e\r\n\u003c/pre\u003e","function_template":"function Q = Monotonic_V(vin)\r\n  Q=0;\r\nend","test_suite":"%%\r\ntic\r\nvin=[4 33 36 47 63 79 146 159 176 191 178 215 226 228 261 262 291 295 322 368 456 461 465 473 479 500 512 527 570 572 613 639 641 654 667 684 699 701 746 751 763 767 786 819 872 925 932 959 965 972 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 33 63 78 82 85 92 101 113 125 138 175 183 196 211 224 250 287 345 368 388 426 447 477 491 504 524 575 579 581 621 694 712 720 737 745 747 784 793 802 813 827 829 853 858 919 924 929 939 960 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 19 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 35 63 72 76 122 103 171 185 221 238 294 318 325 341 355 350 359 365 407 409 438 467 514 548 592 585 599 606 636 646 652 697 708 737 770 773 798 819 832 835 849 881 879 893 904 907 932 967 983 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 72 94 114 136 147 177 185 199 216 214 230 243 252 264 417 285 426 428 445 450 463 465 467 482 485 495 531 537 547 575 558 598 654 677 678 692 685 785 853 891 894 897 905 906 910 918 933 963 979 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[21 18 33 53 158 179 200 225 230 259 261 262 280 319 338 368 369 376 423 449 481 505 517 531 545 588 598 614 607 615 647 655 657 684 702 706 734 756 768 791 806 792 834 889 895 896 957 960 971 995 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[52 53 66 83 119 129 132 145 202 237 274 281 284 296 298 326 442 386 451 456 475 476 486 493 499 520 523 525 589 605 612 626 630 638 694 718 740 763 791 798 800 801 811 839 868 874 895 891 971 984 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 9 21 43 89 106 117 141 150 211 158 220 233 282 296 311 324 353 372 376 407 452 414 455 482 494 503 522 527 531 545 548 552 563 568 586 593 629 673 691 682 703 724 738 787 822 861 882 907 937 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 51 80 105 109 114 129 154 175 167 188 198 227 266 270 437 345 446 459 469 470 478 479 520 582 587 591 611 618 619 658 677 670 683 686 689 710 758 728 815 821 852 870 912 937 946 960 969 985 998 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 34 65 81 83 91 105 114 125 127 132 162 154 176 198 201 222 269 272 296 297 321 345 355 377 402 403 407 444 454 450 493 517 533 546 589 592 593 639 698 700 729 764 798 785 850 909 917 950 988 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[30 94 106 118 125 136 151 161 162 176 233 240 272 290 320 337 347 352 370 433 412 499 504 510 513 572 593 621 629 640 646 710 712 721 735 741 750 786 804 812 814 817 822 844 893 932 944 945 954 972 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 5 6 1 7 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[25 37 40 56 62 81 86 136 95 140 225 228 274 236 297 332 417 516 545 549 573 582 583 595 600 601 603 624 673 699 714 716 719 720 746 737 762 790 802 814 821 835 852 868 860 871 899 910 923 984 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 1000 1000 1000 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 15 42 44 68 69 108 109 126 120 145 148 154 176 199 221 245 266 271 299 325 309 326 411 514 518 552 568 589 607 663 692 723 711 746 754 771 776 780 818 840 843 858 868 878 882 883 904 906 975 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[17 13 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 21 82 107 99 135 136 144 174 183 211 222 259 283 304 333 348 353 366 399 412 491 512 507 526 557 590 593 613 619 634 663 683 689 710 714 719 720 738 754 807 832 885 880 932 934 941 984 990 996 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[5 37 46 52 54 79 125 140 192 294 318 323 333 343 346 354 360 361 372 403 414 435 445 454 471 480 482 503 514 527 583 624 645 632 726 746 760 764 771 791 801 803 812 819 846 885 893 956 976 1000 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 12 36 45 50 101 113 119 131 168 237 250 254 261 281 324 343 401 421 437 442 499 500 501 512 522 523 529 532 545 561 585 586 590 623 679 695 782 798 823 830 843 852 878 891 902 923 922 972 981 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 23 111 61 127 138 144 147 174 194 261 262 279 272 288 318 350 356 396 425 439 441 454 466 473 487 482 590 615 617 632 637 662 688 699 704 734 780 800 803 814 808 828 843 868 922 943 985 987 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[49 73 118 140 194 202 218 249 261 342 272 347 355 403 438 462 466 469 473 488 499 511 514 515 525 532 538 545 588 665 610 707 714 719 716 723 739 751 763 789 809 868 874 899 916 937 939 947 979 994 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 14 67 76 98 107 125 150 151 194 244 248 251 270 289 271 309 354 434 453 468 454 484 487 507 523 526 569 578 601 624 684 690 696 725 752 765 800 813 815 826 906 888 948 963 970 984 993 996 1000 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[15 57 92 105 110 172 125 182 202 213 233 263 282 291 289 293 353 404 421 440 447 469 491 495 504 498 505 543 549 579 597 633 655 671 693 748 768 801 798 811 838 858 859 865 883 889 901 945 959 964 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[30 61 112 126 137 147 154 158 224 266 282 294 303 307 328 320 377 379 391 411 430 423 446 453 461 463 468 493 517 531 536 546 588 613 667 643 683 684 712 722 784 821 848 889 900 919 921 928 931 1000 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[34 18 92 103 108 110 143 200 248 283 284 297 326 365 369 400 439 470 489 498 526 593 596 605 631 684 720 687 754 770 781 793 803 826 811 855 863 886 888 901 916 928 943 954 968 972 982 983 984 987 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 24 74 48 137 172 199 209 224 227 234 293 297 305 324 336 338 377 418 395 432 437 446 474 505 510 529 536 541 568 613 641 645 695 677 735 792 797 805 830 853 869 882 883 888 925 910 970 982 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[25 39 54 55 57 101 117 124 142 143 185 161 196 210 214 237 243 267 282 288 304 394 435 427 458 491 509 519 550 557 582 607 608 634 652 640 681 705 695 753 785 840 871 889 903 912 918 921 966 987 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[30 75 123 160 156 176 202 215 254 264 310 318 354 368 390 435 453 457 474 476 479 510 529 532 603 623 635 637 644 671 686 706 723 725 726 730 732 767 806 807 829 852 869 902 897 912 927 957 994 996 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[40 44 45 46 121 89 141 155 167 179 207 226 263 265 327 337 338 364 373 453 456 478 512 537 543 561 568 577 637 604 641 648 672 687 697 709 701 737 789 808 813 819 820 828 835 911 921 938 947 964 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[40 42 43 60 63 70 78 124 103 131 133 149 161 164 170 227 232 260 266 275 316 323 368 335 372 377 413 418 420 441 553 463 574 576 643 656 665 678 733 741 743 815 762 883 908 928 930 968 974 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[16 78 79 134 151 219 224 240 251 280 295 388 406 483 489 505 507 534 538 539 549 554 555 564 573 583 609 660 672 681 687 711 732 738 745 746 783 792 812 834 837 841 887 866 908 957 961 978 987 994 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[18 20 33 34 35 54 94 123 140 162 169 220 205 250 258 278 299 320 349 362 397 434 492 449 499 504 508 515 531 552 606 647 652 678 695 703 714 735 763 785 836 799 854 858 863 864 929 933 960 984 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 17 37 50 66 96 99 155 107 184 218 257 260 279 285 327 332 337 354 369 398 430 423 437 574 631 656 660 668 676 680 700 709 750 747 761 789 774 813 857 860 886 898 904 949 952 964 976 984 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 78 23 90 101 106 132 141 146 191 206 222 244 270 304 325 332 379 383 392 401 412 417 436 454 465 487 551 499 553 557 562 570 581 613 650 682 691 732 781 782 789 814 816 844 890 965 971 986 998 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[20 65 69 128 131 157 173 175 211 194 216 229 266 278 286 292 320 335 377 358 423 424 463 472 529 531 545 553 557 576 589 585 601 613 657 672 699 711 725 786 789 810 897 923 936 960 996 969 997 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 54 61 67 119 131 153 167 178 199 197 246 256 273 329 321 348 350 353 392 394 402 413 486 511 530 515 539 569 582 586 594 686 763 819 821 829 840 832 848 858 864 870 904 933 944 947 952 967 998 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 40 106 68 118 132 148 162 180 182 200 207 246 283 287 288 320 295 321 325 338 343 349 362 364 371 378 418 503 535 554 562 568 571 577 587 682 699 760 709 769 844 920 938 941 948 960 973 977 983 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 38 43 45 67 75 150 154 173 178 184 189 254 227 278 282 289 315 297 365 373 396 403 505 509 513 521 555 580 583 600 614 643 649 667 678 695 722 732 761 801 824 805 841 879 894 915 926 930 975 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[56 65 94 119 149 165 157 166 198 220 297 302 305 316 321 327 351 347 359 368 380 386 387 403 431 447 448 449 463 528 533 556 562 590 634 610 640 658 693 750 786 759 792 800 825 842 864 889 911 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[5 11 40 95 110 134 138 160 187 208 228 210 240 278 352 354 381 390 414 503 440 507 513 526 528 534 540 543 570 604 609 613 625 632 647 653 658 661 668 708 718 780 846 855 862 860 891 910 936 949 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[6 57 71 73 100 112 134 165 173 189 190 194 197 227 239 229 246 252 278 288 316 319 371 393 450 462 521 585 567 620 625 636 654 689 675 694 701 716 720 741 743 746 820 868 873 879 935 938 979 989 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[5 50 77 74 113 128 129 169 173 179 201 210 228 236 242 251 255 262 279 283 301 369 373 387 380 412 417 441 444 459 476 492 493 532 541 574 644 646 665 720 728 773 802 810 821 853 849 860 912 964 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[10 21 84 97 107 109 123 120 128 137 143 161 254 266 278 301 307 315 361 389 395 408 492 517 549 584 551 597 602 603 618 648 653 657 658 682 723 753 790 799 820 824 831 844 855 866 858 894 916 918 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 4 3 3 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[22 43 49 54 80 84 104 107 149 171 180 197 210 226 312 340 347 356 363 387 407 420 439 463 478 465 485 499 568 590 598 627 646 654 656 675 693 707 760 761 776 798 840 853 856 909 929 947 951 984 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[49 60 70 76 80 96 144 161 203 269 274 296 343 346 400 359 401 428 430 451 454 455 477 480 500 506 522 591 573 598 653 655 657 733 748 736 763 771 784 813 835 855 869 894 920 932 948 956 981 986 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 4 6 7 10 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[26 37 95 122 117 149 183 194 195 239 245 253 272 285 287 330 300 335 349 371 380 390 401 421 489 426 519 521 538 598 626 640 645 665 685 698 704 712 723 791 822 834 859 860 920 900 960 977 986 997 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[70 76 80 97 102 105 113 157 141 161 163 217 251 295 310 320 323 350 355 357 390 391 397 422 428 460 486 472 487 536 570 579 631 665 666 676 681 683 690 693 705 726 813 819 821 850 874 916 935 999 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[51 58 63 80 90 120 157 164 172 190 208 259 278 336 324 348 368 374 379 383 426 436 446 506 536 553 569 589 591 596 637 607 645 708 716 725 735 741 745 764 773 831 884 853 902 905 956 978 982 997 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[33 40 65 72 122 84 130 137 156 227 255 314 333 335 343 345 350 372 373 374 387 417 404 422 433 469 470 495 499 532 571 580 603 630 622 653 660 681 698 752 801 808 816 836 859 889 909 931 961 962 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 42 34 53 59 87 98 141 143 158 188 221 317 319 324 351 346 359 374 390 393 407 430 458 485 488 502 514 559 567 595 598 596 610 629 631 647 719 699 759 769 782 803 805 907 928 934 943 983 987 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[59 61 82 96 100 160 176 194 242 223 259 266 275 282 318 328 357 349 367 370 376 409 416 442 447 475 489 504 507 553 598 603 637 616 684 710 722 712 756 776 783 784 806 814 833 847 879 922 973 992 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 87 98 120 173 139 184 187 214 222 276 310 333 348 356 364 376 382 401 461 422 475 501 509 524 575 579 588 594 596 622 624 652 683 699 751 737 781 827 831 844 863 868 875 892 909 910 975 977 980 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[119 152 207 221 215 245 250 257 269 327 336 345 370 371 382 404 408 440 443 448 458 492 498 509 609 580 614 620 623 653 692 709 713 723 743 760 770 812 784 814 830 862 875 877 916 926 932 947 963 984 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[6 25 46 48 85 102 114 126 179 223 233 238 243 294 276 330 338 386 349 387 418 423 434 463 470 474 487 523 546 559 591 634 667 671 681 696 739 752 772 791 808 830 840 873 862 882 959 965 978 995 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 35 39 58 88 73 89 108 143 186 196 243 253 270 297 271 349 358 368 369 402 420 453 459 464 489 499 568 607 646 653 705 710 712 717 716 721 780 743 793 826 849 916 918 947 950 958 959 961 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 57 88 92 162 186 187 268 297 307 310 342 332 368 391 402 408 422 435 487 447 522 530 535 546 558 571 574 594 628 631 648 651 660 664 675 693 707 715 738 718 762 794 851 853 854 870 902 935 980 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[16 36 61 88 110 205 120 230 243 264 265 270 297 313 316 317 342 346 391 368 401 411 441 472 574 584 587 591 605 645 618 670 675 693 695 736 741 796 804 801 811 824 829 884 915 929 934 984 989 990 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[27 41 59 70 96 145 149 175 274 264 278 297 298 358 361 392 403 413 432 444 480 498 520 542 544 622 626 631 636 641 692 704 715 736 740 805 818 823 828 856 865 875 890 891 913 931 941 966 977 991 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[39 44 48 56 62 94 105 109 195 210 199 211 223 272 311 317 419 435 446 448 467 472 492 483 536 540 609 610 646 638 710 719 740 781 795 798 814 835 858 861 869 876 903 913 936 931 948 965 968 999 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[17 19 42 49 88 94 130 149 215 250 251 288 297 326 334 335 344 372 377 411 406 425 429 436 440 478 488 496 550 554 560 578 585 594 603 607 608 610 631 796 813 820 850 901 937 979 955 989 990 997 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 5 7 21 26 52 128 154 168 192 195 209 225 282 227 284 352 355 363 395 406 432 443 478 501 513 553 577 625 624 658 672 696 699 733 739 750 760 768 817 822 861 869 870 883 913 978 931 993 994 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 18 20 78 110 111 114 117 123 126 138 180 198 214 235 250 286 316 335 409 422 475 476 525 527 593 615 634 657 672 664 682 711 727 729 740 761 781 790 820 837 840 842 853 868 896 971 981 986 995 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 17 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[8 4 42 77 104 141 158 169 192 217 234 244 340 356 343 367 374 393 427 430 433 468 475 477 481 483 507 526 549 557 609 616 611 644 645 678 695 704 758 745 772 794 803 806 825 836 841 858 885 943 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[15 49 77 101 107 140 129 151 156 158 185 219 224 235 236 243 264 271 302 304 329 335 346 435 436 453 472 479 480 496 563 568 571 591 633 673 651 712 718 741 765 775 782 815 859 893 912 918 935 988 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[26 69 77 115 121 141 151 217 243 244 275 293 301 309 313 341 345 366 365 372 391 398 510 516 518 520 542 522 553 572 652 657 660 661 674 705 717 723 789 799 810 849 856 859 876 900 906 942 996 1000 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[7 26 40 48 55 100 118 139 205 246 235 248 269 292 297 356 361 372 393 403 417 435 491 533 544 555 569 572 582 599 597 636 676 692 730 702 758 767 802 807 808 850 884 889 903 911 912 946 968 975 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 48 100 115 131 180 204 205 214 218 247 284 316 289 335 362 382 391 399 403 410 468 469 546 479 550 559 571 592 603 647 654 735 746 751 768 796 795 808 853 859 881 882 905 936 938 941 949 968 981 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[23 57 72 82 90 121 131 165 149 228 243 252 274 285 289 290 306 349 366 385 399 394 405 464 473 530 562 568 604 665 684 693 741 759 797 800 804 805 860 861 866 881 872 885 891 904 905 972 985 995 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[84 29 96 105 134 147 175 179 224 238 255 263 281 290 295 331 332 357 366 406 422 427 442 474 495 509 510 578 606 613 635 665 676 695 714 719 722 726 732 816 819 820 886 915 957 972 975 984 985 991 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 61 76 82 106 122 128 142 136 164 182 183 251 263 332 325 334 385 400 402 410 446 490 504 508 556 571 609 623 629 638 644 660 709 694 714 726 776 793 794 834 842 847 857 899 901 944 919 990 997 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 28 34 47 37 66 116 143 171 213 235 247 309 320 351 330 370 386 397 415 416 474 484 495 512 513 522 572 594 642 681 643 689 707 732 756 760 773 777 799 795 800 830 840 853 866 867 899 951 975 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 12 16 63 79 82 104 121 109 123 141 152 164 208 243 277 327 358 363 382 410 451 483 502 516 524 590 630 633 657 687 658 696 703 706 739 745 761 774 769 780 841 872 880 883 926 929 954 956 986 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 10 17 73 102 122 188 246 252 299 318 325 336 338 343 363 388 401 402 410 419 425 433 435 463 524 535 567 590 637 671 677 698 716 752 753 773 779 797 874 893 896 895 918 921 923 928 940 957 969 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[41 53 50 80 104 122 127 131 148 171 198 235 254 258 299 300 312 334 355 390 404 442 424 445 469 509 545 544 598 639 647 651 653 692 702 747 800 810 822 826 865 868 871 921 938 942 949 948 960 965 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[51 60 84 94 114 121 125 128 138 134 178 192 195 252 277 328 342 333 418 419 462 482 512 550 578 582 584 607 611 612 614 636 680 659 714 733 735 736 743 783 791 792 798 824 864 879 866 910 951 961 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[29 55 33 60 118 148 253 278 287 289 308 337 339 350 359 385 392 398 417 420 462 511 555 568 587 596 602 643 655 670 692 700 696 734 766 770 793 817 818 855 859 874 884 897 911 915 920 923 938 999 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[9 22 26 48 38 98 110 132 135 156 160 163 180 220 262 266 283 292 316 311 335 363 411 412 424 436 484 502 540 541 571 545 572 585 610 633 656 679 743 764 754 812 814 870 880 902 949 964 985 997 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 3 2 1 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[10 23 27 39 56 73 125 164 171 184 195 209 213 232 244 260 264 447 459 465 478 486 519 520 543 554 556 570 579 586 595 596 621 637 644 673 657 677 678 680 688 704 754 763 880 891 910 912 942 984 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[18 16 37 54 59 75 91 101 142 154 194 199 205 234 259 268 317 284 342 351 363 378 417 418 425 491 505 536 563 608 617 624 649 688 709 716 727 821 824 829 850 832 893 903 950 955 957 964 979 988 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[12 61 20 64 70 81 150 158 170 175 201 282 304 307 338 391 366 397 407 428 432 473 492 501 508 533 563 557 579 589 603 631 636 645 648 656 714 685 718 740 742 814 824 842 863 871 927 941 965 986 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[6 14 24 31 39 48 52 60 82 125 164 141 195 213 234 239 255 287 318 334 357 387 369 410 417 421 431 444 446 510 514 547 680 653 684 709 720 765 791 802 823 840 858 871 891 892 950 927 983 1000 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[12 15 37 48 71 74 101 95 104 148 153 162 208 215 269 227 320 356 359 372 406 455 463 477 486 498 559 596 645 651 664 693 665 751 756 779 785 827 804 844 852 874 887 904 905 936 961 982 983 991 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 65 68 71 124 173 181 190 195 204 221 220 304 339 321 352 362 363 368 369 403 415 490 514 520 536 548 550 586 589 592 623 655 638 700 744 755 762 779 789 842 850 865 881 916 924 956 938 987 998 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[48 52 94 107 134 113 186 202 231 233 253 257 274 296 324 332 338 351 356 357 358 393 489 482 519 527 534 537 560 568 604 612 611 617 705 707 730 755 782 812 784 828 867 916 937 948 966 967 971 988 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[55 15 107 117 155 157 198 236 240 245 285 288 302 364 376 380 402 416 421 434 478 488 501 504 567 568 629 644 646 673 657 686 690 740 744 755 769 770 783 792 818 860 855 865 904 905 917 935 971 984 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[80 30 92 103 143 182 200 202 217 222 229 245 273 278 283 303 360 445 446 466 486 489 505 516 547 576 614 630 624 643 671 695 697 709 715 730 739 743 746 768 786 810 872 888 949 938 951 952 959 982 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[41 61 83 126 142 188 214 218 242 249 269 265 315 334 362 369 371 438 454 459 484 464 485 497 501 522 548 568 586 605 614 686 654 701 706 726 732 736 742 765 792 810 823 842 832 846 853 877 891 980 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[20 22 27 74 91 77 144 147 154 269 287 327 328 348 349 386 432 433 438 470 491 550 556 586 588 592 610 640 686 716 722 733 734 736 740 758 779 796 804 805 836 857 901 912 938 940 942 981 990 989 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 13 52 28 149 156 187 223 262 268 269 292 309 332 347 379 373 462 484 501 505 506 524 527 539 544 627 656 660 666 669 677 704 679 712 752 780 783 863 877 882 891 904 937 910 970 979 988 993 994 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[16 46 60 67 71 77 81 102 123 140 143 145 178 249 271 260 336 366 409 470 471 489 497 529 536 596 597 610 664 662 673 677 694 698 718 742 755 759 783 807 850 844 879 880 903 913 915 922 945 959 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[988 988 988 988 988 ];\r\nvexp=[4 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[7 13 14 122 128 154 170 184 193 191 224 241 260 296 299 305 311 316 375 381 424 425 429 437 476 477 488 503 546 532 564 585 665 669 677 689 823 838 831 857 859 877 883 897 918 927 935 948 973 987 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-05T02:13:07.000Z","updated_at":"2026-03-11T10:04:13.000Z","published_at":"2013-10-05T03:12: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\",\"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\u003eThis Challenge is derived from\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=\\\"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Ocean View\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. This is the Small data set witn N\u0026lt;=50 and Q\u0026lt;=4, guaranteed.\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\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\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\u003eSuccinct Challenge statement:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V , Vector length N\u0026lt;=50 with values 1 thru 1000.\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Q , minimum quantity of removed values to produce a valid vector [0: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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [V] [Q]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 4 3 3] [2]  for [1 4] or [1 3]\\n[1 2 3 4 5] [0]\\n[4 3 2 1] [3]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCommentary:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) The GJam Small test suite is not robust\\n2) nchoosek(50,4) is too slow for Cody and the 100 cases\\n3) The Large test suite is N\u003c=1000 with some delete cases \u003e4\\n4) A Good Algorithm that solves the Large case is usually best to pursue\\n5) GJam Competition allows one Large submission within 10 minutes of download \\n6) \u003cLarge Suite Challenge\u003e]]\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":2580,"title":"Sum of series VI","description":"What is the sum of the following sequence:\r\n\r\n Σk⋅k! for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σk⋅k! for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesVI(n)\r\ns = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = 5;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 23;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 5;\r\ns_correct = 719;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 8;\r\ns_correct = 362879;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 10;\r\ns_correct = 39916799;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 12;\r\ns_correct = 6227020799;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))\r\n\r\n%%\r\nn = 15;\r\ns_correct = 20922789887999;\r\nassert(isequal(sumOfSeriesVI(n),s_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1627,"test_suite_updated_at":"2017-06-13T18:10:27.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:14:09.000Z","updated_at":"2026-03-28T09:16:37.000Z","published_at":"2014-09-10T10:14:54.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σk⋅k! for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":2578,"title":"Sum of series IV","description":"What is the sum of the following sequence:\r\n\r\n Σ(-1)^(k+1) (2k-1)^2 for k=1...n\r\n\r\nfor different n?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(-1)^(k+1) (2k-1)^2 for k=1...n\u003c/pre\u003e\u003cp\u003efor different n?\u003c/p\u003e","function_template":"function s = sumOfSeriesIV(n)\r\n  s = n;\r\nend","test_suite":"%%\r\nn = 1;\r\ns_correct = 1;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 2;\r\ns_correct = -8;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 3;\r\ns_correct = 17;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 4;\r\ns_correct = -32;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 7;\r\ns_correct = 97;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 12;\r\ns_correct = -288;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 33;\r\ns_correct = 2177;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))\r\n\r\n%%\r\nn = 59;\r\ns_correct = 6961;\r\nassert(isequal(sumOfSeriesIV(n),s_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1718,"test_suite_updated_at":"2017-06-13T18:05:44.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:01:03.000Z","updated_at":"2026-04-11T00:28:05.000Z","published_at":"2014-09-10T10:01:33.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(-1)^(k+1) (2k-1)^2 for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different 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":566,"title":"Sum of first n terms of a harmonic progression","description":"Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; 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: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; transform-origin: 332px 21px; vertical-align: baseline; perspective-origin: 332px 21px; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; transform-origin: 309px 21px; white-space: pre-wrap; perspective-origin: 309px 21px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; transform-origin: 0px 0px; perspective-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = harmonicSum(a,d,n)\r\n  s=0;\r\nend","test_suite":"%%\r\na=1;d=1;n=1;\r\ny_correct = 1;\r\nassert(isequal(harmonicSum(a,d,n),y_correct));\r\n\r\n%%\r\na=2;d=2;n=5;\r\ny_correct = round(3.5746,4);\r\nassert(isequal(round(harmonicSum(a,d,n),4),y_correct));\r\n\r\n%%\r\na=4;d=5;n=2;\r\ny_correct = round(4.6667,4);\r\nassert(isequal(round(harmonicSum(a,d,n),4),y_correct));","published":true,"deleted":false,"likes_count":3,"comments_count":14,"created_by":2974,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":501,"test_suite_updated_at":"2020-09-29T02:43:20.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2012-04-08T16:38:19.000Z","updated_at":"2026-04-01T16:06:03.000Z","published_at":"2012-04-08T18:58:53.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\u003eGiven inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....\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":52779,"title":"Easy Sequences 25: Product of Series","description":"The function 'P(n)' is defined as the series product:\r\n                            \r\nwhere 'T(n)' is the triangular sum:\r\n                            \r\nIt can be proven that P(n) is convergent, with:\r\n                            \r\nWrite a function that outputs the integer value of 'n' when '3 - P(n)' first becomes less than or equal to a given tolerance 't'.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440000534057617px; 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: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 256px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eThe function 'P(n)' is defined as the series product:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 46px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-17px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"124.5\" height=\"46\" style=\"width: 124.5px; height: 46px;\"\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003ewhere 'T(n)' is the triangular sum:\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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"184\" height=\"19\" style=\"width: 184px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eIt can be proven that P(n) is convergent, with:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 30px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e                            \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-15px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"83.5\" height=\"29\" style=\"width: 83.5px; height: 29px;\"\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; text-align: left; 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; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eWrite a function that outputs the integer value of 'n' when '3 - P(n)' \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; \"\u003e\u003cspan style=\"font-weight: bold; text-decoration: underline; text-decoration-line: underline; \"\u003efirst\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; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003e becomes less than or equal to a given tolerance 't'.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function n = N(t)\r\n    n = N(t); \r\nend","test_suite":"%%\r\nt = 1;\r\nn_correct = 4;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.5;\r\nn_correct = 10;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.01;\r\nn_correct = 598;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.007;\r\nn_correct = 856;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nt = 0.00032;\r\nn_correct = 18748;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nts = 10.^[-1:-1:-8]*3;\r\nns = arrayfun(@(t) N(t),ts); \r\nss_correct = 222222205;\r\nassert(isequal(sum(ns),ss_correct))\r\n%%\r\nt = 0.0000000026;\r\nn_correct = 2307692306;\r\nassert(isequal(N(t),n_correct))\r\n%%\r\nfiletext = fileread('n.m');\r\nnot_allowed = contains(filetext, 'persistent') || contains(filetext, 'global') || contains(filetext, 'BigInteger') || contains(filetext, 'java'); \r\nassert(~not_allowed)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":255988,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2021-09-24T21:04:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-09-24T20:12:14.000Z","updated_at":"2025-12-22T16:55:44.000Z","published_at":"2021-09-24T20:44:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe function 'P(n)' is defined as the series product:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eP(n)=\\\\prod_{k=2}^{n}\\\\frac{T(k)}{T(k)-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\u003ewhere 'T(n)' is the triangular sum:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eT(n) = 1 + 2 + 3 + 4 + ...+n\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\u003eIt can be proven that P(n) is convergent, with:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                            \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\lim_{n\\\\rightarrow \\\\infty}P(n) = 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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWrite a function that outputs the integer value of 'n' when '3 - P(n)' \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efirst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e becomes less than or equal to a given tolerance 't'.\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":45339,"title":"XOR fibonacci","description":"a \u0026 b are the first two terms in the xor fibonacci sequence. Find the nth term of that sequence.\r\n\r\nXOR fib sequence is that in which any term is the xor of the previous two terms.","description_html":"\u003cp\u003ea \u0026 b are the first two terms in the xor fibonacci sequence. Find the nth term of that sequence.\u003c/p\u003e\u003cp\u003eXOR fib sequence is that in which any term is the xor of the previous two terms.\u003c/p\u003e","function_template":"function y = fib_xor(a,b,n)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(fib_xor(1,2,34),1))\r\n\r\n%%\r\nassert(isequal(fib_xor(123,22,57),109))\r\n\r\n%%\r\nassert(isequal(fib_xor(3,7,98),7))\r\n\r\n%%\r\nassert(isequal(fib_xor(3,7,1),3))\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":22,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-17T07:46:31.000Z","updated_at":"2026-01-19T18:17:31.000Z","published_at":"2020-02-17T07:46:58.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 \u0026amp; b are the first two terms in the xor fibonacci sequence. Find the nth term of that 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eXOR fib sequence is that in which any term is the xor of the previous two terms.\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":44523,"title":"Pattern Sum","description":"Write a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: \r\nk + kk + kkk + .... (the last number in the sequence should have m digits) \r\nFor example, if the two integers are:\r\n(4, 5).\r\nYour function should return the total sum of: \r\n4 + 44 + 444 + 4444 + 44444.\r\nNotice the last number in this sequence has 5 digits. The return value should be 49380.","description_html":"\u003cp\u003eWrite a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: \r\nk + kk + kkk + .... (the last number in the sequence should have m digits) \r\nFor example, if the two integers are:\r\n(4, 5).\r\nYour function should return the total sum of: \r\n4 + 44 + 444 + 4444 + 44444.\r\nNotice the last number in this sequence has 5 digits. The return value should be 49380.\u003c/p\u003e","function_template":"function y = pattern_sum(a,b)\r\n    \r\nend","test_suite":"%%\r\na = 4;\r\nb = 5;\r\ny_correct = 49380;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 7;\r\nb = 4;\r\ny_correct = 8638;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 5;\r\nb = 3;\r\ny_correct = 615;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 1;\r\nb = 1;\r\ny_correct = 1;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 2;\r\nb = 2;\r\ny_correct = 24;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 9;\r\nb = 9;\r\ny_correct = 1111111101;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 0;\r\nb = 0;\r\ny_correct = 0;\r\nassert(isequal(pattern_sum(a,b),y_correct))\r\n\r\n%%\r\na = 3;\r\nb = 8;\r\ny_correct = 37037034;\r\nassert(isequal(pattern_sum(a,b),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":181342,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":237,"test_suite_updated_at":"2018-07-13T17:24:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-02-15T01:05:11.000Z","updated_at":"2026-03-24T20:17:24.000Z","published_at":"2018-02-15T01:18:20.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\u003eWrite a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: k + kk + kkk + .... (the last number in the sequence should have m digits) For example, if the two integers are: (4, 5). Your function should return the total sum of: 4 + 44 + 444 + 4444 + 44444. Notice the last number in this sequence has 5 digits. The return value should be 49380.\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":54265,"title":"n-th digit of write-down all numbers","description":"Write down number as\r\n123456789101112131415161718192021222324252627282930...\r\nwhat's the n-th digit? input n and get the digit.","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: 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite down number as\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=\"\"\u003e123456789101112131415161718192021222324252627282930...\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=\"\"\u003ewhat's the n-th digit? input n and get the digit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = ndigit(x)\r\n  y = 3; % whatever\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 9;\r\ny_correct = 9;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = 1;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 11;\r\ny_correct = 0;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 190;\r\ny_correct = 1;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 191;\r\ny_correct = 0;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 1001;\r\ny_correct = 7;\r\nassert(isequal(ndigit(x),y_correct))\r\n%%\r\nx = 10000001;\r\ny_correct = 3;\r\nassert(isequal(ndigit(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-04-13T01:16:09.000Z","deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":"2022-04-13T01:16:09.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-13T01:11:32.000Z","updated_at":"2026-01-28T12:32:50.000Z","published_at":"2022-04-13T01:11:58.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite down number as\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\u003e123456789101112131415161718192021222324252627282930...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhat's the n-th digit? input n and get the digit.\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":45383,"title":"$10,000 sequence","description":"Find the nth term of the Hofstadter–Conway sequence and its chaotic cousin.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/Hofstadter_sequence\u003e\r\n\r\n","description_html":"\u003cp\u003eFind the nth term of the Hofstadter–Conway sequence and its chaotic cousin.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/Hofstadter_sequence\"\u003ehttps://en.wikipedia.org/wiki/Hofstadter_sequence\u003c/a\u003e\u003c/p\u003e","function_template":"function y= Hofstadter(n)","test_suite":"%%\r\nassert(isequal(Hofstadter(50),[29,26]))\r\n%%\r\nassert(isequal(Hofstadter(5),[3,2]))\r\n%%\r\nassert(isequal(Hofstadter(500),[255,254]))\r\n%%\r\nassert(isequal(Hofstadter(73),[40,34]))\r\n%%\r\nassert(isequal(Hofstadter(1489),[819   695]))\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":15,"test_suite_updated_at":"2020-03-24T12:27:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-24T12:16:16.000Z","updated_at":"2020-03-24T12:27:19.000Z","published_at":"2020-03-24T12:27:19.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 term of the Hofstadter–Conway sequence and its chaotic cousin.\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/Hofstadter_sequence\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/Hofstadter_sequence\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":60837,"title":"Project Euler Problem 48: Self Powers","description":"The series,.\r\nReturn a string of the last ten digits of the series:.\r\n\r\nHint: Use modular arithmetic! \r\nSpoiler: The solution is in the test suite\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(255, 255, 255); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(255, 255, 255); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 171px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 85.5px; transform-origin: 408px 85.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: 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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe series,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"245.5\" height=\"19\" style=\"width: 245.5px; height: 19px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn a string of the last ten digits of the series:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,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\" width=\"169.5\" height=\"19\" style=\"width: 169.5px; height: 19px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\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 0px; transform-origin: 0px 0px; 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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHint: Use modular arithmetic! \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 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSpoiler: The solution is in the test suite\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 0px; transform-origin: 0px 0px; 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 digits_string = selfPowerSeries()\r\n  digits_string = '0123456789';\r\nend","test_suite":"%% \r\nm = 10^10\r\nsum = 0;\r\nfor i = 1:1000\r\n    \r\n    modulo = mod(i, m);\r\n\r\n    for j = 1:i-1\r\n        modulo = mod(modulo * i, m);\r\n    end\r\n    \r\n    sum = sum + modulo;\r\nend\r\n\r\ny_correct = num2str(sum)\r\ny_correct = y_correct(end-9:end)\r\n\r\nassert(isequal(selfPowerSeries(),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":2601620,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-04-02T00:34:14.000Z","updated_at":"2025-07-18T08:50:42.000Z","published_at":"2025-04-02T00:34:14.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe series,\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\u003e1^1+2^2+3^3+...+10^{10}=10405071317\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn a string of the last ten digits of the series:\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\u003e1^1+2^2+3^3+...+1000^{1000}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003eHint: Use modular arithmetic! \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\u003eSpoiler: The solution is in the test suite\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2581,"title":"Sum of series VII","description":"What is the sum of the following sequence:\r\n\r\n Σ(km^k)/(k+m)! for k=1...n\r\n\r\nfor different n and m?","description_html":"\u003cp\u003eWhat is the sum of the following sequence:\u003c/p\u003e\u003cpre\u003e Σ(km^k)/(k+m)! for k=1...n\u003c/pre\u003e\u003cp\u003efor different n and m?\u003c/p\u003e","function_template":"function s = sumOfSeriesVII(n,m)\r\ns = n+m;\r\nend","test_suite":"%%\r\nn = 1; m = 1;\r\ns_correct = 1/2;\r\nassert(isequal(sumOfSeriesVII(n,m),s_correct))\r\n\r\n%%\r\nn = 1; m = 2;\r\ns_correct = 1/3;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003ceps)\r\n\r\n%%\r\nn = 3; m = 3;\r\ns_correct = 0.3875;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003ceps)\r\n\r\n%%\r\nn = 4; m = 2;\r\ns_correct = 0.955555555555556;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 7; m = 5;\r\ns_correct = 0.0408511683468281;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 5; m = 7;\r\ns_correct = 0.00114327593060232;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 10; m = 3;\r\ns_correct = 0.499971551885614;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 14; m = 4;\r\ns_correct = 0.166666498956709;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)\r\n\r\n%%\r\nn = 15; m = 11;\r\ns_correct = 2.75459255461393e-07;\r\nassert(abs(sumOfSeriesVII(n,m)-s_correct)\u003c10*eps)","published":true,"deleted":false,"likes_count":17,"comments_count":6,"created_by":3062,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1601,"test_suite_updated_at":"2017-06-13T18:13:20.000Z","rescore_all_solutions":false,"group_id":29,"created_at":"2014-09-10T10:26:13.000Z","updated_at":"2026-04-03T06:43:32.000Z","published_at":"2014-09-10T10:26:41.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\u003eWhat is the sum of 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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Σ(km^k)/(k+m)! for k=1...n]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor different n and m?\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":45761,"title":"Sum of terms in a series 1 (★★★)","description":"Given x and n, compute the following sum:\r\n\r\n  |x|+|x|^(1/2)+|x|^(1/3)+|x|^(1/4)+|x|^(1/5) ... + |x|^(1/n)\r\n\r\nwhere ||x|| indicates the absolute value of x. Thus, if x = -5 and n = 3, then the sum is (up to n =3 terms)\r\n\r\n  |-5|+|-5|^(1/2)+|-5|^(1/3)\r\n= 5+5^(1/2)+5^(1/3)\r\n= 8.946\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 191.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 95.65px; transform-origin: 407px 95.65px; 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: 131.525px 10.5px; transform-origin: 131.525px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven x and n, compute the following sum:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 26px; 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 13px; text-align: left; transform-origin: 384px 13px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"data:image/gif;base64,R0lGODlhoAEWALMAAP///wAAALq6unZ2doiIiJiYmNzc3KqqqhAQEGZmZiIiIkRERFRUVDIyMszMzO7u7iH5BAEAAAAALAAAAACgARYAAAT+EMhJq7046827/2AojmRpnmiqrmzrvuRzLNcAHMWQwJ5MW7aD4JB48Dq+GoVx5CSBgMTBkDA0r6ZnxYbtwg6HhqVgMBAkDK6XAhZXyAAE+ryutMdWCcFdn9zfVgwBCAV9hhl/FHCHUR47Ko8ckQAGfBM7Dm4FPyiTGpOVFo95DQ4rnhmglhKRBmGnjhShFY+FjDCoGKqiHgIDBANktiicG8UnxxnFsxMGwxIDasgey6vOzQR0KskY1RXXEgUPqybcF96ytr85ty3mFujNhQ/AQ0VbBxMCCALb1CvvKsSDZmTCAwUFif1rtmpAwgcC7vnrMBCAQwkHHowDuFACM4L+HqE9azeNoqyGRgoFMDUgnz5PCjiadDKTQ0VPDEzRtNmR0ipUCQIarGnsJC0/ADbuLEr0Y6M3QiUkNDRVWU+nkRz8yEkhwUhpJXlyKNCPqViPlgSU1WMqjwayZ836pKAW448CMceutdo0bVkCBQoQIKQ3roaBdQFotdsB7iHHh6/6nZBNghwKC5jIkmkYA2S+cQ3kZUX3b2G5kZuNfgpAAJ0EYD3v7XZ1NapMjWefq91VHquRshl9pt3U9hJTAhgYWHsgQAMCOlkUs7e8gMSoAIbv1kek+nV9AwhZodcsgPkAscfohke3uwDrBTn5Ep9UW/bA6S9oZ8+9yvvvEsz+Bwd5siRA2Ab7CdSef/BJIF94A9qHQ2W5Cbeegv15Fx949BHooFQMjKSVeQjpwsCJKKaYHycO5KNVIQqUhV2CmE3QomILwChjBgS4JQKNE7DoYo4AxPghBj2aAOSRig2pI5MWJEnCkgAIieOTVfLo448XYkGllS8WuSOSW3YggAKaTQQAHQ4EkFKQFZrFppvZwamLkl3auaYEbb4J5VF4njWnn1neWcKXlPFJ5zDv5AIClTwgqoeihDbqwZavcEZZmnrSkmIDDai4HQUEcPpnMy59kMCnoaKYXjKl8meBKyKsiiKoosq6qa6ypOoIq7liSKqphc7q66+3tnpifqf+AOvqqLsK+82xGDgwW3LSWdAAtTPmeeq2vK4gKQXgStvCuBOUW+ML6EqgbqfnentEuwC8e2oIBBzLwIW2phissP0YQOee96p3VsADa4PdCOMiXJDCkcorHyUJwyuuxPpQ/LDFF1t4sMaTFvxBZorYl8JdMeGVklvdioVXdiUuUmy8LqccM8sR1wzzyhynIOnLKmeHMwxLGsBAQUYjfbRHS1PSdAY/28yzyB7YEE008orwgwEtLddSdDNDjTElXftyANgLcykW11OYjXbOTLHt9dnruiCp3G7Xbbe3DiCQR99/+82n4IoRLvbaZX+tN0nEdabf2I77DDlqLNDbOM1plF+OuSGWQ8u456BpoFHk4aoweuagr3B6aqSfsHrorLvweh2zp27751QvXk5PfSycNgy+3xI87r3zTnzPpZMw/CHLM2/8Gs0fj0X00ivmAdgnYJ+B9mtwf4H3XoBfgfhXkG9j9eFfb0IEADs=\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 24px; 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 12px; text-align: left; transform-origin: 384px 12px; 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: 18.9833px 10.5px; transform-origin: 18.9833px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewhere\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 10.5px; transform-origin: 1.95px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 8.4px 10.5px; transform-origin: 8.4px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 8.4px 8.5px; transform-origin: 8.4px 8.5px; \"\u003e|x\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: 291.358px 10.5px; transform-origin: 291.358px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e| indicates the absolute value of x. Thus, if x = -5 and n = 3, then the sum is (up to n = 3 terms)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 61.3px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30.65px; transform-origin: 404px 30.65px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 109.633px 8.5px; transform-origin: 109.633px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e|-5|+|-5|^(1/2)+|-5|^(1/3)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 80.1167px 8.5px; transform-origin: 80.1167px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e= 5+5^(1/2)+5^(1/3)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 29.5167px 8.5px; transform-origin: 29.5167px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e= 8.946\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 84.4167px 10.5px; transform-origin: 84.4167px 10.5px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAvoid using for/while loops.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x,n)\r\n  y = 0;\r\nend","test_suite":"%%\r\nx = -5; n = 3;\r\ny_correct = 8.946043924176486;\r\nassert(isequal(your_fcn_name(x,n),y_correct))\r\n%%\r\nx = 1; n = 10;\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x,n),y_correct))\r\n%%\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, 'for')),'for forbidden')\r\nassert(isempty(strfind(filetext, 'while')),'while forbidden')","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":428668,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":"2020-10-17T01:24:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-05T22:48:11.000Z","updated_at":"2026-03-31T09:45:39.000Z","published_at":"2020-06-05T22:54:04.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\u003eGiven x and n, compute the following sum:\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=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"22\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"416\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\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\u003ewhere\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e|x\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e| indicates the absolute value of x. Thus, if x = -5 and n = 3, then the sum is (up to n = 3 terms)\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[|-5|+|-5|^(1/2)+|-5|^(1/3)\\n= 5+5^(1/2)+5^(1/3)\\n= 8.946]]\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\u003eAvoid using for/while loops.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.gif\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.gif\",\"contentType\":\"image/gif\",\"content\":\"data:image/gif;base64,R0lGODlhoAEWALMAAP///wAAALq6unZ2doiIiJiYmNzc3KqqqhAQEGZmZiIiIkRERFRUVDIyMszMzO7u7iH5BAEAAAAALAAAAACgARYAAAT+EMhJq7046827/2AojmRpnmiqrmzrvuRzLNcAHMWQwJ5MW7aD4JB48Dq+GoVx5CSBgMTBkDA0r6ZnxYbtwg6HhqVgMBAkDK6XAhZXyAAE+ryutMdWCcFdn9zfVgwBCAV9hhl/FHCHUR47Ko8ckQAGfBM7Dm4FPyiTGpOVFo95DQ4rnhmglhKRBmGnjhShFY+FjDCoGKqiHgIDBANktiicG8UnxxnFsxMGwxIDasgey6vOzQR0KskY1RXXEgUPqybcF96ytr85ty3mFujNhQ/AQ0VbBxMCCALb1CvvKsSDZmTCAwUFif1rtmpAwgcC7vnrMBCAQwkHHowDuFACM4L+HqE9azeNoqyGRgoFMDUgnz5PCjiadDKTQ0VPDEzRtNmR0ipUCQIarGnsJC0/ADbuLEr0Y6M3QiUkNDRVWU+nkRz8yEkhwUhpJXlyKNCPqViPlgSU1WMqjwayZ836pKAW448CMceutdo0bVkCBQoQIKQ3roaBdQFotdsB7iHHh6/6nZBNghwKC5jIkmkYA2S+cQ3kZUX3b2G5kZuNfgpAAJ0EYD3v7XZ1NapMjWefq91VHquRshl9pt3U9hJTAhgYWHsgQAMCOlkUs7e8gMSoAIbv1kek+nV9AwhZodcsgPkAscfohke3uwDrBTn5Ep9UW/bA6S9oZ8+9yvvvEsz+Bwd5siRA2Ab7CdSef/BJIF94A9qHQ2W5Cbeegv15Fx949BHooFQMjKSVeQjpwsCJKKaYHycO5KNVIQqUhV2CmE3QomILwChjBgS4JQKNE7DoYo4AxPghBj2aAOSRig2pI5MWJEnCkgAIieOTVfLo448XYkGllS8WuSOSW3YggAKaTQQAHQ4EkFKQFZrFppvZwamLkl3auaYEbb4J5VF4njWnn1neWcKXlPFJ5zDv5AIClTwgqoeihDbqwZavcEZZmnrSkmIDDai4HQUEcPpnMy59kMCnoaKYXjKl8meBKyKsiiKoosq6qa6ypOoIq7liSKqphc7q66+3tnpifqf+AOvqqLsK+82xGDgwW3LSWdAAtTPmeeq2vK4gKQXgStvCuBOUW+ML6EqgbqfnentEuwC8e2oIBBzLwIW2phissP0YQOee96p3VsADa4PdCOMiXJDCkcorHyUJwyuuxPpQ/LDFF1t4sMaTFvxBZorYl8JdMeGVklvdioVXdiUuUmy8LqccM8sR1wzzyhynIOnLKmeHMwxLGsBAQUYjfbRHS1PSdAY/28yzyB7YEE008orwgwEtLddSdDNDjTElXftyANgLcykW11OYjXbOTLHt9dnruiCp3G7Xbbe3DiCQR99/+82n4IoRLvbaZX+tN0nEdabf2I77DDlqLNDbOM1plF+OuSGWQ8u456BpoFHk4aoweuagr3B6aqSfsHrorLvweh2zp27751QvXk5PfSycNgy+3xI87r3zTnzPpZMw/CHLM2/8Gs0fj0X00ivmAdgnYJ+B9mtwf4H3XoBfgfhXkG9j9eFfb0IEADs=\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1730,"title":"GJam: 2013 Rd1a Bullseye Painting","description":"\u003chttp://code.google.com/codejam/contests.html Google Code Jam\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\r\n\r\nGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\r\n\r\n\u003c\u003chttp://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\u003e\u003e\r\n\r\n*Input:* [r, p]  Integer values, 1\u003c=r,P\u003c=1000. Always enough P for one ring\r\n\r\n\r\n*Output:* Rings\r\n\r\n*Examples:*\r\n\r\n  [1 9] 1;\r\n  [1 10] 2;\r\n  [3 40] 3;\r\n  \r\n  [1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n\r\n*Google Code Jam:*\r\n\r\nThe next competition starts in April 2014. See details from above link.\r\n\r\nThis contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.\r\n\r\nSolutions to the various past Challenges in Matlab can be found via \u003chttp://www.go-hero.net/jam/13/solutions GJam Solutions\u003e.\r\n\r\nThe Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java  BigInteger.\r\n\r\n*Related Challenges:*\r\n\r\n  1) Reading 64 bit input file\r\n  2) Bullseye Large Numbers r\u003c1E18, P\u003c2E18\r\n\r\n*Usage of regexp is verboten*\r\n\r\n","description_html":"\u003cp\u003e\u003ca href = \"http://code.google.com/codejam/contests.html\"\u003eGoogle Code Jam\u003c/a\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\u003c/p\u003e\u003cp\u003eGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\u003c/p\u003e\u003cimg src = \"http://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\"\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [r, p]  Integer values, 1\u0026lt;=r,P\u0026lt;=1000. Always enough P for one ring\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Rings\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 9] 1;\r\n[1 10] 2;\r\n[3 40] 3;\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eGoogle Code Jam:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe next competition starts in April 2014. See details from above link.\u003c/p\u003e\u003cp\u003eThis contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.\u003c/p\u003e\u003cp\u003eSolutions to the various past Challenges in Matlab can be found via \u003ca href = \"http://www.go-hero.net/jam/13/solutions\"\u003eGJam Solutions\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThe Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java  BigInteger.\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Reading 64 bit input file\r\n2) Bullseye Large Numbers r\u0026lt;1E18, P\u0026lt;2E18\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eUsage of regexp is verboten\u003c/b\u003e\u003c/p\u003e","function_template":"function rings=solve_rings(r,p)\r\n rings=0;\r\nend","test_suite":"%%\r\nr=138;p=844;rings=3;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=21;p=197;rings=4;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=214;p=862;rings=2;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=20;p=845;rings=13;\r\nassert(isequal(solve_rings(r,p),rings))\r\n%%\r\nr=20;p=844;rings=12;\r\nassert(isequal(solve_rings(r,p),rings))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-20T20:30:52.000Z","updated_at":"2025-12-31T13:40:54.000Z","published_at":"2013-07-20T21:02:01.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=\\\"http://code.google.com/codejam/contests.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGoogle Code Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\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 a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\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\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [r, p] Integer values, 1\u0026lt;=r,P\u0026lt;=1000. Always enough P for one ring\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Rings\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\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 9] 1;\\n[1 10] 2;\\n[3 40] 3;\\n\\n[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGoogle Code Jam:\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\u003eThe next competition starts in April 2014. See details from above link.\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 contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.\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\u003eSolutions to the various past Challenges in Matlab can be found via\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=\\\"http://www.go-hero.net/jam/13/solutions\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam Solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java BigInteger.\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\u003eRelated Challenges:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Reading 64 bit input file\\n2) Bullseye Large Numbers r\u003c1E18, P\u003c2E18]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eUsage of regexp is verboten\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":52462,"title":"Easy Sequences 1: Find the index of an element","description":"The nth element of a series  is defined by: . Obviously, the first element . Given the nth element , find the value of the corresponding index .","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: 66px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 33px; transform-origin: 407px 33px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 33px; text-align: left; transform-origin: 384px 33px; 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: 88.5px 8px; transform-origin: 88.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe nth element of a series \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eA\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46px 8px; transform-origin: 46px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is defined by: \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-17px\"\u003e\u003cimg src=\"data:image/png;base64,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\" style=\"width: 155.5px; height: 45px;\" width=\"155.5\" height=\"45\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 91px 8px; transform-origin: 91px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Obviously, the first element \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAAAlCAYAAACXvR1IAAACl0lEQVR4nO2aXbHDIBCFj4c4wEAMREEUxEEdxEEtREMlxEMtXA210PsAe0N707KwQH5mvxlm+lAg4cBylgAoiqIoinJmLgCaTG0ZAH2mthQBE4Ahc5uja1cR0iFtxU2wqzUGw+xrwjnFbWt1NAB4woobwwhgjvi/gRXqCf7LzcgfDbaig32fR43OGgA/sIMdM4Cdq2OYfZCgVLjCtrADwelnr7SwgtK7VxF29Dq8RtSbwQuTveujB3BHvLBw/cREhj1xwfL+D1QS1uB1Fd2Z9WJWq48/iWKEpf6q7U2FoFVbXNgZSxh+ut8cU3MDfxL4pAoL2Gc7upGqIqy/6vxVGxK2QXzYJiTCTqi0NxWkirA/WMTx977QwUDP/N8aEmEvifX2RHFhR9c4rc4blgEP5aQkTmxq5NdNEYgiTErqY1x9aZGerBUVtnEN+wLGOGOaBCnkEHYU9isp0mhRVNgJ/40PhVeOM6aHS0EiLFy9FAM1wD63tEhz6WLC0qx/3x9b8J3x1sIeNZ8FCgo7w67Itf2D64xV2HSKCEvnwZ/CDJ2KhBzvVsJK0qy9kF1YMkzfBoXrjOnMN4WtzNNpXTEN6LcH4zrjrdMdaf58GldMJ0uhEEahOuSMJfmkRFiqm+JMT+mKKcSGwohvoELOOBTWPyER9uae68hkE5bE4uR+fsoTWhkT0gZZImzq/ronsghLH6i5wvqHFKFBpAkTs88avH5JihGJtokjf2x/TylTPMrfFQy/jFgfmA7LFRduHYD/od3Ahu219rn3pWYcN83psFwUeC9X7PA2poGNCEkzLwK6eZDraqvCYIB10KUGnfLv0pNHWaHk/d8z3VA8JAPyi1viErqSQI4jN8Lg2DclFEVRFEVRlNr8AmdhZHBxYd9KAAAAAElFTkSuQmCC\" style=\"width: 59px; height: 18.5px;\" width=\"59\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 36.5px 8px; transform-origin: 36.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Given the nth element \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAlCAYAAAD2pT8KAAACZklEQVRoge2ZYZGDMBCFPw84wEANoKAKcFAHODgLaEACHmqhGmqB+wFv2NKUbHoJcz94M525uZZs9mX3vSTAiRMnTvx/3IAq01g1cM001qHogTbzmN0y7uFo+G5Fe+ZqKIGeg8logYmZjBR0wJh/Oi8YyV9tQVTAg5mIlIDN8kxdYlIGF+B5QBw65oQm4CfhuZHjyrancOXVrCRMwN353FHVsI13KRVgZG2LafnbI5gDftJy4UGhCrSraqsiRkRFehvlQM+sFdnxYE3mzkpEbCNzdf5ui4r30q6ZF8TTYjcKtEfHzK5Wf2AlIrYnkLjGrPbKaq/Pzdj18n/FfBJPUBWczUqrJbBNOMU5RFoMWm2rQTWrHXaJcUVE54jtQs+70KncPc6hlfRCbTcyE2FXX8l5V3oik2Aq8La/L2ZCMedIIULCqra485rwzXzvcSsR+meMy2SawMfrHClE2EoLbcB60pLLQoTOE+OHjwQt5ggpRChRVdoWiunp+yy2LYHcG8TrHErOAyuUe+3oscQsYil13it5r4J77dMmOgS+lz54N0mf9M0N7RxjJaXWiTmH18+tEIYmrxbzuoAW4OvzjUo+pspWMGPOEWszWBMNrbh1ExE6sN8iA2GdcUHJeVi3pRxjvndMSuOEYtvqq5bfxIj9Wh+0g/MSYa0uFlQEf9IJO1aoLWzb3AlriIWIS26Lhnd77D4M1LCeCbzPwP7FTGvGCKFiTt57DTdy/GnXDW2XU+85U3Hl9YD4L9Eyl3apSWr/U5rsLCj5/uGwG+xcaMlPRomXRofg2xdEIeje4sSJEydO5MYvnSP5KzErv3UAAAAASUVORK5CYII=\" style=\"width: 33px; height: 18.5px;\" width=\"33\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 134.5px 8px; transform-origin: 134.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, find the value of the corresponding index \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function n = index(a)\r\n  n = a;\r\nend","test_suite":"%%\r\na = 1;\r\nn = index(a);\r\nassert(isequal(1,n))\r\n%%\r\na = 25;\r\nn = index(a);\r\nbs = arrayfun(@(x) sum(arrayfun(@(k) k*(-1)^(k^3+1),1:x)),1:n);\r\nb = bs(end);\r\nassert(isequal(a,b))\r\n%%\r\na = 100;\r\nn = index(a);\r\nbs = arrayfun(@(x) sum(arrayfun(@(k) k*(-1)^(k^3+1),1:x)),1:n);\r\nb = bs(end);\r\nassert(isequal(a,b))\r\n%%\r\na = randi([1000,ceil(exp(log(double(intmax)/2)))]);\r\nn = index(a);\r\nassert(isequal(index(-a+(1-(-1)^(n+1))/2),n+1))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":9,"created_by":255988,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52,"test_suite_updated_at":"2021-08-11T04:47:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-08-10T10:31:40.000Z","updated_at":"2026-04-01T20:40:04.000Z","published_at":"2021-08-10T10:34:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe nth element of a series \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\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is defined by: \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\u003eA(n) = \\\\displaystyle\\\\sum\\\\limits_{k=1}^n (k\\\\cdot(-1)^{k^3+1})\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Obviously, the first element \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\u003eA(1) = 1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Given the nth element \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\u003eA(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, find the value of the corresponding index \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\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":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":679,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-05T17:43:36.000Z","updated_at":"2026-04-07T13:59:33.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":42769,"title":"GJam March 2016 IOW: Cody's Jams ","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/8274486/dashboard GJam March 2016 Annual I/O for Women Cody's Jam\u003e. This is a mix of the small and large data sets.\r\n\r\nThe GJam story goes that a store is having a 25% off sale and ordered original and sale price labels. Unfortunately the labels came commingled in increasing numeric value. Find the sale prices.\r\n\r\n*Input:* m , Vector length N\u003c=100 with values \u003c=10^9.\r\n\r\n*Output:* v , Vector containing the Sale price tags\r\n\r\n*Examples:* [m] [v]\r\n\r\n  [15 20 60 75 80 100] creates v=[15 60 75]\r\n  [9 9 12 12 12 15 16 20] creates v=[9 9 12 15]\r\n \r\n\r\n*Google Code Jam 2016 Open Qualifier: April 8, 2016*\r\n\r\nComplete Code Jam Input/Output included in Test Suite.\r\nThe women's competition had 500 entrants. The qualifier winner was USA Stacy992 using Java. The top 60 show strength in USA, Russia, China, and South Korea under \u003chttp://code.google.com/codejam/contest/8274486/scoreboard?c=8274486# Contest Dashboard\u003e. ","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/8274486/dashboard\"\u003eGJam March 2016 Annual I/O for Women Cody's Jam\u003c/a\u003e. This is a mix of the small and large data sets.\u003c/p\u003e\u003cp\u003eThe GJam story goes that a store is having a 25% off sale and ordered original and sale price labels. Unfortunately the labels came commingled in increasing numeric value. Find the sale prices.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m , Vector length N\u0026lt;=100 with values \u0026lt;=10^9.\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e v , Vector containing the Sale price tags\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [m] [v]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[15 20 60 75 80 100] creates v=[15 60 75]\r\n[9 9 12 12 12 15 16 20] creates v=[9 9 12 15]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eGoogle Code Jam 2016 Open Qualifier: April 8, 2016\u003c/b\u003e\u003c/p\u003e\u003cp\u003eComplete Code Jam Input/Output included in Test Suite.\r\nThe women's competition had 500 entrants. The qualifier winner was USA Stacy992 using Java. The top 60 show strength in USA, Russia, China, and South Korea under \u003ca href = \"http://code.google.com/codejam/contest/8274486/scoreboard?c=8274486#\"\u003eContest Dashboard\u003c/a\u003e.\u003c/p\u003e","function_template":"function v=CodyJams(m)\r\n% m is increasing value vector of length 2L\r\n% v is length L vector of Sale Price Tags\r\n v=[];\r\nend","test_suite":"%%\r\nm=[15 20 60 75 80 100 ];\r\nv=CodyJams(m);\r\nvexp=[15 60 75 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[9 9 12 12 12 15 16 20 ];\r\nv=CodyJams(m);\r\nvexp=[9 9 12 15 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[480 640 1047 1396 1638 2184 2481 3308 ];\r\nv=CodyJams(m);\r\nvexp=[480 1047 1638 2481 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[495 660 1953 2559 2604 2685 3412 3580 ];\r\nv=CodyJams(m);\r\nvexp=[495 1953 2559 2685 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[384 512 1005 1340 2037 2716 2973 3964 ];\r\nv=CodyJams(m);\r\nvexp=[384 1005 2037 2973 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[270624780 336144033 360833040 448192044 736130808 745857189 981507744 994476252 ];\r\nv=CodyJams(m);\r\nvexp=[270624780 336144033 736130808 745857189 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[147 196 267 330 356 440 810 1080 ];\r\nv=CodyJams(m);\r\nvexp=[147 267 330 810 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[222 296 1533 1767 2044 2356 2541 3388 ];\r\nv=CodyJams(m);\r\nvexp=[222 1533 1767 2541 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[450 600 804 1072 1137 1497 1516 1996 ];\r\nv=CodyJams(m);\r\nvexp=[450 804 1137 1497 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[1788 2384 2697 2967 2991 3596 3956 3988 ];\r\nv=CodyJams(m);\r\nvexp=[1788 2697 2967 2991 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[4131 5508 7344 7803 8397 8667 9792 10404 11196 11556 13872 14553 14742 14928 15408 17631 18496 19404 19656 19904 20544 20925 21816 23508 23598 23949 25872 26208 27900 29088 31344 31464 31932 34496 34944 37200 38784 41792 41952 42576 49600 51712 55936 56768 7440174 8148762 8601471 8837667 9290376 9664353 9920232 9920232 10865016 10865016 11468628 11468628 11783556 11783556 12387168 12387168 12885804 12885804 13187610 13226976 13226976 13443489 14309541 14486688 14486688 15291504 15291504 15711408 15711408 16516224 16516224 17181072 17181072 17583480 17583480 17635968 17635968 17924652 17924652 19079388 19079388 19315584 19315584 20388672 20388672 20948544 20948544 22021632 22021632 22908096 22908096 23444640 23444640 23514624 23514624 23899536 23899536 25439184 25439184 25754112 25754112 27184896 27184896 27931392 29362176 29362176 30544128 30544128 31259520 31259520 31352832 31352832 31866048 31866048 33918912 33918912 34338816 34338816 36246528 36246528 39149568 39149568 40725504 40725504 41679360 41679360 41803776 41803776 42488064 42488064 45225216 45225216 45785088 45785088 48328704 48328704 52199424 52199424 54300672 54300672 55572480 55572480 55738368 55738368 56650752 56650752 60300288 60300288 61046784 61046784 64438272 64438272 69599232 69599232 72400896 72400896 74096640 74096640 74317824 74317824 75534336 75534336 80400384 80400384 81395712 81395712 85917696 85917696 92798976 92798976 96534528 96534528 98795520 98795520 99090432 100712448 100712448 107200512 107200512 108527616 108527616 114556928 123731968 128712704 131727360 131727360 134283264 134283264 142934016 142934016 144703488 144703488 175636480 179044352 190578688 192937984 ];\r\nv=CodyJams(m);\r\nvexp=[4131 7344 7803 8397 8667 13872 14553 14742 14928 15408 17631 20925 21816 23598 23949 25872 26208 31344 37200 38784 41952 42576 7440174 8148762 8601471 8837667 9290376 9664353 9920232 10865016 11468628 11783556 12387168 12885804 13187610 13226976 13443489 14309541 14486688 15291504 15711408 16516224 17181072 17583480 17635968 17924652 19079388 19315584 20388672 20948544 22021632 22908096 23444640 23514624 23899536 25439184 25754112 27184896 29362176 30544128 31259520 31352832 31866048 33918912 34338816 36246528 39149568 40725504 41679360 41803776 42488064 45225216 45785088 48328704 52199424 54300672 55572480 55738368 56650752 60300288 61046784 64438272 69599232 72400896 74096640 74317824 75534336 80400384 81395712 85917696 92798976 96534528 98795520 100712448 107200512 108527616 131727360 134283264 142934016 144703488 ];\r\nassert(isequal(vexp,v))\r\n%%\r\nm=[47652765 63537020 67915215 69349602 72816921 73024614 82232592 90005040 90280239 90553620 92466136 94414812 97089228 97366152 103779192 109643456 111106431 111164235 120006720 120373652 125886416 135665742 136205178 138372256 138890175 141176913 142430418 148141908 148218980 151625514 165274734 180887656 181606904 185186900 186382386 188235884 189907224 191652879 197100096 200131203 202167352 220366312 228636354 230018664 233064210 248509848 252322995 253203684 255537172 262800128 266522562 266752464 266841604 276629997 284197221 289714236 292147407 298051953 304848472 306691552 310752280 315722328 323249112 326482563 331581687 336430660 337604912 341668035 343831008 350075772 355363416 355669952 368839996 377457843 378929628 380744748 386285648 389529876 394930203 397402604 398376315 398670747 400335744 403277814 417169314 420741072 420963104 429730527 430998816 431599908 435310084 437438880 442108916 446485650 455557380 456522042 456986763 458441344 458579964 462594018 466767696 473333373 473409816 498541914 500694354 502642542 502680435 503277124 507659664 526573604 531168420 531512730 531560996 533780992 537703752 554512398 556085664 556225752 559312521 560988096 572974036 575466544 576554121 582854961 583251840 595314200 603269448 608696056 609315684 609830100 611439952 616792024 622311657 630908808 631111164 631213088 640087608 662978055 664722552 666189831 667592472 668044893 670190056 670240580 670949520 676510731 678398706 680890563 683321925 683396070 686473173 698833314 701501745 704706354 706326441 708683640 712094160 717827469 719130264 721789842 730229028 732531111 739232499 739349864 740488395 741447552 743207979 745750028 747639918 768738828 777139948 804359264 813106800 829748876 841211744 853450144 883970740 888253108 890726524 894599360 902014308 904531608 907854084 911095900 911194760 915297564 931777752 935335660 939608472 941768588 949458880 957103292 958840352 962386456 973638704 976708148 985643332 987317860 990943972 996853224 ];\r\nv=CodyJams(m);\r\nvexp=[47652765 67915215 69349602 72816921 73024614 82232592 90005040 90280239 94414812 103779192 111106431 111164235 135665742 136205178 138890175 141176913 142430418 151625514 165274734 186382386 191652879 197100096 200131203 228636354 230018664 233064210 252322995 253203684 266522562 266752464 276629997 284197221 289714236 292147407 298051953 315722328 323249112 326482563 331581687 341668035 343831008 350075772 377457843 380744748 394930203 398376315 398670747 400335744 403277814 417169314 420741072 429730527 431599908 437438880 446485650 456522042 456986763 458579964 462594018 473333373 473409816 498541914 500694354 502642542 502680435 531512730 554512398 556085664 559312521 576554121 582854961 603269448 609830100 622311657 630908808 640087608 662978055 666189831 668044893 670949520 676510731 678398706 680890563 683321925 683396070 686473173 698833314 701501745 704706354 706326441 712094160 717827469 719130264 721789842 730229028 732531111 739232499 740488395 743207979 747639918 ];\r\nassert(isequal(vexp,v))\r\n%%\r\n% function GJam_IOW_2016a\r\n% % \r\n% fn='A-large-practice.in';\r\n% %fn='A-small-practice.in';\r\n% [data] = read_file(fn); % create cell array\r\n% \r\n% fidG = fopen('A-large-output.out', 'w');\r\n%  \r\n% tic\r\n% for i=1:size(data,2) % Cell array has N rows of cases\r\n%  v = Rd1A(data{i});\r\n%  m=data{i};\r\n%  \r\n%  fprintf(fidG,'Case #%i:',i);\r\n%  fprintf(fidG,' %i',v);fprintf(fidG,'\\n');\r\n%  fprintf('Case #%i:',i);\r\n%  fprintf(' %i',v);fprintf('\\n');\r\n%  \r\n% end\r\n% toc\r\n% \r\n% fclose(fidG);\r\n% end\r\n% \r\n% function v=Rd1A(m)\r\n%  L=length(m);\r\n%  v=zeros(1,L/2);\r\n%  for i=1:L/2\r\n%   vptr=find(m\u003e0,1,'first');\r\n%   v(i)=m(vptr);\r\n%   m(find(m==round(m(vptr)*4/3),1,'first'))=0;\r\n%   m(vptr)=0;\r\n%  end\r\n% end\r\n% \r\n% \r\n% function [d] = read_file(fn)\r\n% d={};\r\n% fid=fopen(fn);\r\n% fgetl(fid); % Total Count ignore\r\n% ptr=0;\r\n% while ~feof(fid)\r\n%  ptr=ptr+1;\r\n%  fgetl(fid); % Data set countIgnore\r\n%  v=str2num(fgetl(fid)); \r\n%  \r\n%  d{ptr}=v;\r\n%  \r\n% end % feof\r\n%  fclose(fid);\r\n% \r\n% end % read_file\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"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":"2016-03-13T05:45:39.000Z","updated_at":"2016-03-15T16:31:00.000Z","published_at":"2016-03-13T06:32: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\u003eThis Challenge is derived from\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=\\\"http://code.google.com/codejam/contest/8274486/dashboard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam March 2016 Annual I/O for Women Cody's Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. This is a mix of the small and large data sets.\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\u003eThe GJam story goes that a store is having a 25% off sale and ordered original and sale price labels. Unfortunately the labels came commingled in increasing numeric value. Find the sale prices.\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m , Vector length N\u0026lt;=100 with values \u0026lt;=10^9.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e v , Vector containing the Sale price tags\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\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [m] [v]\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[[15 20 60 75 80 100] creates v=[15 60 75]\\n[9 9 12 12 12 15 16 20] creates v=[9 9 12 15]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGoogle Code Jam 2016 Open Qualifier: April 8, 2016\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\u003eComplete Code Jam Input/Output included in Test Suite. The women's competition had 500 entrants. The qualifier winner was USA Stacy992 using Java. The top 60 show strength in USA, Russia, China, and South Korea under\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=\\\"http://code.google.com/codejam/contest/8274486/scoreboard?c=8274486#\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eContest Dashboard\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":44466,"title":"The twelve days of Christmas","description":"Traditionally there are twelve days of Christmas to celebrate (\"Twelvetide\"), typically starting with Christmas Day (25 December) as the \"First Day of Christmas\" and finishing on the 5th of January.  \r\n\r\nIn the traditional Christmas carol, helpfully entitled \u003chttp://christmas-lyrics.com/christmas-carols-lyrics/the-twelve-days-of-christmas-lyrics/ _The Twelve Days of Christmas_\u003e, the singer recounts receiving gifts on each day, sent to them by their True Love.  \r\n\r\nOn the *first* day, they receive *one* gift (1 × \"partridge in a pear tree\").  \r\n\r\nOn the *second* day they receive *two* _new_ gifts (2 × \"turtle doves\") *plus* a repeat of each gift corresponding to the previous days — in this case meaning plus *one* _repeat_ gift (1 × \"partridge in a pear tree\").  Therefore they have _accumulated_ a total of four gifts:  one from the first day, and three from the second day.  \r\n\r\nOn the *third* day they receive *three* _new_ gifts (3 × \"French hens\") *plus* a repeat of each gift corresponding to the previous days — in this case meaning plus *three* _repeat_ gifts (1 × \"partridge in a pear tree\" and 2 × \"turtle doves\").  By now they have _accumulated_ a total of ten gifts:  one from the first day, three from the second day, and six from the third day.  \r\n\r\nThis continues until the twelfth day (the _last_ day of Christmas).  \r\n\r\nFor this problem you must calculate the cumulative total of all gifts received up to the specified day that is provided as input.  (Day 1 is the 25th of December, day 2 is the 26th of December, and so on.)\r\n\r\nEXAMPLE\r\n\r\n day = 2\r\n accumulatedGifts = 4\r\n","description_html":"\u003cp\u003eTraditionally there are twelve days of Christmas to celebrate (\"Twelvetide\"), typically starting with Christmas Day (25 December) as the \"First Day of Christmas\" and finishing on the 5th of January.\u003c/p\u003e\u003cp\u003eIn the traditional Christmas carol, helpfully entitled \u003ca href = \"http://christmas-lyrics.com/christmas-carols-lyrics/the-twelve-days-of-christmas-lyrics/\"\u003e\u003ci\u003eThe Twelve Days of Christmas\u003c/i\u003e\u003c/a\u003e, the singer recounts receiving gifts on each day, sent to them by their True Love.\u003c/p\u003e\u003cp\u003eOn the \u003cb\u003efirst\u003c/b\u003e day, they receive \u003cb\u003eone\u003c/b\u003e gift (1 × \"partridge in a pear tree\").\u003c/p\u003e\u003cp\u003eOn the \u003cb\u003esecond\u003c/b\u003e day they receive \u003cb\u003etwo\u003c/b\u003e \u003ci\u003enew\u003c/i\u003e gifts (2 × \"turtle doves\") \u003cb\u003eplus\u003c/b\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus \u003cb\u003eone\u003c/b\u003e \u003ci\u003erepeat\u003c/i\u003e gift (1 × \"partridge in a pear tree\").  Therefore they have \u003ci\u003eaccumulated\u003c/i\u003e a total of four gifts:  one from the first day, and three from the second day.\u003c/p\u003e\u003cp\u003eOn the \u003cb\u003ethird\u003c/b\u003e day they receive \u003cb\u003ethree\u003c/b\u003e \u003ci\u003enew\u003c/i\u003e gifts (3 × \"French hens\") \u003cb\u003eplus\u003c/b\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus \u003cb\u003ethree\u003c/b\u003e \u003ci\u003erepeat\u003c/i\u003e gifts (1 × \"partridge in a pear tree\" and 2 × \"turtle doves\").  By now they have \u003ci\u003eaccumulated\u003c/i\u003e a total of ten gifts:  one from the first day, three from the second day, and six from the third day.\u003c/p\u003e\u003cp\u003eThis continues until the twelfth day (the \u003ci\u003elast\u003c/i\u003e day of Christmas).\u003c/p\u003e\u003cp\u003eFor this problem you must calculate the cumulative total of all gifts received up to the specified day that is provided as input.  (Day 1 is the 25th of December, day 2 is the 26th of December, and so on.)\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e day = 2\r\n accumulatedGifts = 4\u003c/pre\u003e","function_template":"% Comments...\r\nfunction accumulatedGifts = twelvetide(day)\r\n        accumulatedGifts = 12\r\nend","test_suite":"%% Please do not try to hack the Test Suite.  \r\n% The Test Suite will be updated if inappropriate submissions are received.  \r\n% This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'.\r\n\r\n% EDIT (2019-06-24).  Anti-hacking provision\r\n% Ensure builtin function will be called.  (Probably only the second of these will work.)  \r\n! del fileread.m\r\n! rm -v fileread.m\r\n% Probably only the second of these will work.  \r\nRE = regexp(fileread('twelvetide.m'), '\\w+', 'match');\r\n%tabooWords = {'ans', 'assert', 'freepass', 'tic'};\r\ntabooWords = {'assert', 'freepass'};\r\ntestResult = cellfun( @(z) ismember(z, tabooWords), RE );\r\nmsg = ['Please do not do that in your code!' char([10 13]) ...\r\n    'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...\r\n    'Banned word.' char([10 13])];\r\nassert(~any(  cellfun( @(z) ismember(z, tabooWords), RE )  ), msg)\r\n% END EDIT (2019-06-24)\r\n\r\n\r\n%% Anti-hardcoding test\r\n% Adapted from the code of Alfonso Nieto-Castanon in a comment at \r\n% https://www.mathworks.com/matlabcentral/cody/problems/44343 .\r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[120,165,220,286]),regexp(fileread('twelvetide.m'),'[\\d\\.\\+\\-\\*\\/]+','match'))), 'Please do not hard-code your ''solution''.') \r\n%assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[120,165,220,286,364]),regexp(fileread('twelvetide.m'),'[\\d\\.\\+\\-\\*\\/]+','match'))), 'Please do not hard-code your ''solution''.')  \u003c-- prior to 2018-01-02.\r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[55,66,78]),regexp(fileread('twelvetide.m'),'[\\d\\.\\+\\-\\*\\/]+','match'))), 'No, really: please do not hard-code your ''solution''.')  % Added on 2018-01-06.\r\n\r\n%% Before Christmas\r\nday = 0 - randi(50);\r\naccumulatedGifts = 0;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%% Before Christmas\r\nday = 0;\r\naccumulatedGifts = 0;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%% First day of Christmas\r\nday = 1;\r\naccumulatedGifts = 1;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 2;\r\naccumulatedGifts = 4;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 3;\r\naccumulatedGifts = 10;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 4;\r\naccumulatedGifts = 20;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 5;\r\naccumulatedGifts = 35;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 6;\r\naccumulatedGifts = 56;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 7;\r\naccumulatedGifts = 84;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 8;\r\naccumulatedGifts = 120;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 9;\r\naccumulatedGifts = 165;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 10;\r\naccumulatedGifts = 220;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 11;\r\naccumulatedGifts = 286;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%% Last day of Christmas\r\nday = 12;\r\naccumulatedGifts = 364;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 13;\r\naccumulatedGifts = 364;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nday = 100;\r\naccumulatedGifts = 364;\r\nassert( isequal(twelvetide(day), accumulatedGifts) )\r\n\r\n%%\r\nfor i = 1 : 10\r\n    day = 12 + randi(300);\r\n    accumulatedGifts = 364;\r\n    assert( isequal(twelvetide(day), accumulatedGifts) )\r\nend;","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":158,"test_suite_updated_at":"2019-06-24T08:48:56.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2017-12-23T07:03:22.000Z","updated_at":"2026-02-02T10:48:27.000Z","published_at":"2017-12-23T07:42:59.000Z","restored_at":"2018-02-06T15:11:41.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"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\u003eTraditionally there are twelve days of Christmas to celebrate (\\\"Twelvetide\\\"), typically starting with Christmas Day (25 December) as the \\\"First Day of Christmas\\\" and finishing on the 5th of January.\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 the traditional Christmas carol, helpfully entitled\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=\\\"http://christmas-lyrics.com/christmas-carols-lyrics/the-twelve-days-of-christmas-lyrics/\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eThe Twelve Days of Christmas\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, the singer recounts receiving gifts on each day, sent to them by their True Love.\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\u003eOn 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efirst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day, they receive\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\u003eone\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gift (1 × \\\"partridge in a pear tree\\\").\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\u003eOn 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esecond\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day they receive\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\u003etwo\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\u003enew\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gifts (2 × \\\"turtle doves\\\")\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\u003eplus\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus\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\u003eone\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\u003erepeat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gift (1 × \\\"partridge in a pear tree\\\"). Therefore they have\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\u003eaccumulated\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a total of four gifts: one from the first day, and three from the second day.\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\u003eOn 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ethird\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day they receive\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\u003ethree\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\u003enew\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gifts (3 × \\\"French hens\\\")\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\u003eplus\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a repeat of each gift corresponding to the previous days — in this case meaning plus\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\u003ethree\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\u003erepeat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e gifts (1 × \\\"partridge in a pear tree\\\" and 2 × \\\"turtle doves\\\"). By now they have\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\u003eaccumulated\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e a total of ten gifts: one from the first day, three from the second day, and six from the third day.\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 continues until the twelfth day (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\u003elast\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e day of Christmas).\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 this problem you must calculate the cumulative total of all gifts received up to the specified day that is provided as input. (Day 1 is the 25th of December, day 2 is the 26th of December, and so on.)\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\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[ day = 2\\n accumulatedGifts = 4]]\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":44732,"title":"Highly divisible triangular number (inspired by Project Euler 12)","description":"Triangular numbers can be calculated by the sum from 1 to n. For example, the first 10 triangular numbers are:\r\n\r\n 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\r\n\r\nAll divisors for each of these numbers are listed below\r\n\r\n 1: 1\r\n 3: 1,3\r\n 6: 1,2,3,6\r\n 10: 1,2,5,10\r\n 15: 1,3,5,15\r\n 21: 1,3,7,21\r\n 28: 1,2,4,7,14,28\r\n 36: 1,2,3,4,6,9,12,18,36\r\n 45: 1,3,5,9,15,45\r\n 55: 1,5,11,55\r\n\r\nYour challenge is to write a function that will return the value of the first triangular number to have over d divisors (d will be passed to your function).","description_html":"\u003cp\u003eTriangular numbers can be calculated by the sum from 1 to n. For example, the first 10 triangular numbers are:\u003c/p\u003e\u003cpre\u003e 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\u003c/pre\u003e\u003cp\u003eAll divisors for each of these numbers are listed below\u003c/p\u003e\u003cpre\u003e 1: 1\r\n 3: 1,3\r\n 6: 1,2,3,6\r\n 10: 1,2,5,10\r\n 15: 1,3,5,15\r\n 21: 1,3,7,21\r\n 28: 1,2,4,7,14,28\r\n 36: 1,2,3,4,6,9,12,18,36\r\n 45: 1,3,5,9,15,45\r\n 55: 1,5,11,55\u003c/pre\u003e\u003cp\u003eYour challenge is to write a function that will return the value of the first triangular number to have over d divisors (d will be passed to your function).\u003c/p\u003e","function_template":"function y = div_tri_n(d)\r\n y = d;\r\nend","test_suite":"%%\r\nassessFunctionAbsence({'regexp', 'regexpi', 'str2num'},'FileName','div_tri_n.m')\r\n\r\n%%\r\nassert(isequal(div_tri_n(2),6))\r\n\r\n%%\r\nassert(isequal(div_tri_n(4),28))\r\n\r\n%%\r\nassert(isequal(div_tri_n(8),36))\r\n\r\n%%\r\nassert(isequal(div_tri_n(10),120))\r\n\r\n%%\r\nassert(isequal(div_tri_n(20),630))\r\n\r\n%%\r\nassert(isequal(div_tri_n(25),2016))\r\n\r\n%%\r\nassert(isequal(div_tri_n(39),3240))\r\n\r\n%%\r\nassert(isequal(div_tri_n(40),5460))\r\n\r\n%%\r\nassert(isequal(div_tri_n(50),25200))\r\n\r\n%%\r\nassert(isequal(div_tri_n(70),25200))\r\n\r\n%%\r\nassert(isequal(div_tri_n(80),25200))\r\n\r\n%%\r\nassert(isequal(div_tri_n(100),73920))\r\n\r\n%%\r\nassert(isequal(div_tri_n(115),157080))\r\n\r\n%%\r\nassert(isequal(div_tri_n(120),157080))\r\n\r\n%%\r\nassert(isequal(div_tri_n(130),437580))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":164,"test_suite_updated_at":"2018-08-20T16:04:49.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-08-20T15:15:06.000Z","updated_at":"2026-01-05T00:21:49.000Z","published_at":"2018-08-20T16:04:49.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\u003eTriangular numbers can be calculated by the sum from 1 to n. For example, the first 10 triangular numbers are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...]]\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\u003eAll divisors for each of these numbers are listed below\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1: 1\\n 3: 1,3\\n 6: 1,2,3,6\\n 10: 1,2,5,10\\n 15: 1,3,5,15\\n 21: 1,3,7,21\\n 28: 1,2,4,7,14,28\\n 36: 1,2,3,4,6,9,12,18,36\\n 45: 1,3,5,9,15,45\\n 55: 1,5,11,55]]\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\u003eYour challenge is to write a function that will return the value of the first triangular number to have over d divisors (d will be passed to your 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":58463,"title":"Recurssive serie","description":"let the numerical serie U(n) such as U(n+1)= 0.2U(n) + 0.3U(n-1) ; U(0) = a ; U(1) = b\r\nthe goal is to plot the elements of this serie in a 2D graph after solving for the serie using matrix manipulation\r\nSteps for solving : create the matrix \r\n(0     1\r\n0.3 0. 2)\r\nFind the eigen values ,create a diagonal matrix using those eigen values\r\nFind the matrix whose colomns are the eigen vectors\r\nHINT ( there is only two eigen values. The first element of the diagonal matrix is the negative eigen value!) \r\nCalculate the vector U for every n \u003e=2 such as U(n) = x(2,1)*U(0) + X(2,2)*U(1)\r\nHINT (the matrix X = P * D^n * P^-1 such as D is the diagonal eigen values matrix and P is the eigen vectors matrix.)\r\nplot the vector U with n being the length of U, you don't need to round the values of the serie.","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: 321px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 160.5px; transform-origin: 407px 160.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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003elet the numerical serie U(n) such as U(n+1)= 0.2U(n) + 0.3U(n-1) ; U(0) = a ; U(1) = b\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ethe goal is to plot the elements of this serie in a 2D graph after solving for the serie using matrix manipulation\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSteps for solving : create the matrix \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(0     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: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e0.3 0. 2)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFind the eigen values ,create a diagonal matrix using those eigen values\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFind the matrix whose colomns are the eigen vectors\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eHINT ( \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=\"\"\u003ethere is only two eigen values. The first element of the diagonal matrix is the negative eigen value!\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; \"\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 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCalculate the vector U for every n \u0026gt;=2 such as U(n) = x(2,1)*U(0) + X(2,2)*U(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: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eHINT (\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=\"\"\u003ethe matrix X = P * D^n * P^-1 such as D is the diagonal eigen values matrix and P is the eigen vectors matrix.\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; \"\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-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eplot the vector U with n being the length of U, you don't need to round the values of the serie.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function U = recurrence(a,b,n)\r\n  U=[a,b];\r\n  \r\n  \r\n  plot([1:n],U,\"*\");\r\nend","test_suite":"%%\r\na = 0;\r\nb = 1;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(2),1))\r\n%%\r\na = 1;\r\nb = 0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(2),0))\r\n%%\r\na = 3;\r\nb = 1;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(5),3),0.179))\r\n%%\r\na = 9;\r\nb = 7;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(6),3),0.530))\r\n%%\r\na = 5;\r\nb = 5;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(3),3),1.15))\r\n%%\r\na = 0.6;\r\nb = -4;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(round(U(4),3),-0.487))\r\n%%\r\na=0;\r\nb=0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(4),0))\r\n%%\r\na=0;\r\nb=0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(5),0))\r\n%%\r\na=0;\r\nb=0;\r\nn=7;\r\nU=recurrence(a,b,n);\r\nassert(isequal(U(7),0))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3437689,"edited_by":3437689,"edited_at":"2023-06-24T21:36:27.000Z","deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-06-24T20:47:31.000Z","updated_at":"2023-06-24T21:36:27.000Z","published_at":"2023-06-24T21:36:27.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\u003elet the numerical serie U(n) such as U(n+1)= 0.2U(n) + 0.3U(n-1) ; U(0) = a ; U(1) = 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe goal is to plot the elements of this serie in a 2D graph after solving for the serie using matrix manipulation\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\u003eSteps for solving : create the matrix \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(0     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\u003e0.3 0. 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\u003eFind the eigen values ,create a diagonal matrix using those eigen values\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 matrix whose colomns are the eigen vectors\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\u003eHINT ( \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003ethere is only two eigen values. The first element of the diagonal matrix is the negative eigen value!\u003c/w:t\u003e\u003c/w:r\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: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\u003eCalculate the vector U for every n \u0026gt;=2 such as U(n) = x(2,1)*U(0) + X(2,2)*U(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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHINT (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003ethe matrix X = P * D^n * P^-1 such as D is the diagonal eigen values matrix and P is the eigen vectors matrix.\u003c/w:t\u003e\u003c/w:r\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:t\u003eplot the vector U with n being the length of U, you don't need to round the values of the serie.\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":54275,"title":"Get twenty-four","description":"Inpur four integers in 1 to 10, you may use plus, minus, multiply and divid to get 24. Note that every integer should be used once and only once. Brackets are of no limit, and the result should exactly be 24 once you calculate by hand. (Calculation in computer will lead to a tolerance to the computer precision.) \r\nYou need to return a format and a vector with the same four integers, such that you can print the expression.\r\nE.g., input                            x = [5 5 7 7]\r\n        you may return            f  = '(%d*%d)-(%d/%d)'\r\n                     and                 z = [5 5 7 7]\r\n      so  24 is obatined by     eval(sprintf(f,z)).\r\n     The answer is not necessary unique, e.g., other acceptable answers are\r\n                                            f  = '(%d*%d)-(%d*%d)'  \r\n                                            z =  [7 7 5 5]\r\n                   and                   f = '(%d-%d)*(%d+%d)'\r\n                                            z = [7 5 7 5]","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: 363px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 181.5px; transform-origin: 407px 181.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInpur four integers in 1 to 10, you may use plus, minus, multiply and divid to get 24. Note that every integer should be used once and only once. Brackets are of no limit, and the result should exactly be 24 once you calculate by hand. (Calculation in computer will lead to a tolerance to the computer precision.) \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou need to return a format and a vector with the same four integers, such that you can print the expression.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eE.g., input                            x = [5 5 7 7]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e        you may return            f  = '(%d*%d)-(%d/%d)'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                     and                 z = [5 5 7 7]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e      so  24 is obatined by     eval(sprintf(f,z)).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e     The answer is not necessary unique, e.g., other acceptable answers are\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                                            f  = '(%d*%d)-(%d*%d)'  \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                                            z =  [7 7 5 5]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                   and                   f = '(%d-%d)*(%d+%d)'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e                                            z = [7 5 7 5]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [f,z] = get24(x)\r\n  z = 23;\r\n  f = '(%d%d+%s%s)'\r\nend","test_suite":"%%\r\nx = [1 2 3 4];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [6 9 9 10];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e=9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [4 4 10 10];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [3 3 7 7];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend\r\n%%\r\nx = [1 4 5 6];\r\ntry \r\n    [f,z] = get24(x);\r\n    s = sprintf(f,z); s(s\u003e'9'|s\u003c'0')=' '; assert(length(str2num(s))==4);    \r\n    assert(ischar(f));\r\n    assert(all( sort(z)==sort(x) ));\r\n    assert(length(f(f=='-'|f=='+'|f=='*'|f=='/'))==3);\r\n    assert( abs( eval(sprintf(f,z))-24 )\u003c=1e-8 );\r\n    w = f(f~='('\u0026f~=')'\u0026f~='+'\u0026f~='-'\u0026f~='*'\u0026f~='/'\u0026f~='%'\u0026f~='s'\u0026f~='d');\r\n    assert(isempty(w),'unusual format character!');\r\ncatch\r\n    assert(false,'no result or something wrong!');\r\nend","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":2197980,"edited_by":2197980,"edited_at":"2024-08-29T05:32:43.000Z","deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":"2024-08-29T05:32:43.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-13T12:52:09.000Z","updated_at":"2024-08-29T05:32:43.000Z","published_at":"2022-04-13T12:52:22.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\u003eInpur four integers in 1 to 10, you may use plus, minus, multiply and divid to get 24. Note that every integer should be used once and only once. Brackets are of no limit, and the result should exactly be 24 once you calculate by hand. (Calculation in computer will lead to a tolerance to the computer precision.) \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou need to return a format and a vector with the same four integers, such that you can print the expression.\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\u003eE.g., input                            x = [5 5 7 7]\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        you may return            f  = '(%d*%d)-(%d/%d)'\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                     and                 z = [5 5 7 7]\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      so  24 is obatined by     eval(sprintf(f,z)).\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     The answer is not necessary unique, e.g., other acceptable answers are\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                                            f  = '(%d*%d)-(%d*%d)'  \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                                            z =  [7 7 5 5]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e                   and                   f = '(%d-%d)*(%d+%d)'\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                                            z = [7 5 7 5]\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":54430,"title":"factorial","description":"There are really some cody problems related to factorial of n, e.g., 42667, 45184, 46054, and etc. It is interesting to ask why dont we just write the number n! down and do any kind of analysis later.\r\nSo this problem asks you to write it down as:\r\ninput 3:   write  3!=6\r\ninput 5:  write 5!=120\r\nbut n may be as large as 100 or even more.  Write the result with no spaces.","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: 162px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 81px; transform-origin: 407px 81px; 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=\"\"\u003eThere are really some cody problems related to factorial of n, e.g., \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/42267-factorial-of-a-number-x\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e42667\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45184-factorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e45184\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e46054\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, and etc. It is interesting to ask why dont we just write the number n! down and do any kind of analysis later.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSo this problem asks you to write it down as:\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=\"\"\u003einput 3:   write  3!=6\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=\"\"\u003einput 5:  write 5!=120\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=\"\"\u003ebut n may be as large as 100 or even more.  Write the result with no spaces.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = factorial2(x)\r\n    \r\nend","test_suite":"%%\r\nfiletext = fileread('factorial2.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 = 0;\r\ny_correct = '0!=1';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 1;\r\ny_correct = '1!=1';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 4;\r\ny_correct = '4!=24';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = '10!=3628800';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 100;\r\ny_correct = '100!=93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000';\r\nassert(isequal(factorial2(x),y_correct))\r\n%%\r\nx = 1000;\r\ny_correct = '1000!=402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(factorial2(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-05-03T22:58:06.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2022-05-03T13:40:27.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-03T13:38:41.000Z","updated_at":"2022-05-03T22:58:06.000Z","published_at":"2022-05-03T13:38:41.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\u003eThere are really some cody problems related to factorial of n, e.g., \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/42267-factorial-of-a-number-x\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e42667\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45184-factorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e45184\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46054-count-trailing-zeros-in-a-primorial\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e46054\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and etc. It is interesting to ask why dont we just write the number n! down and do any kind of analysis later.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo this problem asks you to write it down as:\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\u003einput 3:   write  3!=6\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\u003einput 5:  write 5!=120\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 n may be as large as 100 or even more.  Write the result with no spaces.\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":54260,"title":"Concatenate input positive integers to obtain a maximum.","description":"Input some integers, you need to concatenate them to obtain a maximum integer. Neither use library function \"perms\" to list all possible solution, nor use to switch your data between numbers and strings. Therefore, any function, with substring \"perm\" or \"str\" is forbidden. Since possibly you get a super large number, return the string format of the answer.\r\nE.g., input [2 4 41 27], \r\n        you get '441272';\r\nand input [ 2 27 272 27272 ]\r\n     you get '27272722722'","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: 183px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 91.5px; transform-origin: 407px 91.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eInput some integers, you need to concatenate them to obtain a maximum integer. Neither use library function \"perms\" to list all possible solution, nor use to switch your data between numbers and strings. Therefore, any function, with substring \"perm\" or \"str\" is forbidden. Since possibly you get a super large number, return the string format of the answer.\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=\"\"\u003eE.g., input [2 4 41 27], \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=\"\"\u003e        you get '441272';\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=\"\"\u003eand input [ 2 27 272 27272 ]\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=\"\"\u003e     you get '27272722722'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = comax(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [2 4 41 27];\r\ny_correct = '441272';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nx = [ 2 27 272 27272 ];\r\ny_correct = '27272722722';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nx = [93 74 35 59 11 91 88 82 27 60 3 43 32 17 18 9 10 60 48 919];\r\ny_correct = '993919918882746060594843353322718171110';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nx = [93 74 35 59 11 91 88 82 27 60 3 43 32 17 18 9 10 1 100 1000 60 48 919];\r\ny_correct = '99391991888274606059484335332271817111101001000';\r\nassert(isequal(comax(x),y_correct))\r\n\r\n%%\r\nfiletext = fileread('comax.m');\r\nassert(isempty(strfind(filetext, 'perm')))\r\n\r\n%%\r\nfiletext = fileread('comax.m');\r\nassert(isempty(strfind(filetext, 'str'))\u0026isempty(strfind(filetext, 'eval')))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-08-18T13:56:25.000Z","deleted_by":null,"deleted_at":null,"solvers_count":43,"test_suite_updated_at":"2022-08-18T13:56:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-12T02:32:25.000Z","updated_at":"2025-12-02T16:34:12.000Z","published_at":"2022-04-12T02:33:10.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\u003eInput some integers, you need to concatenate them to obtain a maximum integer. Neither use library function \\\"perms\\\" to list all possible solution, nor use to switch your data between numbers and strings. Therefore, any function, with substring \\\"perm\\\" or \\\"str\\\" is forbidden. Since possibly you get a super large number, return the string format of the answer.\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\u003eE.g., input [2 4 41 27], \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        you get '441272';\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\u003eand input [ 2 27 272 27272 ]\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     you get '27272722722'\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":54295,"title":"prime consecutive sums","description":"Create a number sequence of 1 to n, such that the sums of every two consecutive numbers are all primes.\r\nE.g. if n = 5, you may write the sequence as 1,4,3,2,5 or  3,4,1,2,5\r\n       if n = 6, you may wrtie the sequence as 2,3,4,1,6,5\r\nThe answer is not unique, so one correct answer enough.","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: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 55.5px; transform-origin: 407px 55.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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCreate a number sequence of 1 to n, such that the sums of every two consecutive numbers are all primes.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: 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=\"\"\u003eE.g. if n = 5, you may write the sequence as 1,4,3,2,5 or  3,4,1,2,5\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=\"\"\u003e       if n = 6, you may wrtie the sequence as 2,3,4,1,6,5\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=\"\"\u003eThe answer is not unique, so one correct answer enough.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = seq1(n)\r\n  y = 1:n;\r\nend","test_suite":"%%\r\nn = 3;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 4;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 5;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 6;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 100;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n%%\r\nn = 2000;\r\ny = seq1(n);\r\nassert(length(y)==n)\r\nassert(all(unique(y)==1:n))\r\nassert(all(isprime( y(1:n-1)+y(2:n) )))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2197980,"edited_by":2197980,"edited_at":"2022-04-17T10:57:03.000Z","deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":"2022-04-17T10:57:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-17T10:16:01.000Z","updated_at":"2024-12-08T19:33:40.000Z","published_at":"2022-04-17T10:16:01.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate a number sequence of 1 to n, such that the sums of every two consecutive numbers are all primes.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eE.g. if n = 5, you may write the sequence as 1,4,3,2,5 or  3,4,1,2,5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e       if n = 6, you may wrtie the sequence as 2,3,4,1,6,5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer is not unique, so one correct answer enough.\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":1914,"title":"GJam 2013 Veterans: Ocean View (Large)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p2 GJam 2013 Veterans Ocean View\u003e. This is the Large data set with N\u003c=1000 and Q\u003cN\u003c=1000, with typical 80.\r\n\r\nThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\r\n\r\n*Succinct Challenge statement:* Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\r\n\r\n*Input:* V , Vector length N\u003c=1000 with values 1 thru 1000.\r\n\r\n*Output:* Q , minimum quantity of removed values to produce a valid vector (typical 80)\r\n\r\n*Examples:* [V] [Q]\r\n\r\n  [1 4 3 3] [2]  for [1 4] or [1 3]\r\n  [1 2 3 4 5] [0]\r\n  [4 3 2 1] [3]\r\n\r\n*Commentary:*\r\n\r\n  1) nchoosek(1000,80) is a little big\r\n  2) The Large test suite is N\u003c=1000 with some delete cases \u003e4\r\n  3) A Good Algorithm that solves the Large case is usually best to pursue\r\n  4) GJam Competition allows one Large submission within 10 minutes of download \r\n  5) This was only solved by one entrant.\r\n\r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/1913-gjam-2013-veterans-ocean-view-small Small Suite Challenge\u003e\r\n\r\n*Algorithm Spoiler:*\r\nA general method is to start at the end and build all unique length valid vectors. It is only necessary to maintain a Min Value and length for the potential solutions. Once all values are checked find the maximum solution length.  There are three key steps in this method: 1) If vin(j)\u003e Max of all solutions, start a new solution with length 1. 2) Find solutions that are 1 greater than vin(j). Update minimums of these solutions with vin(j) and increase length values.  3) Find solutions where mins\u003evin(j). Augment solution set by a single line of [vin(j),max length found +1]. 4) Find maximum length solution.  This method solved all 100 large cases in \u003c 2 seconds on Cody.\r\n","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\"\u003eGJam 2013 Veterans Ocean View\u003c/a\u003e. This is the Large data set with N\u0026lt;=1000 and Q\u0026lt;N\u0026lt;=1000, with typical 80.\u003c/p\u003e\u003cp\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\u003c/p\u003e\u003cp\u003e\u003cb\u003eSuccinct Challenge statement:\u003c/b\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V , Vector length N\u0026lt;=1000 with values 1 thru 1000.\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Q , minimum quantity of removed values to produce a valid vector (typical 80)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [V] [Q]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 4 3 3] [2]  for [1 4] or [1 3]\r\n[1 2 3 4 5] [0]\r\n[4 3 2 1] [3]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) nchoosek(1000,80) is a little big\r\n2) The Large test suite is N\u0026lt;=1000 with some delete cases \u003e4\r\n3) A Good Algorithm that solves the Large case is usually best to pursue\r\n4) GJam Competition allows one Large submission within 10 minutes of download \r\n5) This was only solved by one entrant.\r\n\u003c/pre\u003e\u003cp\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1913-gjam-2013-veterans-ocean-view-small\"\u003eSmall Suite Challenge\u003c/a\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eAlgorithm Spoiler:\u003c/b\u003e\r\nA general method is to start at the end and build all unique length valid vectors. It is only necessary to maintain a Min Value and length for the potential solutions. Once all values are checked find the maximum solution length.  There are three key steps in this method: 1) If vin(j)\u003e Max of all solutions, start a new solution with length 1. 2) Find solutions that are 1 greater than vin(j). Update minimums of these solutions with vin(j) and increase length values.  3) Find solutions where mins\u003evin(j). Augment solution set by a single line of [vin(j),max length found +1]. 4) Find maximum length solution.  This method solved all 100 large cases in \u0026lt; 2 seconds on Cody.\u003c/p\u003e","function_template":"function Q = Monotonic_V(vin)\r\n  Q=0;\r\nend","test_suite":"%%\r\ntic\r\nvin=[636 246 970 933 361 461 584 712 636 765 900 534 318 948 214 664 649 649 218 159 962 712 215 173 238 112 898 670 665 321 652 653 918 621 585 631 433 520 694 68 285 593 954 954 540 167 970 188 167 187 346 480 899 912 652 488 375 550 157 40 222 808 692 492 781 628 122 565 147 167 985 783 759 938 89 651 104 58 838 623 244 536 102 494 799 106 981 526 7 137 917 228 297 608 71 77 587 544 641 85 ];\r\nvexp=[87 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[985 569 223 420 941 721 504 441 137 145 386 238 4 330 967 408 312 508 90 528 598 922 865 273 505 167 830 764 724 854 486 60 422 60 479 715 781 983 507 269 479 892 506 482 573 472 241 884 331 330 412 929 603 628 553 108 795 383 223 870 236 61 929 10 120 759 76 900 93 582 520 571 825 378 405 397 201 645 632 532 327 395 812 929 23 716 36 169 98 259 38 686 671 966 47 790 724 122 42 817 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[135 80 276 388 795 610 328 961 849 699 154 297 970 548 332 87 647 929 231 574 290 843 993 572 407 364 828 688 492 986 8 979 417 636 366 212 597 45 524 445 744 29 93 65 577 424 152 575 705 382 500 994 576 844 566 334 208 745 21 51 731 29 29 499 16 746 710 612 791 585 56 886 614 148 950 542 924 453 116 980 834 615 973 761 810 890 95 17 635 115 68 717 495 448 215 510 194 277 473 336 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[864 390 641 710 429 314 838 487 749 444 866 162 381 48 901 119 756 642 595 851 197 72 856 600 290 187 648 679 619 273 739 834 14 379 895 442 692 733 928 792 528 145 305 908 193 205 378 300 847 973 150 395 396 357 995 685 896 994 716 514 618 454 699 631 832 594 73 875 678 352 666 205 497 970 464 41 526 193 340 724 165 842 471 561 550 465 597 445 810 312 310 427 117 9 57 300 954 481 174 631 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[522 452 169 41 289 988 837 890 666 829 487 3 346 671 544 443 177 411 525 643 380 167 717 566 460 105 253 724 179 487 742 700 290 263 93 578 602 929 467 267 757 306 270 454 976 165 896 153 927 773 147 307 939 864 872 750 320 476 473 498 314 567 550 603 829 994 180 430 922 647 48 30 304 669 483 279 834 730 783 760 854 282 66 144 145 290 893 816 765 366 665 79 932 214 33 112 207 213 541 480 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 18 20 21 22 23 24 25 26 28 30 31 32 33 34 35 37 38 39 40 41 43 44 45 46 47 48 51 53 54 55 56 57 58 59 60 61 62 63 65 66 67 68 69 71 72 73 74 78 79 80 82 83 84 85 87 88 89 90 93 94 95 96 99 100 101 102 103 104 105 106 107 109 110 111 112 113 114 115 116 117 118 119 120 122 123 124 125 126 127 128 129 134 138 140 141 142 143 144 145 146 147 148 149 150 151 152 155 157 158 160 164 165 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 184 185 186 187 189 190 191 192 193 194 195 196 197 198 199 200 202 203 204 205 206 207 208 209 210 212 213 214 215 216 218 220 221 222 223 224 225 226 227 228 229 230 231 233 234 235 236 237 238 242 243 244 246 247 248 249 250 251 252 254 255 256 258 259 261 262 263 265 266 267 268 269 270 271 272 273 274 275 276 277 279 280 281 282 283 284 286 287 288 289 292 294 295 297 298 299 300 302 303 304 306 307 308 309 310 311 312 313 314 315 316 318 321 324 325 327 328 330 331 334 335 336 337 339 340 342 343 344 345 346 348 349 350 351 352 353 354 355 357 358 359 363 364 365 366 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 388 390 391 393 394 395 397 398 399 401 402 403 404 405 406 407 408 409 410 413 415 416 418 419 420 421 422 423 424 425 427 428 430 431 432 433 435 437 438 440 441 442 443 445 446 447 449 451 452 453 455 457 458 459 460 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 504 505 507 508 509 510 511 512 513 514 515 516 517 518 520 521 524 525 527 528 529 530 531 533 536 537 540 541 542 543 544 545 546 547 549 550 551 552 553 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 577 579 580 581 582 584 585 586 587 588 590 591 592 593 595 597 598 599 600 603 604 605 606 607 610 611 615 616 617 619 620 621 622 623 624 625 626 627 628 630 632 633 634 635 638 641 642 643 644 645 646 648 649 651 653 654 655 656 657 658 659 661 663 664 665 666 667 668 669 670 671 672 673 675 677 678 680 682 683 684 685 686 687 688 689 690 691 692 693 694 696 697 698 700 702 704 705 706 709 710 711 712 713 714 715 717 718 719 720 721 722 723 724 725 726 727 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 748 749 750 751 752 753 754 755 756 757 758 759 761 762 764 766 767 768 769 771 772 773 774 776 777 778 779 780 781 782 783 785 786 788 789 790 791 792 793 794 795 796 797 798 800 801 802 803 804 805 806 807 808 809 810 812 813 815 816 817 818 819 820 821 822 823 824 826 827 829 830 831 832 833 837 838 839 840 841 842 843 844 845 846 847 848 849 851 852 853 854 855 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 877 879 881 882 883 884 887 888 890 891 892 893 894 895 896 898 899 900 901 903 904 905 906 908 909 911 912 913 914 915 916 917 918 919 920 921 922 923 924 927 928 929 930 931 932 933 935 936 937 938 941 942 943 944 945 946 949 950 951 952 953 954 955 956 957 958 960 961 962 963 965 966 967 970 971 972 973 974 975 978 979 980 981 982 983 984 985 986 989 991 992 993 994 995 996 997 998 1000 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[656 151 894 432 577 271 474 259 534 441 734 522 365 493 942 532 175 900 688 139 374 59 422 443 326 64 804 69 733 90 372 740 240 265 172 168 536 997 778 421 437 511 942 801 4 236 685 530 487 372 21 860 430 442 302 107 857 458 175 941 899 899 32 138 163 555 657 50 551 435 471 987 945 764 140 300 351 176 182 837 547 202 48 329 995 350 435 203 159 962 495 57 860 526 546 374 81 202 424 631 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[160 284 529 233 858 58 181 837 14 284 240 425 835 57 402 496 430 135 982 713 622 716 909 963 253 31 790 307 273 291 321 432 574 201 16 431 259 196 620 624 479 211 49 666 268 450 161 49 936 494 762 558 561 22 520 814 404 662 120 676 952 792 459 877 993 474 308 603 670 279 578 500 489 978 517 108 427 30 157 363 523 270 272 84 643 791 249 47 804 720 74 107 863 533 984 207 6 643 809 27 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[717 997 953 616 739 418 429 967 875 551 327 828 991 994 841 796 268 640 537 215 847 996 558 831 282 117 696 696 386 518 188 103 867 140 70 957 557 498 923 783 400 601 962 391 595 803 538 214 794 74 428 640 70 337 823 351 454 518 398 191 388 585 293 254 724 715 562 280 564 484 414 964 436 376 706 30 530 243 595 323 668 375 314 89 711 136 792 516 6 189 707 745 774 351 350 497 65 911 129 629 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[339 92 136 280 51 932 913 389 388 240 645 424 760 147 8 880 39 875 953 822 525 377 243 505 978 181 421 497 443 665 862 133 108 998 412 158 281 677 898 668 916 543 91 675 689 451 906 79 677 210 901 201 587 495 705 564 27 477 60 469 493 274 601 600 623 365 110 903 41 7 922 956 901 364 982 941 166 888 20 842 97 272 43 35 766 99 598 792 576 10 613 420 283 565 20 905 929 129 159 969 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[3 4 6 7 10 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[902 371 99 852 750 675 90 760 805 58 948 19 245 440 484 372 354 920 794 849 927 838 454 61 432 979 709 266 797 673 155 698 395 253 902 144 927 991 256 731 400 203 101 996 642 936 719 348 856 512 196 134 701 649 194 484 628 255 102 424 927 256 122 673 508 375 169 434 365 424 517 765 978 969 112 971 905 831 318 112 694 514 245 395 162 791 878 789 45 331 565 323 586 38 347 93 412 515 879 776 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[745 222 207 664 944 756 340 17 820 810 426 512 977 342 97 68 374 759 193 308 24 106 963 317 227 746 262 260 405 645 380 149 866 938 164 162 694 504 178 865 313 955 376 641 297 824 60 22 583 252 330 958 358 644 274 936 389 535 195 145 179 575 646 397 512 809 558 557 312 87 422 977 393 149 617 41 973 677 63 907 280 744 864 989 387 489 924 127 23 119 623 554 45 268 302 556 77 859 465 740 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[483 135 335 407 908 857 578 767 378 156 248 269 292 372 111 5 821 150 426 334 446 615 791 5 517 928 677 194 68 908 122 550 42 808 309 302 664 886 420 41 41 668 309 684 39 771 688 212 921 465 545 366 79 687 722 595 614 398 140 33 657 261 583 698 420 891 999 84 128 771 476 520 438 137 203 828 907 242 391 179 706 287 544 784 973 617 730 939 14 869 971 670 481 905 720 900 147 70 335 274 ];\r\nvexp=[80 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[449 699 779 845 562 962 785 857 407 939 248 891 282 197 497 444 329 886 476 573 390 526 492 686 583 679 622 471 498 176 415 946 875 545 143 788 506 927 644 264 218 244 155 851 440 651 646 768 888 121 693 277 998 184 314 580 214 935 50 63 110 816 9 336 712 503 123 217 429 119 481 646 362 987 848 153 989 493 272 876 613 964 504 962 499 817 893 64 751 294 127 860 461 487 196 172 989 670 389 769 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[506 358 525 125 131 493 597 657 174 465 212 984 660 340 197 879 464 893 546 146 446 858 66 893 292 295 771 364 324 233 803 830 591 327 306 73 819 254 81 345 70 644 328 729 984 524 960 447 768 505 944 566 362 10 458 653 304 228 369 628 812 523 809 754 849 466 827 20 719 259 716 789 903 43 869 238 919 828 36 38 685 980 603 46 989 60 51 292 639 771 271 803 293 431 556 141 896 382 512 967 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 201 457 409 579 138 659 919 860 512 119 881 554 984 460 612 370 104 453 607 792 323 877 982 906 932 419 986 615 397 771 618 950 580 378 528 69 37 446 280 900 917 160 806 900 972 417 269 75 222 227 219 896 455 200 801 386 618 138 1000 367 909 970 316 840 699 195 908 87 992 187 987 908 699 792 807 670 560 428 744 133 654 314 29 461 514 829 846 483 967 198 201 227 519 516 418 217 62 325 656 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[536 287 975 835 202 487 189 178 104 222 6 933 565 70 493 646 121 949 836 462 586 175 876 615 42 687 243 401 489 327 78 24 613 404 858 166 890 398 344 345 620 701 629 536 770 121 533 242 421 368 703 7 894 930 973 935 968 215 688 457 893 117 480 857 872 690 23 113 87 718 458 58 770 86 945 891 559 477 132 979 196 186 337 90 467 309 376 434 875 415 890 767 531 722 624 402 763 998 867 849 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[833 191 187 681 160 2 73 38 194 412 113 711 605 583 623 155 399 219 599 208 883 909 986 999 269 395 299 222 875 824 204 59 15 390 91 526 743 163 563 936 927 676 646 531 610 268 37 9 839 636 568 721 896 554 71 516 948 369 89 174 193 292 585 559 33 675 84 775 838 647 62 764 674 708 646 283 327 683 643 517 670 211 237 917 764 660 784 63 28 872 236 572 515 820 130 899 495 214 673 684 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 3 2 1 ];\r\nvexp=[3 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[544 765 207 299 570 502 839 142 76 830 438 777 696 718 720 628 215 31 72 544 666 606 940 218 865 169 973 254 550 831 129 446 948 335 744 517 188 582 10 616 764 447 392 459 164 464 438 731 846 509 626 511 114 565 80 331 85 52 584 634 235 64 79 534 750 174 50 937 108 411 552 871 858 296 681 373 759 119 455 956 979 432 466 93 348 898 775 432 301 358 66 887 421 496 420 522 22 821 458 129 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[785 582 933 107 851 569 822 33 992 796 966 99 985 62 5 70 257 409 548 674 546 105 824 71 10 447 326 723 819 799 22 955 380 306 62 582 874 883 966 217 30 931 316 15 993 320 84 601 728 983 626 273 87 801 695 96 247 373 819 65 171 192 372 902 497 433 835 723 667 800 939 697 83 606 63 427 925 498 27 4 480 653 629 919 453 323 366 52 695 536 116 217 727 839 118 576 623 304 650 290 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[379 605 855 323 94 992 160 884 141 954 836 48 258 937 651 919 261 967 418 311 554 590 622 688 538 87 844 682 520 888 740 250 845 594 925 938 586 436 822 78 390 9 477 647 297 128 918 557 94 335 220 1000 276 193 687 165 279 882 846 151 122 585 752 966 531 676 255 468 112 76 545 501 436 21 147 733 500 416 641 594 750 860 945 377 52 983 542 331 865 739 833 986 676 584 303 206 260 557 673 371 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[954 932 241 707 209 356 476 772 941 695 374 528 156 421 13 187 443 842 884 139 129 463 369 117 721 356 808 952 976 529 501 929 812 93 987 20 449 814 143 741 508 516 620 16 936 985 202 730 826 85 868 954 548 589 422 620 296 230 923 271 110 423 551 922 516 889 941 316 703 84 408 210 951 27 577 239 11 778 968 836 215 188 141 114 776 915 85 71 144 8 693 253 782 595 526 649 483 467 964 537 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ];\r\nvexp=[999 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[861 880 573 826 28 522 719 303 975 834 282 160 800 606 921 962 496 15 978 482 481 397 198 328 845 412 189 390 688 662 77 901 541 649 78 920 522 797 222 848 982 855 8 134 461 280 95 956 294 424 437 126 821 986 453 17 397 642 758 437 303 186 689 195 186 766 115 707 914 688 907 248 895 914 381 355 193 827 662 838 250 450 315 422 435 768 438 183 761 547 971 415 732 659 609 269 777 75 328 690 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[212 86 799 237 145 796 871 824 830 514 340 499 724 577 767 487 236 550 901 615 773 136 539 639 308 20 537 802 585 561 837 148 647 987 384 143 782 607 966 612 120 306 462 843 234 229 681 821 130 581 435 255 68 325 893 375 697 782 528 281 342 364 429 340 350 164 483 484 770 448 95 241 753 556 435 338 136 467 158 266 399 945 872 467 269 764 841 965 897 721 598 239 436 378 930 138 541 412 621 663 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[153 433 497 818 590 42 657 625 619 100 678 271 684 627 284 600 980 569 862 178 530 692 225 1 239 891 474 710 719 529 477 872 313 973 689 255 15 697 879 633 148 909 255 831 535 890 430 866 459 644 44 340 335 620 340 925 510 165 986 229 694 462 100 358 434 140 612 800 836 843 784 984 751 391 166 637 280 948 855 90 943 250 429 629 869 768 905 379 285 890 959 330 351 410 687 136 549 299 288 736 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[422 107 359 466 750 64 127 249 677 702 213 920 568 385 70 37 787 149 971 26 915 76 17 851 728 43 738 163 767 379 341 540 838 51 357 939 466 483 188 143 184 752 62 751 137 484 139 275 632 462 300 898 537 316 749 265 359 838 779 477 569 471 368 758 521 724 696 987 558 883 481 741 987 542 843 123 25 334 749 9 147 48 906 683 715 6 299 73 196 78 901 764 900 268 521 421 343 216 759 900 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[830 800 491 470 290 893 711 316 603 32 241 822 608 314 513 533 514 537 19 447 670 582 20 35 543 428 35 411 413 882 8 594 33 498 63 674 743 125 990 697 156 230 870 764 895 735 648 408 271 19 207 292 952 578 326 846 5 712 257 769 945 264 362 329 114 776 3 856 900 344 904 407 925 774 522 819 508 170 579 130 540 785 773 843 714 450 688 70 161 944 838 458 560 551 786 673 678 788 880 929 ];\r\nvexp=[79 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[43 360 9 945 127 32 574 617 273 710 476 930 679 187 746 569 725 493 693 539 527 933 487 508 562 719 739 403 813 707 484 855 67 493 151 545 876 725 162 500 434 989 429 112 176 526 32 252 19 77 790 545 9 629 404 922 699 143 676 864 849 511 70 267 3 221 164 230 297 325 730 730 313 158 194 840 684 577 443 54 653 585 598 13 565 353 934 263 847 609 478 48 120 548 314 474 120 477 704 416 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[290 747 892 267 715 356 238 619 186 555 82 879 420 327 625 582 469 855 722 865 185 638 187 771 675 533 215 86 400 93 214 689 839 457 956 906 812 545 876 349 451 958 580 871 284 204 804 104 410 877 968 947 515 506 69 189 38 283 627 789 728 840 478 918 296 785 823 460 329 699 808 779 656 739 649 291 943 804 394 704 681 713 650 195 218 718 383 607 353 9 396 80 200 225 997 848 9 820 307 337 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[226 923 398 567 407 187 615 980 2 14 380 144 628 177 231 799 501 612 159 124 261 636 742 374 458 143 404 885 207 225 671 784 147 420 703 905 958 669 236 312 682 615 455 309 144 37 460 996 648 618 119 909 605 212 282 414 354 37 651 561 261 321 696 759 93 398 663 50 419 251 361 100 865 167 761 8 203 220 3 851 837 473 111 793 685 392 206 38 781 856 950 393 529 998 152 973 747 166 22 165 ];\r\nvexp=[80 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[456 940 338 538 898 400 964 822 249 990 178 80 994 806 998 799 480 364 850 175 899 317 743 978 156 861 905 778 516 906 419 971 845 108 508 742 859 823 916 107 165 445 187 158 250 184 956 81 899 157 255 150 474 998 127 981 210 383 110 77 288 529 48 484 988 907 578 847 730 845 953 894 289 139 403 890 675 711 970 573 867 577 722 692 926 200 672 135 934 134 563 221 14 610 57 1 517 986 847 598 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[416 735 265 633 901 377 640 456 596 995 306 784 819 768 576 855 159 133 245 939 341 546 332 221 543 835 193 290 1000 566 806 416 300 70 48 201 446 39 656 393 385 313 176 204 80 103 410 590 236 654 881 928 200 564 148 94 398 340 735 749 905 541 164 557 962 563 109 408 954 116 152 338 780 328 893 859 782 303 800 369 956 680 296 507 595 443 953 992 134 687 741 391 227 256 947 189 171 407 948 124 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[28 33 63 78 82 85 92 101 113 125 138 175 183 196 211 224 250 287 345 368 388 426 447 477 491 504 524 575 579 581 621 694 712 720 737 745 747 784 793 802 813 827 829 853 858 919 924 929 939 960 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[751 767 289 186 348 753 835 126 830 440 200 582 596 824 917 356 380 767 870 274 279 308 426 749 518 607 719 233 246 57 756 348 823 396 885 170 500 719 647 329 158 198 263 753 21 179 461 752 297 682 26 927 989 803 28 858 762 746 442 7 154 197 706 977 593 590 498 92 308 497 773 818 46 35 922 419 565 734 170 861 416 547 140 404 702 167 262 463 264 703 821 417 252 526 745 196 115 595 287 774 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 2 4 3 5 6 8 7 10 9 11 12 14 13 15 16 17 19 18 20 21 22 24 23 25 26 28 27 30 29 31 32 33 34 36 35 37 38 40 39 41 43 42 44 45 46 48 47 50 49 51 52 53 55 54 56 57 58 60 59 61 63 62 64 65 66 68 67 69 71 70 72 73 74 76 75 78 77 79 80 82 81 83 84 85 87 86 88 89 91 90 92 93 94 96 95 98 97 99 100 101 102 104 103 106 105 107 108 110 109 111 112 114 113 115 116 118 117 119 120 121 123 122 124 125 127 126 128 130 129 131 132 134 133 135 136 137 139 138 140 141 142 144 143 145 146 148 147 149 151 150 152 154 153 155 156 157 158 160 159 162 161 163 164 165 166 168 167 169 170 172 171 173 174 176 175 178 177 179 180 181 182 184 183 186 185 187 188 190 189 191 192 194 193 195 196 198 197 199 200 201 203 202 204 206 205 207 208 209 210 212 211 214 213 215 216 217 219 218 220 221 222 224 223 226 225 227 228 229 230 232 231 233 235 234 236 237 239 238 240 242 241 243 244 246 245 247 248 250 249 251 252 254 253 255 256 257 259 258 260 261 263 262 264 265 266 268 267 269 270 272 271 274 273 275 276 278 277 279 280 281 283 282 284 285 287 286 288 290 289 291 292 293 295 294 296 298 297 299 300 301 303 302 304 305 307 306 308 309 310 312 311 313 315 314 316 317 318 320 319 321 322 324 323 326 325 327 328 330 329 331 332 334 333 335 336 337 339 338 340 341 342 344 343 346 345 347 348 349 350 352 351 353 354 356 355 357 359 358 360 362 361 363 364 365 366 368 367 370 369 371 372 373 375 374 376 377 378 380 379 381 383 382 384 386 385 387 388 390 389 391 392 393 395 394 396 397 399 398 400 401 403 402 404 406 405 407 408 409 410 412 411 413 415 414 416 417 418 420 419 421 423 422 424 426 425 427 428 430 429 431 432 433 435 434 436 437 439 438 440 442 441 443 444 445 447 446 448 450 449 451 452 453 455 454 456 457 459 458 460 461 462 464 463 465 467 466 468 469 470 472 471 473 475 474 476 478 477 479 480 481 483 482 484 486 485 487 488 490 489 491 492 493 495 494 496 497 499 498 500 501 502 504 503 505 507 506 508 509 511 510 512 514 513 515 516 517 518 520 519 522 521 523 524 525 527 526 528 530 529 531 532 533 535 534 536 538 537 539 540 542 541 543 544 545 546 548 547 550 549 551 552 553 555 554 556 557 559 558 560 562 561 563 564 565 566 568 567 569 570 572 571 574 573 575 576 578 577 579 580 581 583 582 584 585 586 588 587 589 590 592 591 593 595 594 596 597 599 598 600 601 602 604 603 605 606 608 607 609 611 610 612 614 613 615 616 617 618 620 619 622 621 623 624 626 625 627 628 629 631 630 632 633 634 636 635 638 637 639 640 641 643 642 644 646 645 647 648 650 649 651 652 653 654 656 655 657 659 658 660 662 661 663 664 666 665 667 668 669 671 670 672 673 675 674 676 677 679 678 680 682 681 683 684 685 686 688 687 689 691 690 692 693 694 696 695 697 698 700 699 701 702 704 703 705 707 706 708 709 710 712 711 713 714 716 715 717 718 720 719 722 721 723 724 725 726 728 727 730 729 731 732 734 733 735 736 738 737 739 740 741 742 744 743 746 745 747 748 749 751 750 752 753 755 754 756 758 757 759 760 761 763 762 764 765 766 768 767 769 771 770 772 773 775 774 776 777 778 780 779 782 781 783 784 785 786 788 787 789 790 792 791 793 794 796 795 797 799 798 800 801 802 804 803 805 806 808 807 810 809 811 812 814 813 815 816 817 818 820 819 822 821 823 824 826 825 827 828 829 831 830 832 834 833 835 836 837 838 840 839 841 843 842 844 846 845 847 848 849 850 852 851 853 854 856 855 857 859 858 860 861 862 864 863 865 866 868 867 869 870 872 871 873 875 874 876 878 877 879 880 882 881 883 884 885 886 888 887 889 890 892 891 893 895 894 896 897 898 900 899 902 901 903 904 905 906 908 907 909 910 912 911 914 913 915 916 917 918 920 919 921 923 922 924 925 926 928 927 929 930 932 931 933 935 934 936 938 937 939 940 941 942 944 943 945 946 948 947 949 951 950 952 954 953 955 956 957 958 960 959 962 961 963 964 965 967 966 968 970 969 971 972 974 973 975 976 977 979 978 980 981 982 984 983 986 985 987 988 990 989 991 992 993 995 994 996 997 999 998 1000 ];\r\nvexp=[250 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[19 19 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 4 3 3 ];\r\nvexp=[2 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[815 768 572 413 61 287 382 520 43 814 125 344 903 447 878 702 868 762 461 590 511 448 907 997 74 333 918 953 644 230 54 810 349 625 222 409 264 955 280 306 120 756 1 22 203 878 76 422 991 536 12 853 983 918 850 57 603 767 361 598 348 766 408 696 743 981 104 6 936 383 663 55 138 15 429 692 244 504 114 234 39 477 87 21 394 288 429 996 406 141 594 753 907 1 448 649 333 903 6 268 ];\r\nvexp=[87 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[715 324 259 836 409 555 726 967 384 857 298 931 42 986 20 508 647 748 941 873 162 183 992 45 256 967 798 18 964 664 218 30 987 828 865 748 383 590 66 118 446 715 48 839 701 420 346 347 519 638 571 680 172 562 76 779 528 874 796 843 537 366 872 876 193 88 623 927 677 40 44 474 755 444 312 455 863 9 153 381 999 723 412 522 637 488 301 164 361 96 7 249 461 230 124 6 318 98 932 346 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[522 99 461 301 778 354 511 560 8 662 280 315 694 576 174 288 370 126 632 856 812 724 246 391 979 544 931 501 950 230 624 823 328 437 475 458 142 985 369 149 646 648 463 339 223 988 979 945 113 610 800 277 333 45 19 663 940 949 164 241 178 787 63 857 223 537 666 716 873 34 864 870 682 679 209 256 666 187 200 131 148 351 407 480 395 425 142 686 725 305 926 254 444 340 110 18 876 776 734 100 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[986 869 904 402 636 104 209 757 705 337 301 740 169 404 572 415 22 827 117 133 872 263 503 640 737 654 616 432 752 268 954 737 136 858 138 772 313 698 528 18 386 180 109 906 583 32 320 956 859 436 88 82 50 591 73 138 596 41 570 347 308 523 83 443 380 572 566 45 621 445 62 6 625 522 911 559 554 230 515 764 18 954 197 67 896 269 205 491 661 774 837 968 648 271 763 28 194 328 424 814 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[835 78 7 863 573 841 832 653 720 351 56 298 397 179 562 636 299 542 569 853 327 320 54 147 328 355 444 206 343 100 546 529 529 904 392 102 96 575 106 816 926 514 465 674 692 27 309 990 568 229 195 246 900 248 392 579 954 187 785 648 638 330 177 519 233 920 972 329 494 77 496 771 590 960 796 634 986 105 975 905 685 521 150 585 768 893 515 74 432 299 73 421 980 601 939 565 520 910 245 14 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[626 750 682 840 23 620 651 542 846 79 714 942 624 759 272 636 101 647 505 954 823 212 398 949 431 870 68 568 133 370 720 758 471 753 949 845 725 952 387 570 382 452 864 6 210 135 641 662 133 145 615 307 708 365 255 138 586 675 706 718 396 777 828 866 882 776 710 606 727 448 527 461 900 390 466 461 877 458 123 361 954 89 668 662 805 922 799 390 948 856 108 343 985 287 208 866 62 270 471 141 ];\r\nvexp=[79 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[235 228 987 190 889 791 317 684 110 217 895 566 657 188 402 731 514 485 602 606 767 410 328 583 701 500 772 884 333 161 654 919 740 993 461 629 135 129 312 244 346 206 161 2 394 562 84 259 399 685 865 165 447 544 99 499 395 870 382 79 382 388 997 122 732 457 750 866 938 413 109 283 971 270 636 716 183 72 974 581 108 190 97 554 733 196 405 479 417 786 557 799 525 554 272 256 362 373 121 299 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[993 227 107 247 622 327 484 892 155 519 281 839 498 884 236 838 295 638 482 286 408 752 88 700 535 643 193 782 377 56 748 721 635 206 967 608 533 802 499 39 320 779 229 170 14 464 7 661 454 840 946 213 592 385 265 478 27 457 259 755 864 7 475 498 564 793 105 96 594 955 134 266 86 362 787 99 178 145 759 983 985 56 195 928 440 459 405 819 267 663 573 131 21 400 980 585 544 437 32 138 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[637 668 675 126 34 103 818 277 606 283 510 996 759 948 368 504 587 149 500 992 289 445 744 547 797 543 195 129 445 552 749 81 571 423 207 604 877 376 880 834 10 742 829 120 41 196 975 628 696 474 619 985 270 715 883 66 257 430 547 702 981 647 134 552 69 692 155 945 419 35 130 780 776 958 251 816 505 226 795 201 699 766 537 321 480 419 738 736 848 636 789 829 282 275 732 350 318 886 646 737 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[520 971 78 333 535 918 930 357 193 69 399 244 246 841 552 833 468 478 785 476 173 296 215 260 277 366 692 711 363 448 381 235 418 459 919 304 728 848 660 272 916 410 868 513 602 419 346 70 249 482 545 421 130 111 681 758 828 724 468 190 171 201 776 940 659 694 244 738 893 255 361 161 17 228 673 618 999 18 687 247 852 583 667 981 693 699 738 520 423 557 710 945 757 837 237 767 531 832 856 775 ];\r\nvexp=[78 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[161 949 970 194 627 530 802 645 68 353 775 215 704 181 694 450 957 187 136 33 844 61 286 287 753 747 656 628 874 389 80 35 690 49 228 316 578 381 312 645 734 86 211 437 618 904 886 574 442 21 606 285 434 243 923 186 990 579 165 863 319 244 897 8 644 477 676 221 857 987 217 590 425 427 378 42 682 264 968 124 636 573 760 421 168 683 958 157 613 123 19 283 718 268 643 362 744 670 934 952 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[921 739 879 409 716 747 869 495 776 25 857 651 646 480 86 288 622 686 334 426 757 408 532 619 292 515 826 649 157 986 28 429 724 906 838 440 4 706 934 132 82 142 782 727 973 219 366 594 256 700 19 12 459 903 982 750 769 807 398 278 145 425 706 868 682 543 659 686 600 944 817 33 437 950 759 409 520 477 355 775 176 725 786 634 627 767 735 396 926 132 673 70 909 378 289 590 273 300 275 224 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[211 588 861 514 609 695 144 442 425 927 553 630 208 971 774 704 612 666 871 376 31 535 806 314 101 839 425 659 403 965 139 613 905 999 126 513 694 269 306 470 547 210 99 106 180 872 161 791 890 31 519 272 566 676 586 666 866 10 324 268 327 814 880 583 165 5 95 858 626 752 679 172 961 777 630 141 1 790 283 242 821 801 513 738 829 98 403 694 460 78 962 786 244 841 368 408 198 814 617 175 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[345 356 192 379 626 146 339 157 374 419 580 561 192 746 68 231 668 760 231 149 516 13 702 426 515 688 214 702 980 729 501 324 436 692 55 414 189 745 922 914 515 501 827 58 246 894 288 265 654 519 766 521 883 819 298 397 507 512 98 838 240 951 513 28 642 919 441 183 663 362 448 530 215 274 587 812 168 227 77 173 745 194 693 979 12 991 375 518 854 825 355 93 775 220 472 768 138 912 302 153 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[55 561 739 879 938 143 627 491 788 610 374 114 357 185 42 379 252 430 547 702 40 936 387 710 253 785 499 328 258 892 496 312 453 235 542 742 377 520 232 516 129 605 981 485 141 375 215 745 804 113 446 195 48 184 904 652 968 754 980 225 646 475 888 450 709 429 191 438 300 775 953 428 731 934 265 224 308 831 968 463 944 413 657 343 596 912 995 563 665 326 139 662 152 26 111 213 806 654 650 105 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[115 234 289 9 499 669 715 43 847 376 880 97 177 546 518 963 313 308 145 425 206 468 839 290 126 800 558 254 874 885 296 988 470 584 348 968 605 62 10 451 789 241 547 317 787 417 279 451 76 776 876 281 243 714 570 368 513 480 622 739 364 917 78 186 852 426 153 456 839 163 907 980 403 453 296 189 221 575 992 296 350 867 929 592 580 498 311 445 329 284 183 45 552 260 230 404 37 382 859 876 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[377 312 592 156 382 321 20 986 965 831 995 59 736 919 383 679 650 258 427 674 392 926 663 374 319 161 553 406 353 268 485 729 931 428 237 664 100 256 649 64 439 995 474 526 266 857 204 915 114 631 940 857 908 955 230 578 115 134 335 819 753 172 548 35 951 784 698 403 391 698 818 181 693 292 706 310 500 262 576 613 892 515 821 151 469 402 80 935 888 414 754 992 937 301 27 888 436 724 290 178 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[4 5 6 1 7 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[702 390 16 146 565 919 452 746 471 596 64 700 367 25 892 634 431 175 691 493 279 938 37 406 397 833 103 910 422 299 743 475 41 759 621 605 677 424 702 499 371 117 550 737 141 442 370 923 968 412 415 246 349 804 3 97 636 105 6 409 755 749 236 795 859 208 751 535 631 804 386 1 921 935 89 413 376 458 336 695 222 102 940 570 905 294 667 540 398 24 301 505 124 536 651 982 743 402 517 373 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[294 606 149 273 390 992 232 883 106 284 406 537 904 323 960 281 898 282 973 120 668 189 94 950 572 109 382 247 197 864 338 490 470 838 762 859 829 345 93 287 629 850 823 884 173 783 165 422 416 489 541 84 677 634 33 600 94 415 847 290 630 184 779 99 373 892 310 201 589 754 487 217 604 662 452 128 444 968 549 859 456 89 294 485 74 327 84 520 93 930 809 722 465 940 173 837 183 482 390 771 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[138 328 820 892 771 483 698 985 844 850 717 842 924 128 363 560 967 15 76 679 111 434 928 923 663 51 280 980 149 564 326 286 891 497 177 13 331 874 349 174 75 65 367 350 544 82 262 863 96 689 541 558 122 468 833 784 519 112 116 19 675 441 304 917 289 832 281 619 57 629 145 483 45 863 184 941 944 445 803 392 133 343 949 254 811 781 390 681 893 505 51 919 297 706 188 585 889 468 555 945 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 17 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[976 853 243 180 658 979 923 226 893 655 966 40 37 892 748 564 93 396 415 245 255 203 54 735 935 446 55 146 523 568 947 850 420 541 29 429 519 304 655 411 310 972 450 347 863 550 262 956 945 676 200 199 231 605 933 165 50 339 662 924 906 608 773 678 500 154 106 18 457 112 428 766 436 230 464 298 779 726 605 723 753 805 273 983 761 557 499 163 895 512 86 153 471 211 830 970 364 287 987 172 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 988 ];\r\nvexp=[999 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[493 423 719 243 813 237 231 93 184 85 534 478 686 963 106 555 82 362 285 366 251 243 695 953 652 382 440 552 32 79 287 524 502 6 118 314 594 348 758 777 785 292 606 470 254 711 376 335 424 660 53 674 254 747 978 257 480 417 808 511 848 95 34 349 452 503 662 45 851 772 173 987 63 778 808 668 840 184 2 263 195 406 288 449 153 265 705 632 33 513 495 880 959 880 228 410 383 242 454 585 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[297 238 716 689 386 333 730 710 361 144 616 992 887 831 981 625 319 904 103 694 374 725 599 418 345 900 326 421 110 790 160 406 27 876 446 764 560 527 474 272 22 441 263 260 624 243 236 942 499 338 987 872 415 937 290 759 836 967 531 297 756 690 54 134 917 500 897 828 378 722 99 400 163 714 659 786 308 895 79 158 584 418 30 350 354 671 108 542 637 990 838 744 32 892 877 948 743 125 128 120 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[961 238 790 232 341 217 876 109 914 771 275 778 761 924 820 756 37 283 58 200 170 971 229 962 481 406 83 173 107 819 779 419 409 921 651 749 137 878 857 403 648 483 180 760 406 351 515 794 986 924 345 155 246 925 469 726 331 551 251 789 369 29 208 777 301 210 877 438 87 85 840 87 568 371 198 325 73 65 471 58 340 167 565 586 92 33 663 774 583 913 562 303 294 121 432 594 682 660 383 121 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[17 13 ];\r\nvexp=[1 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[847 578 871 9 291 882 146 951 776 224 108 711 993 489 61 347 511 520 240 147 510 77 242 541 320 470 840 62 595 967 534 441 545 404 801 187 285 946 137 412 521 597 123 866 85 535 564 596 54 803 94 915 879 336 455 199 157 295 612 751 613 145 543 157 549 343 696 185 640 184 597 513 780 71 730 865 605 293 460 658 95 905 573 973 592 379 523 749 25 135 499 638 631 394 146 179 88 193 716 80 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1000 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 ];\r\nvexp=[0 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[595 443 257 384 392 367 144 911 843 498 37 18 223 174 3 201 293 89 596 570 221 620 639 129 350 279 70 622 930 697 197 877 139 453 260 883 820 403 145 14 253 182 384 827 355 386 27 999 827 975 568 47 594 558 527 295 837 948 268 118 644 465 994 783 917 605 665 88 360 809 102 612 342 485 438 49 222 816 47 48 790 615 446 736 172 324 30 360 272 298 478 267 114 471 49 30 428 65 470 787 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[780 954 884 510 239 148 85 898 331 52 360 274 464 368 968 411 279 314 325 296 991 463 957 143 840 420 355 645 73 4 749 852 309 985 713 548 132 798 445 814 849 157 439 665 524 407 427 155 72 752 450 63 566 406 205 758 825 911 402 249 914 503 452 222 487 165 121 970 314 918 784 514 74 222 178 597 980 957 103 404 60 552 466 977 310 22 734 486 932 488 735 197 990 186 770 828 702 243 149 15 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[13 978 571 427 755 378 94 946 913 447 208 108 853 495 908 5 111 964 988 143 828 482 23 786 362 602 195 96 195 1000 680 559 329 250 985 83 979 430 28 892 877 587 999 729 433 258 85 543 221 424 38 49 258 412 834 971 13 381 66 560 732 745 118 61 994 455 495 972 884 875 215 760 461 565 840 246 822 924 788 43 700 177 91 957 588 276 927 953 8 344 512 740 88 629 152 433 435 646 756 319 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[451 239 992 437 132 835 911 157 520 659 517 666 58 774 700 772 780 999 197 975 428 97 90 327 717 962 99 59 529 857 959 979 447 950 767 579 136 29 87 7 687 603 672 96 376 372 868 507 722 64 833 149 512 922 827 228 883 926 639 412 134 597 742 933 898 861 511 386 889 949 744 928 903 416 23 278 139 242 137 860 305 969 360 817 891 538 396 125 463 34 888 949 982 630 881 880 842 743 617 730 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[54 863 642 961 561 785 120 582 696 547 678 829 552 991 857 12 856 37 210 339 355 407 539 933 277 407 350 845 820 26 500 873 241 493 834 153 629 305 735 325 851 412 505 402 754 713 414 610 749 975 948 456 381 838 740 9 596 442 853 416 467 705 640 59 197 825 212 826 129 298 502 979 61 6 733 814 718 498 423 818 472 722 625 204 912 365 212 507 806 416 274 624 120 914 683 669 90 246 846 219 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[557 254 725 829 188 813 242 916 622 929 610 843 30 902 765 935 195 783 826 945 806 126 449 282 661 99 263 755 852 131 479 761 384 203 589 924 367 182 191 989 110 800 183 140 53 947 74 600 81 899 544 239 377 344 520 37 442 782 792 646 913 622 406 648 825 994 571 191 176 761 531 637 913 714 776 965 12 201 916 93 452 459 331 828 802 850 864 596 983 7 241 895 629 998 543 805 991 465 347 518 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[382 165 739 167 38 451 342 38 166 455 245 754 118 285 706 466 81 767 408 279 675 398 220 142 598 521 210 991 413 174 676 794 690 767 312 79 217 653 116 382 459 360 487 928 997 193 745 429 311 505 59 985 254 279 478 852 799 687 842 563 212 869 708 901 635 19 980 851 24 447 584 834 159 71 762 155 263 858 935 925 362 994 909 616 272 386 819 422 424 660 984 636 880 691 888 515 61 219 717 84 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[91 411 591 488 445 865 258 361 598 428 574 13 326 713 417 379 879 30 193 142 84 13 910 335 890 655 530 356 249 169 130 691 579 72 530 376 288 788 736 886 567 309 250 892 373 666 623 251 47 815 744 131 180 654 817 69 660 347 425 908 867 906 950 797 977 479 524 617 266 260 502 832 920 751 76 293 769 698 895 815 864 639 297 43 644 114 112 303 812 536 562 30 793 511 826 121 341 350 737 607 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[773 485 819 749 358 729 307 911 311 821 26 680 127 222 98 22 843 654 513 503 779 701 823 427 972 585 806 165 264 229 331 36 65 149 136 422 230 443 685 892 615 710 571 741 284 668 763 126 322 627 980 100 327 802 878 650 738 683 167 2 911 497 389 327 645 525 749 226 967 433 117 581 494 687 674 129 707 436 606 380 62 586 831 740 387 709 390 477 743 556 478 6 52 866 332 48 390 80 274 708 ];\r\nvexp=[84 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[840 811 793 629 947 995 457 205 236 199 384 941 486 279 76 810 896 157 100 909 377 71 931 209 327 2 461 474 71 795 747 911 957 892 539 903 886 347 108 474 898 491 766 383 769 842 192 16 350 292 925 727 714 207 935 40 560 395 865 630 542 612 892 498 503 783 753 740 481 860 213 378 702 979 112 822 172 304 838 521 947 114 599 12 672 886 403 231 280 268 212 173 879 456 671 733 238 423 824 70 ];\r\nvexp=[86 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[666 301 270 824 723 31 330 985 240 264 909 602 257 169 217 880 554 35 653 329 46 988 964 925 30 204 791 91 422 508 526 439 808 795 262 530 177 943 866 417 207 126 370 815 294 586 695 199 972 347 527 369 687 843 645 716 46 436 806 467 295 684 906 102 478 519 983 7 462 200 775 668 677 144 834 970 81 528 168 404 227 46 772 913 888 768 628 933 555 786 752 849 469 657 302 298 527 636 304 988 ];\r\nvexp=[81 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[140 221 767 853 559 614 357 547 107 629 774 71 944 277 33 795 93 277 858 843 571 984 702 31 470 249 203 458 919 943 227 410 515 345 263 73 958 619 971 64 599 744 135 895 20 519 689 464 795 546 306 365 882 359 748 351 960 302 161 230 596 739 639 110 83 901 534 392 872 504 456 470 599 942 716 618 460 404 433 606 302 738 971 183 448 70 885 407 371 397 636 318 487 627 427 569 879 960 313 750 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[895 347 549 955 352 281 120 421 130 543 238 601 616 863 156 527 579 719 386 384 135 11 359 606 276 393 626 366 638 471 584 884 817 484 190 168 765 310 940 246 204 178 847 819 392 354 698 970 73 435 705 559 797 63 516 73 456 142 790 445 612 725 329 429 208 518 948 972 827 888 570 382 417 768 201 808 121 250 129 193 36 833 103 832 895 619 904 350 760 45 147 371 769 475 799 977 344 747 300 523 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[212 715 903 316 622 690 654 758 156 811 375 555 755 246 21 376 361 213 692 258 285 289 496 721 666 777 858 559 189 830 573 752 896 827 67 517 516 720 274 672 883 648 578 637 893 950 364 254 514 56 511 799 696 358 871 714 134 80 272 674 909 196 425 804 22 844 320 538 915 946 561 797 593 490 786 838 439 149 443 952 556 305 102 252 662 972 965 147 51 588 173 959 783 949 114 156 792 434 693 707 ];\r\nvexp=[82 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[1 2 3 4 5 7 8 9 10 12 13 14 15 16 17 19 20 21 24 25 26 27 30 31 32 33 34 36 37 38 39 40 41 42 43 44 45 46 47 49 52 53 54 55 58 59 60 61 62 63 64 65 66 67 69 70 72 74 75 76 77 79 80 81 82 83 84 85 87 89 90 93 95 96 97 98 100 101 102 104 105 108 109 110 112 115 117 116 118 119 120 121 122 123 124 125 126 128 132 133 134 135 136 137 139 142 143 145 146 147 148 149 150 151 153 154 155 156 159 157 160 161 162 163 164 165 167 168 170 171 174 177 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 196 197 198 199 201 202 203 204 205 206 207 208 212 213 214 216 217 219 220 221 223 224 225 226 227 228 229 230 231 232 233 234 235 237 238 239 241 242 245 246 248 249 250 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 270 271 272 275 278 279 280 282 283 284 286 287 288 289 291 292 293 295 296 297 299 300 301 302 303 304 305 307 308 310 312 313 314 315 317 319 320 322 323 324 325 327 328 330 329 331 332 333 334 335 336 337 338 339 340 341 342 343 344 346 347 348 349 350 351 352 354 355 357 358 359 360 361 362 363 364 365 367 368 369 370 373 374 375 378 379 383 384 386 387 388 389 390 392 394 396 398 399 400 401 403 404 405 406 407 408 409 410 411 412 413 414 416 420 417 421 422 424 426 427 428 429 430 432 433 434 436 437 438 439 440 442 443 444 445 446 448 449 450 452 454 455 456 457 458 459 460 461 462 463 464 465 466 468 469 471 472 474 475 476 477 478 479 480 481 483 484 485 486 487 489 490 491 492 493 494 496 497 498 499 500 501 502 504 505 506 507 508 509 510 511 514 515 517 518 519 520 521 522 526 527 529 530 531 532 533 534 535 536 537 538 539 540 541 543 545 546 547 548 549 550 552 553 554 555 557 558 559 560 561 565 566 567 568 569 570 571 574 575 576 577 579 580 581 582 583 586 587 588 589 590 591 593 594 595 596 597 599 601 602 603 604 605 606 607 608 609 610 612 614 613 615 616 617 618 619 620 621 623 624 625 626 627 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 647 648 649 651 654 652 655 656 657 659 662 663 664 665 666 667 668 670 671 672 673 674 675 676 677 678 679 680 681 684 685 687 688 689 690 691 693 694 696 697 700 702 703 704 705 706 707 708 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 745 746 748 749 750 751 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 770 771 773 774 775 776 777 778 779 780 781 783 784 785 786 787 788 790 791 792 793 794 796 797 798 799 800 801 802 803 804 805 807 806 809 811 812 813 814 815 816 818 819 820 822 823 824 825 826 827 828 829 830 831 832 833 834 836 839 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 863 864 865 866 867 868 869 870 871 872 873 874 876 877 878 881 882 883 886 888 889 891 892 893 895 896 897 898 899 900 901 903 904 905 906 907 908 909 910 911 912 914 915 916 919 920 921 922 923 924 925 926 927 928 929 930 931 933 934 935 937 938 939 940 943 944 946 947 948 949 950 951 954 955 958 959 960 962 964 963 965 966 967 968 969 970 971 973 974 976 977 978 979 980 981 982 983 985 987 989 990 991 992 993 994 995 996 997 998 999 1000 ];\r\nvexp=[8 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[232 362 351 89 9 383 813 119 501 620 74 832 51 891 276 399 788 50 830 441 407 247 327 179 95 747 700 116 567 509 596 798 870 946 238 230 680 51 348 533 22 421 364 72 312 639 470 451 688 652 891 446 898 570 624 992 316 675 107 882 183 54 680 405 999 269 634 31 671 982 563 692 754 926 764 417 564 585 220 251 236 462 48 486 31 671 477 346 697 936 228 231 989 259 635 340 879 621 370 550 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[743 518 755 828 879 541 927 408 37 37 390 21 445 937 948 884 395 704 54 14 367 979 496 739 378 827 675 921 263 707 410 6 224 164 185 454 56 111 214 93 500 603 465 944 891 765 179 286 468 233 651 186 211 146 925 940 972 951 212 587 657 622 944 232 137 128 686 545 591 899 989 442 853 805 385 744 569 563 381 389 147 31 926 357 528 202 296 851 153 860 437 809 481 732 41 969 860 78 513 802 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[86 217 935 102 796 608 72 794 977 758 392 828 341 411 808 33 109 545 905 883 454 614 180 210 450 416 977 332 247 832 107 332 400 41 786 196 1000 857 341 977 966 733 804 658 495 964 43 603 860 947 838 313 912 17 523 361 432 851 45 678 682 503 361 434 895 498 629 895 706 321 871 672 405 26 329 899 341 723 854 201 669 691 513 580 59 387 293 490 237 689 519 271 191 231 704 85 81 684 979 786 ];\r\nvexp=[83 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[473 794 229 24 568 883 911 820 507 554 938 670 729 241 831 64 196 280 334 572 853 361 223 365 866 48 748 528 116 865 442 941 658 670 964 225 904 226 44 410 131 982 79 859 574 261 275 770 540 608 693 392 320 915 109 186 962 208 713 430 72 154 370 82 176 685 306 79 262 702 841 744 35 271 955 960 532 229 729 71 836 421 815 156 688 923 693 1 130 405 430 554 910 151 635 437 187 292 516 448 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\n%%\r\nvin=[746 542 944 181 269 649 563 798 243 157 472 262 531 138 351 242 625 142 109 630 330 815 726 455 518 75 952 582 985 432 562 82 973 857 263 594 505 825 743 99 981 567 361 512 704 711 105 328 852 213 310 533 380 35 988 897 462 291 830 446 722 392 880 46 248 142 639 105 318 734 203 298 300 915 161 355 625 617 682 828 830 343 713 209 730 52 457 191 342 286 988 415 29 867 460 629 360 451 733 677 ];\r\nvexp=[85 ];\r\nvout=Monotonic_V(vin);\r\nassert(isequal(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":"2013-10-05T04:03:17.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-05T03:14:32.000Z","updated_at":"2013-10-06T00:40:15.000Z","published_at":"2013-10-05T03:49:00.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\u003eThis Challenge is derived from\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=\\\"http://code.google.com/codejam/contest/2334486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Ocean View\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. This is the Large data set with N\u0026lt;=1000 and Q\u0026lt;N\u0026lt;=1000, with typical 80.\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\u003eThe GJam story goes that as Supreme Ruler you are annoyed by complaints of non-ocean views on a hillside. To resolve the issue a minimum number of homes will be removed to provide a maximum number of ocean view homes. The Elevation of the homes should monotonically increase, no equal values, from element 1 thru the end.\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\u003eSuccinct Challenge statement:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Given a vector create the maximum length monotonically increasing vector by removing values. Report the number of values removed.\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V , Vector length N\u0026lt;=1000 with values 1 thru 1000.\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Q , minimum quantity of removed values to produce a valid vector (typical 80)\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\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [V] [Q]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 4 3 3] [2]  for [1 4] or [1 3]\\n[1 2 3 4 5] [0]\\n[4 3 2 1] [3]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCommentary:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) nchoosek(1000,80) is a little big\\n2) The Large test suite is N\u003c=1000 with some delete cases \u003e4\\n3) A Good Algorithm that solves the Large case is usually best to pursue\\n4) GJam Competition allows one Large submission within 10 minutes of download \\n5) This was only solved by one entrant.]]\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1913-gjam-2013-veterans-ocean-view-small\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSmall Suite Challenge\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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAlgorithm Spoiler:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A general method is to start at the end and build all unique length valid vectors. It is only necessary to maintain a Min Value and length for the potential solutions. Once all values are checked find the maximum solution length. There are three key steps in this method: 1) If vin(j)\u0026gt; Max of all solutions, start a new solution with length 1. 2) Find solutions that are 1 greater than vin(j). Update minimums of these solutions with vin(j) and increase length values. 3) Find solutions where mins\u0026gt;vin(j). Augment solution set by a single line of [vin(j),max length found +1]. 4) Find maximum length solution. This method solved all 100 large cases in \u0026lt; 2 seconds on Cody.\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\"}]}"}],"term":"tag:\"series\"","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:\"series\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"series\"","","\"","series","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fbf323e7580\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fbf323e74e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fbf323e6c20\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fbf323e7800\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fbf323e7760\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fbf323e76c0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fbf323e7620\u003e":"tag:\"series\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fbf323e7620\u003e":"tag:\"series\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"series\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"series\"","","\"","series","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fbf323e7580\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fbf323e74e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fbf323e6c20\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fbf323e7800\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fbf323e7760\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fbf323e76c0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fbf323e7620\u003e":"tag:\"series\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fbf323e7620\u003e":"tag:\"series\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":47078,"difficulty_rating":"easy"},{"id":57595,"difficulty_rating":"easy"},{"id":134,"difficulty_rating":"easy"},{"id":44860,"difficulty_rating":"easy"},{"id":47083,"difficulty_rating":"easy"},{"id":44225,"difficulty_rating":"easy"},{"id":3015,"difficulty_rating":"easy"},{"id":47234,"difficulty_rating":"easy"},{"id":58658,"difficulty_rating":"easy"},{"id":47239,"difficulty_rating":"easy"},{"id":57795,"difficulty_rating":"easy-medium"},{"id":2579,"difficulty_rating":"easy-medium"},{"id":2575,"difficulty_rating":"easy-medium"},{"id":2577,"difficulty_rating":"easy-medium"},{"id":43968,"difficulty_rating":"easy-medium"},{"id":45384,"difficulty_rating":"easy-medium"},{"id":2576,"difficulty_rating":"easy-medium"},{"id":45248,"difficulty_rating":"easy-medium"},{"id":45364,"difficulty_rating":"easy-medium"},{"id":1913,"difficulty_rating":"easy-medium"},{"id":2580,"difficulty_rating":"easy-medium"},{"id":2578,"difficulty_rating":"easy-medium"},{"id":566,"difficulty_rating":"easy-medium"},{"id":52779,"difficulty_rating":"easy-medium"},{"id":45339,"difficulty_rating":"easy-medium"},{"id":44523,"difficulty_rating":"easy-medium"},{"id":45223,"difficulty_rating":"easy-medium"},{"id":54265,"difficulty_rating":"easy-medium"},{"id":45383,"difficulty_rating":"easy-medium"},{"id":60837,"difficulty_rating":"easy-medium"},{"id":2581,"difficulty_rating":"easy-medium"},{"id":45761,"difficulty_rating":"easy-medium"},{"id":1730,"difficulty_rating":"easy-medium"},{"id":52462,"difficulty_rating":"easy-medium"},{"id":44360,"difficulty_rating":"easy-medium"},{"id":42769,"difficulty_rating":"easy-medium"},{"id":44466,"difficulty_rating":"medium"},{"id":44732,"difficulty_rating":"medium"},{"id":58463,"difficulty_rating":"medium"},{"id":54275,"difficulty_rating":"medium"},{"id":54430,"difficulty_rating":"medium"},{"id":54260,"difficulty_rating":"medium"},{"id":54295,"difficulty_rating":"medium"},{"id":1914,"difficulty_rating":"hard"}]}}