{"group":{"group":{"id":59,"name":"Number Manipulation III","lockable":false,"created_at":"2020-04-27T20:21:31.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Apparently, the original numbers weren't good enough.","is_default":false,"created_by":26769,"badge_id":62,"featured":false,"trending":false,"solution_count_in_trending_period":8,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":653,"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":"{\"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\u003eApparently, the original numbers weren't good 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\"}]}","description_html":"\u003cdiv style = \"text-align: start; line-height: normal; 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=\"display: block; min-width: 0px; padding-top: 0px; perspective-origin: 289.5px 10.5px; transform-origin: 289.5px 10.5px; \"\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; white-space: pre-wrap; perspective-origin: 266.5px 10.5px; transform-origin: 266.5px 10.5px; 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; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eApparently, the original numbers weren't good enough.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2020-04-27T20:21:50.000Z"},"current_player":null},"problems":[{"id":42757,"title":"Convert integer to base26 using letters","description":"Write a function that converts a decimal integer to base26 using the letters of the english alphabet, i.e. 0-\u003e'a', 1-\u003e'b', 2-\u003e'c', and so on.\r\n\r\nFor example 10 becomes 'k' and 260 becomes 'ka'.\r\n\r\nSee http://www.dcode.fr/base-n-convert for other hints and examples.","description_html":"\u003cp\u003eWrite a function that converts a decimal integer to base26 using the letters of the english alphabet, i.e. 0-\u0026gt;'a', 1-\u0026gt;'b', 2-\u0026gt;'c', and so on.\u003c/p\u003e\u003cp\u003eFor example 10 becomes 'k' and 260 becomes 'ka'.\u003c/p\u003e\u003cp\u003eSee \u003ca href = \"http://www.dcode.fr/base-n-convert\"\u003ehttp://www.dcode.fr/base-n-convert\u003c/a\u003e for other hints and examples.\u003c/p\u003e","function_template":"function s = dec2alpha(x)\r\n\r\ns = dec2base(x, 26);\r\n\r\nend","test_suite":"%% \r\nnums = [0,1,10,25,26,52,100,260];\r\nwords = {'a','b','k','z','ba','ca','dw','ka'};\r\nfor n=1:length(nums)\r\n  assert(strcmpi(words{n},dec2alpha(nums(n))));\r\nend\r\n%%\r\nnums = [35664,62366];\r\nwords = {'cats','dogs'};\r\nfor n=1:length(nums)\r\n  assert(strcmpi(words{n},dec2alpha(nums(n))));\r\nend\r\n%%\r\nassert(strcmpi('matlab', dec2alpha(142917893)));","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":55263,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-02-26T07:48:57.000Z","updated_at":"2026-02-18T21:29:16.000Z","published_at":"2016-02-26T07:48: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\",\"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\u003eWrite a function that converts a decimal integer to base26 using the letters of the english alphabet, i.e. 0-\u0026gt;'a', 1-\u0026gt;'b', 2-\u0026gt;'c', 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\u003eFor example 10 becomes 'k' and 260 becomes 'ka'.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee\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.dcode.fr/base-n-convert\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.dcode.fr/base-n-convert\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for other hints and examples.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42758,"title":"Convert float to base N","description":"The matlab function dec2base converts a positive integer number to a specified base.\r\nExtend it so that it works with non integers and negative numbers.\r\nFor example 10.5 in base16 is 'a.8', and -4 is base2 is '-100'.\r\n\r\nThe tests are not case-sensitive and check the first 6 digits after the decimal point.","description_html":"\u003cp\u003eThe matlab function dec2base converts a positive integer number to a specified base.\r\nExtend it so that it works with non integers and negative numbers.\r\nFor example 10.5 in base16 is 'a.8', and -4 is base2 is '-100'.\u003c/p\u003e\u003cp\u003eThe tests are not case-sensitive and check the first 6 digits after the decimal point.\u003c/p\u003e","function_template":"function s = float2base(x, n)\r\ns = dec2base(x,n);\r\nend","test_suite":"%% to base 2\r\nx = [0, -1, 0.5, 2.25, 10.125, -10.5];\r\ns = {'0', '-1', '0.1', '10.01', '1010.001', '-1010.1'};\r\nfor n=1:length(x);\r\n  assert(strcmpi(s{n}, float2base(x(n), 2)));\r\nend\r\n\r\n%% to base 16\r\nx = [0, 1, 0.5, 2.25, 10.125];\r\ns = {'0', '1', '0.8', '2.4', 'a.2'};\r\nfor n=1:length(x);\r\n  assert(strcmpi(s{n}, float2base(x(n), 16)));\r\nend\r\n\r\n%%\r\n% only checking 6 digits after period\r\nx = 3.14;\r\ns = {'11.0010001111','3.10753412172','3.23d70a3d70a'};\r\nbases = [2,8,16];\r\nfor n=1:length(bases)\r\n  assert(strncmpi(s{n}, float2base(x, bases(n)), 8));\r\nend\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":6,"created_by":55263,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":24,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-02-27T07:36:02.000Z","updated_at":"2025-12-02T13:03:02.000Z","published_at":"2016-02-27T07:36:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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 matlab function dec2base converts a positive integer number to a specified base. Extend it so that it works with non integers and negative numbers. For example 10.5 in base16 is 'a.8', and -4 is base2 is '-100'.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 tests are not case-sensitive and check the first 6 digits after the decimal point.\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":42760,"title":"Find the gcm of n given values","description":"Create a function that given n integer values greater than zero, finds the two numbers with the greatest common divisor and returns the gcm\r\nExample\r\nInput x = [1 10 13 50 26]\r\nOutput y = 13","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: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 66px; transform-origin: 407px 66px; 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: 376.5px 8px; transform-origin: 376.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCreate a function that given n integer values greater than zero, finds the two numbers with the greatest common divisor and returns the gcm\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: 26.5px 8px; transform-origin: 26.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample\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: 76.5px 8px; transform-origin: 76.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInput x = [1 10 13 50 26]\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: 43px 8px; transform-origin: 43px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOutput y = 13\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = greatest_gcm(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 10 13 50 26];\r\ny_correct = 13;\r\nassert(isequal(greatest_gcm(x),y_correct))\r\n\r\n%%\r\nx = [1 1 1 2 5];\r\ny_correct = 1;\r\nassert(isequal(greatest_gcm(x),y_correct))\r\n\r\n%%\r\nx = [25 50 1 5 1 2 4 5];\r\ny_correct = 25;\r\nassert(isequal(greatest_gcm(x),y_correct))\r\n\r\n%%\r\nx = 1:10;\r\ny_correct = 5;\r\nassert(isequal(greatest_gcm(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":68145,"edited_by":223089,"edited_at":"2022-07-04T10:57:36.000Z","deleted_by":null,"deleted_at":null,"solvers_count":52,"test_suite_updated_at":"2022-07-04T10:57:36.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-03-05T10:30:35.000Z","updated_at":"2025-12-02T12:56:10.000Z","published_at":"2016-03-05T10:32:17.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 function that given n integer values greater than zero, finds the two numbers with the greatest common divisor and returns the gcm\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput x = [1 10 13 50 26]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput y = 13\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":42824,"title":"Number construction I","description":"Given a positive integer, n, return a, b, c and d, such that\r\n\r\n1. n = a*sqrt(b)+c*sqrt(d)\r\n\r\n2. a, b, c and d are all positive integers greater than 1\r\n\r\nIf a solution does not exist, set all four output variables to zero.\r\n\r\nExample 1:\r\n\r\nn = 41\r\n\r\na = 5\r\n\r\nb = 16\r\n\r\nc = 7\r\n\r\nd = 9\r\n\r\nExample 2:\r\n\r\nn = 6\r\n\r\na = 0\r\n\r\nb = 0\r\n\r\nc = 0\r\n\r\nd = 0","description_html":"\u003cp\u003eGiven a positive integer, n, return a, b, c and d, such that\u003c/p\u003e\u003cp\u003e1. n = a*sqrt(b)+c*sqrt(d)\u003c/p\u003e\u003cp\u003e2. a, b, c and d are all positive integers greater than 1\u003c/p\u003e\u003cp\u003eIf a solution does not exist, set all four output variables to zero.\u003c/p\u003e\u003cp\u003eExample 1:\u003c/p\u003e\u003cp\u003en = 41\u003c/p\u003e\u003cp\u003ea = 5\u003c/p\u003e\u003cp\u003eb = 16\u003c/p\u003e\u003cp\u003ec = 7\u003c/p\u003e\u003cp\u003ed = 9\u003c/p\u003e\u003cp\u003eExample 2:\u003c/p\u003e\u003cp\u003en = 6\u003c/p\u003e\u003cp\u003ea = 0\u003c/p\u003e\u003cp\u003eb = 0\u003c/p\u003e\u003cp\u003ec = 0\u003c/p\u003e\u003cp\u003ed = 0\u003c/p\u003e","function_template":"function [a b c d] = numcons(n)\r\n  a = n;\r\n  b = n;\r\n  c = n;\r\n  d = n;\r\nend","test_suite":"%%\r\nn = 6;\r\n[a b c d] = numcons(n);\r\nassert(all([a b c d]==0))\r\n\r\n%%\r\nn = 11;\r\n[a b c d] = numcons(n);\r\nassert(all([a b c d]==0))\r\n\r\n%%\r\nn = 8;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*sqrt(b)+c*sqrt(d)==n)\r\n\r\n%%\r\nn = 41;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*sqrt(b)+c*sqrt(d)==n)\r\n\r\n%%\r\nn = 841;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*sqrt(b)+c*sqrt(d)==n)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":34,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-24T17:35:54.000Z","updated_at":"2025-12-02T12:58:33.000Z","published_at":"2016-04-24T17:35: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\",\"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 positive integer, n, return a, b, c and d, such that\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1. n = a*sqrt(b)+c*sqrt(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\u003e2. a, b, c and d are all positive integers greater than 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\u003eIf a solution does not exist, set all four output variables to zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003en = 41\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 = 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\u003eb = 16\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ec = 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\u003ed = 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\u003eExample 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\u003en = 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\u003ea = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eb = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ec = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ed = 0\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":42827,"title":"Number construction II","description":"Given a positive integer, n, return a, b, c and d, such that\r\n\r\n1. n = a*2^b+c*3^d\r\n\r\n2. a, b, c and d are all positive integers greater than 1\r\n\r\nIf a solution does not exist, set all four output variables to zero.\r\n\r\nExample 1:\r\n\r\nn = 26\r\n\r\na = 2\r\n\r\nb = 2\r\n\r\nc = 2\r\n\r\nd = 2\r\n\r\nExample 2:\r\n\r\nn = 28\r\n\r\na = 0\r\n\r\nb = 0\r\n\r\nc = 0\r\n\r\nd = 0","description_html":"\u003cp\u003eGiven a positive integer, n, return a, b, c and d, such that\u003c/p\u003e\u003cp\u003e1. n = a*2^b+c*3^d\u003c/p\u003e\u003cp\u003e2. a, b, c and d are all positive integers greater than 1\u003c/p\u003e\u003cp\u003eIf a solution does not exist, set all four output variables to zero.\u003c/p\u003e\u003cp\u003eExample 1:\u003c/p\u003e\u003cp\u003en = 26\u003c/p\u003e\u003cp\u003ea = 2\u003c/p\u003e\u003cp\u003eb = 2\u003c/p\u003e\u003cp\u003ec = 2\u003c/p\u003e\u003cp\u003ed = 2\u003c/p\u003e\u003cp\u003eExample 2:\u003c/p\u003e\u003cp\u003en = 28\u003c/p\u003e\u003cp\u003ea = 0\u003c/p\u003e\u003cp\u003eb = 0\u003c/p\u003e\u003cp\u003ec = 0\u003c/p\u003e\u003cp\u003ed = 0\u003c/p\u003e","function_template":"function [a b c d] = numcons(n)\r\n  a = n;\r\n  b = n;\r\n  c = n;\r\n  d = n;\r\nend","test_suite":"%%\r\nn = 28;\r\n[a b c d] = numcons(n);\r\nassert(all([a b c d]==0))\r\n\r\n%%\r\nn = 40;\r\n[a b c d] = numcons(n);\r\nassert(all([a b c d]==0))\r\n\r\n%%\r\nn = 41;\r\n[a b c d] = numcons(n);\r\nassert(all([a b c d]==0))\r\n\r\n%%\r\nn = 26;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*2^b+c*3^d==n)\r\n\r\n%%\r\nn = 38;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*2^b+c*3^d==n)\r\n\r\n%%\r\nn = 39;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*2^b+c*3^d==n)\r\n\r\n%%\r\nn = 555;\r\n[a b c d] = numcons(n);\r\nassert(all(mod([a b c d],1)==0))\r\nassert(all([a b c d]\u003e1))\r\nassert(a*2^b+c*3^d==n)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-24T18:58:05.000Z","updated_at":"2025-12-02T12:58:50.000Z","published_at":"2016-04-24T18:58:05.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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 positive integer, n, return a, b, c and d, such that\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1. n = a*2^b+c*3^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\u003e2. a, b, c and d are all positive integers greater than 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\u003eIf a solution does not exist, set all four output variables to zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003en = 26\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 = 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\u003eb = 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\u003ec = 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\u003ed = 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\u003eExample 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\u003en = 28\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eb = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ec = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ed = 0\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":42829,"title":"Number construction III","description":"Given a positive integer, n, return a, b and c, such that\r\n\r\n1. n = a^1.5+b^2.5+c^3.5\r\n\r\n2. a, b and c are all positive integers greater than 1\r\n\r\nIf a solution does not exist, set all three output variables to zero.\r\n\r\nExample 1:\r\n\r\nn = 168\r\n\r\na = 4\r\n\r\nb = 4\r\n\r\nc = 4\r\n\r\nExample 2:\r\n\r\nn = 100\r\n\r\na = 0\r\n\r\nb = 0\r\n\r\nc = 0","description_html":"\u003cp\u003eGiven a positive integer, n, return a, b and c, such that\u003c/p\u003e\u003cp\u003e1. n = a^1.5+b^2.5+c^3.5\u003c/p\u003e\u003cp\u003e2. a, b and c are all positive integers greater than 1\u003c/p\u003e\u003cp\u003eIf a solution does not exist, set all three output variables to zero.\u003c/p\u003e\u003cp\u003eExample 1:\u003c/p\u003e\u003cp\u003en = 168\u003c/p\u003e\u003cp\u003ea = 4\u003c/p\u003e\u003cp\u003eb = 4\u003c/p\u003e\u003cp\u003ec = 4\u003c/p\u003e\u003cp\u003eExample 2:\u003c/p\u003e\u003cp\u003en = 100\u003c/p\u003e\u003cp\u003ea = 0\u003c/p\u003e\u003cp\u003eb = 0\u003c/p\u003e\u003cp\u003ec = 0\u003c/p\u003e","function_template":"function [a b c] = numcons(n)\r\n  a = n;\r\n  b = n;\r\n  c = n;\r\nend","test_suite":"%%\r\nn = 100;\r\n[a b c] = numcons(n);\r\nassert(all([a b c]==0))\r\n\r\n%%\r\nn = 888;\r\n[a b c] = numcons(n);\r\nassert(all([a b c]==0))\r\n\r\n%%\r\nn = 19666;\r\n[a b c] = numcons(n);\r\nassert(all([a b c]==0))\r\n\r\n%%\r\nn = 314159;\r\n[a b c] = numcons(n);\r\nassert(all([a b c]==0))\r\n\r\n%%\r\nn = 1100;\r\n[a b c] = numcons(n);\r\nassert(all(mod([a b c],1)==0))\r\nassert(all([a b c]\u003e1))\r\nassert(a^1.5+b^2.5+c^3.5==n)\r\n\r\n%%\r\nn = 116600;\r\n[a b c] = numcons(n);\r\nassert(all(mod([a b c],1)==0))\r\nassert(all([a b c]\u003e1))\r\nassert(a^1.5+b^2.5+c^3.5==n)\r\n\r\n%%\r\nn = 16999;\r\n[a b c] = numcons(n);\r\nassert(all(mod([a b c],1)==0))\r\nassert(all([a b c]\u003e1))\r\nassert(a^1.5+b^2.5+c^3.5==n)\r\n\r\n%%\r\nn = 10000040;\r\n[a b c] = numcons(n);\r\nassert(all(mod([a b c],1)==0))\r\nassert(all([a b c]\u003e1))\r\nassert(a^1.5+b^2.5+c^3.5==n)\r\n\r\n%%\r\nn = 94940;\r\n[a b c] = numcons(n);\r\nassert(all(mod([a b c],1)==0))\r\nassert(all([a b c]\u003e1))\r\nassert(a^1.5+b^2.5+c^3.5==n)\r\n\r\n%%\r\nn = 9990;\r\n[a b c] = numcons(n);\r\nassert(all(mod([a b c],1)==0))\r\nassert(all([a b c]\u003e1))\r\nassert(a^1.5+b^2.5+c^3.5==n)","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":33,"test_suite_updated_at":"2016-04-28T18:19:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-25T11:29:04.000Z","updated_at":"2026-03-18T19:21:15.000Z","published_at":"2016-04-25T11:29:04.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 positive integer, n, return a, b and c, such that\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1. n = a^1.5+b^2.5+c^3.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\u003e2. a, b and c are all positive integers greater than 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\u003eIf a solution does not exist, set all three output variables to zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003en = 168\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 = 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\u003eb = 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\u003ec = 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\u003eExample 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\u003en = 100\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eb = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ec = 0\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":42831,"title":"Integer complexity","description":"Given an array, n, of positive integers, return an array, c, of the same size, in which each element is the complexity of the corresponding element in n.\r\nInteger complexity is defined in number theory as the least number of ones required to represent an integer using only addition, multiplication and parentheses.\r\nExample 1:\r\nn = 3\r\nc = 3\r\nExample 2:\r\nn = [6 10 11;16 18 41]\r\nc = [5 7 8;8 8 12]","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: 273px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 136.5px; transform-origin: 407px 136.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 324px 8px; transform-origin: 324px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven an array, n, of positive integers, return an array, c, of the same size, in which each element is the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Integer_complexity\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ecomplexity\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: 22px 8px; transform-origin: 22px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of the corresponding element in n.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373.5px 8px; transform-origin: 373.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInteger complexity is defined in number theory as the least number of ones required to represent an integer using only addition, multiplication and parentheses.\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: 34.5px 8px; transform-origin: 34.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample 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: 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: 16px 8px; transform-origin: 16px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003en = 3\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: 15.5px 8px; transform-origin: 15.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ec = 3\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: 34.5px 8px; transform-origin: 34.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample 2:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 69.5px 8px; transform-origin: 69.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003en = [6 10 11;16 18 41]\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: 53.5px 8px; transform-origin: 53.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ec = [5 7 8;8 8 12]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function c = intcomp(n)\r\n  c = n;\r\nend","test_suite":"%%\r\nfiletext = fileread('intcomp.m');\r\nillegal = contains(filetext, 'regexp') || contains(filetext, 'assert') || ...\r\n          contains(filetext, 'oeis') || contains(filetext, 'read'); \r\nassert(~illegal)\r\n\r\n%%\r\nn = 1;\r\nc_correct = 1;\r\nassert(isequal(intcomp(n),c_correct))\r\n\r\n%%\r\nn = 3;\r\nc_correct = 3;\r\nassert(isequal(intcomp(n),c_correct))\r\n\r\n%%\r\nn = [6 10 11;16 18 41];\r\nc_correct = [5 7 8;8 8 12];\r\nassert(isequal(intcomp(n),c_correct))\r\n\r\n%%\r\nn = [60 27 72 1 51 24 46];\r\nc_correct = [12 9 12 1 12 9 12];\r\nassert(isequal(intcomp(n),c_correct))\r\n\r\n%%\r\nn = [58;65;47;78;62];\r\nc_correct = [13;13;13;13;13];\r\nassert(isequal(intcomp(n),c_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":15521,"edited_by":223089,"edited_at":"2023-01-01T06:46:51.000Z","deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":"2023-01-01T06:46:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-26T12:10:39.000Z","updated_at":"2025-12-02T13:00:32.000Z","published_at":"2016-04-26T12:10:39.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, n, of positive integers, return an array, c, of the same size, in which each element is the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Integer_complexity\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ecomplexity\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of the corresponding element in 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\u003eInteger complexity is defined in number theory as the least number of ones required to represent an integer using only addition, multiplication and parentheses.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003en = 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ec = 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003en = [6 10 11;16 18 41]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ec = [5 7 8;8 8 12]\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":42834,"title":"Integer complexity (Large numbers)","description":"Inspired by \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42831-integer-complexity Problem 42831\u003e, this problem aims to calculate the \u003chttps://en.wikipedia.org/wiki/Integer_complexity integer complexity\u003e for large numbers. The *integer complexity* of a natural number n is defined as the least number of 1’s required to express n using only the two operations + and × and parentheses. \r\n\r\n*Example*: the number 11 may be represented using 8 ones:\r\n\r\n    11 = (1 + 1 + 1) × (1 + 1 + 1) + 1 + 1.\r\n\r\nHowever, it has no representation using 7 or fewer ones. Therefore, its complexity is 8.\r\n\r\nYour solution will be scored based on its running time. No cheating please. ","description_html":"\u003cp\u003eInspired by \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42831-integer-complexity\"\u003eProblem 42831\u003c/a\u003e, this problem aims to calculate the \u003ca href = \"https://en.wikipedia.org/wiki/Integer_complexity\"\u003einteger complexity\u003c/a\u003e for large numbers. The \u003cb\u003einteger complexity\u003c/b\u003e of a natural number n is defined as the least number of 1’s required to express n using only the two operations + and × and parentheses.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e: the number 11 may be represented using 8 ones:\u003c/p\u003e\u003cpre\u003e    11 = (1 + 1 + 1) × (1 + 1 + 1) + 1 + 1.\u003c/pre\u003e\u003cp\u003eHowever, it has no representation using 7 or fewer ones. Therefore, its complexity is 8.\u003c/p\u003e\u003cp\u003eYour solution will be scored based on its running time. No cheating please.\u003c/p\u003e","function_template":"function c = intcomp2(n)\r\nc = n;","test_suite":"%%\r\nn = 1:11;\r\nc_correct = [1,2,3,4,5,5,6,6,6,7,8];\r\nassert(isequal(intcomp2(n),c_correct))\r\n\r\n%%\r\nn = [60 27 72 1 51 24 46 58 65 47 78 62];\r\nc_correct = [12 9 12 1 12 9 12 13 13 13 13 13];\r\nassert(isequal(intcomp2(n),c_correct))\r\n\r\n%% \r\nglobal sol_score\r\nn = (1:10)*1e4;\r\nc_correct = [28,30,31,32,33,33,32,34,34,35];\r\ntic, c = intcomp2(n); sol_score = toc\r\nassert(isequal(c,c_correct))\r\n\r\n%%\r\n% Scoring function by LY Cao\r\nglobal sol_score\r\nfid = fopen('score.p','wb');\r\nfwrite(fid,sscanf('7630312E30307630302E30300008501CD77E9FB100000035000001110000018422762999A8C1DE50537BEE443F4D73651F830FC6C78ADFB7DF68DF98823F565884DC58E21C7E397E3D26E4FFEA9A0D83589ABB5C0B0B553B44CFD79C9B272D11DF1965AD538598E8319529727DF4C4CF36A6016DD7816544AE5A8F64C9B2D9D0C4B94DD5EDF14595CBFE3D402647499EA3D9D125AC927454ED85973BCD1AAEA536D5A6CDDCD78A0211E8179603FFE12E4AB0E4704EA195704428700BAE5C4DFD42FF1A8760EDF2721F9724498ECC9F957735E7A3CDB9630DB17DF92ACE8F486706020E0A8D022D14BC313879724760AE20D67F572DD85211E4BEA45CDF3E22976253F113AEA96C1FF907329E4BD429BCFC6331077DA21F05D791DA6ECCF680D2E23AC77DFCE5C1D9869D3098F5B89FF92A','%2x'));\r\nfclose(fid);\r\nscore(sol_score);","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":12569,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":"2016-04-30T01:44:40.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-27T01:46:51.000Z","updated_at":"2025-12-02T13:02:17.000Z","published_at":"2016-04-27T01:54: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\u003eInspired by\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.mathworks.com/matlabcentral/cody/problems/42831-integer-complexity\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42831\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, this problem aims to calculate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Integer_complexity\\\"\u003e\u003cw:r\u003e\u003cw:t\u003einteger complexity\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for large numbers. 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\u003einteger complexity\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of a natural number n is defined as the least number of 1’s required to express n using only the two operations + and × and parentheses.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the number 11 may be represented using 8 ones:\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[    11 = (1 + 1 + 1) × (1 + 1 + 1) + 1 + 1.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHowever, it has no representation using 7 or fewer ones. Therefore, its complexity is 8.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour solution will be scored based on its running time. No cheating please.\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":42863,"title":"Replace values out of an interval with the lower or upper values","description":"For a vector or matrix X and an interval [n1,n2], the function replace every element of x inferior to n1 by n1, and every element of x superior to n2 by n2.\r\n\r\nExample\r\n\r\n x= [1 2 3 4 5 1 2 4 6]\r\n\r\n n=[3,5]\r\n\r\n y_correct= [3 3 3 4 5 3 3 4 5]","description_html":"\u003cp\u003eFor a vector or matrix X and an interval [n1,n2], the function replace every element of x inferior to n1 by n1, and every element of x superior to n2 by n2.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e x= [1 2 3 4 5 1 2 4 6]\u003c/pre\u003e\u003cpre\u003e n=[3,5]\u003c/pre\u003e\u003cpre\u003e y_correct= [3 3 3 4 5 3 3 4 5]\u003c/pre\u003e","function_template":"function y = limit2interval(x,n)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = ones(1,25);\r\nn=[0,2];\r\ny_correct = x;\r\nassert(isequal(limit2interval(x,n),y_correct))\r\n\r\n%%\r\nx= [1 2 3 4 5 1 2 4 6];\r\nn=[3,5];\r\ny_correct= [3 3 3 4 5 3 3 4 5];\r\nassert(isequal(limit2interval(x,n),y_correct))\r\n\r\n%%\r\nx= magic(7);\r\nn=[7,14];\r\ny_correct=ones(7)*14-sparse([4 5 3 2 3 1 2 1 7 6 7 5 6],[1 1 2 3 3 4 4 5 5 6 6 7 7],[7 1 7 7 6 7 5 4 7 7 3 7 2])\r\nassert(isequal(limit2interval(x,n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":55194,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":71,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-05-28T10:47:32.000Z","updated_at":"2026-02-04T15:47:26.000Z","published_at":"2016-05-28T21:13:31.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\u003eFor a vector or matrix X and an interval [n1,n2], the function replace every element of x inferior to n1 by n1, and every element of x superior to n2 by n2.\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[ x= [1 2 3 4 5 1 2 4 6]\\n\\n n=[3,5]\\n\\n y_correct= [3 3 3 4 5 3 3 4 5]]]\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":43042,"title":"Convert decimal to binary and then generate the minimum binary  it can with jumbling","description":"input is 10 --\u003e 1010\r\noutput should be 3 --\u003e 0011\r\n\r\ninput 23 --\u003e 10111\r\noutput should be 15 --\u003e 01111","description_html":"\u003cp\u003einput is 10 --\u0026gt; 1010\r\noutput should be 3 --\u0026gt; 0011\u003c/p\u003e\u003cp\u003einput 23 --\u0026gt; 10111\r\noutput should be 15 --\u0026gt; 01111\u003c/p\u003e","function_template":"function y = minBin(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct = 3;\r\nassert(isequal(minBin(x),y_correct))\r\n%%\r\nx = 23;\r\ny_correct = 15;\r\nassert(isequal(minBin(x),y_correct))\r\n%%\r\nx = 15;\r\ny_correct = 15;\r\nassert(isequal(minBin(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":10,"comments_count":1,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":95,"test_suite_updated_at":"2016-10-29T17:12:00.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T10:17:07.000Z","updated_at":"2026-03-24T11:36:00.000Z","published_at":"2016-10-05T10:17: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\",\"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\u003einput is 10 --\u0026gt; 1010 output should be 3 --\u0026gt; 0011\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 23 --\u0026gt; 10111 output should be 15 --\u0026gt; 01111\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":43057,"title":"Binary Inversion","description":"Given the unsigned 8-bit integer x, return the number y which is the binary inversion of x.\r\n\r\nFor example if x is 5, y should be 250 because:\r\n\r\n   5 (8-bit): 00000101\r\n\r\n 250 (8-bit): 11111010","description_html":"\u003cp\u003eGiven the unsigned 8-bit integer x, return the number y which is the binary inversion of x.\u003c/p\u003e\u003cp\u003eFor example if x is 5, y should be 250 because:\u003c/p\u003e\u003cpre\u003e   5 (8-bit): 00000101\u003c/pre\u003e\u003cpre\u003e 250 (8-bit): 11111010\u003c/pre\u003e","function_template":"function y = binInvert(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct = 245;\r\nassert(isequal(binInvert(x),y_correct))\r\n%%\r\nx = 245;\r\ny_correct = 10;\r\nassert(isequal(binInvert(x),y_correct))\r\n%%\r\nx = 20;\r\ny_correct = 235;\r\nassert(isequal(binInvert(x),y_correct))\r\n%%\r\nx = 235;\r\ny_correct = 20;\r\nassert(isequal(binInvert(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":94929,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":"2016-10-19T11:46:21.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T13:46:36.000Z","updated_at":"2026-02-04T15:53:48.000Z","published_at":"2016-10-05T13:46:36.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven the unsigned 8-bit integer x, return the number y which is the binary inversion of x.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example if x is 5, y should be 250 because:\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 (8-bit): 00000101\\n\\n 250 (8-bit): 11111010]]\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":2360,"title":"Fill an array given a sum and array length values","description":"Fill an array with random numbers so that their sum and array length will be equal to the given values as input. Function will generate 1 value at a time (not whole array at once)\r\nExample\r\nLet's say you are asked to fill 5 elements (n = 5) in an empty array where summation of their elements (sum_up = 4) should be 4. Then the function will be invoked 5 times in the test suite, and your function supposed to check the array being constructed (sum_array) and provide 1 element each time.","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: 144px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 72px; transform-origin: 408px 72px; 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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFill an array with random numbers so that their sum and array length will be equal to the given values as input. Function will generate 1 value at a time (not whole array at once)\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=\"\"\u003eExample\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 31.5px; text-align: left; transform-origin: 385px 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=\"\"\u003eLet's say you are asked to fill 5 elements (n = 5) in an empty array where summation of their elements (sum_up = 4) should be 4. Then the function will be invoked 5 times in the test suite, and your function supposed to check the array being constructed (sum_array) and provide 1 element each time.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = fill_array_sum_up_to(sum_up,n,sum_array)\r\n%code\r\nend","test_suite":"%%\r\nfor times = 1:100\r\n    sum_up = 5*rand; % sum of array should be this\r\n    n = randi(10); %number of elements in array\r\n    sum_array = [];\r\n    for i = 1:n\r\n        sum_array(i,1) = fill_array_sum_up_to(sum_up,n,sum_array);\r\n    end\r\n    checksum(times) = all(diff(sort(sum_array))) \u0026\u0026 abs(sum_up-sum(sum_array))\u003c1e-10;\r\nend\r\nassert(all(checksum));","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":27005,"edited_by":485721,"edited_at":"2025-03-25T18:26:05.000Z","deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2025-02-16T12:11:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-12T14:22:32.000Z","updated_at":"2025-12-18T23:14:14.000Z","published_at":"2014-06-12T14:27:21.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\u003eFill an array with random numbers so that their sum and array length will be equal to the given values as input. Function will generate 1 value at a time (not whole array at once)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLet's say you are asked to fill 5 elements (n = 5) in an empty array where summation of their elements (sum_up = 4) should be 4. Then the function will be invoked 5 times in the test suite, and your function supposed to check the array being constructed (sum_array) and provide 1 element each time.\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":1081,"title":"Test if two numbers have the same digits","description":"Given two integers _x1_ and _x2_, return |true| if the numbers written with no leading zeros contain the same digits. That is, the string representation of one number is a permutation of the string representation of the other.\r\n\r\nFor example\r\n\r\n    x1 = 1234;\r\n    x2 = 4321;\r\n    tf = same_digits(x1,x2)\r\n\r\nwould output\r\n\r\n    tf = true\r\n\r\nwhereas\r\n\r\n    x1 = 1234;\r\n    x2 = 1244;\r\n    tf = same_digits(x1,x2)\r\n\r\nwould output\r\n\r\n    tf = false","description_html":"\u003cp\u003eGiven two integers \u003ci\u003ex1\u003c/i\u003e and \u003ci\u003ex2\u003c/i\u003e, return \u003ctt\u003etrue\u003c/tt\u003e if the numbers written with no leading zeros contain the same digits. That is, the string representation of one number is a permutation of the string representation of the other.\u003c/p\u003e\u003cp\u003eFor example\u003c/p\u003e\u003cpre\u003e    x1 = 1234;\r\n    x2 = 4321;\r\n    tf = same_digits(x1,x2)\u003c/pre\u003e\u003cp\u003ewould output\u003c/p\u003e\u003cpre\u003e    tf = true\u003c/pre\u003e\u003cp\u003ewhereas\u003c/p\u003e\u003cpre\u003e    x1 = 1234;\r\n    x2 = 1244;\r\n    tf = same_digits(x1,x2)\u003c/pre\u003e\u003cp\u003ewould output\u003c/p\u003e\u003cpre\u003e    tf = false\u003c/pre\u003e","function_template":"function tf = same_digits(x1,x2)\r\n  tf = true;\r\nend","test_suite":"%%\r\nassert(same_digits(1234,4321))\r\n\r\n%%\r\nassert(same_digits(1134,4311))\r\n\r\n%%\r\nassert(same_digits(1111,1111))\r\n\r\n%%\r\nassert(~same_digits(11,1111))\r\n\r\n%%\r\nassert(~same_digits(11,1234))\r\n\r\n%%\r\nassert(~same_digits(1234,234))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":266,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-12-02T05:43:24.000Z","updated_at":"2026-03-30T13:27:25.000Z","published_at":"2012-12-04T20:00:06.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two integers\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\u003ex1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw: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\u003ex2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return\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\u003etrue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e if the numbers written with no leading zeros contain the same digits. That is, the string representation of one number is a permutation of the string representation of the other.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    x1 = 1234;\\n    x2 = 4321;\\n    tf = same_digits(x1,x2)]]\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\u003ewould output\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[    tf = true]]\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\u003ewhereas\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[    x1 = 1234;\\n    x2 = 1244;\\n    tf = same_digits(x1,x2)]]\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\u003ewould output\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[    tf = false]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1164,"title":"Sum the Digits of a Number","description":"Given an integer, sum the digits repeatedly until you end up with a single value less than 10.\r\n\r\nFor example, if you add the digits of the number 123456789, you get 1+2+3+4+5+6+7+8+9 = 45, and then 4+5 = 9\r\n\r\nThe input will be a string of digits. The output should be the scalar value of the repeated sum of digits.","description_html":"\u003cp\u003eGiven an integer, sum the digits repeatedly until you end up with a single value less than 10.\u003c/p\u003e\u003cp\u003eFor example, if you add the digits of the number 123456789, you get 1+2+3+4+5+6+7+8+9 = 45, and then 4+5 = 9\u003c/p\u003e\u003cp\u003eThe input will be a string of digits. The output should be the scalar value of the repeated sum of digits.\u003c/p\u003e","function_template":"function s = digit_sum(a)\r\n  s = [];\r\nend","test_suite":"%%\r\n\r\nassessFunctionAbsence('regexp','FileName','digit_sum.m')\r\n\r\n%%\r\nx = '123456789';\r\nassert(isequal(digit_sum(x),9))\r\n\r\n%%\r\nx = '13579';\r\nassert(isequal(digit_sum(x),7))\r\n\r\n%%\r\nx = '199';\r\nassert(isequal(digit_sum(x),1))\r\n\r\n%%\r\nx = '19999999999999999999999';\r\nassert(isequal(digit_sum(x),1))\r\n\r\n%%\r\nx = '1036654257757615301164620529930689045676735109259113932133140605724504628985272966102896725849035075';\r\nassert(isequal(digit_sum(x),5))\r\n\r\n%%\r\nx = '74021245485969262660226837606390444737401741361729271205654666692721644673648826558231964656575921104437679911605584367531520724637367403421848373873279364871895851147873501164141085965889086954824958';\r\nassert(isequal(digit_sum(x),1))\r\n\r\n%%\r\nx = '5851147873501164141085965889086954824958752606678975950184825606304112110625645414882256429011165097708998751310932346085834016381957924478113053129649177515212802040810341932020576007951832700665777265307367115487700079617116367572798033657320723526417122504117269467461912747320644603761100467516110111332287512097531691230649461317836258532443574410236994277771642081168571956087153534120969197542720767643838785694086392663104173875192923061073636098783655224289050890906758861210169349969736226546755550793938442137760897037722646218791104180057313259613054984813997639176837835953637446938790362276560342782718153854834909165636800962412231318093037756803017785098259784452756314377610539928858957504653988358962604698474998342789551842878266142728834686534787064418323355335697481001330501689595534408048368891285568524496673551564873437746977135402808065251650010486580915150789952155706519549648556325841434843312042241472703020112115992435204109497067652723884369953849057131345052221998713';\r\nassert(isequal(digit_sum(x),3))\r\n\r\n%%\r\nx = '908345908234987234589734591724598712345987345273472134987134589764359712459087124587213458149576345917461982455851147873501164141085965889086954824958752606678975950184825606304112110625645414882256429011165097708998751310932346085834016381957924478113053129649177515212802040810341932020576007951832700665777265307367115487700079617116367572798033657320723526417122504117269467461912747320644603761100467516110111332287512097531691230649461317836258532443574410236994277771642081168571956087153534120969197542720767643838785694086392663104173875192923061073636098783655224289050890906758861210169349969736226546755550793938442137760897037722646218791104180057313259613054984813997639176837835953637446938790362276560342782718153854834909165636800962412231318093037756803017785098259784452756314377610539928858957504653988358962604698474998342789551842878266142728834686534787064418323355335697481001330501689595534408048368891285568524496673551564873437746977135402808065251650010486580915150789952155706519549648556325841434843312042241472703020112115992435204109497067652723884369953849057131345059345982439827345092847145091842350981273459871458321098243593498348934598234098145091245845745091240912345931475871452221993493498324734583402901234912925903469023609823768684168426843682436846824645654268462546242684234365243284325436590349324982345923459832145097614359071642509832457234591249314598734590872134590871645098132450921347509237602389760914651346592451257153';\r\nassert(isequal(digit_sum(x),6))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":1,"created_by":1057,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":300,"test_suite_updated_at":"2017-11-16T13:16:47.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-01-02T18:59:46.000Z","updated_at":"2026-02-19T10:27:43.000Z","published_at":"2013-01-02T19:00:21.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 an integer, sum the digits repeatedly until you end up with a single value less than 10.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if you add the digits of the number 123456789, you get 1+2+3+4+5+6+7+8+9 = 45, and then 4+5 = 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\u003eThe input will be a string of digits. The output should be the scalar value of the repeated sum of digits.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1510,"title":"Number of digits in an integer","description":"Specifies how many digits in a given integer. Example: in=100 ==\u003e out=3","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 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: 226.5px 8px; transform-origin: 226.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSpecifies how many digits in a given integer. Example: in=100 ==\u0026gt; out=3\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = HowManyDigits(in)\r\n  out = in;\r\nend","test_suite":"%%\r\nx = -1;\r\ny_correct = 1;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n%%\r\nx = -10;\r\ny_correct = 2;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = 2;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n%%\r\nx = 100;\r\ny_correct = 3;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n%%\r\nx=1000;\r\ny_correct = 4;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n%%\r\nx=5435742363271149;\r\ny_correct = 16;\r\nassert(isequal(HowManyDigits(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":13478,"edited_by":223089,"edited_at":"2022-07-08T06:58:06.000Z","deleted_by":null,"deleted_at":null,"solvers_count":170,"test_suite_updated_at":"2022-07-08T06:58:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-05-14T15:59:45.000Z","updated_at":"2026-02-12T18:20:08.000Z","published_at":"2013-05-14T15:59:45.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\u003eSpecifies how many digits in a given integer. Example: in=100 ==\u0026gt; out=3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}