{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":42412,"title":"Divisible by 10","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 10.\r\n\r\nWrite a function to determine if a number is divisible by 10. This can be done by checking if the last digit is zero.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9 divisible by 9\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11 divisible by 11\u003e.\r\n","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 10.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 10. This can be done by checking if the last digit is zero.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9\"\u003edivisible by 9\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11\"\u003edivisible by 11\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_10(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_10.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '10';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '234';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '220';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '12361230';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227960';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '220';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":376,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:34:57.000Z","updated_at":"2026-03-24T13:02:48.000Z","published_at":"2015-06-25T03:34: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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 10. This can be done by checking if the last digit is 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42411-divisible-by-9\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 9\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42413-divisible-by-11\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42407,"title":"Divisible by 5","description":"Pursuant to the first problem in this series, this one involves checking for divisibility by 5.\r\nWrite a function to determine if a number is divisible by 5. This can be checked by the following method:\r\nCheck if the last digits is 0 or 5.\r\nPrevious problem: divisible by 4. Next problem: divisible by 6.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 122.433px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 61.2167px; transform-origin: 408px 61.2167px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 47.45px 7.79167px; transform-origin: 47.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePursuant to the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003efirst problem\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: 184.767px 7.79167px; transform-origin: 184.767px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in this series, this one involves checking for divisibility by 5.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 320.775px 7.79167px; transform-origin: 320.775px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine if a number is divisible by 5. This can be checked by the following method:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 10.2167px; transform-origin: 391px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 96.8417px 7.79167px; transform-origin: 96.8417px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCheck if the last digits is 0 or 5.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.4083px 7.79167px; transform-origin: 56.4083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePrevious problem:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003edivisible by 4\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: 47.45px 7.79167px; transform-origin: 47.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Next problem:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://www.mathworks.com/matlabcentral/cody/problems/42408-divisible-by-6\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003edivisible by 6\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [tf] = divisible_by_5(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_5.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\nassert(isempty(strfind(filetext, 'regexp ''')),'regexp hacks forbidden')\r\n%Last assert added by Dyuman Joshi on 02/01/2026\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '225';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '1236125';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '225';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":26769,"edited_by":223089,"edited_at":"2026-01-02T16:52:49.000Z","deleted_by":null,"deleted_at":null,"solvers_count":495,"test_suite_updated_at":"2026-01-02T16:52:49.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:41:14.000Z","updated_at":"2026-03-24T09:37:28.000Z","published_at":"2015-06-25T02:41:14.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003eWrite a function to determine if a number is divisible by 5. This can be checked by the following method:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck if the last digits is 0 or 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\u003ePrevious problem:\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/42406-divisible-by-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42408-divisible-by-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":42404,"title":"Divisible by 2","description":"This is the first problem in a set of \"divisible by x\" problems. You will be provided a number as a string and the function you write must return whether or not that number is divisible by x.\r\n\r\nRather than allowing you to use an easy way out, such as the modulus function, division and checking the result against its rounded value, Java functions, etc., you get to learn and apply integer divisibility rules. For reference, some divisibility conditions for integers are listed \u003chttp://en.wikipedia.org/wiki/Divisibility_rule here\u003e. Other such references are also available elsewhere on the internet.\r\n\r\nThere are two benefits to approaching divisibility in this manner: first, you learn neat divisibility tricks that you can use in your head or on paper for large numbers and, second, you program a routine capable of determining divisibility for arbitrarily large numbers, for which existing precision fails. *_So, to begin..._*\r\n\r\nWrite a function to determine if a number is divisible by 2. This will be the case if its last digit is even.\r\n\r\n(This problem blocks a range of functions in the first test case so that you must use one of the supplied methods; some of these restrictions will be lifted for later problems in the series.)\r\n\r\nNext problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisible by 3\u003e.","description_html":"\u003cp\u003eThis is the first problem in a set of \"divisible by x\" problems. You will be provided a number as a string and the function you write must return whether or not that number is divisible by x.\u003c/p\u003e\u003cp\u003eRather than allowing you to use an easy way out, such as the modulus function, division and checking the result against its rounded value, Java functions, etc., you get to learn and apply integer divisibility rules. For reference, some divisibility conditions for integers are listed \u003ca href = \"http://en.wikipedia.org/wiki/Divisibility_rule\"\u003ehere\u003c/a\u003e. Other such references are also available elsewhere on the internet.\u003c/p\u003e\u003cp\u003eThere are two benefits to approaching divisibility in this manner: first, you learn neat divisibility tricks that you can use in your head or on paper for large numbers and, second, you program a routine capable of determining divisibility for arbitrarily large numbers, for which existing precision fails. \u003cb\u003e\u003ci\u003eSo, to begin...\u003c/i\u003e\u003c/b\u003e\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 2. This will be the case if its last digit is even.\u003c/p\u003e\u003cp\u003e(This problem blocks a range of functions in the first test case so that you must use one of the supplied methods; some of these restrictions will be lifted for later problems in the series.)\u003c/p\u003e\u003cp\u003eNext problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisible by 3\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_2(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_2.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'factor')),'factor() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '1236127';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '1236127';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\nend\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '223';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\nend\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1236127';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":10,"comments_count":8,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":616,"test_suite_updated_at":"2017-04-19T17:42:44.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:14:54.000Z","updated_at":"2026-03-24T09:42:10.000Z","published_at":"2015-06-25T02:14:54.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the first problem in a set of \\\"divisible by x\\\" problems. You will be provided a number as a string and the function you write must return whether or not that number is divisible by 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\u003eRather than allowing you to use an easy way out, such as the modulus function, division and checking the result against its rounded value, Java functions, etc., you get to learn and apply integer divisibility rules. For reference, some divisibility conditions for integers are listed\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://en.wikipedia.org/wiki/Divisibility_rule\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehere\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Other such references are also available elsewhere on the internet.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are two benefits to approaching divisibility in this manner: first, you learn neat divisibility tricks that you can use in your head or on paper for large numbers and, second, you program a routine capable of determining divisibility for arbitrarily large numbers, for which existing precision fails.\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\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSo, to begin...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 2. This will be the case if its last digit is even.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(This problem blocks a range of functions in the first test case so that you must use one of the supplied methods; some of these restrictions will be lifted for later problems in the series.)\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\u003eNext problem:\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42411,"title":"Divisible by 9","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 9.\r\n\r\nWrite a function to determine if a number is divisible by 9. This can be done by the following method:\r\n\r\n# Sum the digits of the number. As with methods for other numbers, this summing step can be applied recursively until a single-digit number results. If the resulting number is divisible by nine, then so is the original number.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8 divisible by 8\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10 divisible by 10\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 9.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 9. This can be done by the following method:\u003c/p\u003e\u003col\u003e\u003cli\u003eSum the digits of the number. As with methods for other numbers, this summing step can be applied recursively until a single-digit number results. If the resulting number is divisible by nine, then so is the original number.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8\"\u003edivisible by 8\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10\"\u003edivisible by 10\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_9(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_9.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '18';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '234';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '225';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '234';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":277,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:31:29.000Z","updated_at":"2026-03-27T11:38:56.000Z","published_at":"2015-06-25T03:31:29.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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 9.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 9. This can be done by the following method:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSum the digits of the number. As with methods for other numbers, this summing step can be applied recursively until a single-digit number results. If the resulting number is divisible by nine, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42410-divisible-by-8\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42412-divisible-by-10\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42408,"title":"Divisible by 6","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 6.\r\n\r\nWrite a function to determine if a number is divisible by 6. This can be done by checking for \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 divisibility by 2\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisibility by 3\u003e. If the number passes both tests, it is also divisible by 6.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5 divisible by 5\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7 divisible by 7\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 6.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 6. This can be done by checking for \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003edivisibility by 2\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisibility by 3\u003c/a\u003e. If the number passes both tests, it is also divisible by 6.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\"\u003edivisible by 5\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\"\u003edivisible by 7\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_6(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_6.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '1236126';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_6(n_str),1))%\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '223';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":332,"test_suite_updated_at":"2015-06-25T03:14:53.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:46:24.000Z","updated_at":"2026-03-24T12:51:01.000Z","published_at":"2015-06-25T02:46:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 6. This can be done by checking for\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/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. If the number passes both tests, it is also divisible by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42407-divisible-by-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42409-divisible-by-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42417,"title":"Divisible by 15","description":"Write a function to determine if a number is divisible by 15. If a number is \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisible by 3\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5 divisible by 5\u003e, then it is divisible by 15.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14 divisible by 14\u003e. Next problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16 divisible by 16\u003e.\r\n","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 15. If a number is \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisible by 3\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\"\u003edivisible by 5\u003c/a\u003e, then it is divisible by 15.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14\"\u003edivisible by 14\u003c/a\u003e. Next problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16\"\u003edivisible by 16\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_15(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_15.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '15';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '225';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '211';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '210';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '1236120';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922790';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '210';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\nend\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":221,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T01:58:40.000Z","updated_at":"2026-03-27T16:43:11.000Z","published_at":"2015-06-26T01:58:40.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 to determine if a number is divisible by 15. If a number is\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, then it is divisible by 15.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42416-divisible-by-14\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 14\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem\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/42418-divisible-by-16\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 16\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42406,"title":"Divisible by 4","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 4.\r\n\r\nWrite a function to determine if a number is divisible by 4. This can be checked by a few slightly different methods:\r\n\r\n# Check the last two digits for divisibility by four.\r\n# From the \u003chttps://en.wikipedia.org/wiki/Divisibility_rule wikipedia reference page\u003e: \"If the tens digit is even, the ones digit must be 0, 4, or 8.\r\nIf the tens digit is odd, the ones digit must be 2 or 6.\"\r\n# Check the following sum for divisibility by four: twice the tens digit plus the ones digit.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisible by 3\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5 divisible by 5\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 4.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 4. This can be checked by a few slightly different methods:\u003c/p\u003e\u003col\u003e\u003cli\u003eCheck the last two digits for divisibility by four.\u003c/li\u003e\u003cli\u003eFrom the \u003ca href = \"https://en.wikipedia.org/wiki/Divisibility_rule\"\u003ewikipedia reference page\u003c/a\u003e: \"If the tens digit is even, the ones digit must be 0, 4, or 8.\r\nIf the tens digit is odd, the ones digit must be 2 or 6.\"\u003c/li\u003e\u003cli\u003eCheck the following sum for divisibility by four: twice the tens digit plus the ones digit.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisible by 3\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\"\u003edivisible by 5\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_4(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_4.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '1236127';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '232';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\nend","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":373,"test_suite_updated_at":"2015-06-25T03:13:44.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:35:16.000Z","updated_at":"2026-03-24T10:06:27.000Z","published_at":"2015-06-25T02:35:16.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 4.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 4. This can be checked by a few slightly different methods:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck the last two digits for divisibility by four.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFrom 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/Divisibility_rule\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia reference page\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e: \\\"If the tens digit is even, the ones digit must be 0, 4, or 8.If the tens digit is odd, the ones digit must be 2 or 6.\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck the following sum for divisibility by four: twice the tens digit plus the ones digit.\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\u003ePrevious problem:\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42407-divisible-by-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42509,"title":"Divisible by n, Truncated-number Divisors","description":"Some divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Examples include 25, 32, 50, 64, 75, 100, 125, 128, 256, and 512. Notice that this list includes some prime-power divisors (e.g, 25 = 5^2, 32 = 2^5, 125 = 5^3, etc.). Write a function to determine if a given number, provided as a string (n_str), is divisible by the provided divisor. See the test suite for examples and rules for these simple divisors below:\r\n\r\n* 25: The last two digits must be divisible by 25.\r\n* 32: The last five digits must be divisible by 32.\r\n* 50: The last two digits must be 00 or 50.\r\n* 64: The last six digits must be divisible by 64.\r\n* 75: The number must be divisible by 3 (can be done by a \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 simple sum\u003e) and end in 00, 25, 50, or 75 (last two digits divisible by 25). \r\n* 100: The last two digits must be 00.\r\n* 125: The last three digits must be divisible by 125.\r\n* 128: The last seven digits must be divisible by 128.\r\n* 256: The last eight digits must be divisible by 256.\r\n* 512: The last nine digits must be divisible by 512.\r\n\r\nThe only restriction that remains is Java.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200 Divisible by n, prime divisors from 20 to 200\u003e. Next problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42510-divisible-by-n-composite-divisors Divisible by n, Composite Divisors\u003e.","description_html":"\u003cp\u003eSome divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Examples include 25, 32, 50, 64, 75, 100, 125, 128, 256, and 512. Notice that this list includes some prime-power divisors (e.g, 25 = 5^2, 32 = 2^5, 125 = 5^3, etc.). Write a function to determine if a given number, provided as a string (n_str), is divisible by the provided divisor. See the test suite for examples and rules for these simple divisors below:\u003c/p\u003e\u003cul\u003e\u003cli\u003e25: The last two digits must be divisible by 25.\u003c/li\u003e\u003cli\u003e32: The last five digits must be divisible by 32.\u003c/li\u003e\u003cli\u003e50: The last two digits must be 00 or 50.\u003c/li\u003e\u003cli\u003e64: The last six digits must be divisible by 64.\u003c/li\u003e\u003cli\u003e75: The number must be divisible by 3 (can be done by a \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003esimple sum\u003c/a\u003e) and end in 00, 25, 50, or 75 (last two digits divisible by 25).\u003c/li\u003e\u003cli\u003e100: The last two digits must be 00.\u003c/li\u003e\u003cli\u003e125: The last three digits must be divisible by 125.\u003c/li\u003e\u003cli\u003e128: The last seven digits must be divisible by 128.\u003c/li\u003e\u003cli\u003e256: The last eight digits must be divisible by 256.\u003c/li\u003e\u003cli\u003e512: The last nine digits must be divisible by 512.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe only restriction that remains is Java.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200\"\u003eDivisible by n, prime divisors from 20 to 200\u003c/a\u003e. Next problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42510-divisible-by-n-composite-divisors\"\u003eDivisible by n, Composite Divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = truncated_number_divisors(n,n_str)\r\n\r\ntf = 1;\r\n\r\nend","test_suite":"%%\r\nfiletext = fileread('truncated_number_divisors.m');\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = 25;\r\nn_str = '123456789025';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 25;\r\nn_str = '1234567890250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 25;\r\nn_str = '1234567890250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 32;\r\nn_str = '213546116579874651316984601654958847098406516051320150408460840649084790870510201378465465046760406541654604601561065140637860373703970644065166540616510650165409684098049804165016510320540540645106056501650165709804650860466840650156106165028224';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 32;\r\nn_str = '213546116579874651316984601654958847098406516051320150408460840649084790870510201378465465046760406541654604601561065140637860373703970644065166540616510650165409684098049804165016510320540540645106056501650165709804650860466840650156106165028227';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 50;\r\nn_str = '15668045014654987098045406540500';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 50;\r\nn_str = '50440984098480149540561065106510516501615001';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 50;\r\nn_str = '50440984098480149540561065106510516501615001897241387234587503198417059813645097867234985672307485679813709582304957234897659832746098514949188412929894824924949334949777378994191995216173718811313515141418186186382171646871681436817897678350';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404996';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111489216';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111489217';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 75;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499175';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 75;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499275';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992750';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992700';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499200';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 125;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499200125';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 125;\r\nn_str = '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111489216';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 125;\r\nn_str = '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114892375';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 128;\r\nn_str = '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111148923751048576';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 128;\r\nn_str = '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111148923751048578';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 256;\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904049917516777216';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 256;\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904049917516777210';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 512;\r\nn_str = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000134217728';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 512;\r\nn_str = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000536870912';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 512;\r\nn_str = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000536870914';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":79,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-08-17T21:32:54.000Z","updated_at":"2026-01-11T10:42:54.000Z","published_at":"2015-08-17T21:32:54.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Examples include 25, 32, 50, 64, 75, 100, 125, 128, 256, and 512. Notice that this list includes some prime-power divisors (e.g, 25 = 5^2, 32 = 2^5, 125 = 5^3, etc.). Write a function to determine if a given number, provided as a string (n_str), is divisible by the provided divisor. See the test suite for examples and rules for these simple divisors below:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e25: The last two digits must be divisible by 25.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e32: The last five digits must be divisible by 32.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e50: The last two digits must be 00 or 50.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e64: The last six digits must be divisible by 64.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e75: The number must be divisible by 3 (can be done by a\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003esimple sum\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) and end in 00, 25, 50, or 75 (last two digits divisible by 25).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e100: The last two digits must be 00.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e125: The last three digits must be divisible by 125.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e128: The last seven digits must be divisible by 128.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e256: The last eight digits must be divisible by 256.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e512: The last nine digits must be divisible by 512.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe only restriction that remains is Java.\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\u003ePrevious problem:\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/42508-divisible-by-n-prime-divisors-from-20-to-200\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors from 20 to 200\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem\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/42510-divisible-by-n-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, Composite Divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42414,"title":"Divisible by 12","description":"Write a function to determine if a number is divisible by 12. Similar to the number six, this can be done by checking for divisibility of two numbers, in this case, \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisibility by 3\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4 divisibility by 4\u003e. If the number passes both tests, it is also divisible by 12.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11 divisible by 11\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13 divisible by 13\u003e.\r\n","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 12. Similar to the number six, this can be done by checking for divisibility of two numbers, in this case, \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisibility by 3\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\"\u003edivisibility by 4\u003c/a\u003e. If the number passes both tests, it is also divisible by 12.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11\"\u003edivisible by 11\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13\"\u003edivisible by 13\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_12(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_12.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '11';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '228';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '242';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '1236120';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922790';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '228';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":210,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:54:07.000Z","updated_at":"2026-03-27T16:47:41.000Z","published_at":"2015-06-25T03:54:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 12. Similar to the number six, this can be done by checking for divisibility of two numbers, in this case,\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. If the number passes both tests, it is also divisible by 12.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42413-divisible-by-11\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42415-divisible-by-13\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 13\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42410,"title":"Divisible by 8","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 8.\r\n\r\nWrite a function to determine if a number is divisible by 8. This can be done by the following method:\r\n\r\n# Check the last three digits for divisibility by eight. If that portion of the number is divisible by eight, then so is the original number. That three-digit number can be further reduced by summing four times the hundreds digit, two times the tens digit, and the ones digit. As with methods for other numbers, this factor/sum step can be applied recursively until a single-digit number results.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7 divisible by 7\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9 divisible by 9\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 8.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 8. This can be done by the following method:\u003c/p\u003e\u003col\u003e\u003cli\u003eCheck the last three digits for divisibility by eight. If that portion of the number is divisible by eight, then so is the original number. That three-digit number can be further reduced by summing four times the hundreds digit, two times the tens digit, and the ones digit. As with methods for other numbers, this factor/sum step can be applied recursively until a single-digit number results.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\"\u003edivisible by 7\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9\"\u003edivisible by 9\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_8(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_8.m');\r\n%assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '16';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '1236128';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_8(n_str),0))%\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '232';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '16';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":243,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:23:41.000Z","updated_at":"2026-03-27T11:43:47.000Z","published_at":"2015-06-25T03:23:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003eWrite a function to determine if a number is divisible by 8. This can be done by the following method:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck the last three digits for divisibility by eight. If that portion of the number is divisible by eight, then so is the original number. That three-digit number can be further reduced by summing four times the hundreds digit, two times the tens digit, and the ones digit. As with methods for other numbers, this factor/sum step can be applied recursively until a single-digit number results.\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\u003ePrevious problem:\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/42409-divisible-by-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42411-divisible-by-9\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 9\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42454,"title":"Divisible by n, prime divisors (including powers)","description":"For this problem, you will be provided an array of numbers (not necessarily in order). Return the array of numbers with only prime divisors (including prime powers) remaining in the array. For example:\r\n\r\n  n = 1:10;\r\n  n_p = [2 3 4 5 7 8 9];\r\n\r\nSince the prime numbers in the 1:10 range are 2, 3, 5, and 7, while the prime powers in this range are 4 (2^2), 8 (2^3), and 9 (3^2). (Ignore one, as it is a trivial case since all integers are divisible by one.) Therefore, you should return the array including both sets joined together and sorted, as shown in the example above.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors Divisible by n, prime vs. composite divisors\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19 Divisible by n, prime divisors - 11, 13, 17, \u0026 19\u003e.","description_html":"\u003cp\u003eFor this problem, you will be provided an array of numbers (not necessarily in order). Return the array of numbers with only prime divisors (including prime powers) remaining in the array. For example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003en = 1:10;\r\nn_p = [2 3 4 5 7 8 9];\r\n\u003c/pre\u003e\u003cp\u003eSince the prime numbers in the 1:10 range are 2, 3, 5, and 7, while the prime powers in this range are 4 (2^2), 8 (2^3), and 9 (3^2). (Ignore one, as it is a trivial case since all integers are divisible by one.) Therefore, you should return the array including both sets joined together and sorted, as shown in the example above.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\"\u003eDivisible by n, prime vs. composite divisors\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19\"\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026 19\u003c/a\u003e.\u003c/p\u003e","function_template":"function [n_p] = prime_divisors_incl_powers(n)\r\n\r\nn_p = 1;\r\n\r\nend","test_suite":"%%\r\nn = 1:10;\r\nn_p = [2 3 4 5 7 8 9]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = [2:7 12:17 10 42:55 11 19:29];\r\nn_p = [2 3 4 5 7 11 13 16 17 19 23 25 27 29 43 47 49 53]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 1:100;\r\nn_p = [2 3 4 5 7 8 9 11 13 16 17 19 23 25 27 29 31 32 37 41 43 47 49 53 59 61 64 67 71 73 79 81 83 89 97]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 41:59;\r\nn_p = [41 43 47 49 53 59]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 100:200;\r\nn_p = [101 103 107 109 113 121 125 127 128 131 137 139 149 151 157 163 167 169 173 179 181 191 193 197 199]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 1000:1111;\r\nn_p = [1009 1013 1019 1021 1024 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 1103 1109]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 1:10;\r\n\t\tn_p = [2 3 4 5 7 8 9]; %prime factors (including powers)\r\n\tcase 2\r\n\t\tn = 41:59;\r\n\t\tn_p = [41 43 47 49 53 59]; %prime factors (including powers)\r\n\tcase 3\r\n\t\tn = 1:100;\r\n\t\tn_p = [2 3 4 5 7 8 9 11 13 16 17 19 23 25 27 29 31 32 37 41 43 47 49 53 59 61 64 67 71 73 79 81 83 89 97]; %prime factors (including powers)\r\n\tcase 4\r\n\t\tn = [2:7 12:17 10 42:55 11 19:29];\r\n\t\tn_p = [2 3 4 5 7 11 13 16 17 19 23 25 27 29 43 47 49 53];\r\nend\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 1:100;\r\n\t\tn_p = [2 3 4 5 7 8 9 11 13 16 17 19 23 25 27 29 31 32 37 41 43 47 49 53 59 61 64 67 71 73 79 81 83 89 97]; %prime factors (including powers)\r\n\tcase 2\r\n\t\tn = [2:7 12:17 10 42:55 11 19:29];\r\n\t\tn_p = [2 3 4 5 7 11 13 16 17 19 23 25 27 29 43 47 49 53];\r\n\tcase 3\r\n\t\tn = 41:59;\r\n\t\tn_p = [41 43 47 49 53 59]; %prime factors (including powers)\r\n\tcase 4\r\n\t\tn = 1000:1111;\r\n\t\tn_p = [1009 1013 1019 1021 1024 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 1103 1109]; %prime factors (including powers)\r\nend\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":95,"test_suite_updated_at":"2017-03-20T19:03:08.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-07-09T01:55:28.000Z","updated_at":"2026-01-11T12:28:45.000Z","published_at":"2015-07-09T01:55:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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 this problem, you will be provided an array of numbers (not necessarily in order). Return the array of numbers with only prime divisors (including prime powers) remaining in the array. For example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[n = 1:10;\\nn_p = [2 3 4 5 7 8 9];]]\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\u003eSince the prime numbers in the 1:10 range are 2, 3, 5, and 7, while the prime powers in this range are 4 (2^2), 8 (2^3), and 9 (3^2). (Ignore one, as it is a trivial case since all integers are divisible by one.) Therefore, you should return the array including both sets joined together and sorted, as shown in the example above.\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\u003ePrevious problem:\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/42453-divisible-by-n-prime-vs-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime vs. composite divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42455-divisible-by-n-prime-divisors-11-13-17-19\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026amp; 19\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42413,"title":"Divisible by 11","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 11.\r\n\r\nWrite a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:\r\n\r\n# Form the alternating sum of the digits (e.g., positive even digits and negative odd digits). Apply recursively until a two-digit number results. If that result is divisible by 11, then so is the original number.\r\n# Add the digits of the number in blocks of two from right to left. Apply recursively, as needed, and check for divisibility as stated in the previous method.\r\n# Subtract the last digit from the remaining number (e.g., 649: 64 - 9 = 55). Apply recursion, as needed.\r\n# Add ten times the last digit to the remaining number. Apply recursion, as needed. For example: 737: 73 + 70 = 143: 14 + 30 = 44.\r\n# Etc.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10 divisible by 10\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12 divisible by 12\u003e.\r\n","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 11.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:\u003c/p\u003e\u003col\u003e\u003cli\u003eForm the alternating sum of the digits (e.g., positive even digits and negative odd digits). Apply recursively until a two-digit number results. If that result is divisible by 11, then so is the original number.\u003c/li\u003e\u003cli\u003eAdd the digits of the number in blocks of two from right to left. Apply recursively, as needed, and check for divisibility as stated in the previous method.\u003c/li\u003e\u003cli\u003eSubtract the last digit from the remaining number (e.g., 649: 64 - 9 = 55). Apply recursion, as needed.\u003c/li\u003e\u003cli\u003eAdd ten times the last digit to the remaining number. Apply recursion, as needed. For example: 737: 73 + 70 = 143: 14 + 30 = 44.\u003c/li\u003e\u003cli\u003eEtc.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10\"\u003edivisible by 10\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12\"\u003edivisible by 12\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_11(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_11.m');\r\n%assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\n%assert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '11';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '231';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '242';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '1236125';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567881';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922789';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567881';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '231';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '242';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":175,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:49:05.000Z","updated_at":"2025-12-29T20:09:06.000Z","published_at":"2015-06-25T03:49:05.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eForm the alternating sum of the digits (e.g., positive even digits and negative odd digits). Apply recursively until a two-digit number results. If that result is divisible by 11, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAdd the digits of the number in blocks of two from right to left. Apply recursively, as needed, and check for divisibility as stated in the previous method.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSubtract the last digit from the remaining number (e.g., 649: 64 - 9 = 55). Apply recursion, as needed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAdd ten times the last digit to the remaining number. Apply recursion, as needed. For example: 737: 73 + 70 = 143: 14 + 30 = 44.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEtc.\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\u003ePrevious problem:\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/42412-divisible-by-10\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42414-divisible-by-12\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42416,"title":"Divisible by 14","description":"Write a function to determine if a number is divisible by 14. If a number is \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 divisible by 2\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7 divisible by 7\u003e, then it is divisible by 14.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13 divisible by 13\u003e. Next problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15 divisible by 15\u003e.","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 14. If a number is \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003edivisible by 2\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\"\u003edivisible by 7\u003c/a\u003e, then it is divisible by 14.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13\"\u003edivisible by 13\u003c/a\u003e. Next problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15\"\u003edivisible by 15\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_14(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_14.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '14';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '210';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '1236130';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922799';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '210';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":153,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T01:47:26.000Z","updated_at":"2026-03-27T16:40:51.000Z","published_at":"2015-06-26T01:47:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 14. If a number is\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/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, then it is divisible by 14.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42415-divisible-by-13\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 13\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem\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/42417-divisible-by-15\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 15\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42418,"title":"Divisible by 16","description":"Write a function to determine if a number is divisible by 16. This can be done by a few different methods. Here are two:\r\n\r\n# If a number has four or more digits, take the last three digits. Add eight to it if the thousands digit in the original number is odd (zero if even). If this three-digit number is divisible by 16, so is the original number. The resulting number can also be reduced by the following method.\r\n# Take the last two digits and add them to four times the remaining number. Apply this method recursively until a two-digit number remains. As usual, if the resulting number is divisible by 16, then so is the original number.\r\n\r\nA few of the function restrictions have been lifted.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15 divisible by 15\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors divisible by n, prime vs. composite divisors\u003e.","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 16. This can be done by a few different methods. Here are two:\u003c/p\u003e\u003col\u003e\u003cli\u003eIf a number has four or more digits, take the last three digits. Add eight to it if the thousands digit in the original number is odd (zero if even). If this three-digit number is divisible by 16, so is the original number. The resulting number can also be reduced by the following method.\u003c/li\u003e\u003cli\u003eTake the last two digits and add them to four times the remaining number. Apply this method recursively until a two-digit number remains. As usual, if the resulting number is divisible by 16, then so is the original number.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eA few of the function restrictions have been lifted.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15\"\u003edivisible by 15\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\"\u003edivisible by n, prime vs. composite divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_16(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_16.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\n% assert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\n% assert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\n% assert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\n% assert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '16';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '208';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '210';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '1236128';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567888';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922784';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100112';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567888';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '208';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100112';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1236123';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567888';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":178,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T02:08:33.000Z","updated_at":"2026-03-31T13:28:32.000Z","published_at":"2015-06-26T02:08:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 16. This can be done by a few different methods. Here are two:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf a number has four or more digits, take the last three digits. Add eight to it if the thousands digit in the original number is odd (zero if even). If this three-digit number is divisible by 16, so is the original number. The resulting number can also be reduced by the following method.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake the last two digits and add them to four times the remaining number. Apply this method recursively until a two-digit number remains. As usual, if the resulting number is divisible by 16, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA few of the function restrictions have been lifted.\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\u003ePrevious problem:\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/42417-divisible-by-15\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 15\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42453-divisible-by-n-prime-vs-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by n, prime vs. composite divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42405,"title":"Divisible by 3","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 3.\r\n\r\nWrite a function to determine if a number is divisible by 3. This can be checked by at least two different methods:\r\n\r\n# Sum the digits in the number. If the resulting sum is divisible by 3, then so is the original number. This routine can be applied recursively until the resulting sum is a single digit.\r\n# From the \u003chttps://en.wikipedia.org/wiki/Divisibility_rule wikipedia reference page\u003e: \"Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number.\" If the resulting sum (absolute value) is a multiple of 3, then so is the original number.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 divisible by 2\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4 divisible by 4\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 3.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 3. This can be checked by at least two different methods:\u003c/p\u003e\u003col\u003e\u003cli\u003eSum the digits in the number. If the resulting sum is divisible by 3, then so is the original number. This routine can be applied recursively until the resulting sum is a single digit.\u003c/li\u003e\u003cli\u003eFrom the \u003ca href = \"https://en.wikipedia.org/wiki/Divisibility_rule\"\u003ewikipedia reference page\u003c/a\u003e: \"Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number.\" If the resulting sum (absolute value) is a multiple of 3, then so is the original number.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003edivisible by 2\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\"\u003edivisible by 4\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_3(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_3.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '1236127';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '1236127';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":12,"comments_count":7,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":429,"test_suite_updated_at":"2015-06-25T03:11:34.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:27:10.000Z","updated_at":"2026-03-24T12:40:53.000Z","published_at":"2015-06-25T02:27:10.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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 3. This can be checked by at least two different methods:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSum the digits in the number. If the resulting sum is divisible by 3, then so is the original number. This routine can be applied recursively until the resulting sum is a single digit.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFrom 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/Divisibility_rule\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia reference page\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e: \\\"Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number.\\\" If the resulting sum (absolute value) is a multiple of 3, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42406-divisible-by-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42510,"title":"Divisible by n, Composite Divisors","description":"Pursuant to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors Divisible by n, prime vs. composite divisors\u003e, this problem requires you to write a function that determines divisibility for a large number (n_str) when the divisor is a composite. As was required in that problem, you will need to formulate the highest-power factorization of the divisor. Divisibility of n_str can then be determined by testing against each highest-power factor. For simplicity, this problem is restricted to numbers that contain the following as highest-power factors: 2, 3, 4, 5, 8, 9, and 10, as these divisibility tests are trivial. Their rules are included briefly below, for reference.\r\n\r\nAs an example, a number is divisible by 30 if it is divisible by 2, 3, and 5, as those are the highest-power factors for 30. Likewise, a number is divisible by 36 if it is divisible by 4 and 9 (not 3), as those are its highest-power factors.\r\n\r\nThe only restriction that remains is Java.\r\n\r\n* Divisible by 2: if the last digit is divisible by 2.\r\n* Divisible by 3: if the sum of the number's digits (n_str) is divisible by 3. Apply iteratively, as necessary, to arrive at a single-digit number.\r\n* Divisible by 4: if the last two digits are divisible by 4.\r\n* Divisible by 5: if the last digit is a 0 or 5.\r\n* Divisible by 8: if the last three digits are divisible by 8.\r\n* Divisible by 9: if the sum of the number's digits (n_str) is divisible by 9. Apply iteratively, as necessary, to arrive at a single-digit number.\r\n* Divisible by 10: if the last digit is zero.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors Divisible by n, Truncated-number Divisors\u003e.","description_html":"\u003cp\u003ePursuant to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\"\u003eDivisible by n, prime vs. composite divisors\u003c/a\u003e, this problem requires you to write a function that determines divisibility for a large number (n_str) when the divisor is a composite. As was required in that problem, you will need to formulate the highest-power factorization of the divisor. Divisibility of n_str can then be determined by testing against each highest-power factor. For simplicity, this problem is restricted to numbers that contain the following as highest-power factors: 2, 3, 4, 5, 8, 9, and 10, as these divisibility tests are trivial. Their rules are included briefly below, for reference.\u003c/p\u003e\u003cp\u003eAs an example, a number is divisible by 30 if it is divisible by 2, 3, and 5, as those are the highest-power factors for 30. Likewise, a number is divisible by 36 if it is divisible by 4 and 9 (not 3), as those are its highest-power factors.\u003c/p\u003e\u003cp\u003eThe only restriction that remains is Java.\u003c/p\u003e\u003cul\u003e\u003cli\u003eDivisible by 2: if the last digit is divisible by 2.\u003c/li\u003e\u003cli\u003eDivisible by 3: if the sum of the number's digits (n_str) is divisible by 3. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/li\u003e\u003cli\u003eDivisible by 4: if the last two digits are divisible by 4.\u003c/li\u003e\u003cli\u003eDivisible by 5: if the last digit is a 0 or 5.\u003c/li\u003e\u003cli\u003eDivisible by 8: if the last three digits are divisible by 8.\u003c/li\u003e\u003cli\u003eDivisible by 9: if the sum of the number's digits (n_str) is divisible by 9. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/li\u003e\u003cli\u003eDivisible by 10: if the last digit is zero.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors\"\u003eDivisible by n, Truncated-number Divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = composite_divisors(n,n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('composite_divisors.m');\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = 18;\r\nn_str = '612220032';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '612220031';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '64268410079232';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '192805230237696';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '64268410079230';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '192805230237696000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '192805230237696000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 30;\r\nn_str = '64268410079230';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 30;\r\nn_str = '64268410079220';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 90;\r\nn_str = '47829690000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 90;\r\nn_str = '47829690000001';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '101559956668416';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '101559956668417';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '3046798700052480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '3046798700052480000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '262144000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '262144000000008';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '52428800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '52428800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '4586471424';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '45864714247';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '26418075402240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '26418075402240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":76,"test_suite_updated_at":"2015-08-18T17:06:20.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-08-18T01:06:51.000Z","updated_at":"2026-01-11T11:13:47.000Z","published_at":"2015-08-18T01:06:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003ePursuant to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime vs. composite divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, this problem requires you to write a function that determines divisibility for a large number (n_str) when the divisor is a composite. As was required in that problem, you will need to formulate the highest-power factorization of the divisor. Divisibility of n_str can then be determined by testing against each highest-power factor. For simplicity, this problem is restricted to numbers that contain the following as highest-power factors: 2, 3, 4, 5, 8, 9, and 10, as these divisibility tests are trivial. Their rules are included briefly below, for reference.\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\u003eAs an example, a number is divisible by 30 if it is divisible by 2, 3, and 5, as those are the highest-power factors for 30. Likewise, a number is divisible by 36 if it is divisible by 4 and 9 (not 3), as those are its highest-power factors.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe only restriction that remains is Java.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 2: if the last digit is divisible by 2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 3: if the sum of the number's digits (n_str) is divisible by 3. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 4: if the last two digits are divisible by 4.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 5: if the last digit is a 0 or 5.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 8: if the last three digits are divisible by 8.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 9: if the sum of the number's digits (n_str) is divisible by 9. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 10: if the last digit is 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42509-divisible-by-n-truncated-number-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, Truncated-number Divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42453,"title":"Divisible by n, prime vs. composite divisors","description":"In general, there are two types of divisibility checks; the first involves composite divisors and the second prime divisors, including powers of prime numbers (technically composite divisors, though they often function similar to prime numbers for the sake of divisibility). We'll get into the specifics of the two divisibility check types in subsequent problems. For now, we'll segregate numbers into three groups, based on type (n_type) while also returning the number's highest-power factorization (hpf). Write a function to return these two variables for a given number; see the following examples for reference:\r\n\r\n  n = 11  |  n_type = 1 (prime)        |  hpf = [11]\r\n  n = 31  |  n_type = 1 (prime)        |  hpf = [31]\r\n  n = 9   |  n_type = 2 (prime power)  |  hpf = [9] (3^2)\r\n  n = 32  |  n_type = 2 (prime power)  |  hpf = [32] (2^5)\r\n  n = 49  |  n_type = 2 (prime power)  |  hpf = [49] (7^2)\r\n  n = 21  |  n_type = 3 (composite)    |  hpf = [3,7]\r\n  n = 39  |  n_type = 3 (composite)    |  hpf = [3,13]\r\n  n = 42  |  n_type = 3 (composite)    |  hpf = [2,3,7]\r\n  n = 63  |  n_type = 3 (composite)    |  hpf = [9,7] ([3^2,7])\r\n  n = 90  |  n_type = 3 (composite)    |  hpf = [2,9,5] ([2,3^2,5])\r\n\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16 divisible by 16\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers Divisible by n, prime divisors (including powers)\u003e.","description_html":"\u003cp\u003eIn general, there are two types of divisibility checks; the first involves composite divisors and the second prime divisors, including powers of prime numbers (technically composite divisors, though they often function similar to prime numbers for the sake of divisibility). We'll get into the specifics of the two divisibility check types in subsequent problems. For now, we'll segregate numbers into three groups, based on type (n_type) while also returning the number's highest-power factorization (hpf). Write a function to return these two variables for a given number; see the following examples for reference:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003en = 11  |  n_type = 1 (prime)        |  hpf = [11]\r\nn = 31  |  n_type = 1 (prime)        |  hpf = [31]\r\nn = 9   |  n_type = 2 (prime power)  |  hpf = [9] (3^2)\r\nn = 32  |  n_type = 2 (prime power)  |  hpf = [32] (2^5)\r\nn = 49  |  n_type = 2 (prime power)  |  hpf = [49] (7^2)\r\nn = 21  |  n_type = 3 (composite)    |  hpf = [3,7]\r\nn = 39  |  n_type = 3 (composite)    |  hpf = [3,13]\r\nn = 42  |  n_type = 3 (composite)    |  hpf = [2,3,7]\r\nn = 63  |  n_type = 3 (composite)    |  hpf = [9,7] ([3^2,7])\r\nn = 90  |  n_type = 3 (composite)    |  hpf = [2,9,5] ([2,3^2,5])\r\n\u003c/pre\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16\"\u003edivisible by 16\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers\"\u003eDivisible by n, prime divisors (including powers)\u003c/a\u003e.\u003c/p\u003e","function_template":"function [n_type,hpf] = composite_vs_prime_divisor(n)\r\n\r\nn_type = 1;\r\nhpf = [1];\r\n\r\nend\r\n","test_suite":"%%\r\nn = 5;\r\ntf_corr = 1; %prime factor\r\nhpf_corr = 5;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 7;\r\ntf_corr = 1; %prime factor\r\nhpf_corr = 7;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 15;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [3,5];\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 25;\r\ntf_corr = 2; %composite factor, prime power (5^2)\r\nhpf_corr = 25;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 125;\r\ntf_corr = 2; %composite factor, prime power (5^3)\r\nhpf_corr = 125;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 20;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [4,5];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 42;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [2,3,7];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 18;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [2,9];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 29;\r\ntf_corr = 1; %prime factor\r\nhpf_corr = 29;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 39;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [3,13];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 64;\r\ntf_corr = 2; %composite factor, prime power (2^6)\r\nhpf_corr = 64;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 27;\r\ntf_corr = 2; %composite factor, prime power (3^3)\r\nhpf_corr = 27;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 29;\r\n\t\ttf_corr = 1; %prime factor\r\n\t\thpf_corr = 29;\r\n\tcase 2\r\n\t\tn = 42;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,3,7];\r\n\tcase 3\r\n\t\tn = 18;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,9];\r\n\tcase 4\r\n\t\tn = 42;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,3,7];\r\nend\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 64;\r\n\t\ttf_corr = 2; %composite factor, prime power (2^6)\r\n\t\thpf_corr = 64;\r\n\tcase 2\r\n\t\tn = 27;\r\n\t\ttf_corr = 2; %composite factor, prime power (3^3)\r\n\t\thpf_corr = 27;\r\n\tcase 3\r\n\t\tn = 42;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,3,7];\r\n\tcase 4\r\n\t\tn = 18;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,9];\r\nend\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 39;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [3,13];\r\n\tcase 2\r\n\t\tn = 5;\r\n\t\ttf_corr = 1; %prime factor\r\n\t\thpf_corr = 5;\r\n\tcase 3\r\n\t\tn = 18;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,9];\r\n\tcase 4\r\n\t\tn = 27;\r\n\t\ttf_corr = 2; %composite factor, prime power (3^3)\r\n\t\thpf_corr = 27;\r\nend\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":113,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-07-09T01:29:13.000Z","updated_at":"2026-01-11T11:07:59.000Z","published_at":"2015-07-09T01:29:13.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\u003eIn general, there are two types of divisibility checks; the first involves composite divisors and the second prime divisors, including powers of prime numbers (technically composite divisors, though they often function similar to prime numbers for the sake of divisibility). We'll get into the specifics of the two divisibility check types in subsequent problems. For now, we'll segregate numbers into three groups, based on type (n_type) while also returning the number's highest-power factorization (hpf). Write a function to return these two variables for a given number; see the following examples for reference:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[n = 11  |  n_type = 1 (prime)        |  hpf = [11]\\nn = 31  |  n_type = 1 (prime)        |  hpf = [31]\\nn = 9   |  n_type = 2 (prime power)  |  hpf = [9] (3^2)\\nn = 32  |  n_type = 2 (prime power)  |  hpf = [32] (2^5)\\nn = 49  |  n_type = 2 (prime power)  |  hpf = [49] (7^2)\\nn = 21  |  n_type = 3 (composite)    |  hpf = [3,7]\\nn = 39  |  n_type = 3 (composite)    |  hpf = [3,13]\\nn = 42  |  n_type = 3 (composite)    |  hpf = [2,3,7]\\nn = 63  |  n_type = 3 (composite)    |  hpf = [9,7] ([3^2,7])\\nn = 90  |  n_type = 3 (composite)    |  hpf = [2,9,5] ([2,3^2,5])]]\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\u003ePrevious problem:\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/42418-divisible-by-16\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 16\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42454-divisible-by-n-prime-divisors-including-powers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors (including powers)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":563,"title":"How to add?","description":"* Imagine you are in 2222 Anno Domini, when everyone must learn how to add,\r\n* and competing for the highly prestigious post of,\r\n* Chief Comptroller of Dda Corporation.\r\n* You are being tested via \u003chttp://www.mathworks.com/matlabcentral/cody MATLAB Cody\u003e for addition of two positive integers X and Y,\r\n* both are fortunately in decimal system, and only a few dozen digits or less, \r\n* and delivered as ASCII strings.\r\n* Please output the result Z in similar style.\r\n* Please adopt a general strategy, as X and Y may be changed later.\r\n* Please rename the function Z = dda(X,Y).\r\n* Function Template:\r\n    \r\n  function Z = dda(X,Y)\r\n     X='98765432109876543210987654321098765432109876543210987654321'\r\n     Y='98765432109876543210987654321098765432109876543210987654321'\r\n     Z='197530864219753086421975308642197530864219753086421975308642';\r\n  end\r\n","description_html":"\u003cul\u003e\u003cli\u003eImagine you are in 2222 Anno Domini, when everyone must learn how to add,\u003c/li\u003e\u003cli\u003eand competing for the highly prestigious post of,\u003c/li\u003e\u003cli\u003eChief Comptroller of Dda Corporation.\u003c/li\u003e\u003cli\u003eYou are being tested via \u003ca href=\"http://www.mathworks.com/matlabcentral/cody\"\u003eMATLAB Cody\u003c/a\u003e for addition of two positive integers X and Y,\u003c/li\u003e\u003cli\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\u003c/li\u003e\u003cli\u003eand delivered as ASCII strings.\u003c/li\u003e\u003cli\u003ePlease output the result Z in similar style.\u003c/li\u003e\u003cli\u003ePlease adopt a general strategy, as X and Y may be changed later.\u003c/li\u003e\u003cli\u003ePlease rename the function Z = dda(X,Y).\u003c/li\u003e\u003cli\u003eFunction Template:\u003c/li\u003e\u003c/ul\u003e\u003cpre class=\"language-matlab\"\u003efunction Z = dda(X,Y)\r\n   X='98765432109876543210987654321098765432109876543210987654321'\r\n   Y='98765432109876543210987654321098765432109876543210987654321'\r\n   Z='197530864219753086421975308642197530864219753086421975308642';\r\nend\r\n\u003c/pre\u003e","function_template":"function Z = dda(X,Y)\r\n   X='98765432109876543210987654321098765432109876543210987654321';\r\n   Y='98765432109876543210987654321098765432109876543210987654321';\r\n   Z='197530864219753086421975308642197530864219753086421975308642';\r\nend\r\n","test_suite":"%%\r\nX='98765432109876543210987654321098765432109876543210987654321';\r\nY='98765432109876543210987654321098765432109876543210987654321';\r\nZ='197530864219753086421975308642197530864219753086421975308642';\r\nassert(isequal(dda(X,Y),Z))\r\n\r\n%%\r\nX='6546468768680988454345';\r\nY='5757557542432424209808098908085353545657657';\r\nZ='5757557542432424209814645376854034534112002';\r\nassert(isequal(dda(X,Y),Z))\r\n\r\n%%\r\nX='122';\r\nY='323';\r\nZ='445';\r\nassert(isequal(dda(X,Y),Z))\r\n\r\n%%\r\nX='767678686868667868635435353545';\r\nY='465464643244242424249787979';\r\nZ='768144151511912111059685141524';\r\nassert(isequal(dda(X,Y),Z))\r\n","published":true,"deleted":false,"likes_count":9,"comments_count":3,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":156,"test_suite_updated_at":"2012-04-08T02:09:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-04-08T02:09:11.000Z","updated_at":"2026-01-14T15:36:10.000Z","published_at":"2012-04-08T02:09:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImagine you are in 2222 Anno Domini, when everyone must learn how to add,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eand competing for the highly prestigious post of,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eChief Comptroller of Dda Corporation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are being tested via\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMATLAB Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for addition of two positive integers X and Y,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eand delivered as ASCII strings.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease output the result Z in similar style.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease adopt a general strategy, as X and Y may be changed later.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease rename the function Z = dda(X,Y).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFunction Template:\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[function Z = dda(X,Y)\\n   X='98765432109876543210987654321098765432109876543210987654321'\\n   Y='98765432109876543210987654321098765432109876543210987654321'\\n   Z='197530864219753086421975308642197530864219753086421975308642';\\nend]]\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":42415,"title":"Divisible by 13","description":"Write a function to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:\r\n\r\n# Form the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.\r\n# Add four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.\r\n# Similar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.\r\n\r\nSome of the function restrictions have been lifted.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12 divisible by 12\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14 divisible by 14\u003e.","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:\u003c/p\u003e\u003col\u003e\u003cli\u003eForm the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.\u003c/li\u003e\u003cli\u003eAdd four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.\u003c/li\u003e\u003cli\u003eSimilar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eSome of the function restrictions have been lifted.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12\"\u003edivisible by 12\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14\"\u003edivisible by 14\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_13(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_13.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\n% assert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\n% assert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '228';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '221';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '1236131';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922799';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001007';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '221';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001007';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '228';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":157,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T01:40:22.000Z","updated_at":"2025-12-24T20:24:26.000Z","published_at":"2015-06-26T01:40:22.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 to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eForm the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAdd four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome of the function restrictions have been lifted.\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\u003ePrevious problem:\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/42414-divisible-by-12\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42416-divisible-by-14\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 14\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3077,"title":"Big numbers, least significant digits","description":"Given two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number of digits in x. Keep in mind that the n values in the examples are small, however the test suite values may be much larger. Also, any leading zeros in the final answer should be discounted (If d = 2 and the number ends in 01, just report 1) \r\n\r\nExample #1:\r\n\r\n* x = 23 (therefore d = 2)\r\n* n = 2;\r\n* 23^2 = 529;\r\n* function will return 29\r\n\r\nExample #2:\r\n\r\n* x = 123; (therefore d = 3)\r\n* n = 3;\r\n* 123^3 = 1860867;\r\n* function should return 867","description_html":"\u003cp\u003eGiven two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number of digits in x. Keep in mind that the n values in the examples are small, however the test suite values may be much larger. Also, any leading zeros in the final answer should be discounted (If d = 2 and the number ends in 01, just report 1)\u003c/p\u003e\u003cp\u003eExample #1:\u003c/p\u003e\u003cul\u003e\u003cli\u003ex = 23 (therefore d = 2)\u003c/li\u003e\u003cli\u003en = 2;\u003c/li\u003e\u003cli\u003e23^2 = 529;\u003c/li\u003e\u003cli\u003efunction will return 29\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExample #2:\u003c/p\u003e\u003cul\u003e\u003cli\u003ex = 123; (therefore d = 3)\u003c/li\u003e\u003cli\u003en = 3;\u003c/li\u003e\u003cli\u003e123^3 = 1860867;\u003c/li\u003e\u003cli\u003efunction should return 867\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = findLeastInBig(x,n)\r\n  y = x + n;\r\nend","test_suite":"%%\r\nx = 23;\r\nn = 2\r\ny_correct = 29;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 123;\r\nn = 3;\r\ny_correct = 867;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 9876;\r\nn = 1024;\r\ny_correct = 1376;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 1234;\r\nn = 45;\r\ny_correct = 7824;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 201;\r\nn = 100;\r\ny_correct = 1;\r\nassert(isequal(findLeastInBig(x,n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":3096,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":106,"test_suite_updated_at":"2015-03-13T13:02:34.000Z","rescore_all_solutions":false,"group_id":45,"created_at":"2015-03-12T15:02:27.000Z","updated_at":"2026-01-15T14:46:42.000Z","published_at":"2015-03-12T15:03: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\u003eGiven two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number of digits in x. Keep in mind that the n values in the examples are small, however the test suite values may be much larger. Also, any leading zeros in the final answer should be discounted (If d = 2 and the number ends in 01, just report 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\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = 23 (therefore d = 2)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 2;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e23^2 = 529;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efunction will return 29\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = 123; (therefore d = 3)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 3;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e123^3 = 1860867;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efunction should return 867\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":42409,"title":"Divisible by 7","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 7.\r\n\r\nWrite a function to determine if a number is divisible by 7. This can be done by a variety of methods. Some are:\r\n\r\n# Multiply each digit in the candidate number (from right to left) by the digit in the corresponding position in this pattern: 1, 3, 2, -1, -3, -2 (1 applies to the ones digit, 3 to the tens digit, etc.). This pattern should be repeated beyond the hundred-thousands digit. The resulting sum will be a smaller number. This method can be applied recursively to the absolute values of the resulting sum until a single digit results. Then, check that number for divisibility by seven.\r\n# The previous method can also be used applying a slightly different pattern: 1, 3, 2, 6, 4, 5 (1 applies to the ones digit again, etc.). The absolute value of the resulting sum is not necessary as none of the factors are negative.\r\n# Multiply the last (ones) digit by two and subtract the result from the remaining number. Apply recursively, as noted in methods above.\r\n# Similar to the previous method, multiply the last digit by five and add to the remaining number. Apply recursively, as noted in methods above.\r\n# Double the last digit and subtract it from the remaining number (original number except for the ones digit). Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\r\n# Similar to the previous method, multiply the ones digit by five and add it to the remaining number. Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\r\n# Along similar lines, take the last three digits of the number and subtract that number from the remaining number. Once you reach a number less than 1000, another method can be applied to further reduce the number to check for divisibility by seven.\r\n# Etc. (there are others)\r\n\r\nThe restriction for multiplication has been lifted for this specific problem.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42408-divisible-by-6 divisible by 6\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8 divisible by 8\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 7.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 7. This can be done by a variety of methods. Some are:\u003c/p\u003e\u003col\u003e\u003cli\u003eMultiply each digit in the candidate number (from right to left) by the digit in the corresponding position in this pattern: 1, 3, 2, -1, -3, -2 (1 applies to the ones digit, 3 to the tens digit, etc.). This pattern should be repeated beyond the hundred-thousands digit. The resulting sum will be a smaller number. This method can be applied recursively to the absolute values of the resulting sum until a single digit results. Then, check that number for divisibility by seven.\u003c/li\u003e\u003cli\u003eThe previous method can also be used applying a slightly different pattern: 1, 3, 2, 6, 4, 5 (1 applies to the ones digit again, etc.). The absolute value of the resulting sum is not necessary as none of the factors are negative.\u003c/li\u003e\u003cli\u003eMultiply the last (ones) digit by two and subtract the result from the remaining number. Apply recursively, as noted in methods above.\u003c/li\u003e\u003cli\u003eSimilar to the previous method, multiply the last digit by five and add to the remaining number. Apply recursively, as noted in methods above.\u003c/li\u003e\u003cli\u003eDouble the last digit and subtract it from the remaining number (original number except for the ones digit). Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/li\u003e\u003cli\u003eSimilar to the previous method, multiply the ones digit by five and add it to the remaining number. Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/li\u003e\u003cli\u003eAlong similar lines, take the last three digits of the number and subtract that number from the remaining number. Once you reach a number less than 1000, another method can be applied to further reduce the number to check for divisibility by seven.\u003c/li\u003e\u003cli\u003eEtc. (there are others)\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eThe restriction for multiplication has been lifted for this specific problem.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42408-divisible-by-6\"\u003edivisible by 6\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8\"\u003edivisible by 8\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_7(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_7.m');\r\n%assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '14';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '231';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '14';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '231';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '224';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1236123';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":2,"comments_count":5,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":183,"test_suite_updated_at":"2015-06-25T03:15:21.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:07:11.000Z","updated_at":"2025-12-29T13:23:25.000Z","published_at":"2015-06-25T03:07:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 7. This can be done by a variety of methods. Some are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMultiply each digit in the candidate number (from right to left) by the digit in the corresponding position in this pattern: 1, 3, 2, -1, -3, -2 (1 applies to the ones digit, 3 to the tens digit, etc.). This pattern should be repeated beyond the hundred-thousands digit. The resulting sum will be a smaller number. This method can be applied recursively to the absolute values of the resulting sum until a single digit results. Then, check that number for divisibility by seven.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe previous method can also be used applying a slightly different pattern: 1, 3, 2, 6, 4, 5 (1 applies to the ones digit again, etc.). The absolute value of the resulting sum is not necessary as none of the factors are negative.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMultiply the last (ones) digit by two and subtract the result from the remaining number. Apply recursively, as noted in methods above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous method, multiply the last digit by five and add to the remaining number. Apply recursively, as noted in methods above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDouble the last digit and subtract it from the remaining number (original number except for the ones digit). Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous method, multiply the ones digit by five and add it to the remaining number. Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAlong similar lines, take the last three digits of the number and subtract that number from the remaining number. Once you reach a number less than 1000, another method can be applied to further reduce the number to check for divisibility by seven.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEtc. (there are others)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe restriction for multiplication has been lifted for this specific problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42408-divisible-by-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42410-divisible-by-8\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42508,"title":"Divisible by n, prime divisors from 20 to 200","description":"Pursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers for any prime number from 20 to 200. Similar to the previous problem, these can all be checked using the same routine: add or subtract x times the last digit to or from the remaining number after removing that last digit. For example, for 127, the last-digit factor is -38:\r\n\r\n* 2048379: 204837 + -38*9 = 204495: 20449 + -38*5 = 20259: 2025 + -38*9 = 1683: 168 + -38*3 = 54 -\u003e 2048379 is not divisible by 127 since 54 is not divisible by 127.\r\n\r\n* 4853940: 485394 + -38*0 = 485394: 48539 + -38*4 = 48387: 4838 + -38*7 = 4572: 457 + -38*2 = 381: 38 + -38*1 = 0 -\u003e 4853940 is divisible by 127.\r\n\r\nYour function will be provided with the prime number, n, and the number to check for divisibility as a string, n_str. Write a function that returns true or false for each prime number and candidate number pair. See the test suite for more examples. The template function will include arrays of all possible prime number in the given range in addition to a paired array with the associated factors.\r\n\r\nRestrictions on Java, mod, ceil, round, and floor are still in effect.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19 Divisible by n, prime divisors - 11, 13, 17, \u0026 19\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors Divisible by n, Truncated-number Divisors\u003e.","description_html":"\u003cp\u003ePursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers for any prime number from 20 to 200. Similar to the previous problem, these can all be checked using the same routine: add or subtract x times the last digit to or from the remaining number after removing that last digit. For example, for 127, the last-digit factor is -38:\u003c/p\u003e\u003cul\u003e\u003cli\u003e2048379: 204837 + -38*9 = 204495: 20449 + -38*5 = 20259: 2025 + -38*9 = 1683: 168 + -38*3 = 54 -\u0026gt; 2048379 is not divisible by 127 since 54 is not divisible by 127.\u003c/li\u003e\u003c/ul\u003e\u003cul\u003e\u003cli\u003e4853940: 485394 + -38*0 = 485394: 48539 + -38*4 = 48387: 4838 + -38*7 = 4572: 457 + -38*2 = 381: 38 + -38*1 = 0 -\u0026gt; 4853940 is divisible by 127.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYour function will be provided with the prime number, n, and the number to check for divisibility as a string, n_str. Write a function that returns true or false for each prime number and candidate number pair. See the test suite for more examples. The template function will include arrays of all possible prime number in the given range in addition to a paired array with the associated factors.\u003c/p\u003e\u003cp\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19\"\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026 19\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors\"\u003eDivisible by n, Truncated-number Divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = prime_divisors_20_to_200(n,n_str)\r\n\r\np_digits =      [23 29  31 37  41 43  47 53 59 61 67  71 73 79 83 89 97  101 103 107 109 113 127 131 137 139  149  151 157 163  167 173  179  181 191 193  197 199];\r\nlast_dig_mult = [7  3  -3 -11 -4  13 -14 16 6 -6 -20 -7 -51 8  25 9 -29 -10 -72 -32 -98 -79 -38 -13 -41 -125 -134 -15 -47 -114 -50 -121 -161 -18 -19 -135 -59 -179];\r\n\r\ntf = 1;\r\n\r\nend","test_suite":"%%\r\nfiletext = fileread('prime_divisors_20_to_200.m');\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = 23;\r\nn_str = '943';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 23;\r\nn_str = '9430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 23;\r\nn_str = '9430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 29;\r\nn_str = '22649';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 31;\r\nn_str = '992';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 31;\r\nn_str = '9920000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 31;\r\nn_str = '9920000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 37;\r\nn_str = '4107';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 41;\r\nn_str = '33292';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 43;\r\nn_str = '85140';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 43;\r\nn_str = '851400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 43;\r\nn_str = '851400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 47;\r\nn_str = '232603';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 53;\r\nn_str = '148877';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 59;\r\nn_str = '12698688';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 61;\r\nn_str = '61965813';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 61;\r\nn_str = '619658130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 61;\r\nn_str = '619658130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 67;\r\nn_str = '22319844';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 71;\r\nn_str = '25411681';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 73;\r\nn_str = '328500';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 73;\r\nn_str = '32850000000000000000000000000000000000000000000000000000000000001000000000000';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 79;\r\nn_str = '41977440';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 83;\r\nn_str = '342873';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 89;\r\nn_str = '8900000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 97;\r\nn_str = '88529281';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 101;\r\nn_str = '104060401';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 101;\r\nn_str = '1040604010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 101;\r\nn_str = '1040604010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 103;\r\nn_str = '112550881';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 107;\r\nn_str = '515205';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 109;\r\nn_str = '141158161';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 113;\r\nn_str = '2151294';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 113;\r\nn_str = '2151294000000000000000000000000113000000000000000000000000113000000000000000000000000113000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 113;\r\nn_str = '2151294000000000000000000000000113000000000000000000000000113000000000000000000000000113000000000000000000000112';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 127;\r\nn_str = '4853940';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 131;\r\nn_str = '294499921';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 137;\r\nn_str = '249421241';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 139;\r\nn_str = '2685619';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 139;\r\nn_str = '268561900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013900000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 139;\r\nn_str = '268561900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013900000000000000000000000000000000000000000000000000000000000000000000000013';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 149;\r\nn_str = '512977200';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 151;\r\nn_str = '141160991';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 157;\r\nn_str = '607573201';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 163;\r\nn_str = '705911761';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 167;\r\nn_str = '777796321';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 173;\r\nn_str = '154963892093';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 179;\r\nn_str = '98682340334763';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 181;\r\nn_str = '35161828327081';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 191;\r\nn_str = '884089868985578';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 193;\r\nn_str = '1387488001';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 197;\r\nn_str = '27000544548887';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '328039798800';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '32803979880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '32803979880000000000000000000000000000000000000000000000000000000000000001990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001990000000000000000000000000000000000199000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '32803979880000000000000000000000000000000000000000000000000000000000000001991000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001990000000000000000000000000000000000199000000000000';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-08-17T19:05:44.000Z","updated_at":"2025-12-27T11:58:28.000Z","published_at":"2015-08-17T19:05:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers for any prime number from 20 to 200. Similar to the previous problem, these can all be checked using the same routine: add or subtract x times the last digit to or from the remaining number after removing that last digit. For example, for 127, the last-digit factor is -38:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2048379: 204837 + -38*9 = 204495: 20449 + -38*5 = 20259: 2025 + -38*9 = 1683: 168 + -38*3 = 54 -\u0026gt; 2048379 is not divisible by 127 since 54 is not divisible by 127.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4853940: 485394 + -38*0 = 485394: 48539 + -38*4 = 48387: 4838 + -38*7 = 4572: 457 + -38*2 = 381: 38 + -38*1 = 0 -\u0026gt; 4853940 is divisible by 127.\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 function will be provided with the prime number, n, and the number to check for divisibility as a string, n_str. Write a function that returns true or false for each prime number and candidate number pair. See the test suite for more examples. The template function will include arrays of all possible prime number in the given range in addition to a paired array with the associated factors.\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\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\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\u003ePrevious problem:\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/42455-divisible-by-n-prime-divisors-11-13-17-19\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026amp; 19\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42509-divisible-by-n-truncated-number-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, Truncated-number Divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44513,"title":"Add all the numbers between two limits (inclusive)","description":"In this problem you must add up \"all of the numbers\" between two specified limits, |a| and |b|, in which |a| ≤ |b|.  However, the practical interpretation of \"all of the numbers\" will depend upon the specified \u003chttps://au.mathworks.com/help/matlab/numeric-types.html data type\u003e, |dt|.  \r\n\r\nMathematically speaking, if |a| \u003c |b| then the required sum constitutes an _infinite series_ that does not converge (i.e. the required sum would be infinity).  For example, if |a=1| and |b=2| then we could capture _some_ of those numbers through the series \r\nlim n→∞  ⁿ∑ᵢ₌₁{1 + (1/i)} = lim n→∞ {n + ⁿ∑ᵢ₌₁(1/i)} ≈ lim n→∞ {n + γ + ln(n)}, using properties of the harmonic series in the last approximation.  \r\n\r\nBut MATLAB cannot represent numbers with _infinite_ precision.  In fact, the precision is determined by the specified \u003chttps://au.mathworks.com/help/matlab/numeric-types.html data type\u003e.  For instance, if |dt = 'single'|, then with |a=1| and |b=2| the summation would comprise the series {(1) + (1+1×2⁻²³) + (1+2×2⁻²³) + (1+3×2⁻²³) + ... + (2−2×2⁻²³) + (2−1×2⁻²³) + (2)} = 12582913.5, which is finite.  \r\n\r\nAnother example:\r\n\r\n % INPUT\r\n a = 10\r\n b = 12\r\n dt = 'int16'\r\n % OUTPUT\r\n s = 33         %  = 10 + 11 +12\r\n\r\nSo please add up all the numbers between two limits (inclusive), subject to the precision indicated by the specified \u003chttps://au.mathworks.com/help/matlab/numeric-types.html data type\u003e.  \r\n\r\n_NOTE *1*:  Terminal values |a| and |b| are whole numbers in every case (albeit implicitly defined as of the |double| data type);  they can be positive or negative.  However, values -1\u003cx\u003c+1 are never included in the summations._  \r\n\r\n_NOTE *2*:  All data types specified in the input |dt| shall be \u003chttps://au.mathworks.com/help/matlab/numeric-types.html numeric\u003e._ ","description_html":"\u003cp\u003eIn this problem you must add up \"all of the numbers\" between two specified limits, \u003ctt\u003ea\u003c/tt\u003e and \u003ctt\u003eb\u003c/tt\u003e, in which \u003ctt\u003ea\u003c/tt\u003e ≤ \u003ctt\u003eb\u003c/tt\u003e.  However, the practical interpretation of \"all of the numbers\" will depend upon the specified \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003edata type\u003c/a\u003e, \u003ctt\u003edt\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eMathematically speaking, if \u003ctt\u003ea\u003c/tt\u003e \u0026lt; \u003ctt\u003eb\u003c/tt\u003e then the required sum constitutes an \u003ci\u003einfinite series\u003c/i\u003e that does not converge (i.e. the required sum would be infinity).  For example, if \u003ctt\u003ea=1\u003c/tt\u003e and \u003ctt\u003eb=2\u003c/tt\u003e then we could capture \u003ci\u003esome\u003c/i\u003e of those numbers through the series \r\nlim n→∞  ⁿ∑ᵢ₌₁{1 + (1/i)} = lim n→∞ {n + ⁿ∑ᵢ₌₁(1/i)} ≈ lim n→∞ {n + γ + ln(n)}, using properties of the harmonic series in the last approximation.\u003c/p\u003e\u003cp\u003eBut MATLAB cannot represent numbers with \u003ci\u003einfinite\u003c/i\u003e precision.  In fact, the precision is determined by the specified \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003edata type\u003c/a\u003e.  For instance, if \u003ctt\u003edt = 'single'\u003c/tt\u003e, then with \u003ctt\u003ea=1\u003c/tt\u003e and \u003ctt\u003eb=2\u003c/tt\u003e the summation would comprise the series {(1) + (1+1×2⁻²³) + (1+2×2⁻²³) + (1+3×2⁻²³) + ... + (2−2×2⁻²³) + (2−1×2⁻²³) + (2)} = 12582913.5, which is finite.\u003c/p\u003e\u003cp\u003eAnother example:\u003c/p\u003e\u003cpre\u003e % INPUT\r\n a = 10\r\n b = 12\r\n dt = 'int16'\r\n % OUTPUT\r\n s = 33         %  = 10 + 11 +12\u003c/pre\u003e\u003cp\u003eSo please add up all the numbers between two limits (inclusive), subject to the precision indicated by the specified \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003edata type\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003ci\u003eNOTE \u003cb\u003e1\u003c/b\u003e:  Terminal values \u003ctt\u003ea\u003c/tt\u003e and \u003ctt\u003eb\u003c/tt\u003e are whole numbers in every case (albeit implicitly defined as of the \u003ctt\u003edouble\u003c/tt\u003e data type);  they can be positive or negative.  However, values -1\u0026lt;x\u0026lt;+1 are never included in the summations.\u003c/i\u003e\u003c/p\u003e\u003cp\u003e\u003ci\u003eNOTE \u003cb\u003e2\u003c/b\u003e:  All data types specified in the input \u003ctt\u003edt\u003c/tt\u003e shall be \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003enumeric\u003c/a\u003e.\u003c/i\u003e\u003c/p\u003e","function_template":"function s = summation(a, b, dt)\r\n    \r\nend","test_suite":"%%\r\na = 1;\r\nb = 2;\r\ndt = 'uint64';\r\ns_correct = 3;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\ndt = 'int8';\r\ns_correct = 3;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\ndt = 'single';\r\ns_correct = 12582913.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\ndt = 'double';\r\ns_correct = 6755399441055746;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'int32';\r\ns_correct = 5;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'uint16';\r\ns_correct = 5;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'single';\r\ns_correct = 10485762.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'double';\r\ns_correct = 5629499534213122;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'int64';\r\ns_correct = 9;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'uint8';\r\ns_correct = 9;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'single';\r\ns_correct = 9437188.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'double';\r\ns_correct = 5066549580791812;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'uint32';\r\ns_correct = 17;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'int16';\r\ns_correct = 17;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'single';\r\ns_correct = 8912904.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'double';\r\ns_correct = 4785074604081160;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 20;\r\nb = 22;\r\ndt = 'int32';\r\ns_correct = 63;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 20;\r\nb = 22;\r\ndt = 'double';\r\ns_correct = 11821949021847573;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 4 )\r\n\r\n%%\r\na = 20;\r\nb = 22;\r\ndt = 'single';\r\ns_correct = 22020117;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 4 )\r\n\r\n\r\n%%\r\na = 20;\r\nb = 30;\r\ndt = 'uint16';\r\ns_correct = 275;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 20;\r\nb = 30;\r\ndt = 'double';\r\ns_correct = 70368744177664025;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 32 )\r\n\r\n%%\r\na = 20;\r\nb = 30;\r\ndt = 'single';\r\ns_correct = 131072025;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 32 )\r\n\r\n\r\n%%\r\na = 1;\r\nb = 17;\r\ndt = 'uint8';\r\ns_correct = 153;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 1;\r\nb = 17;\r\ndt = 'double';\r\ns_correct = 105975328731561993;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 64 )\r\n\r\n%%\r\na = 1;\r\nb = 17;\r\ndt = 'single';\r\ns_correct = 197394441;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 64 )\r\n\r\n\r\n%%\r\na = -130;\r\nb = -126;\r\ndt = 'int32';\r\ns_correct = -640;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = -130;\r\nb = -126;\r\ndt = 'double';\r\ns_correct = -26951229020045440;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 16 )\r\n\r\n%%\r\na = -130;\r\nb = -126;\r\ndt = 'single';\r\ns_correct = -50200704;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 16 )\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-02-06T03:56:08.000Z","updated_at":"2018-02-06T14:46:13.000Z","published_at":"2018-02-06T14:39: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\u003eIn this problem you must add up \\\"all of the numbers\\\" between two specified limits,\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\u003ea\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, in which\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≤\u003c/w:t\u003e\u003c/w:r\u003e\u003cw: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\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. However, the practical interpretation of \\\"all of the numbers\\\" will depend upon the specified\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://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMathematically speaking, if\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\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u0026lt;\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\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e then the required sum constitutes an\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\u003einfinite series\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that does not converge (i.e. the required sum would be infinity). For example, if\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\u003ea=1\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb=2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e then we could capture\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\u003esome\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of those numbers through the series lim n→∞ ⁿ∑ᵢ₌₁{1 + (1/i)} = lim n→∞ {n + ⁿ∑ᵢ₌₁(1/i)} ≈ lim n→∞ {n + γ + ln(n)}, using properties of the harmonic series in the last approximation.\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\u003eBut MATLAB cannot represent numbers with\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\u003einfinite\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e precision. In fact, the precision is determined by the specified\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://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. For instance, if\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\u003edt = 'single'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, then with\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\u003ea=1\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb=2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e the summation would comprise the series {(1) + (1+1×2⁻²³) + (1+2×2⁻²³) + (1+3×2⁻²³) + ... + (2−2×2⁻²³) + (2−1×2⁻²³) + (2)} = 12582913.5, which is finite.\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\u003eAnother 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[ % INPUT\\n a = 10\\n b = 12\\n dt = 'int16'\\n % OUTPUT\\n s = 33         %  = 10 + 11 +12]]\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\u003eSo please add up all the numbers between two limits (inclusive), subject to the precision indicated by the specified\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://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNOTE\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e: Terminal values\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e are whole numbers in every case (albeit implicitly defined as of the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edouble\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e data type); they can be positive or negative. However, values -1\u0026lt;x\u0026lt;+1 are never included in the summations.\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:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNOTE\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e: All data types specified in the input\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e shall be\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enumeric\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\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":44695,"title":"What score did they give?","description":"Your task in this problem is to figure out the most recent score, |S|, submitted.  \r\n\r\n\u003c\u003chttps://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Star_rating_4.5_of_5.png/799px-Star_rating_4.5_of_5.png\u003e\u003e\r\n\r\nMany websites allow users to rate things like restaurants, books, films, and even computer programs.  Often these are rated _from one to five stars_, and the display shows the _average_ rating after _rounding to one decimal place_, |R|, and the number of users who have rated the item/place/thing, |N|.  \r\n\r\nThis morning you checked the website and noted |R| and |N|.  This evening you check again:  |N| has increased by one, and the rounded version of the updated overall rating is now displayed, |R_new|.  You then deduce what possible scores, |S|, were submitted by the additional person during the day.  \r\n\r\nEXAMPLE\r\n\r\n % Inputs\r\n N = 11\r\n R = 2.5\r\n R_new = 2.6\r\n % Output\r\n S = [3 4]\r\n\r\nExplanation:  Given |N|=11, the unrounded version of |R| must have been either 2 ⁵/₁₁ or 2 ⁶/₁₁. Increasing |N| by 1 with an additional score of either 4 stars or 3 stars (respectively) would mean that the unrounded version of |R_new| would become 2 ⁷/₁₂, consistent with the displayed value.  \r\n\r\n|S| shall be a row vector, or scalar, or empty.  If |S| is a row vector, scores shall be listed in ascending order, without repetition.  ","description_html":"\u003cp\u003eYour task in this problem is to figure out the most recent score, \u003ctt\u003eS\u003c/tt\u003e, submitted.\u003c/p\u003e\u003cimg src = \"https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Star_rating_4.5_of_5.png/799px-Star_rating_4.5_of_5.png\"\u003e\u003cp\u003eMany websites allow users to rate things like restaurants, books, films, and even computer programs.  Often these are rated \u003ci\u003efrom one to five stars\u003c/i\u003e, and the display shows the \u003ci\u003eaverage\u003c/i\u003e rating after \u003ci\u003erounding to one decimal place\u003c/i\u003e, \u003ctt\u003eR\u003c/tt\u003e, and the number of users who have rated the item/place/thing, \u003ctt\u003eN\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eThis morning you checked the website and noted \u003ctt\u003eR\u003c/tt\u003e and \u003ctt\u003eN\u003c/tt\u003e.  This evening you check again:  \u003ctt\u003eN\u003c/tt\u003e has increased by one, and the rounded version of the updated overall rating is now displayed, \u003ctt\u003eR_new\u003c/tt\u003e.  You then deduce what possible scores, \u003ctt\u003eS\u003c/tt\u003e, were submitted by the additional person during the day.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e % Inputs\r\n N = 11\r\n R = 2.5\r\n R_new = 2.6\r\n % Output\r\n S = [3 4]\u003c/pre\u003e\u003cp\u003eExplanation:  Given \u003ctt\u003eN\u003c/tt\u003e=11, the unrounded version of \u003ctt\u003eR\u003c/tt\u003e must have been either 2 ⁵/₁₁ or 2 ⁶/₁₁. Increasing \u003ctt\u003eN\u003c/tt\u003e by 1 with an additional score of either 4 stars or 3 stars (respectively) would mean that the unrounded version of \u003ctt\u003eR_new\u003c/tt\u003e would become 2 ⁷/₁₂, consistent with the displayed value.\u003c/p\u003e\u003cp\u003e\u003ctt\u003eS\u003c/tt\u003e shall be a row vector, or scalar, or empty.  If \u003ctt\u003eS\u003c/tt\u003e is a row vector, scores shall be listed in ascending order, without repetition.\u003c/p\u003e","function_template":"function S = latestScore(N, R, R_new)\r\n    \r\nend","test_suite":"%% No silly stuff\r\n% This Test Suite can be updated if inappropriate 'hacks' are discovered \r\n% in any submitted solutions, so your submission's status may therefore change over time.  \r\nassessFunctionAbsence({'regexp', 'regexpi', 'str2num'}, 'FileName','latestScore.m')\r\n\r\nRE = regexp(fileread('latestScore.m'), '\\w+', 'match');\r\ntabooWords = {'ans'};\r\ntestResult = cellfun( @(z) ismember(z, tabooWords), RE );\r\nmsg = ['Please do not do that in your code!' char([10 13]) ...\r\n    'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...\r\n    'Banned word.' char([10 13])];\r\nassert(~any( testResult ), msg)\r\n\r\n\r\n%% N = 11\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.2;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.3;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.4;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [2 3];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.6;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [3 4];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [4 5];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.8;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.9;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n\r\n\r\n%% N = 12\r\nN = 12;\r\nR = 2.3;\r\nR_new = 2.2;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 12;\r\nR = 2.3;\r\nR_new = 2.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [4 5];\r\nassert(isequal(S, S_correct))\r\n\r\n\r\n\r\n%% N = 17\r\nN = 17;\r\nR = 1.6;\r\nR_new = 1.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [2 3 4];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 2.6;\r\nR_new = 2.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 2.6;\r\nR_new = 2.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [3 4 5];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 2.6;\r\nR_new = 2.8;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 3.4;\r\nR_new = 3.2;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 3.4;\r\nR_new = 3.3;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2 3];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 3.4;\r\nR_new = 3.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n\r\n%% N = 48\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.5;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n\r\n%%\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.6;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.8;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.2;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:4;\r\nassert( isempty(S) )\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.3;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:4;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.4;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.5;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-07-09T03:13:05.000Z","updated_at":"2025-09-14T14:31:48.000Z","published_at":"2018-07-09T04:06:39.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.png\"}],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task in this problem is to figure out the most recent score,\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\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, submitted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMany websites allow users to rate things like restaurants, books, films, and even computer programs. Often these are rated\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\u003efrom one to five stars\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and the display shows the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eaverage\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e rating after\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\u003erounding to one decimal place\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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\u003eR\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and the number of users who have rated the item/place/thing,\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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis morning you checked the website and noted\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\u003eR\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. This evening you check again: \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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e has increased by one, and the rounded version of the updated overall rating is now displayed,\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\u003eR_new\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. You then deduce what possible scores,\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\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, were submitted by the additional person during the day.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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[ % Inputs\\n N = 11\\n R = 2.5\\n R_new = 2.6\\n % Output\\n S = [3 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExplanation: Given\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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e=11, the unrounded version of\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\u003eR\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e must have been either 2 ⁵/₁₁ or 2 ⁶/₁₁. Increasing\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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e by 1 with an additional score of either 4 stars or 3 stars (respectively) would mean that the unrounded version of\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\u003eR_new\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e would become 2 ⁷/₁₂, consistent with the displayed value.\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e shall be a row vector, or scalar, or empty. If\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\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a row vector, scores shall be listed in ascending order, without repetition.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAx8AAACqCAYAAADMS/L+AACAAElEQVR42uydB3gc1dX3r2xjegkOJRBIgASSkEoIIZB8SSBvyksK6QnJy0sCCc0Y4yLbalvVe7d6s2zLvYFteg8BUiGBF2I6BIipAuy1Jc33nzuzq9nRvTN3Zncl2Tr3ec4zq7aaOfPbc87/tmGMGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVqk7xpc0aNGrWJYI8aNeKOGjVq1NLfHrrqbPbn33yOaeQKapMqEV9jJuOryRfUxpG7JVQEUpsg9q4n7qiR6KU2Ndr/FZzObqz8LuAj+UFtcomP6QiIJ2hXsmnkDWrjxl0hywJ3x8NmkjeojRt3v+fiYxa4O1y7gvxBbRzZmwfLJj9QG9/2lwWfOei+eed/qOe6xVnkDWqTJyBex05EIo7iOIu8QW3cuJvNDgN3+bCPQ/hSozY+3P2OzQBzv4cA+Zb2W/IHtXHi7moueo/XbmCnIfZRozY+3F3O2I75p37q9kVfL8kPFx9BHqE2OcDMg81nF2kL2F8RFL+qBcgn1MaBuwLYXPYZsPcguPsNikDqkaGWee40swCczzZo81iZdg07iLxCbZzExzTEvF/BciA+DiCPUBsX7pBb35j//ivvyP/vvxQEw2e3LPo9OYXaJAAzjIC4gJVo2extJOMlWgUVgdTGgbsGPgXhN+DudRSCPdoimnpFbRy4W8C5O09byJ7G6/vw+ngUg9SoZZ69uewwMNcJuwXi42TyCLVx4W4eO2jX/ENX3By4+K38UPjKdXMuphqP2iQAM5udiGB4J0yDbcTX7yevUMs4d4t4Im4xufsHvv4oeYXaOMS76eBtDmwv7A2IkAv1xefUqGWUO32DgxvYqdp8xLqF7N94faEuhK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+caaIB52GoKPrAzgHV8UNUt7EZwTCZZuawsCU1k4EGB/CP6k9y+LS7LEw3gDDTbqxQcciQxMN9+LOUZZwn0ZUnY1Hby71wi8RPDRffch11gteGZmzCpGi1reovd0CN51M++KIT/RHcKMcALroPOmiN7dbrezPAi5iaafzQzeGSJa97aHpTvZI6Ep7ClviQCDgg8oQq2EptsVrTvvhc8wxhmyqBTNOFQkVo3uMfdiToYEH9OM7GepuO89gnezMyj4EE5gzwl8szMj+BBNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFE69r2/wGutU8LllhfnwAAAABJRU5ErkJggg==\"}]}"},{"id":1197,"title":"Numerical Integration","description":"Input\r\n\r\n* |x0|, a real number greater than 0\r\n\r\nOutput\r\n\r\n* |I|, a numerical estimate of the integral\r\n\r\n      x0\r\n      /\r\n  I = |  cosh(x) / sqrt(cosh(x0) - cosh(x)) dx\r\n      /\r\n      0\r\n\r\nExample:\r\n\r\n   x0=1.0  --\u003e  I = 2.6405789412796\r\n\r\n\r\nRemarks:\r\n\r\n* Aim at a relative precision better than 1e-10\r\n* The problem arises studying the frictionless movement of a mass point on a hanging wire, which follows the curve cosh(x).","description_html":"\u003cp\u003eInput\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ctt\u003ex0\u003c/tt\u003e, a real number greater than 0\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eOutput\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ctt\u003eI\u003c/tt\u003e, a numerical estimate of the integral\u003c/li\u003e\u003c/ul\u003e\u003cpre\u003e      x0\r\n      /\r\n  I = |  cosh(x) / sqrt(cosh(x0) - cosh(x)) dx\r\n      /\r\n      0\u003c/pre\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e   x0=1.0  --\u003e  I = 2.6405789412796\u003c/pre\u003e\u003cp\u003eRemarks:\u003c/p\u003e\u003cul\u003e\u003cli\u003eAim at a relative precision better than 1e-10\u003c/li\u003e\u003cli\u003eThe problem arises studying the frictionless movement of a mass point on a hanging wire, which follows the curve cosh(x).\u003c/li\u003e\u003c/ul\u003e","function_template":"function I = coshint(x0)\r\n  I = x0;\r\nend","test_suite":"%%\r\nx0 = 1;\r\nI_correct = 2.6405789412796;\r\nfprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\nassert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\n\r\n%%\r\nx0 = 2;\r\nI_correct = 3.9464053536380;\r\nfprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\nassert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\n\r\n%%\r\nx0 = 13;\r\nI_correct = 9.4065231838369e+02;\r\nfprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\nassert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\n\r\n%% randomized test for small values of x0 where \r\n % cosh(x) ~ 1 + x^2/2 + ...\r\n % and up to x0=1e-5 Integrating (analytically) the approximation is\r\n % accurate enough\r\nfor l=1:5\r\n   x0 = 1e-6 * (1+rand);\r\n   I_correct = pi*(4+x0^2)/4/sqrt(2);\r\n   fprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\n   assert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\nend","published":true,"deleted":false,"likes_count":1,"comments_count":9,"created_by":203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":106,"test_suite_updated_at":"2013-01-11T15:08:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-01-11T14:11:17.000Z","updated_at":"2026-03-13T22:59:58.000Z","published_at":"2013-01-11T15:08:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, a real number greater than 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eI\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, a numerical estimate of the integral\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[      x0\\n      /\\n  I = |  cosh(x) / sqrt(cosh(x0) - cosh(x)) dx\\n      /\\n      0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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[   x0=1.0  --\u003e  I = 2.6405789412796]]\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\u003eRemarks:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAim at a relative precision better than 1e-10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe problem arises studying the frictionless movement of a mass point on a hanging wire, which follows the curve cosh(x).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42455,"title":"Divisible by n, prime divisors - 11, 13, 17, \u0026 19","description":"Divisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:\r\n\r\n* 2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -\u003e 2392 is divisible by 13.\r\n\r\nFor 17, subtract five times the last digit from the rest:\r\n\r\n* 3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -\u003e 3281 is divisible by 17.\r\n\r\nFor 19, add two times the last digit to the rest:\r\n\r\n* 16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -\u003e 16863 is not divisible by 19.\r\n\r\nAnd, for 11, subtract the last digit from the rest:\r\n\r\n* 269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -\u003e 269830 is divisible by 11.\r\n\r\nWrite a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.\r\n\r\nRestrictions on Java, mod, ceil, round, and floor are still in effect.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers Divisible by n, prime divisors (including powers)\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200 Divisible by n, prime divisors from 20 to 200\u003e.","description_html":"\u003cp\u003eDivisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -\u0026gt; 2392 is divisible by 13.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor 17, subtract five times the last digit from the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -\u0026gt; 3281 is divisible by 17.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor 19, add two times the last digit to the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -\u0026gt; 16863 is not divisible by 19.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eAnd, for 11, subtract the last digit from the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -\u0026gt; 269830 is divisible by 11.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWrite a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.\u003c/p\u003e\u003cp\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers\"\u003eDivisible by n, prime divisors (including powers)\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200\"\u003eDivisible by n, prime divisors from 20 to 200\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = prime_divisors_11_to_20(n)\r\n\r\np_digits = [11 13 17 19];\r\ntf = zeros(1,4); %[11 13 17 19]\r\n\t\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('prime_divisors_11_to_20.m');\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = '143';\r\ntf = [1 1 0 0]; %[11 13 17 19]\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '187';\r\ntf = [1 0 1 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '221';\r\ntf = [0 1 1 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '247';\r\ntf = [0 1 0 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '46189';\r\ntf = [1 1 1 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '2133423721';\r\ntf = [1 1 1 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '233296158667';\r\ntf = [1 1 1 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '1011001000101010101010110101001010101001010101001001011010101000101010101010101010010101010010101010100101010101001100101010010101';\r\ntf = [0 0 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '1011001000101010101010110101001010101001010101001001011010101000101010101010101010010101010010101010100101010101001100101010010103';\r\ntf = [0 1 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '1011001000101010101010110101001010101001010101001001011010101000101010101010101010010101010010101010100101010101001100101010010107';\r\ntf = [0 0 0 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%\r\nn = '14300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = [1 1 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '14300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = [0 0 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '22100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = [0 1 1 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = '221';\r\n\t\ttf = [0 1 1 0];\r\n\tcase 2\r\n\t\tn = '233296158667';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 3\r\n\t\tn = '46189';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 4\r\n\t\tn = '247';\r\n\t\ttf = [0 1 0 1];\r\nend\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = '187';\r\n\t\ttf = [1 0 1 0];\r\n\tcase 2\r\n\t\tn = '143';\r\n\t\ttf = [1 1 0 0];\r\n\tcase 3\r\n\t\tn = '221';\r\n\t\ttf = [0 1 1 0];\r\n\tcase 4\r\n\t\tn = '233296158667';\r\n\t\ttf = [1 1 1 1];\r\nend\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = '2133423721';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 2\r\n\t\tn = '46189';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 3\r\n\t\tn = '187';\r\n\t\ttf = [1 0 1 0];\r\n\tcase 4\r\n\t\tn = '247';\r\n\t\ttf = [0 1 0 1];\r\nend\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-07-09T04:18:06.000Z","updated_at":"2025-12-28T20:47:42.000Z","published_at":"2015-07-09T04:18: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\u003eDivisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -\u0026gt; 2392 is divisible by 13.\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 17, subtract five times the last digit from the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -\u0026gt; 3281 is divisible by 17.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor 19, add two times the last digit to the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -\u0026gt; 16863 is not divisible by 19.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnd, for 11, subtract the last digit from the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -\u0026gt; 269830 is divisible by 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.\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\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\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\u003ePrevious problem:\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/42454-divisible-by-n-prime-divisors-including-powers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors (including powers)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42508-divisible-by-n-prime-divisors-from-20-to-200\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors from 20 to 200\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1165,"title":"Convert double scalar to half-precision floating point (IEEE 754r)","description":"Use MATLAB to convert a scalar double into a half-precision floating point.  The return value should be a uint16.\r\n\r\nThe half-precision floating point format is specified here, and is the source for much of the test suite:\r\n\r\n\u003chttp://en.wikipedia.org/wiki/Half-precision_floating-point_format\u003e\r\n\r\nThis is an implementation in C if you want some inspiration to get started:\r\n\r\n\u003chttp://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\u003e\r\n\r\nAs other problems related to half-precision are added, I will try to link them here.","description_html":"\u003cp\u003eUse MATLAB to convert a scalar double into a half-precision floating point.  The return value should be a uint16.\u003c/p\u003e\u003cp\u003eThe half-precision floating point format is specified here, and is the source for much of the test suite:\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://en.wikipedia.org/wiki/Half-precision_floating-point_format\"\u003ehttp://en.wikipedia.org/wiki/Half-precision_floating-point_format\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThis is an implementation in C if you want some inspiration to get started:\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\"\u003ehttp://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\u003c/a\u003e\u003c/p\u003e\u003cp\u003eAs other problems related to half-precision are added, I will try to link them here.\u003c/p\u003e","function_template":"function H = double2half(D)\r\n  H = D;\r\nend","test_suite":"%%\r\nassert(double2half(2^(-24)) == uint16(1)) % Smallest number\r\n%%\r\nassert(double2half(2^(-25)) == uint16(1)) % Rounds up to smallest number\r\n%%\r\nassert(double2half(2^(-26)) == uint16(0)) % Rounds down to zero\r\n%%\r\nassert(bin2dec('0 01111 0000000000') == double2half(1))\r\n%%\r\nassert(bin2dec('0 01111 0000000001') == double2half(1 + 2^(-10)))\r\n%%\r\nassert(bin2dec('1 10000 0000000000') == double2half(-2))\r\n%%\r\nassert(bin2dec('0 11110 1111111111') == double2half(65504))\r\n%%\r\nassert(bin2dec('0 00001 0000000000') == double2half(2^(-14)))\r\n%%\r\nassert(bin2dec('0 00000 1111111111') == double2half(2^(-14) - 2^(-24)))\r\n%%\r\nassert(bin2dec('0 00000 0000000001') == double2half(2^(-24)))\r\n%%\r\nassert(bin2dec('0 00000 0000000000') == double2half(0))\r\n%%\r\nassert(bin2dec('1 00000 0000000000') == double2half(-0))\r\n%%\r\nassert(bin2dec('0 11111 0000000000') == double2half(inf))\r\n%%\r\nassert(bin2dec('1 11111 0000000000') == double2half(-inf))\r\n%%\r\nassert(bin2dec('0 01101 0101010101') == double2half(0.33325))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":8780,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":"2013-01-03T17:42:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-01-03T17:31:54.000Z","updated_at":"2025-12-21T07:22:06.000Z","published_at":"2013-01-03T17:42:13.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\u003eUse MATLAB to convert a scalar double into a half-precision floating point. The return value should be a uint16.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe half-precision floating point format is specified here, and is the source for much of the test suite:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Half-precision_floating-point_format\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Half-precision_floating-point_format\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is an implementation in C if you want some inspiration to get started:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs other problems related to half-precision are added, I will try to link them here.\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":44545,"title":"\"Percentages may not total 100 due to rounding\"","description":"*Percentages* are commonly *rounded* when presented in tables.  As a result, the sum of the individual numbers does not always add up to 100%.  A warning is therefore sometimes appended to such tables, along the lines: _\"Percentages may not total 100 due to rounding\"_.\r\n\r\nEXAMPLE 1:\r\nA survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral.  Percentage-wise this becomes\r\n\r\n  In favour:          45% (5 of 11)\r\n  Undecided/neutral:   9% (1 of 11)  \r\n  Opposed:            45% (5 of 11)  \r\n\r\nThe total of these is 99%, rather than the expected 100%.  Despite this conflict, in this example *all of the individual numbers have been correctly entered*.  \r\n\r\nEXAMPLE 2:\r\nIn the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral.  Suppose the data were presented in the following table\r\n\r\n  In favour:          45%\r\n  Undecided/neutral:  20%\r\n  Opposed:            45%\r\n\r\nGiven the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%.  In fact, we would probably guess that a copy-and-paste mistake had occurred.  However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example *one or more of the individual numbers must have been entered incorrectly*.  \r\n\r\nYOUR JOB:  \r\nGiven a list (vector) of integer percentages, determine whether among the individual values at least one of them _must_ have been incorrectly entered (return |true|), as in Example 2, or whether there might not be any incorrect entries (return |false|), as in Example 1.","description_html":"\u003cp\u003e\u003cb\u003ePercentages\u003c/b\u003e are commonly \u003cb\u003erounded\u003c/b\u003e when presented in tables.  As a result, the sum of the individual numbers does not always add up to 100%.  A warning is therefore sometimes appended to such tables, along the lines: \u003ci\u003e\"Percentages may not total 100 due to rounding\"\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eEXAMPLE 1:\r\nA survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral.  Percentage-wise this becomes\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eIn favour:          45% (5 of 11)\r\nUndecided/neutral:   9% (1 of 11)  \r\nOpposed:            45% (5 of 11)  \r\n\u003c/pre\u003e\u003cp\u003eThe total of these is 99%, rather than the expected 100%.  Despite this conflict, in this example \u003cb\u003eall of the individual numbers have been correctly entered\u003c/b\u003e.\u003c/p\u003e\u003cp\u003eEXAMPLE 2:\r\nIn the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral.  Suppose the data were presented in the following table\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eIn favour:          45%\r\nUndecided/neutral:  20%\r\nOpposed:            45%\r\n\u003c/pre\u003e\u003cp\u003eGiven the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%.  In fact, we would probably guess that a copy-and-paste mistake had occurred.  However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example \u003cb\u003eone or more of the individual numbers must have been entered incorrectly\u003c/b\u003e.\u003c/p\u003e\u003cp\u003eYOUR JOB:  \r\nGiven a list (vector) of integer percentages, determine whether among the individual values at least one of them \u003ci\u003emust\u003c/i\u003e have been incorrectly entered (return \u003ctt\u003etrue\u003c/tt\u003e), as in Example 2, or whether there might not be any incorrect entries (return \u003ctt\u003efalse\u003c/tt\u003e), as in Example 1.\u003c/p\u003e","function_template":"% \"May not sum to total due to rounding: the probability of rounding errors\"\r\n% Henry Bottomley, 03 June 2008\r\n% http://www.se16.info/hgb/rounding.pdf\r\n\r\n% \"How to make rounded percentages add up to 100%\"\r\n% https://stackoverflow.com/questions/13483430/how-to-make-rounded-percentages-add-up-to-100\r\n% cf. https://stackoverflow.com/questions/5227215/how-to-deal-with-the-sum-of-rounded-percentage-not-being-100\r\nfunction containsMistake = checkForMistake(z)\r\n    containsMistake = true * + false,\r\nend","test_suite":"%% Basics\r\nassessFunctionAbsence({'regexp', 'regexpi'}, 'FileName','checkForMistake.m')\r\n\r\n%% Example 1 (Row vector)\r\nxVec = round( 100*[5 1 5]/11 );\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) )\r\n\r\n%% Example 1 (Column vector)\r\nxVec = round( 100*[5 1 5]/11 )';\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) )\r\n\r\n%% Example 2 (Row vector)\r\nxVec = [42 20 45];\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) )\r\n\r\n%% One percentage, over and under\r\nxVec = [100];\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test a')\r\nxVec = round([100.5]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test b')\r\nxVec = round([99.49]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test c')\r\n\r\n%% Two percentages, over and under\r\nxVec = [50 50];\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test a')\r\nxVec = round([49.5 50.5]);\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test b')\r\nxVec = round([50.5 50.5]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test c')\r\nxVec = round([49.49 50.49]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test d')\r\n\r\n%% Equal percentages\r\nfor j = [2:250 1000:1000:10000]\r\n    xVec = round( repelem(100/j, j) );\r\n    containsMistake = false;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Geometric series (from Bottomley, §5)\r\nfor j = 10:30\r\n    xVec = round( 10 * (9/10).^[0:j] );\r\n    containsMistake = j \u003c 21;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Geometric series (from Bottomley, §5), permuted\r\nfor j = 2:40\r\n    xVec = round( 10 * (9/10).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 21;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) I\r\nfor j = 2:100\r\n    xVec = round( (99/100).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 66;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) II\r\nfor j = 2:30\r\n    xVec = round( 20 * (4/5).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 12;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) III\r\nfor j = 2:20\r\n    xVec = round( 25 * (3/4).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 10;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) IV\r\nfor j = 2:20\r\n    xVec = round( 50 * (1/2).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 5;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Systematic overestimation\r\nfor j = 2:100\r\n    num = randi(round(100/j)+1) - 1;\r\n    xRaw = repelem(num+0.5, j);   % cf. https://oletus.github.io/float16-simulator.js/\r\n    sm = sum(xRaw);\r\n    xRaw = [xRaw max(100-sm, 0)];\r\n    if sm \u003e 100.5,                % Not sm\u003e100, because need to account for extra zero added.\r\n        containsMistake = true;\r\n    else\r\n        containsMistake = false;\r\n    end;\r\n    xVec = round( xRaw );\r\n    xVec = xVec( randperm(j+1) );\r\n    assert( isequal(checkForMistake(xVec), containsMistake) , ['Failed with xRaw = ' num2str(xRaw)] )\r\nend;\r\n\r\n%% Systematic underestimation\r\nfor j = 2:100\r\n    num = randi(round(100/j)+1) - 1;\r\n    xRaw = repelem(num+0.499755859375, j);   % cf. https://oletus.github.io/float16-simulator.js/ \u0026 https://au.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html\r\n    cs = cumsum(xRaw);\r\n    if cs(end) \u003e 100,\r\n        xRaw( cs \u003e 100 ) = [];\r\n        containsMistake = true;\r\n    else\r\n        xRaw = [xRaw (100-cs(end))];\r\n        containsMistake = false;\r\n    end;\r\n    xVec = round( xRaw );\r\n    assert( isequal(checkForMistake(xVec), containsMistake) , ['Failed with xRaw = ' num2str(xRaw)] )\r\nend;","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-03-23T08:02:20.000Z","updated_at":"2018-03-24T13:53:40.000Z","published_at":"2018-03-24T13:53:40.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ePercentages\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are commonly\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\u003erounded\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e when presented in tables. As a result, the sum of the individual numbers does not always add up to 100%. A warning is therefore sometimes appended to such tables, along the lines:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\\\"Percentages may not total 100 due to rounding\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE 1: A survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral. Percentage-wise this becomes\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[In favour:          45% (5 of 11)\\nUndecided/neutral:   9% (1 of 11)  \\nOpposed:            45% (5 of 11)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe total of these is 99%, rather than the expected 100%. Despite this conflict, in this example\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\u003eall of the individual numbers have been correctly entered\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE 2: In the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral. Suppose the data were presented in the following table\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[In favour:          45%\\nUndecided/neutral:  20%\\nOpposed:            45%]]\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\u003eGiven the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%. In fact, we would probably guess that a copy-and-paste mistake had occurred. However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eone or more of the individual numbers must have been entered incorrectly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYOUR JOB: Given a list (vector) of integer percentages, determine whether among the individual values at least one of them\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\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e have been incorrectly entered (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), as in Example 2, or whether there might not be any incorrect entries (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\u003efalse\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e), as in Example 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":42412,"title":"Divisible by 10","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 10.\r\n\r\nWrite a function to determine if a number is divisible by 10. This can be done by checking if the last digit is zero.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9 divisible by 9\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11 divisible by 11\u003e.\r\n","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 10.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 10. This can be done by checking if the last digit is zero.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9\"\u003edivisible by 9\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11\"\u003edivisible by 11\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_10(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_10.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '10';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '234';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '220';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '12361230';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227960';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_10(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\nassert(isequal(divisible_by_10(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '220';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_10(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_10(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":376,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:34:57.000Z","updated_at":"2026-03-24T13:02:48.000Z","published_at":"2015-06-25T03:34: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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 10. This can be done by checking if the last digit is 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42411-divisible-by-9\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 9\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42413-divisible-by-11\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42407,"title":"Divisible by 5","description":"Pursuant to the first problem in this series, this one involves checking for divisibility by 5.\r\nWrite a function to determine if a number is divisible by 5. This can be checked by the following method:\r\nCheck if the last digits is 0 or 5.\r\nPrevious problem: divisible by 4. Next problem: divisible by 6.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 122.433px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 61.2167px; transform-origin: 408px 61.2167px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 47.45px 7.79167px; transform-origin: 47.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePursuant to the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003efirst problem\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: 184.767px 7.79167px; transform-origin: 184.767px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in this series, this one involves checking for divisibility by 5.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 320.775px 7.79167px; transform-origin: 320.775px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine if a number is divisible by 5. This can be checked by the following method:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 20.4333px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 391px 10.2167px; transform-origin: 391px 10.2167px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 96.8417px 7.79167px; transform-origin: 96.8417px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCheck if the last digits is 0 or 5.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.4083px 7.79167px; transform-origin: 56.4083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePrevious problem:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003edivisible by 4\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: 47.45px 7.79167px; transform-origin: 47.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Next problem:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"http://www.mathworks.com/matlabcentral/cody/problems/42408-divisible-by-6\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003edivisible by 6\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.79167px; transform-origin: 1.94167px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [tf] = divisible_by_5(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_5.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\nassert(isempty(strfind(filetext, 'regexp ''')),'regexp hacks forbidden')\r\n%Last assert added by Dyuman Joshi on 02/01/2026\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '225';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '1236125';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_5(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010';\r\nassert(isequal(divisible_by_5(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '225';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_5(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_5(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":26769,"edited_by":223089,"edited_at":"2026-01-02T16:52:49.000Z","deleted_by":null,"deleted_at":null,"solvers_count":495,"test_suite_updated_at":"2026-01-02T16:52:49.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:41:14.000Z","updated_at":"2026-03-24T09:37:28.000Z","published_at":"2015-06-25T02:41:14.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003eWrite a function to determine if a number is divisible by 5. This can be checked by the following method:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck if the last digits is 0 or 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\u003ePrevious problem:\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/42406-divisible-by-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42408-divisible-by-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":42404,"title":"Divisible by 2","description":"This is the first problem in a set of \"divisible by x\" problems. You will be provided a number as a string and the function you write must return whether or not that number is divisible by x.\r\n\r\nRather than allowing you to use an easy way out, such as the modulus function, division and checking the result against its rounded value, Java functions, etc., you get to learn and apply integer divisibility rules. For reference, some divisibility conditions for integers are listed \u003chttp://en.wikipedia.org/wiki/Divisibility_rule here\u003e. Other such references are also available elsewhere on the internet.\r\n\r\nThere are two benefits to approaching divisibility in this manner: first, you learn neat divisibility tricks that you can use in your head or on paper for large numbers and, second, you program a routine capable of determining divisibility for arbitrarily large numbers, for which existing precision fails. *_So, to begin..._*\r\n\r\nWrite a function to determine if a number is divisible by 2. This will be the case if its last digit is even.\r\n\r\n(This problem blocks a range of functions in the first test case so that you must use one of the supplied methods; some of these restrictions will be lifted for later problems in the series.)\r\n\r\nNext problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisible by 3\u003e.","description_html":"\u003cp\u003eThis is the first problem in a set of \"divisible by x\" problems. You will be provided a number as a string and the function you write must return whether or not that number is divisible by x.\u003c/p\u003e\u003cp\u003eRather than allowing you to use an easy way out, such as the modulus function, division and checking the result against its rounded value, Java functions, etc., you get to learn and apply integer divisibility rules. For reference, some divisibility conditions for integers are listed \u003ca href = \"http://en.wikipedia.org/wiki/Divisibility_rule\"\u003ehere\u003c/a\u003e. Other such references are also available elsewhere on the internet.\u003c/p\u003e\u003cp\u003eThere are two benefits to approaching divisibility in this manner: first, you learn neat divisibility tricks that you can use in your head or on paper for large numbers and, second, you program a routine capable of determining divisibility for arbitrarily large numbers, for which existing precision fails. \u003cb\u003e\u003ci\u003eSo, to begin...\u003c/i\u003e\u003c/b\u003e\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 2. This will be the case if its last digit is even.\u003c/p\u003e\u003cp\u003e(This problem blocks a range of functions in the first test case so that you must use one of the supplied methods; some of these restrictions will be lifted for later problems in the series.)\u003c/p\u003e\u003cp\u003eNext problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisible by 3\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_2(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_2.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'factor')),'factor() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '1236127';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_2(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_2(n_str),0))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '1236127';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\nend\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '223';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\nend\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1236127';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_2(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\n\t\tassert(isequal(divisible_by_2(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":10,"comments_count":8,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":616,"test_suite_updated_at":"2017-04-19T17:42:44.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:14:54.000Z","updated_at":"2026-03-24T09:42:10.000Z","published_at":"2015-06-25T02:14:54.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the first problem in a set of \\\"divisible by x\\\" problems. You will be provided a number as a string and the function you write must return whether or not that number is divisible by 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\u003eRather than allowing you to use an easy way out, such as the modulus function, division and checking the result against its rounded value, Java functions, etc., you get to learn and apply integer divisibility rules. For reference, some divisibility conditions for integers are listed\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://en.wikipedia.org/wiki/Divisibility_rule\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehere\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Other such references are also available elsewhere on the internet.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are two benefits to approaching divisibility in this manner: first, you learn neat divisibility tricks that you can use in your head or on paper for large numbers and, second, you program a routine capable of determining divisibility for arbitrarily large numbers, for which existing precision fails.\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\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSo, to begin...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 2. This will be the case if its last digit is even.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(This problem blocks a range of functions in the first test case so that you must use one of the supplied methods; some of these restrictions will be lifted for later problems in the series.)\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\u003eNext problem:\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42411,"title":"Divisible by 9","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 9.\r\n\r\nWrite a function to determine if a number is divisible by 9. This can be done by the following method:\r\n\r\n# Sum the digits of the number. As with methods for other numbers, this summing step can be applied recursively until a single-digit number results. If the resulting number is divisible by nine, then so is the original number.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8 divisible by 8\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10 divisible by 10\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 9.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 9. This can be done by the following method:\u003c/p\u003e\u003col\u003e\u003cli\u003eSum the digits of the number. As with methods for other numbers, this summing step can be applied recursively until a single-digit number results. If the resulting number is divisible by nine, then so is the original number.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8\"\u003edivisible by 8\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10\"\u003edivisible by 10\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_9(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_9.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '18';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '234';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '225';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_9(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\nassert(isequal(divisible_by_9(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '234';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_9(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_9(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":277,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:31:29.000Z","updated_at":"2026-03-27T11:38:56.000Z","published_at":"2015-06-25T03:31:29.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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 9.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 9. This can be done by the following method:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSum the digits of the number. As with methods for other numbers, this summing step can be applied recursively until a single-digit number results. If the resulting number is divisible by nine, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42410-divisible-by-8\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42412-divisible-by-10\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42408,"title":"Divisible by 6","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 6.\r\n\r\nWrite a function to determine if a number is divisible by 6. This can be done by checking for \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 divisibility by 2\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisibility by 3\u003e. If the number passes both tests, it is also divisible by 6.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5 divisible by 5\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7 divisible by 7\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 6.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 6. This can be done by checking for \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003edivisibility by 2\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisibility by 3\u003c/a\u003e. If the number passes both tests, it is also divisible by 6.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\"\u003edivisible by 5\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\"\u003edivisible by 7\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_6(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_6.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '1236126';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_6(n_str),1))%\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_6(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_6(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '223';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_6(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_6(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":332,"test_suite_updated_at":"2015-06-25T03:14:53.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:46:24.000Z","updated_at":"2026-03-24T12:51:01.000Z","published_at":"2015-06-25T02:46:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 6. This can be done by checking for\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/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. If the number passes both tests, it is also divisible by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42407-divisible-by-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42409-divisible-by-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42417,"title":"Divisible by 15","description":"Write a function to determine if a number is divisible by 15. If a number is \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisible by 3\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5 divisible by 5\u003e, then it is divisible by 15.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14 divisible by 14\u003e. Next problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16 divisible by 16\u003e.\r\n","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 15. If a number is \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisible by 3\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\"\u003edivisible by 5\u003c/a\u003e, then it is divisible by 15.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14\"\u003edivisible by 14\u003c/a\u003e. Next problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16\"\u003edivisible by 16\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_15(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_15.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '15';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '225';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '211';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '210';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '1236120';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922790';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_15(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\nassert(isequal(divisible_by_15(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '210';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_15(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_15(n_str),1))\r\nend\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":221,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T01:58:40.000Z","updated_at":"2026-03-27T16:43:11.000Z","published_at":"2015-06-26T01:58:40.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 to determine if a number is divisible by 15. If a number is\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, then it is divisible by 15.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42416-divisible-by-14\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 14\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem\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/42418-divisible-by-16\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 16\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42406,"title":"Divisible by 4","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 4.\r\n\r\nWrite a function to determine if a number is divisible by 4. This can be checked by a few slightly different methods:\r\n\r\n# Check the last two digits for divisibility by four.\r\n# From the \u003chttps://en.wikipedia.org/wiki/Divisibility_rule wikipedia reference page\u003e: \"If the tens digit is even, the ones digit must be 0, 4, or 8.\r\nIf the tens digit is odd, the ones digit must be 2 or 6.\"\r\n# Check the following sum for divisibility by four: twice the tens digit plus the ones digit.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisible by 3\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5 divisible by 5\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 4.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 4. This can be checked by a few slightly different methods:\u003c/p\u003e\u003col\u003e\u003cli\u003eCheck the last two digits for divisibility by four.\u003c/li\u003e\u003cli\u003eFrom the \u003ca href = \"https://en.wikipedia.org/wiki/Divisibility_rule\"\u003ewikipedia reference page\u003c/a\u003e: \"If the tens digit is even, the ones digit must be 0, 4, or 8.\r\nIf the tens digit is odd, the ones digit must be 2 or 6.\"\u003c/li\u003e\u003cli\u003eCheck the following sum for divisibility by four: twice the tens digit plus the ones digit.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisible by 3\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42407-divisible-by-5\"\u003edivisible by 5\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_4(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_4.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '1236127';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_4(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_4(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '232';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_4(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_4(n_str),0))\r\nend","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":373,"test_suite_updated_at":"2015-06-25T03:13:44.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:35:16.000Z","updated_at":"2026-03-24T10:06:27.000Z","published_at":"2015-06-25T02:35:16.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 4.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 4. This can be checked by a few slightly different methods:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck the last two digits for divisibility by four.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFrom 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/Divisibility_rule\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia reference page\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e: \\\"If the tens digit is even, the ones digit must be 0, 4, or 8.If the tens digit is odd, the ones digit must be 2 or 6.\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck the following sum for divisibility by four: twice the tens digit plus the ones digit.\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\u003ePrevious problem:\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42407-divisible-by-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42509,"title":"Divisible by n, Truncated-number Divisors","description":"Some divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Examples include 25, 32, 50, 64, 75, 100, 125, 128, 256, and 512. Notice that this list includes some prime-power divisors (e.g, 25 = 5^2, 32 = 2^5, 125 = 5^3, etc.). Write a function to determine if a given number, provided as a string (n_str), is divisible by the provided divisor. See the test suite for examples and rules for these simple divisors below:\r\n\r\n* 25: The last two digits must be divisible by 25.\r\n* 32: The last five digits must be divisible by 32.\r\n* 50: The last two digits must be 00 or 50.\r\n* 64: The last six digits must be divisible by 64.\r\n* 75: The number must be divisible by 3 (can be done by a \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 simple sum\u003e) and end in 00, 25, 50, or 75 (last two digits divisible by 25). \r\n* 100: The last two digits must be 00.\r\n* 125: The last three digits must be divisible by 125.\r\n* 128: The last seven digits must be divisible by 128.\r\n* 256: The last eight digits must be divisible by 256.\r\n* 512: The last nine digits must be divisible by 512.\r\n\r\nThe only restriction that remains is Java.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200 Divisible by n, prime divisors from 20 to 200\u003e. Next problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42510-divisible-by-n-composite-divisors Divisible by n, Composite Divisors\u003e.","description_html":"\u003cp\u003eSome divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Examples include 25, 32, 50, 64, 75, 100, 125, 128, 256, and 512. Notice that this list includes some prime-power divisors (e.g, 25 = 5^2, 32 = 2^5, 125 = 5^3, etc.). Write a function to determine if a given number, provided as a string (n_str), is divisible by the provided divisor. See the test suite for examples and rules for these simple divisors below:\u003c/p\u003e\u003cul\u003e\u003cli\u003e25: The last two digits must be divisible by 25.\u003c/li\u003e\u003cli\u003e32: The last five digits must be divisible by 32.\u003c/li\u003e\u003cli\u003e50: The last two digits must be 00 or 50.\u003c/li\u003e\u003cli\u003e64: The last six digits must be divisible by 64.\u003c/li\u003e\u003cli\u003e75: The number must be divisible by 3 (can be done by a \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003esimple sum\u003c/a\u003e) and end in 00, 25, 50, or 75 (last two digits divisible by 25).\u003c/li\u003e\u003cli\u003e100: The last two digits must be 00.\u003c/li\u003e\u003cli\u003e125: The last three digits must be divisible by 125.\u003c/li\u003e\u003cli\u003e128: The last seven digits must be divisible by 128.\u003c/li\u003e\u003cli\u003e256: The last eight digits must be divisible by 256.\u003c/li\u003e\u003cli\u003e512: The last nine digits must be divisible by 512.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe only restriction that remains is Java.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200\"\u003eDivisible by n, prime divisors from 20 to 200\u003c/a\u003e. Next problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42510-divisible-by-n-composite-divisors\"\u003eDivisible by n, Composite Divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = truncated_number_divisors(n,n_str)\r\n\r\ntf = 1;\r\n\r\nend","test_suite":"%%\r\nfiletext = fileread('truncated_number_divisors.m');\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = 25;\r\nn_str = '123456789025';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 25;\r\nn_str = '1234567890250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 25;\r\nn_str = '1234567890250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 32;\r\nn_str = '213546116579874651316984601654958847098406516051320150408460840649084790870510201378465465046760406541654604601561065140637860373703970644065166540616510650165409684098049804165016510320540540645106056501650165709804650860466840650156106165028224';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 32;\r\nn_str = '213546116579874651316984601654958847098406516051320150408460840649084790870510201378465465046760406541654604601561065140637860373703970644065166540616510650165409684098049804165016510320540540645106056501650165709804650860466840650156106165028227';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 50;\r\nn_str = '15668045014654987098045406540500';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 50;\r\nn_str = '50440984098480149540561065106510516501615001';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 50;\r\nn_str = '50440984098480149540561065106510516501615001897241387234587503198417059813645097867234985672307485679813709582304957234897659832746098514949188412929894824924949334949777378994191995216173718811313515141418186186382171646871681436817897678350';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404996';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111489216';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 64;\r\nn_str = '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111489217';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 75;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499175';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 75;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499275';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992750';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992700';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890404992';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 100;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499200';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 125;\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789040499200125';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 125;\r\nn_str = '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111489216';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 125;\r\nn_str = '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114892375';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 128;\r\nn_str = '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111148923751048576';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 128;\r\nn_str = '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111148923751048578';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 256;\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904049917516777216';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 256;\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904049917516777210';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 512;\r\nn_str = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000134217728';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 512;\r\nn_str = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000536870912';\r\ntf = 1;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 512;\r\nn_str = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000536870914';\r\ntf = 0;\r\nassert(isequal(truncated_number_divisors(n,n_str),tf))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":79,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-08-17T21:32:54.000Z","updated_at":"2026-01-11T10:42:54.000Z","published_at":"2015-08-17T21:32:54.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome divisors only require a few numbers at the end of the number in question to determine divisibility, no matter how long. Examples include 25, 32, 50, 64, 75, 100, 125, 128, 256, and 512. Notice that this list includes some prime-power divisors (e.g, 25 = 5^2, 32 = 2^5, 125 = 5^3, etc.). Write a function to determine if a given number, provided as a string (n_str), is divisible by the provided divisor. See the test suite for examples and rules for these simple divisors below:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e25: The last two digits must be divisible by 25.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e32: The last five digits must be divisible by 32.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e50: The last two digits must be 00 or 50.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e64: The last six digits must be divisible by 64.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e75: The number must be divisible by 3 (can be done by a\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003esimple sum\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) and end in 00, 25, 50, or 75 (last two digits divisible by 25).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e100: The last two digits must be 00.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e125: The last three digits must be divisible by 125.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e128: The last seven digits must be divisible by 128.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e256: The last eight digits must be divisible by 256.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e512: The last nine digits must be divisible by 512.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe only restriction that remains is Java.\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\u003ePrevious problem:\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/42508-divisible-by-n-prime-divisors-from-20-to-200\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors from 20 to 200\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem\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/42510-divisible-by-n-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, Composite Divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42414,"title":"Divisible by 12","description":"Write a function to determine if a number is divisible by 12. Similar to the number six, this can be done by checking for divisibility of two numbers, in this case, \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3 divisibility by 3\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4 divisibility by 4\u003e. If the number passes both tests, it is also divisible by 12.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11 divisible by 11\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13 divisible by 13\u003e.\r\n","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 12. Similar to the number six, this can be done by checking for divisibility of two numbers, in this case, \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42405-divisible-by-3\"\u003edivisibility by 3\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\"\u003edivisibility by 4\u003c/a\u003e. If the number passes both tests, it is also divisible by 12.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42413-divisible-by-11\"\u003edivisible by 11\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13\"\u003edivisible by 13\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_12(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_12.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '11';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '228';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '242';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '1236120';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_12(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922790';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_12(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '228';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_12(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_12(n_str),0))\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":210,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:54:07.000Z","updated_at":"2026-03-27T16:47:41.000Z","published_at":"2015-06-25T03:54:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 12. Similar to the number six, this can be done by checking for divisibility of two numbers, in this case,\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/42405-divisible-by-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisibility by 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. If the number passes both tests, it is also divisible by 12.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42413-divisible-by-11\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42415-divisible-by-13\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 13\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42410,"title":"Divisible by 8","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 8.\r\n\r\nWrite a function to determine if a number is divisible by 8. This can be done by the following method:\r\n\r\n# Check the last three digits for divisibility by eight. If that portion of the number is divisible by eight, then so is the original number. That three-digit number can be further reduced by summing four times the hundreds digit, two times the tens digit, and the ones digit. As with methods for other numbers, this factor/sum step can be applied recursively until a single-digit number results.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7 divisible by 7\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9 divisible by 9\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 8.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 8. This can be done by the following method:\u003c/p\u003e\u003col\u003e\u003cli\u003eCheck the last three digits for divisibility by eight. If that portion of the number is divisible by eight, then so is the original number. That three-digit number can be further reduced by summing four times the hundreds digit, two times the tens digit, and the ones digit. As with methods for other numbers, this factor/sum step can be applied recursively until a single-digit number results.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\"\u003edivisible by 7\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42411-divisible-by-9\"\u003edivisible by 9\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_8(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_8.m');\r\n%assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '16';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '1236128';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_8(n_str),0))%\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_8(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_8(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '232';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '16';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_8(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678904';\r\n\t\tassert(isequal(divisible_by_8(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":243,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:23:41.000Z","updated_at":"2026-03-27T11:43:47.000Z","published_at":"2015-06-25T03:23:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003eWrite a function to determine if a number is divisible by 8. This can be done by the following method:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck the last three digits for divisibility by eight. If that portion of the number is divisible by eight, then so is the original number. That three-digit number can be further reduced by summing four times the hundreds digit, two times the tens digit, and the ones digit. As with methods for other numbers, this factor/sum step can be applied recursively until a single-digit number results.\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\u003ePrevious problem:\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/42409-divisible-by-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42411-divisible-by-9\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 9\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42454,"title":"Divisible by n, prime divisors (including powers)","description":"For this problem, you will be provided an array of numbers (not necessarily in order). Return the array of numbers with only prime divisors (including prime powers) remaining in the array. For example:\r\n\r\n  n = 1:10;\r\n  n_p = [2 3 4 5 7 8 9];\r\n\r\nSince the prime numbers in the 1:10 range are 2, 3, 5, and 7, while the prime powers in this range are 4 (2^2), 8 (2^3), and 9 (3^2). (Ignore one, as it is a trivial case since all integers are divisible by one.) Therefore, you should return the array including both sets joined together and sorted, as shown in the example above.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors Divisible by n, prime vs. composite divisors\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19 Divisible by n, prime divisors - 11, 13, 17, \u0026 19\u003e.","description_html":"\u003cp\u003eFor this problem, you will be provided an array of numbers (not necessarily in order). Return the array of numbers with only prime divisors (including prime powers) remaining in the array. For example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003en = 1:10;\r\nn_p = [2 3 4 5 7 8 9];\r\n\u003c/pre\u003e\u003cp\u003eSince the prime numbers in the 1:10 range are 2, 3, 5, and 7, while the prime powers in this range are 4 (2^2), 8 (2^3), and 9 (3^2). (Ignore one, as it is a trivial case since all integers are divisible by one.) Therefore, you should return the array including both sets joined together and sorted, as shown in the example above.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\"\u003eDivisible by n, prime vs. composite divisors\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19\"\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026 19\u003c/a\u003e.\u003c/p\u003e","function_template":"function [n_p] = prime_divisors_incl_powers(n)\r\n\r\nn_p = 1;\r\n\r\nend","test_suite":"%%\r\nn = 1:10;\r\nn_p = [2 3 4 5 7 8 9]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = [2:7 12:17 10 42:55 11 19:29];\r\nn_p = [2 3 4 5 7 11 13 16 17 19 23 25 27 29 43 47 49 53]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 1:100;\r\nn_p = [2 3 4 5 7 8 9 11 13 16 17 19 23 25 27 29 31 32 37 41 43 47 49 53 59 61 64 67 71 73 79 81 83 89 97]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 41:59;\r\nn_p = [41 43 47 49 53 59]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 100:200;\r\nn_p = [101 103 107 109 113 121 125 127 128 131 137 139 149 151 157 163 167 169 173 179 181 191 193 197 199]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%%\r\nn = 1000:1111;\r\nn_p = [1009 1013 1019 1021 1024 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 1103 1109]; %prime factors (including powers)\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 1:10;\r\n\t\tn_p = [2 3 4 5 7 8 9]; %prime factors (including powers)\r\n\tcase 2\r\n\t\tn = 41:59;\r\n\t\tn_p = [41 43 47 49 53 59]; %prime factors (including powers)\r\n\tcase 3\r\n\t\tn = 1:100;\r\n\t\tn_p = [2 3 4 5 7 8 9 11 13 16 17 19 23 25 27 29 31 32 37 41 43 47 49 53 59 61 64 67 71 73 79 81 83 89 97]; %prime factors (including powers)\r\n\tcase 4\r\n\t\tn = [2:7 12:17 10 42:55 11 19:29];\r\n\t\tn_p = [2 3 4 5 7 11 13 16 17 19 23 25 27 29 43 47 49 53];\r\nend\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 1:100;\r\n\t\tn_p = [2 3 4 5 7 8 9 11 13 16 17 19 23 25 27 29 31 32 37 41 43 47 49 53 59 61 64 67 71 73 79 81 83 89 97]; %prime factors (including powers)\r\n\tcase 2\r\n\t\tn = [2:7 12:17 10 42:55 11 19:29];\r\n\t\tn_p = [2 3 4 5 7 11 13 16 17 19 23 25 27 29 43 47 49 53];\r\n\tcase 3\r\n\t\tn = 41:59;\r\n\t\tn_p = [41 43 47 49 53 59]; %prime factors (including powers)\r\n\tcase 4\r\n\t\tn = 1000:1111;\r\n\t\tn_p = [1009 1013 1019 1021 1024 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 1103 1109]; %prime factors (including powers)\r\nend\r\nassert(isequal(n_p,prime_divisors_incl_powers(n)))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":95,"test_suite_updated_at":"2017-03-20T19:03:08.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-07-09T01:55:28.000Z","updated_at":"2026-01-11T12:28:45.000Z","published_at":"2015-07-09T01:55:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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 this problem, you will be provided an array of numbers (not necessarily in order). Return the array of numbers with only prime divisors (including prime powers) remaining in the array. For example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[n = 1:10;\\nn_p = [2 3 4 5 7 8 9];]]\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\u003eSince the prime numbers in the 1:10 range are 2, 3, 5, and 7, while the prime powers in this range are 4 (2^2), 8 (2^3), and 9 (3^2). (Ignore one, as it is a trivial case since all integers are divisible by one.) Therefore, you should return the array including both sets joined together and sorted, as shown in the example above.\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\u003ePrevious problem:\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/42453-divisible-by-n-prime-vs-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime vs. composite divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42455-divisible-by-n-prime-divisors-11-13-17-19\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026amp; 19\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42413,"title":"Divisible by 11","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 11.\r\n\r\nWrite a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:\r\n\r\n# Form the alternating sum of the digits (e.g., positive even digits and negative odd digits). Apply recursively until a two-digit number results. If that result is divisible by 11, then so is the original number.\r\n# Add the digits of the number in blocks of two from right to left. Apply recursively, as needed, and check for divisibility as stated in the previous method.\r\n# Subtract the last digit from the remaining number (e.g., 649: 64 - 9 = 55). Apply recursion, as needed.\r\n# Add ten times the last digit to the remaining number. Apply recursion, as needed. For example: 737: 73 + 70 = 143: 14 + 30 = 44.\r\n# Etc.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10 divisible by 10\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12 divisible by 12\u003e.\r\n","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 11.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:\u003c/p\u003e\u003col\u003e\u003cli\u003eForm the alternating sum of the digits (e.g., positive even digits and negative odd digits). Apply recursively until a two-digit number results. If that result is divisible by 11, then so is the original number.\u003c/li\u003e\u003cli\u003eAdd the digits of the number in blocks of two from right to left. Apply recursively, as needed, and check for divisibility as stated in the previous method.\u003c/li\u003e\u003cli\u003eSubtract the last digit from the remaining number (e.g., 649: 64 - 9 = 55). Apply recursion, as needed.\u003c/li\u003e\u003cli\u003eAdd ten times the last digit to the remaining number. Apply recursion, as needed. For example: 737: 73 + 70 = 143: 14 + 30 = 44.\u003c/li\u003e\u003cli\u003eEtc.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42412-divisible-by-10\"\u003edivisible by 10\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12\"\u003edivisible by 12\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_11(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_11.m');\r\n%assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\n%assert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '11';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '231';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '242';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '1236125';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567881';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922789';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_11(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\nassert(isequal(divisible_by_11(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567881';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '231';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001010010110';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '242';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\n\t\tassert(isequal(divisible_by_11(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_11(n_str),0))\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":175,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:49:05.000Z","updated_at":"2025-12-29T20:09:06.000Z","published_at":"2015-06-25T03:49:05.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 11. Like the number seven, this can be done by a variety of methods. Some are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eForm the alternating sum of the digits (e.g., positive even digits and negative odd digits). Apply recursively until a two-digit number results. If that result is divisible by 11, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAdd the digits of the number in blocks of two from right to left. Apply recursively, as needed, and check for divisibility as stated in the previous method.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSubtract the last digit from the remaining number (e.g., 649: 64 - 9 = 55). Apply recursion, as needed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAdd ten times the last digit to the remaining number. Apply recursion, as needed. For example: 737: 73 + 70 = 143: 14 + 30 = 44.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEtc.\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\u003ePrevious problem:\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/42412-divisible-by-10\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42414-divisible-by-12\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42416,"title":"Divisible by 14","description":"Write a function to determine if a number is divisible by 14. If a number is \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 divisible by 2\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7 divisible by 7\u003e, then it is divisible by 14.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13 divisible by 13\u003e. Next problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15 divisible by 15\u003e.","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 14. If a number is \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003edivisible by 2\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\"\u003edivisible by 7\u003c/a\u003e, then it is divisible by 14.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42415-divisible-by-13\"\u003edivisible by 13\u003c/a\u003e. Next problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15\"\u003edivisible by 15\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_14(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_14.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '14';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '210';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '1236130';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922799';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_14(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\nassert(isequal(divisible_by_14(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '210';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100110';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '222';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_14(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_14(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":153,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T01:47:26.000Z","updated_at":"2026-03-27T16:40:51.000Z","published_at":"2015-06-26T01:47:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 14. If a number is\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/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42409-divisible-by-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, then it is divisible by 14.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42415-divisible-by-13\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 13\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem\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/42417-divisible-by-15\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 15\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42418,"title":"Divisible by 16","description":"Write a function to determine if a number is divisible by 16. This can be done by a few different methods. Here are two:\r\n\r\n# If a number has four or more digits, take the last three digits. Add eight to it if the thousands digit in the original number is odd (zero if even). If this three-digit number is divisible by 16, so is the original number. The resulting number can also be reduced by the following method.\r\n# Take the last two digits and add them to four times the remaining number. Apply this method recursively until a two-digit number remains. As usual, if the resulting number is divisible by 16, then so is the original number.\r\n\r\nA few of the function restrictions have been lifted.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15 divisible by 15\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors divisible by n, prime vs. composite divisors\u003e.","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 16. This can be done by a few different methods. Here are two:\u003c/p\u003e\u003col\u003e\u003cli\u003eIf a number has four or more digits, take the last three digits. Add eight to it if the thousands digit in the original number is odd (zero if even). If this three-digit number is divisible by 16, so is the original number. The resulting number can also be reduced by the following method.\u003c/li\u003e\u003cli\u003eTake the last two digits and add them to four times the remaining number. Apply this method recursively until a two-digit number remains. As usual, if the resulting number is divisible by 16, then so is the original number.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eA few of the function restrictions have been lifted.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42417-divisible-by-15\"\u003edivisible by 15\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\"\u003edivisible by n, prime vs. composite divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_16(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_16.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\n% assert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\n% assert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\n% assert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\n% assert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '16';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '208';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '210';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '1236128';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567888';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922784';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_16(n_str),0))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100112';\r\nassert(isequal(divisible_by_16(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567888';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '208';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100112';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1236123';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012';\r\n\t\tassert(isequal(divisible_by_16(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567888';\r\n\t\tassert(isequal(divisible_by_16(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":178,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T02:08:33.000Z","updated_at":"2026-03-31T13:28:32.000Z","published_at":"2015-06-26T02:08:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 16. This can be done by a few different methods. Here are two:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf a number has four or more digits, take the last three digits. Add eight to it if the thousands digit in the original number is odd (zero if even). If this three-digit number is divisible by 16, so is the original number. The resulting number can also be reduced by the following method.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake the last two digits and add them to four times the remaining number. Apply this method recursively until a two-digit number remains. As usual, if the resulting number is divisible by 16, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA few of the function restrictions have been lifted.\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\u003ePrevious problem:\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/42417-divisible-by-15\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 15\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42453-divisible-by-n-prime-vs-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by n, prime vs. composite divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42405,"title":"Divisible by 3","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 3.\r\n\r\nWrite a function to determine if a number is divisible by 3. This can be checked by at least two different methods:\r\n\r\n# Sum the digits in the number. If the resulting sum is divisible by 3, then so is the original number. This routine can be applied recursively until the resulting sum is a single digit.\r\n# From the \u003chttps://en.wikipedia.org/wiki/Divisibility_rule wikipedia reference page\u003e: \"Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number.\" If the resulting sum (absolute value) is a multiple of 3, then so is the original number.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 divisible by 2\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4 divisible by 4\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 3.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 3. This can be checked by at least two different methods:\u003c/p\u003e\u003col\u003e\u003cli\u003eSum the digits in the number. If the resulting sum is divisible by 3, then so is the original number. This routine can be applied recursively until the resulting sum is a single digit.\u003c/li\u003e\u003cli\u003eFrom the \u003ca href = \"https://en.wikipedia.org/wiki/Divisibility_rule\"\u003ewikipedia reference page\u003c/a\u003e: \"Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number.\" If the resulting sum (absolute value) is a multiple of 3, then so is the original number.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003edivisible by 2\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42406-divisible-by-4\"\u003edivisible by 4\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_3(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_3.m');\r\nassert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '232';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '223';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '1236127';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_3(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_3(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '1236127';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '13';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_3(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_3(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":12,"comments_count":7,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":429,"test_suite_updated_at":"2015-06-25T03:11:34.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T02:27:10.000Z","updated_at":"2026-03-24T12:40:53.000Z","published_at":"2015-06-25T02:27:10.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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 3. This can be checked by at least two different methods:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSum the digits in the number. If the resulting sum is divisible by 3, then so is the original number. This routine can be applied recursively until the resulting sum is a single digit.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFrom 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/Divisibility_rule\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia reference page\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e: \\\"Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number.\\\" If the resulting sum (absolute value) is a multiple of 3, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42406-divisible-by-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42510,"title":"Divisible by n, Composite Divisors","description":"Pursuant to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors Divisible by n, prime vs. composite divisors\u003e, this problem requires you to write a function that determines divisibility for a large number (n_str) when the divisor is a composite. As was required in that problem, you will need to formulate the highest-power factorization of the divisor. Divisibility of n_str can then be determined by testing against each highest-power factor. For simplicity, this problem is restricted to numbers that contain the following as highest-power factors: 2, 3, 4, 5, 8, 9, and 10, as these divisibility tests are trivial. Their rules are included briefly below, for reference.\r\n\r\nAs an example, a number is divisible by 30 if it is divisible by 2, 3, and 5, as those are the highest-power factors for 30. Likewise, a number is divisible by 36 if it is divisible by 4 and 9 (not 3), as those are its highest-power factors.\r\n\r\nThe only restriction that remains is Java.\r\n\r\n* Divisible by 2: if the last digit is divisible by 2.\r\n* Divisible by 3: if the sum of the number's digits (n_str) is divisible by 3. Apply iteratively, as necessary, to arrive at a single-digit number.\r\n* Divisible by 4: if the last two digits are divisible by 4.\r\n* Divisible by 5: if the last digit is a 0 or 5.\r\n* Divisible by 8: if the last three digits are divisible by 8.\r\n* Divisible by 9: if the sum of the number's digits (n_str) is divisible by 9. Apply iteratively, as necessary, to arrive at a single-digit number.\r\n* Divisible by 10: if the last digit is zero.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors Divisible by n, Truncated-number Divisors\u003e.","description_html":"\u003cp\u003ePursuant to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\"\u003eDivisible by n, prime vs. composite divisors\u003c/a\u003e, this problem requires you to write a function that determines divisibility for a large number (n_str) when the divisor is a composite. As was required in that problem, you will need to formulate the highest-power factorization of the divisor. Divisibility of n_str can then be determined by testing against each highest-power factor. For simplicity, this problem is restricted to numbers that contain the following as highest-power factors: 2, 3, 4, 5, 8, 9, and 10, as these divisibility tests are trivial. Their rules are included briefly below, for reference.\u003c/p\u003e\u003cp\u003eAs an example, a number is divisible by 30 if it is divisible by 2, 3, and 5, as those are the highest-power factors for 30. Likewise, a number is divisible by 36 if it is divisible by 4 and 9 (not 3), as those are its highest-power factors.\u003c/p\u003e\u003cp\u003eThe only restriction that remains is Java.\u003c/p\u003e\u003cul\u003e\u003cli\u003eDivisible by 2: if the last digit is divisible by 2.\u003c/li\u003e\u003cli\u003eDivisible by 3: if the sum of the number's digits (n_str) is divisible by 3. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/li\u003e\u003cli\u003eDivisible by 4: if the last two digits are divisible by 4.\u003c/li\u003e\u003cli\u003eDivisible by 5: if the last digit is a 0 or 5.\u003c/li\u003e\u003cli\u003eDivisible by 8: if the last three digits are divisible by 8.\u003c/li\u003e\u003cli\u003eDivisible by 9: if the sum of the number's digits (n_str) is divisible by 9. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/li\u003e\u003cli\u003eDivisible by 10: if the last digit is zero.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors\"\u003eDivisible by n, Truncated-number Divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = composite_divisors(n,n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('composite_divisors.m');\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = 18;\r\nn_str = '612220032';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '612220031';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '64268410079232';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '192805230237696';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '64268410079230';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '192805230237696000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 18;\r\nn_str = '192805230237696000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 30;\r\nn_str = '64268410079230';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 30;\r\nn_str = '64268410079220';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 90;\r\nn_str = '47829690000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 90;\r\nn_str = '47829690000001';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '101559956668416';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '101559956668417';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '3046798700052480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 36;\r\nn_str = '3046798700052480000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '262144000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '262144000000008';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '52428800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 40;\r\nn_str = '52428800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '4586471424';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '45864714247';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '26418075402240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020';\r\ntf = 0;\r\nassert(isequal(composite_divisors(n,n_str),tf))\r\n\r\n%%\r\nn = 24;\r\nn_str = '26418075402240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(composite_divisors(n,n_str),tf))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":76,"test_suite_updated_at":"2015-08-18T17:06:20.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-08-18T01:06:51.000Z","updated_at":"2026-01-11T11:13:47.000Z","published_at":"2015-08-18T01:06:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003ePursuant to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42453-divisible-by-n-prime-vs-composite-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime vs. composite divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, this problem requires you to write a function that determines divisibility for a large number (n_str) when the divisor is a composite. As was required in that problem, you will need to formulate the highest-power factorization of the divisor. Divisibility of n_str can then be determined by testing against each highest-power factor. For simplicity, this problem is restricted to numbers that contain the following as highest-power factors: 2, 3, 4, 5, 8, 9, and 10, as these divisibility tests are trivial. Their rules are included briefly below, for reference.\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\u003eAs an example, a number is divisible by 30 if it is divisible by 2, 3, and 5, as those are the highest-power factors for 30. Likewise, a number is divisible by 36 if it is divisible by 4 and 9 (not 3), as those are its highest-power factors.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe only restriction that remains is Java.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 2: if the last digit is divisible by 2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 3: if the sum of the number's digits (n_str) is divisible by 3. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 4: if the last two digits are divisible by 4.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 5: if the last digit is a 0 or 5.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 8: if the last three digits are divisible by 8.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 9: if the sum of the number's digits (n_str) is divisible by 9. Apply iteratively, as necessary, to arrive at a single-digit number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by 10: if the last digit is 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42509-divisible-by-n-truncated-number-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, Truncated-number Divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42453,"title":"Divisible by n, prime vs. composite divisors","description":"In general, there are two types of divisibility checks; the first involves composite divisors and the second prime divisors, including powers of prime numbers (technically composite divisors, though they often function similar to prime numbers for the sake of divisibility). We'll get into the specifics of the two divisibility check types in subsequent problems. For now, we'll segregate numbers into three groups, based on type (n_type) while also returning the number's highest-power factorization (hpf). Write a function to return these two variables for a given number; see the following examples for reference:\r\n\r\n  n = 11  |  n_type = 1 (prime)        |  hpf = [11]\r\n  n = 31  |  n_type = 1 (prime)        |  hpf = [31]\r\n  n = 9   |  n_type = 2 (prime power)  |  hpf = [9] (3^2)\r\n  n = 32  |  n_type = 2 (prime power)  |  hpf = [32] (2^5)\r\n  n = 49  |  n_type = 2 (prime power)  |  hpf = [49] (7^2)\r\n  n = 21  |  n_type = 3 (composite)    |  hpf = [3,7]\r\n  n = 39  |  n_type = 3 (composite)    |  hpf = [3,13]\r\n  n = 42  |  n_type = 3 (composite)    |  hpf = [2,3,7]\r\n  n = 63  |  n_type = 3 (composite)    |  hpf = [9,7] ([3^2,7])\r\n  n = 90  |  n_type = 3 (composite)    |  hpf = [2,9,5] ([2,3^2,5])\r\n\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16 divisible by 16\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers Divisible by n, prime divisors (including powers)\u003e.","description_html":"\u003cp\u003eIn general, there are two types of divisibility checks; the first involves composite divisors and the second prime divisors, including powers of prime numbers (technically composite divisors, though they often function similar to prime numbers for the sake of divisibility). We'll get into the specifics of the two divisibility check types in subsequent problems. For now, we'll segregate numbers into three groups, based on type (n_type) while also returning the number's highest-power factorization (hpf). Write a function to return these two variables for a given number; see the following examples for reference:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003en = 11  |  n_type = 1 (prime)        |  hpf = [11]\r\nn = 31  |  n_type = 1 (prime)        |  hpf = [31]\r\nn = 9   |  n_type = 2 (prime power)  |  hpf = [9] (3^2)\r\nn = 32  |  n_type = 2 (prime power)  |  hpf = [32] (2^5)\r\nn = 49  |  n_type = 2 (prime power)  |  hpf = [49] (7^2)\r\nn = 21  |  n_type = 3 (composite)    |  hpf = [3,7]\r\nn = 39  |  n_type = 3 (composite)    |  hpf = [3,13]\r\nn = 42  |  n_type = 3 (composite)    |  hpf = [2,3,7]\r\nn = 63  |  n_type = 3 (composite)    |  hpf = [9,7] ([3^2,7])\r\nn = 90  |  n_type = 3 (composite)    |  hpf = [2,9,5] ([2,3^2,5])\r\n\u003c/pre\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42418-divisible-by-16\"\u003edivisible by 16\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers\"\u003eDivisible by n, prime divisors (including powers)\u003c/a\u003e.\u003c/p\u003e","function_template":"function [n_type,hpf] = composite_vs_prime_divisor(n)\r\n\r\nn_type = 1;\r\nhpf = [1];\r\n\r\nend\r\n","test_suite":"%%\r\nn = 5;\r\ntf_corr = 1; %prime factor\r\nhpf_corr = 5;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 7;\r\ntf_corr = 1; %prime factor\r\nhpf_corr = 7;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 15;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [3,5];\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 25;\r\ntf_corr = 2; %composite factor, prime power (5^2)\r\nhpf_corr = 25;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 125;\r\ntf_corr = 2; %composite factor, prime power (5^3)\r\nhpf_corr = 125;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 20;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [4,5];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 42;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [2,3,7];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 18;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [2,9];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 29;\r\ntf_corr = 1; %prime factor\r\nhpf_corr = 29;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 39;\r\ntf_corr = 3; %composite factor\r\nhpf_corr = [3,13];\r\n[tf,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(tf,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 64;\r\ntf_corr = 2; %composite factor, prime power (2^6)\r\nhpf_corr = 64;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%%\r\nn = 27;\r\ntf_corr = 2; %composite factor, prime power (3^3)\r\nhpf_corr = 27;\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 29;\r\n\t\ttf_corr = 1; %prime factor\r\n\t\thpf_corr = 29;\r\n\tcase 2\r\n\t\tn = 42;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,3,7];\r\n\tcase 3\r\n\t\tn = 18;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,9];\r\n\tcase 4\r\n\t\tn = 42;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,3,7];\r\nend\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 64;\r\n\t\ttf_corr = 2; %composite factor, prime power (2^6)\r\n\t\thpf_corr = 64;\r\n\tcase 2\r\n\t\tn = 27;\r\n\t\ttf_corr = 2; %composite factor, prime power (3^3)\r\n\t\thpf_corr = 27;\r\n\tcase 3\r\n\t\tn = 42;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,3,7];\r\n\tcase 4\r\n\t\tn = 18;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,9];\r\nend\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n\r\n%% anti-cheating test case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = 39;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [3,13];\r\n\tcase 2\r\n\t\tn = 5;\r\n\t\ttf_corr = 1; %prime factor\r\n\t\thpf_corr = 5;\r\n\tcase 3\r\n\t\tn = 18;\r\n\t\ttf_corr = 3; %composite factor\r\n\t\thpf_corr = [2,9];\r\n\tcase 4\r\n\t\tn = 27;\r\n\t\ttf_corr = 2; %composite factor, prime power (3^3)\r\n\t\thpf_corr = 27;\r\nend\r\n[n_type,hpf] = composite_vs_prime_divisor(n);\r\nassert(isequal(n_type,tf_corr))\r\nassert(isequal(hpf,hpf_corr))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":113,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-07-09T01:29:13.000Z","updated_at":"2026-01-11T11:07:59.000Z","published_at":"2015-07-09T01:29:13.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\u003eIn general, there are two types of divisibility checks; the first involves composite divisors and the second prime divisors, including powers of prime numbers (technically composite divisors, though they often function similar to prime numbers for the sake of divisibility). We'll get into the specifics of the two divisibility check types in subsequent problems. For now, we'll segregate numbers into three groups, based on type (n_type) while also returning the number's highest-power factorization (hpf). Write a function to return these two variables for a given number; see the following examples for reference:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[n = 11  |  n_type = 1 (prime)        |  hpf = [11]\\nn = 31  |  n_type = 1 (prime)        |  hpf = [31]\\nn = 9   |  n_type = 2 (prime power)  |  hpf = [9] (3^2)\\nn = 32  |  n_type = 2 (prime power)  |  hpf = [32] (2^5)\\nn = 49  |  n_type = 2 (prime power)  |  hpf = [49] (7^2)\\nn = 21  |  n_type = 3 (composite)    |  hpf = [3,7]\\nn = 39  |  n_type = 3 (composite)    |  hpf = [3,13]\\nn = 42  |  n_type = 3 (composite)    |  hpf = [2,3,7]\\nn = 63  |  n_type = 3 (composite)    |  hpf = [9,7] ([3^2,7])\\nn = 90  |  n_type = 3 (composite)    |  hpf = [2,9,5] ([2,3^2,5])]]\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\u003ePrevious problem:\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/42418-divisible-by-16\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 16\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42454-divisible-by-n-prime-divisors-including-powers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors (including powers)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":563,"title":"How to add?","description":"* Imagine you are in 2222 Anno Domini, when everyone must learn how to add,\r\n* and competing for the highly prestigious post of,\r\n* Chief Comptroller of Dda Corporation.\r\n* You are being tested via \u003chttp://www.mathworks.com/matlabcentral/cody MATLAB Cody\u003e for addition of two positive integers X and Y,\r\n* both are fortunately in decimal system, and only a few dozen digits or less, \r\n* and delivered as ASCII strings.\r\n* Please output the result Z in similar style.\r\n* Please adopt a general strategy, as X and Y may be changed later.\r\n* Please rename the function Z = dda(X,Y).\r\n* Function Template:\r\n    \r\n  function Z = dda(X,Y)\r\n     X='98765432109876543210987654321098765432109876543210987654321'\r\n     Y='98765432109876543210987654321098765432109876543210987654321'\r\n     Z='197530864219753086421975308642197530864219753086421975308642';\r\n  end\r\n","description_html":"\u003cul\u003e\u003cli\u003eImagine you are in 2222 Anno Domini, when everyone must learn how to add,\u003c/li\u003e\u003cli\u003eand competing for the highly prestigious post of,\u003c/li\u003e\u003cli\u003eChief Comptroller of Dda Corporation.\u003c/li\u003e\u003cli\u003eYou are being tested via \u003ca href=\"http://www.mathworks.com/matlabcentral/cody\"\u003eMATLAB Cody\u003c/a\u003e for addition of two positive integers X and Y,\u003c/li\u003e\u003cli\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\u003c/li\u003e\u003cli\u003eand delivered as ASCII strings.\u003c/li\u003e\u003cli\u003ePlease output the result Z in similar style.\u003c/li\u003e\u003cli\u003ePlease adopt a general strategy, as X and Y may be changed later.\u003c/li\u003e\u003cli\u003ePlease rename the function Z = dda(X,Y).\u003c/li\u003e\u003cli\u003eFunction Template:\u003c/li\u003e\u003c/ul\u003e\u003cpre class=\"language-matlab\"\u003efunction Z = dda(X,Y)\r\n   X='98765432109876543210987654321098765432109876543210987654321'\r\n   Y='98765432109876543210987654321098765432109876543210987654321'\r\n   Z='197530864219753086421975308642197530864219753086421975308642';\r\nend\r\n\u003c/pre\u003e","function_template":"function Z = dda(X,Y)\r\n   X='98765432109876543210987654321098765432109876543210987654321';\r\n   Y='98765432109876543210987654321098765432109876543210987654321';\r\n   Z='197530864219753086421975308642197530864219753086421975308642';\r\nend\r\n","test_suite":"%%\r\nX='98765432109876543210987654321098765432109876543210987654321';\r\nY='98765432109876543210987654321098765432109876543210987654321';\r\nZ='197530864219753086421975308642197530864219753086421975308642';\r\nassert(isequal(dda(X,Y),Z))\r\n\r\n%%\r\nX='6546468768680988454345';\r\nY='5757557542432424209808098908085353545657657';\r\nZ='5757557542432424209814645376854034534112002';\r\nassert(isequal(dda(X,Y),Z))\r\n\r\n%%\r\nX='122';\r\nY='323';\r\nZ='445';\r\nassert(isequal(dda(X,Y),Z))\r\n\r\n%%\r\nX='767678686868667868635435353545';\r\nY='465464643244242424249787979';\r\nZ='768144151511912111059685141524';\r\nassert(isequal(dda(X,Y),Z))\r\n","published":true,"deleted":false,"likes_count":9,"comments_count":3,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":156,"test_suite_updated_at":"2012-04-08T02:09:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-04-08T02:09:11.000Z","updated_at":"2026-01-14T15:36:10.000Z","published_at":"2012-04-08T02:09:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImagine you are in 2222 Anno Domini, when everyone must learn how to add,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eand competing for the highly prestigious post of,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eChief Comptroller of Dda Corporation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are being tested via\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMATLAB Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for addition of two positive integers X and Y,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eand delivered as ASCII strings.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease output the result Z in similar style.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease adopt a general strategy, as X and Y may be changed later.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease rename the function Z = dda(X,Y).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFunction Template:\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[function Z = dda(X,Y)\\n   X='98765432109876543210987654321098765432109876543210987654321'\\n   Y='98765432109876543210987654321098765432109876543210987654321'\\n   Z='197530864219753086421975308642197530864219753086421975308642';\\nend]]\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":42415,"title":"Divisible by 13","description":"Write a function to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:\r\n\r\n# Form the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.\r\n# Add four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.\r\n# Similar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.\r\n\r\nSome of the function restrictions have been lifted.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12 divisible by 12\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14 divisible by 14\u003e.","description_html":"\u003cp\u003eWrite a function to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:\u003c/p\u003e\u003col\u003e\u003cli\u003eForm the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.\u003c/li\u003e\u003cli\u003eAdd four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.\u003c/li\u003e\u003cli\u003eSimilar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eSome of the function restrictions have been lifted.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42414-divisible-by-12\"\u003edivisible by 12\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42416-divisible-by-14\"\u003edivisible by 14\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_13(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_13.m');\r\n% assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\n% assert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\n% assert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '13';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '228';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '221';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '1236131';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922799';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_13(n_str),0))\r\n\r\n%%\r\nn_str = '10100101010110101010010110101001011010100101001011010100110101001007';\r\nassert(isequal(divisible_by_13(n_str),1))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '12';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567896';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '221';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '10100101010110101010010110101001011010100101001011010100110101001007';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '228';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_13(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_13(n_str),1))\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":157,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-26T01:40:22.000Z","updated_at":"2025-12-24T20:24:26.000Z","published_at":"2015-06-26T01:40:22.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 to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eForm the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAdd four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome of the function restrictions have been lifted.\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\u003ePrevious problem:\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/42414-divisible-by-12\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42416-divisible-by-14\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 14\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":3077,"title":"Big numbers, least significant digits","description":"Given two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number of digits in x. Keep in mind that the n values in the examples are small, however the test suite values may be much larger. Also, any leading zeros in the final answer should be discounted (If d = 2 and the number ends in 01, just report 1) \r\n\r\nExample #1:\r\n\r\n* x = 23 (therefore d = 2)\r\n* n = 2;\r\n* 23^2 = 529;\r\n* function will return 29\r\n\r\nExample #2:\r\n\r\n* x = 123; (therefore d = 3)\r\n* n = 3;\r\n* 123^3 = 1860867;\r\n* function should return 867","description_html":"\u003cp\u003eGiven two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number of digits in x. Keep in mind that the n values in the examples are small, however the test suite values may be much larger. Also, any leading zeros in the final answer should be discounted (If d = 2 and the number ends in 01, just report 1)\u003c/p\u003e\u003cp\u003eExample #1:\u003c/p\u003e\u003cul\u003e\u003cli\u003ex = 23 (therefore d = 2)\u003c/li\u003e\u003cli\u003en = 2;\u003c/li\u003e\u003cli\u003e23^2 = 529;\u003c/li\u003e\u003cli\u003efunction will return 29\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExample #2:\u003c/p\u003e\u003cul\u003e\u003cli\u003ex = 123; (therefore d = 3)\u003c/li\u003e\u003cli\u003en = 3;\u003c/li\u003e\u003cli\u003e123^3 = 1860867;\u003c/li\u003e\u003cli\u003efunction should return 867\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = findLeastInBig(x,n)\r\n  y = x + n;\r\nend","test_suite":"%%\r\nx = 23;\r\nn = 2\r\ny_correct = 29;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 123;\r\nn = 3;\r\ny_correct = 867;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 9876;\r\nn = 1024;\r\ny_correct = 1376;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 1234;\r\nn = 45;\r\ny_correct = 7824;\r\nassert(isequal(findLeastInBig(x,n),y_correct))\r\n\r\n%%\r\nx = 201;\r\nn = 100;\r\ny_correct = 1;\r\nassert(isequal(findLeastInBig(x,n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":3096,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":106,"test_suite_updated_at":"2015-03-13T13:02:34.000Z","rescore_all_solutions":false,"group_id":45,"created_at":"2015-03-12T15:02:27.000Z","updated_at":"2026-01-15T14:46:42.000Z","published_at":"2015-03-12T15:03: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\u003eGiven two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number of digits in x. Keep in mind that the n values in the examples are small, however the test suite values may be much larger. Also, any leading zeros in the final answer should be discounted (If d = 2 and the number ends in 01, just report 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\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = 23 (therefore d = 2)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 2;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e23^2 = 529;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efunction will return 29\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex = 123; (therefore d = 3)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en = 3;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e123^3 = 1860867;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efunction should return 867\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":42409,"title":"Divisible by 7","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem\u003e in this series, this one involves checking for divisibility by 7.\r\n\r\nWrite a function to determine if a number is divisible by 7. This can be done by a variety of methods. Some are:\r\n\r\n# Multiply each digit in the candidate number (from right to left) by the digit in the corresponding position in this pattern: 1, 3, 2, -1, -3, -2 (1 applies to the ones digit, 3 to the tens digit, etc.). This pattern should be repeated beyond the hundred-thousands digit. The resulting sum will be a smaller number. This method can be applied recursively to the absolute values of the resulting sum until a single digit results. Then, check that number for divisibility by seven.\r\n# The previous method can also be used applying a slightly different pattern: 1, 3, 2, 6, 4, 5 (1 applies to the ones digit again, etc.). The absolute value of the resulting sum is not necessary as none of the factors are negative.\r\n# Multiply the last (ones) digit by two and subtract the result from the remaining number. Apply recursively, as noted in methods above.\r\n# Similar to the previous method, multiply the last digit by five and add to the remaining number. Apply recursively, as noted in methods above.\r\n# Double the last digit and subtract it from the remaining number (original number except for the ones digit). Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\r\n# Similar to the previous method, multiply the ones digit by five and add it to the remaining number. Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\r\n# Along similar lines, take the last three digits of the number and subtract that number from the remaining number. Once you reach a number less than 1000, another method can be applied to further reduce the number to check for divisibility by seven.\r\n# Etc. (there are others)\r\n\r\nThe restriction for multiplication has been lifted for this specific problem.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42408-divisible-by-6 divisible by 6\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8 divisible by 8\u003e.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\"\u003efirst problem\u003c/a\u003e in this series, this one involves checking for divisibility by 7.\u003c/p\u003e\u003cp\u003eWrite a function to determine if a number is divisible by 7. This can be done by a variety of methods. Some are:\u003c/p\u003e\u003col\u003e\u003cli\u003eMultiply each digit in the candidate number (from right to left) by the digit in the corresponding position in this pattern: 1, 3, 2, -1, -3, -2 (1 applies to the ones digit, 3 to the tens digit, etc.). This pattern should be repeated beyond the hundred-thousands digit. The resulting sum will be a smaller number. This method can be applied recursively to the absolute values of the resulting sum until a single digit results. Then, check that number for divisibility by seven.\u003c/li\u003e\u003cli\u003eThe previous method can also be used applying a slightly different pattern: 1, 3, 2, 6, 4, 5 (1 applies to the ones digit again, etc.). The absolute value of the resulting sum is not necessary as none of the factors are negative.\u003c/li\u003e\u003cli\u003eMultiply the last (ones) digit by two and subtract the result from the remaining number. Apply recursively, as noted in methods above.\u003c/li\u003e\u003cli\u003eSimilar to the previous method, multiply the last digit by five and add to the remaining number. Apply recursively, as noted in methods above.\u003c/li\u003e\u003cli\u003eDouble the last digit and subtract it from the remaining number (original number except for the ones digit). Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/li\u003e\u003cli\u003eSimilar to the previous method, multiply the ones digit by five and add it to the remaining number. Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/li\u003e\u003cli\u003eAlong similar lines, take the last three digits of the number and subtract that number from the remaining number. Once you reach a number less than 1000, another method can be applied to further reduce the number to check for divisibility by seven.\u003c/li\u003e\u003cli\u003eEtc. (there are others)\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eThe restriction for multiplication has been lifted for this specific problem.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42408-divisible-by-6\"\u003edivisible by 6\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42410-divisible-by-8\"\u003edivisible by 8\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = divisible_by_7(n_str)\r\n\r\ntf = 1;\r\n\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('divisible_by_7.m');\r\n%assert(isempty(strfind(filetext, '*')),'* forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross() forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod() forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden')\r\nassert(isempty(strfind(filetext, 'times')),'times() forbidden')\r\nassert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden')\r\nassert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden')\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')),'\\ forbidden')\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')),'dot() forbidden')\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn_str = '12';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '14';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '222';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '231';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '224';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '1236123';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%%\r\nn_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796';\r\nassert(isequal(divisible_by_7(n_str),1))\r\n\r\n%%\r\nn_str = '1010010101011010101001011010100101101010010100101101010011010100101';\r\nassert(isequal(divisible_by_7(n_str),0))\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '14';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 4\r\n\t\tn_str = '231';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '101001010101101010100101101010010110101001010010110101001101010010101';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 2\r\n\t\tn_str = '224';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\nend\r\n\r\n%% anti-cheating case\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn_str = '1236123';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\n\tcase 2\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 3\r\n\t\tn_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\n\t\tassert(isequal(divisible_by_7(n_str),0))\r\n\tcase 4\r\n\t\tn_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';\r\n\t\tassert(isequal(divisible_by_7(n_str),1))\r\nend","published":true,"deleted":false,"likes_count":2,"comments_count":5,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":183,"test_suite_updated_at":"2015-06-25T03:15:21.000Z","rescore_all_solutions":false,"group_id":22,"created_at":"2015-06-25T03:07:11.000Z","updated_at":"2025-12-29T13:23:25.000Z","published_at":"2015-06-25T03:07:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003ePursuant to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efirst problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e in this series, this one involves checking for divisibility by 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine if a number is divisible by 7. This can be done by a variety of methods. Some are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMultiply each digit in the candidate number (from right to left) by the digit in the corresponding position in this pattern: 1, 3, 2, -1, -3, -2 (1 applies to the ones digit, 3 to the tens digit, etc.). This pattern should be repeated beyond the hundred-thousands digit. The resulting sum will be a smaller number. This method can be applied recursively to the absolute values of the resulting sum until a single digit results. Then, check that number for divisibility by seven.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe previous method can also be used applying a slightly different pattern: 1, 3, 2, 6, 4, 5 (1 applies to the ones digit again, etc.). The absolute value of the resulting sum is not necessary as none of the factors are negative.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMultiply the last (ones) digit by two and subtract the result from the remaining number. Apply recursively, as noted in methods above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous method, multiply the last digit by five and add to the remaining number. Apply recursively, as noted in methods above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDouble the last digit and subtract it from the remaining number (original number except for the ones digit). Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous method, multiply the ones digit by five and add it to the remaining number. Apply this recursively until a single digit results. If that number is divisible by seven, then so is the original number.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAlong similar lines, take the last three digits of the number and subtract that number from the remaining number. Once you reach a number less than 1000, another method can be applied to further reduce the number to check for divisibility by seven.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEtc. (there are others)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe restriction for multiplication has been lifted for this specific problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem:\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/42408-divisible-by-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42410-divisible-by-8\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edivisible by 8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42508,"title":"Divisible by n, prime divisors from 20 to 200","description":"Pursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers for any prime number from 20 to 200. Similar to the previous problem, these can all be checked using the same routine: add or subtract x times the last digit to or from the remaining number after removing that last digit. For example, for 127, the last-digit factor is -38:\r\n\r\n* 2048379: 204837 + -38*9 = 204495: 20449 + -38*5 = 20259: 2025 + -38*9 = 1683: 168 + -38*3 = 54 -\u003e 2048379 is not divisible by 127 since 54 is not divisible by 127.\r\n\r\n* 4853940: 485394 + -38*0 = 485394: 48539 + -38*4 = 48387: 4838 + -38*7 = 4572: 457 + -38*2 = 381: 38 + -38*1 = 0 -\u003e 4853940 is divisible by 127.\r\n\r\nYour function will be provided with the prime number, n, and the number to check for divisibility as a string, n_str. Write a function that returns true or false for each prime number and candidate number pair. See the test suite for more examples. The template function will include arrays of all possible prime number in the given range in addition to a paired array with the associated factors.\r\n\r\nRestrictions on Java, mod, ceil, round, and floor are still in effect.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19 Divisible by n, prime divisors - 11, 13, 17, \u0026 19\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors Divisible by n, Truncated-number Divisors\u003e.","description_html":"\u003cp\u003ePursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers for any prime number from 20 to 200. Similar to the previous problem, these can all be checked using the same routine: add or subtract x times the last digit to or from the remaining number after removing that last digit. For example, for 127, the last-digit factor is -38:\u003c/p\u003e\u003cul\u003e\u003cli\u003e2048379: 204837 + -38*9 = 204495: 20449 + -38*5 = 20259: 2025 + -38*9 = 1683: 168 + -38*3 = 54 -\u0026gt; 2048379 is not divisible by 127 since 54 is not divisible by 127.\u003c/li\u003e\u003c/ul\u003e\u003cul\u003e\u003cli\u003e4853940: 485394 + -38*0 = 485394: 48539 + -38*4 = 48387: 4838 + -38*7 = 4572: 457 + -38*2 = 381: 38 + -38*1 = 0 -\u0026gt; 4853940 is divisible by 127.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYour function will be provided with the prime number, n, and the number to check for divisibility as a string, n_str. Write a function that returns true or false for each prime number and candidate number pair. See the test suite for more examples. The template function will include arrays of all possible prime number in the given range in addition to a paired array with the associated factors.\u003c/p\u003e\u003cp\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42455-divisible-by-n-prime-divisors-11-13-17-19\"\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026 19\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42509-divisible-by-n-truncated-number-divisors\"\u003eDivisible by n, Truncated-number Divisors\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = prime_divisors_20_to_200(n,n_str)\r\n\r\np_digits =      [23 29  31 37  41 43  47 53 59 61 67  71 73 79 83 89 97  101 103 107 109 113 127 131 137 139  149  151 157 163  167 173  179  181 191 193  197 199];\r\nlast_dig_mult = [7  3  -3 -11 -4  13 -14 16 6 -6 -20 -7 -51 8  25 9 -29 -10 -72 -32 -98 -79 -38 -13 -41 -125 -134 -15 -47 -114 -50 -121 -161 -18 -19 -135 -59 -179];\r\n\r\ntf = 1;\r\n\r\nend","test_suite":"%%\r\nfiletext = fileread('prime_divisors_20_to_200.m');\r\nassert(isempty(strfind(filetext, 'rem')),'rem() forbidden')\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = 23;\r\nn_str = '943';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 23;\r\nn_str = '9430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 23;\r\nn_str = '9430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 29;\r\nn_str = '22649';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 31;\r\nn_str = '992';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 31;\r\nn_str = '9920000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 31;\r\nn_str = '9920000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 37;\r\nn_str = '4107';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 41;\r\nn_str = '33292';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 43;\r\nn_str = '85140';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 43;\r\nn_str = '851400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 43;\r\nn_str = '851400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 47;\r\nn_str = '232603';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 53;\r\nn_str = '148877';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 59;\r\nn_str = '12698688';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 61;\r\nn_str = '61965813';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 61;\r\nn_str = '619658130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 61;\r\nn_str = '619658130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 67;\r\nn_str = '22319844';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 71;\r\nn_str = '25411681';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 73;\r\nn_str = '328500';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 73;\r\nn_str = '32850000000000000000000000000000000000000000000000000000000000001000000000000';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 79;\r\nn_str = '41977440';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 83;\r\nn_str = '342873';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 89;\r\nn_str = '8900000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 97;\r\nn_str = '88529281';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 101;\r\nn_str = '104060401';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 101;\r\nn_str = '1040604010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 101;\r\nn_str = '1040604010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 103;\r\nn_str = '112550881';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 107;\r\nn_str = '515205';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 109;\r\nn_str = '141158161';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 113;\r\nn_str = '2151294';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 113;\r\nn_str = '2151294000000000000000000000000113000000000000000000000000113000000000000000000000000113000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 113;\r\nn_str = '2151294000000000000000000000000113000000000000000000000000113000000000000000000000000113000000000000000000000112';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 127;\r\nn_str = '4853940';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 131;\r\nn_str = '294499921';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 137;\r\nn_str = '249421241';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 139;\r\nn_str = '2685619';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 139;\r\nn_str = '268561900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013900000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 139;\r\nn_str = '268561900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013900000000000000000000000000000000000000000000000000000000000000000000000013';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 149;\r\nn_str = '512977200';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 151;\r\nn_str = '141160991';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 157;\r\nn_str = '607573201';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 163;\r\nn_str = '705911761';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 167;\r\nn_str = '777796321';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 173;\r\nn_str = '154963892093';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 179;\r\nn_str = '98682340334763';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 181;\r\nn_str = '35161828327081';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 191;\r\nn_str = '884089868985578';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 193;\r\nn_str = '1387488001';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 197;\r\nn_str = '27000544548887';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '328039798800';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '32803979880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '32803979880000000000000000000000000000000000000000000000000000000000000001990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001990000000000000000000000000000000000199000000000000';\r\ntf = 1;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n\r\n%%\r\nn = 199;\r\nn_str = '32803979880000000000000000000000000000000000000000000000000000000000000001991000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001990000000000000000000000000000000000199000000000000';\r\ntf = 0;\r\nassert(isequal(prime_divisors_20_to_200(n,n_str),tf))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":68,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-08-17T19:05:44.000Z","updated_at":"2025-12-27T11:58:28.000Z","published_at":"2015-08-17T19:05:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePursuant to the previous problem (linked below), this problem requires a function that checks for divisibility of large numbers for any prime number from 20 to 200. Similar to the previous problem, these can all be checked using the same routine: add or subtract x times the last digit to or from the remaining number after removing that last digit. For example, for 127, the last-digit factor is -38:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2048379: 204837 + -38*9 = 204495: 20449 + -38*5 = 20259: 2025 + -38*9 = 1683: 168 + -38*3 = 54 -\u0026gt; 2048379 is not divisible by 127 since 54 is not divisible by 127.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4853940: 485394 + -38*0 = 485394: 48539 + -38*4 = 48387: 4838 + -38*7 = 4572: 457 + -38*2 = 381: 38 + -38*1 = 0 -\u0026gt; 4853940 is divisible by 127.\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 function will be provided with the prime number, n, and the number to check for divisibility as a string, n_str. Write a function that returns true or false for each prime number and candidate number pair. See the test suite for more examples. The template function will include arrays of all possible prime number in the given range in addition to a paired array with the associated factors.\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\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\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\u003ePrevious problem:\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/42455-divisible-by-n-prime-divisors-11-13-17-19\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors - 11, 13, 17, \u0026amp; 19\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42509-divisible-by-n-truncated-number-divisors\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, Truncated-number Divisors\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44513,"title":"Add all the numbers between two limits (inclusive)","description":"In this problem you must add up \"all of the numbers\" between two specified limits, |a| and |b|, in which |a| ≤ |b|.  However, the practical interpretation of \"all of the numbers\" will depend upon the specified \u003chttps://au.mathworks.com/help/matlab/numeric-types.html data type\u003e, |dt|.  \r\n\r\nMathematically speaking, if |a| \u003c |b| then the required sum constitutes an _infinite series_ that does not converge (i.e. the required sum would be infinity).  For example, if |a=1| and |b=2| then we could capture _some_ of those numbers through the series \r\nlim n→∞  ⁿ∑ᵢ₌₁{1 + (1/i)} = lim n→∞ {n + ⁿ∑ᵢ₌₁(1/i)} ≈ lim n→∞ {n + γ + ln(n)}, using properties of the harmonic series in the last approximation.  \r\n\r\nBut MATLAB cannot represent numbers with _infinite_ precision.  In fact, the precision is determined by the specified \u003chttps://au.mathworks.com/help/matlab/numeric-types.html data type\u003e.  For instance, if |dt = 'single'|, then with |a=1| and |b=2| the summation would comprise the series {(1) + (1+1×2⁻²³) + (1+2×2⁻²³) + (1+3×2⁻²³) + ... + (2−2×2⁻²³) + (2−1×2⁻²³) + (2)} = 12582913.5, which is finite.  \r\n\r\nAnother example:\r\n\r\n % INPUT\r\n a = 10\r\n b = 12\r\n dt = 'int16'\r\n % OUTPUT\r\n s = 33         %  = 10 + 11 +12\r\n\r\nSo please add up all the numbers between two limits (inclusive), subject to the precision indicated by the specified \u003chttps://au.mathworks.com/help/matlab/numeric-types.html data type\u003e.  \r\n\r\n_NOTE *1*:  Terminal values |a| and |b| are whole numbers in every case (albeit implicitly defined as of the |double| data type);  they can be positive or negative.  However, values -1\u003cx\u003c+1 are never included in the summations._  \r\n\r\n_NOTE *2*:  All data types specified in the input |dt| shall be \u003chttps://au.mathworks.com/help/matlab/numeric-types.html numeric\u003e._ ","description_html":"\u003cp\u003eIn this problem you must add up \"all of the numbers\" between two specified limits, \u003ctt\u003ea\u003c/tt\u003e and \u003ctt\u003eb\u003c/tt\u003e, in which \u003ctt\u003ea\u003c/tt\u003e ≤ \u003ctt\u003eb\u003c/tt\u003e.  However, the practical interpretation of \"all of the numbers\" will depend upon the specified \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003edata type\u003c/a\u003e, \u003ctt\u003edt\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eMathematically speaking, if \u003ctt\u003ea\u003c/tt\u003e \u0026lt; \u003ctt\u003eb\u003c/tt\u003e then the required sum constitutes an \u003ci\u003einfinite series\u003c/i\u003e that does not converge (i.e. the required sum would be infinity).  For example, if \u003ctt\u003ea=1\u003c/tt\u003e and \u003ctt\u003eb=2\u003c/tt\u003e then we could capture \u003ci\u003esome\u003c/i\u003e of those numbers through the series \r\nlim n→∞  ⁿ∑ᵢ₌₁{1 + (1/i)} = lim n→∞ {n + ⁿ∑ᵢ₌₁(1/i)} ≈ lim n→∞ {n + γ + ln(n)}, using properties of the harmonic series in the last approximation.\u003c/p\u003e\u003cp\u003eBut MATLAB cannot represent numbers with \u003ci\u003einfinite\u003c/i\u003e precision.  In fact, the precision is determined by the specified \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003edata type\u003c/a\u003e.  For instance, if \u003ctt\u003edt = 'single'\u003c/tt\u003e, then with \u003ctt\u003ea=1\u003c/tt\u003e and \u003ctt\u003eb=2\u003c/tt\u003e the summation would comprise the series {(1) + (1+1×2⁻²³) + (1+2×2⁻²³) + (1+3×2⁻²³) + ... + (2−2×2⁻²³) + (2−1×2⁻²³) + (2)} = 12582913.5, which is finite.\u003c/p\u003e\u003cp\u003eAnother example:\u003c/p\u003e\u003cpre\u003e % INPUT\r\n a = 10\r\n b = 12\r\n dt = 'int16'\r\n % OUTPUT\r\n s = 33         %  = 10 + 11 +12\u003c/pre\u003e\u003cp\u003eSo please add up all the numbers between two limits (inclusive), subject to the precision indicated by the specified \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003edata type\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003ci\u003eNOTE \u003cb\u003e1\u003c/b\u003e:  Terminal values \u003ctt\u003ea\u003c/tt\u003e and \u003ctt\u003eb\u003c/tt\u003e are whole numbers in every case (albeit implicitly defined as of the \u003ctt\u003edouble\u003c/tt\u003e data type);  they can be positive or negative.  However, values -1\u0026lt;x\u0026lt;+1 are never included in the summations.\u003c/i\u003e\u003c/p\u003e\u003cp\u003e\u003ci\u003eNOTE \u003cb\u003e2\u003c/b\u003e:  All data types specified in the input \u003ctt\u003edt\u003c/tt\u003e shall be \u003ca href = \"https://au.mathworks.com/help/matlab/numeric-types.html\"\u003enumeric\u003c/a\u003e.\u003c/i\u003e\u003c/p\u003e","function_template":"function s = summation(a, b, dt)\r\n    \r\nend","test_suite":"%%\r\na = 1;\r\nb = 2;\r\ndt = 'uint64';\r\ns_correct = 3;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\ndt = 'int8';\r\ns_correct = 3;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\ndt = 'single';\r\ns_correct = 12582913.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\ndt = 'double';\r\ns_correct = 6755399441055746;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'int32';\r\ns_correct = 5;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'uint16';\r\ns_correct = 5;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'single';\r\ns_correct = 10485762.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 2;\r\nb = 3;\r\ndt = 'double';\r\ns_correct = 5629499534213122;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'int64';\r\ns_correct = 9;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'uint8';\r\ns_correct = 9;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'single';\r\ns_correct = 9437188.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 4;\r\nb = 5;\r\ndt = 'double';\r\ns_correct = 5066549580791812;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'uint32';\r\ns_correct = 17;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'int16';\r\ns_correct = 17;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'single';\r\ns_correct = 8912904.5;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n%%\r\na = 8;\r\nb = 9;\r\ndt = 'double';\r\ns_correct = 4785074604081160;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 2 )\r\n\r\n\r\n%%\r\na = 20;\r\nb = 22;\r\ndt = 'int32';\r\ns_correct = 63;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 20;\r\nb = 22;\r\ndt = 'double';\r\ns_correct = 11821949021847573;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 4 )\r\n\r\n%%\r\na = 20;\r\nb = 22;\r\ndt = 'single';\r\ns_correct = 22020117;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 4 )\r\n\r\n\r\n%%\r\na = 20;\r\nb = 30;\r\ndt = 'uint16';\r\ns_correct = 275;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 20;\r\nb = 30;\r\ndt = 'double';\r\ns_correct = 70368744177664025;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 32 )\r\n\r\n%%\r\na = 20;\r\nb = 30;\r\ndt = 'single';\r\ns_correct = 131072025;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 32 )\r\n\r\n\r\n%%\r\na = 1;\r\nb = 17;\r\ndt = 'uint8';\r\ns_correct = 153;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = 1;\r\nb = 17;\r\ndt = 'double';\r\ns_correct = 105975328731561993;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 64 )\r\n\r\n%%\r\na = 1;\r\nb = 17;\r\ndt = 'single';\r\ns_correct = 197394441;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 64 )\r\n\r\n\r\n%%\r\na = -130;\r\nb = -126;\r\ndt = 'int32';\r\ns_correct = -640;\r\ns = summation(a, b, dt);\r\nassert( isequal(s, s_correct) )\r\n\r\n%%\r\na = -130;\r\nb = -126;\r\ndt = 'double';\r\ns_correct = -26951229020045440;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 16 )\r\n\r\n%%\r\na = -130;\r\nb = -126;\r\ndt = 'single';\r\ns_correct = -50200704;\r\ns = summation(a, b, dt);\r\nassert( abs(s - s_correct) \u003c 16 )\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-02-06T03:56:08.000Z","updated_at":"2018-02-06T14:46:13.000Z","published_at":"2018-02-06T14:39: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\u003eIn this problem you must add up \\\"all of the numbers\\\" between two specified limits,\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\u003ea\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, in which\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≤\u003c/w:t\u003e\u003c/w:r\u003e\u003cw: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\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. However, the practical interpretation of \\\"all of the numbers\\\" will depend upon the specified\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://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMathematically speaking, if\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\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u0026lt;\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\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e then the required sum constitutes an\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\u003einfinite series\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that does not converge (i.e. the required sum would be infinity). For example, if\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\u003ea=1\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb=2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e then we could capture\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\u003esome\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of those numbers through the series lim n→∞ ⁿ∑ᵢ₌₁{1 + (1/i)} = lim n→∞ {n + ⁿ∑ᵢ₌₁(1/i)} ≈ lim n→∞ {n + γ + ln(n)}, using properties of the harmonic series in the last approximation.\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\u003eBut MATLAB cannot represent numbers with\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\u003einfinite\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e precision. In fact, the precision is determined by the specified\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://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. For instance, if\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\u003edt = 'single'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, then with\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\u003ea=1\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb=2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e the summation would comprise the series {(1) + (1+1×2⁻²³) + (1+2×2⁻²³) + (1+3×2⁻²³) + ... + (2−2×2⁻²³) + (2−1×2⁻²³) + (2)} = 12582913.5, which is finite.\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\u003eAnother 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[ % INPUT\\n a = 10\\n b = 12\\n dt = 'int16'\\n % OUTPUT\\n s = 33         %  = 10 + 11 +12]]\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\u003eSo please add up all the numbers between two limits (inclusive), subject to the precision indicated by the specified\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://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNOTE\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e: Terminal values\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e are whole numbers in every case (albeit implicitly defined as of the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edouble\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e data type); they can be positive or negative. However, values -1\u0026lt;x\u0026lt;+1 are never included in the summations.\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:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNOTE\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e: All data types specified in the input\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e shall be\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/numeric-types.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enumeric\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\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":44695,"title":"What score did they give?","description":"Your task in this problem is to figure out the most recent score, |S|, submitted.  \r\n\r\n\u003c\u003chttps://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Star_rating_4.5_of_5.png/799px-Star_rating_4.5_of_5.png\u003e\u003e\r\n\r\nMany websites allow users to rate things like restaurants, books, films, and even computer programs.  Often these are rated _from one to five stars_, and the display shows the _average_ rating after _rounding to one decimal place_, |R|, and the number of users who have rated the item/place/thing, |N|.  \r\n\r\nThis morning you checked the website and noted |R| and |N|.  This evening you check again:  |N| has increased by one, and the rounded version of the updated overall rating is now displayed, |R_new|.  You then deduce what possible scores, |S|, were submitted by the additional person during the day.  \r\n\r\nEXAMPLE\r\n\r\n % Inputs\r\n N = 11\r\n R = 2.5\r\n R_new = 2.6\r\n % Output\r\n S = [3 4]\r\n\r\nExplanation:  Given |N|=11, the unrounded version of |R| must have been either 2 ⁵/₁₁ or 2 ⁶/₁₁. Increasing |N| by 1 with an additional score of either 4 stars or 3 stars (respectively) would mean that the unrounded version of |R_new| would become 2 ⁷/₁₂, consistent with the displayed value.  \r\n\r\n|S| shall be a row vector, or scalar, or empty.  If |S| is a row vector, scores shall be listed in ascending order, without repetition.  ","description_html":"\u003cp\u003eYour task in this problem is to figure out the most recent score, \u003ctt\u003eS\u003c/tt\u003e, submitted.\u003c/p\u003e\u003cimg src = \"https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Star_rating_4.5_of_5.png/799px-Star_rating_4.5_of_5.png\"\u003e\u003cp\u003eMany websites allow users to rate things like restaurants, books, films, and even computer programs.  Often these are rated \u003ci\u003efrom one to five stars\u003c/i\u003e, and the display shows the \u003ci\u003eaverage\u003c/i\u003e rating after \u003ci\u003erounding to one decimal place\u003c/i\u003e, \u003ctt\u003eR\u003c/tt\u003e, and the number of users who have rated the item/place/thing, \u003ctt\u003eN\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eThis morning you checked the website and noted \u003ctt\u003eR\u003c/tt\u003e and \u003ctt\u003eN\u003c/tt\u003e.  This evening you check again:  \u003ctt\u003eN\u003c/tt\u003e has increased by one, and the rounded version of the updated overall rating is now displayed, \u003ctt\u003eR_new\u003c/tt\u003e.  You then deduce what possible scores, \u003ctt\u003eS\u003c/tt\u003e, were submitted by the additional person during the day.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e % Inputs\r\n N = 11\r\n R = 2.5\r\n R_new = 2.6\r\n % Output\r\n S = [3 4]\u003c/pre\u003e\u003cp\u003eExplanation:  Given \u003ctt\u003eN\u003c/tt\u003e=11, the unrounded version of \u003ctt\u003eR\u003c/tt\u003e must have been either 2 ⁵/₁₁ or 2 ⁶/₁₁. Increasing \u003ctt\u003eN\u003c/tt\u003e by 1 with an additional score of either 4 stars or 3 stars (respectively) would mean that the unrounded version of \u003ctt\u003eR_new\u003c/tt\u003e would become 2 ⁷/₁₂, consistent with the displayed value.\u003c/p\u003e\u003cp\u003e\u003ctt\u003eS\u003c/tt\u003e shall be a row vector, or scalar, or empty.  If \u003ctt\u003eS\u003c/tt\u003e is a row vector, scores shall be listed in ascending order, without repetition.\u003c/p\u003e","function_template":"function S = latestScore(N, R, R_new)\r\n    \r\nend","test_suite":"%% No silly stuff\r\n% This Test Suite can be updated if inappropriate 'hacks' are discovered \r\n% in any submitted solutions, so your submission's status may therefore change over time.  \r\nassessFunctionAbsence({'regexp', 'regexpi', 'str2num'}, 'FileName','latestScore.m')\r\n\r\nRE = regexp(fileread('latestScore.m'), '\\w+', 'match');\r\ntabooWords = {'ans'};\r\ntestResult = cellfun( @(z) ismember(z, tabooWords), RE );\r\nmsg = ['Please do not do that in your code!' char([10 13]) ...\r\n    'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...\r\n    'Banned word.' char([10 13])];\r\nassert(~any( testResult ), msg)\r\n\r\n\r\n%% N = 11\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.2;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.3;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.4;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [2 3];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.6;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [3 4];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [4 5];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.8;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 11;\r\nR = 2.5;\r\nR_new = 2.9;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n\r\n\r\n%% N = 12\r\nN = 12;\r\nR = 2.3;\r\nR_new = 2.2;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 12;\r\nR = 2.3;\r\nR_new = 2.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [4 5];\r\nassert(isequal(S, S_correct))\r\n\r\n\r\n\r\n%% N = 17\r\nN = 17;\r\nR = 1.6;\r\nR_new = 1.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [2 3 4];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 2.6;\r\nR_new = 2.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 2.6;\r\nR_new = 2.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [3 4 5];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 2.6;\r\nR_new = 2.8;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 3.4;\r\nR_new = 3.2;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 3.4;\r\nR_new = 3.3;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2 3];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 17;\r\nR = 3.4;\r\nR_new = 3.5;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n\r\n%% N = 48\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.5;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n\r\n%%\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.6;\r\nS = latestScore(N, R, R_new);\r\nS_correct = [1 2];\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.7;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 3.7;\r\nR_new = 3.8;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.2;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:4;\r\nassert( isempty(S) )\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.3;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:4;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.4;\r\nS = latestScore(N, R, R_new);\r\nS_correct = 1:5;\r\nassert(isequal(S, S_correct))\r\n\r\n%%\r\nN = 48;\r\nR = 4.4;\r\nR_new = 4.5;\r\nS = latestScore(N, R, R_new);\r\nassert( isempty(S) )\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-07-09T03:13:05.000Z","updated_at":"2025-09-14T14:31:48.000Z","published_at":"2018-07-09T04:06:39.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.png\"}],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task in this problem is to figure out the most recent score,\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\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, submitted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMany websites allow users to rate things like restaurants, books, films, and even computer programs. Often these are rated\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\u003efrom one to five stars\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and the display shows the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eaverage\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e rating after\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\u003erounding to one decimal place\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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\u003eR\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and the number of users who have rated the item/place/thing,\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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis morning you checked the website and noted\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\u003eR\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. This evening you check again: \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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e has increased by one, and the rounded version of the updated overall rating is now displayed,\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\u003eR_new\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. You then deduce what possible scores,\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\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, were submitted by the additional person during the day.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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[ % Inputs\\n N = 11\\n R = 2.5\\n R_new = 2.6\\n % Output\\n S = [3 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExplanation: Given\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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e=11, the unrounded version of\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\u003eR\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e must have been either 2 ⁵/₁₁ or 2 ⁶/₁₁. Increasing\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\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e by 1 with an additional score of either 4 stars or 3 stars (respectively) would mean that the unrounded version of\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\u003eR_new\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e would become 2 ⁷/₁₂, consistent with the displayed value.\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e shall be a row vector, or scalar, or empty. If\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\u003eS\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a row vector, scores shall be listed in ascending order, without repetition.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAx8AAACqCAYAAADMS/L+AACAAElEQVR42uydB3gc1dX3r2xjegkOJRBIgASSkEoIIZB8SSBvyksK6QnJy0sCCc0Y4yLbalvVe7d6s2zLvYFteg8BUiGBF2I6BIipAuy1Jc33nzuzq9nRvTN3Zncl2Tr3ec4zq7aaOfPbc87/tmGMGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVq1KhRo0aNGjVqk7xpc0aNGrWJYI8aNeKOGjVq1NLfHrrqbPbn33yOaeQKapMqEV9jJuOryRfUxpG7JVQEUpsg9q4n7qiR6KU2Ndr/FZzObqz8LuAj+UFtcomP6QiIJ2hXsmnkDWrjxl0hywJ3x8NmkjeojRt3v+fiYxa4O1y7gvxBbRzZmwfLJj9QG9/2lwWfOei+eed/qOe6xVnkDWqTJyBex05EIo7iOIu8QW3cuJvNDgN3+bCPQ/hSozY+3P2OzQBzv4cA+Zb2W/IHtXHi7moueo/XbmCnIfZRozY+3F3O2I75p37q9kVfL8kPFx9BHqE2OcDMg81nF2kL2F8RFL+qBcgn1MaBuwLYXPYZsPcguPsNikDqkaGWee40swCczzZo81iZdg07iLxCbZzExzTEvF/BciA+DiCPUBsX7pBb35j//ivvyP/vvxQEw2e3LPo9OYXaJAAzjIC4gJVo2extJOMlWg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TLjMIemF/e8Za/tM1KZlCO88NMXuNbCtRxuz0YnWRe2p0ERWGy5ilZFyNi+Yc/q8UOG1KyVvP/FQ3kCGdxDIOQ7Gt7/o+u2m+5BNinEg3YfczJiJA8EHH+9xJp9iWPR0dKMzOAf3IYedQQNhMyH4uJtmwxlN00rmidn7uo1395IjeCpkOI4P+95eOIF80paRPOOuTcJ+keBBtwQh+caaIB52GoKPrAzgHV8UNUt7EZwTCZZuawsCU1k4EGB/CP6k9y+LS7LEw3gDDTbqxQcciQxMN9+LOUZZwn0ZUnY1Hby71wi8RPDRffch11gteGZmzCpGi1reovd0CN51M++KIT/RHcKMcALroPOmiN7dbrezPAi5iaafzQzeGSJa97aHpTvZI6Ep7ClviQCDgg8oQq2EptsVrTvvhc8wxhmyqBTNOFQkVo3uMfdiToYEH9OM7GepuO89gnezMyj4EE5gzwl8szMj+BBNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFEE0000UQTTTTRRBNNNNFE69r2/wGutU8LllhfnwAAAABJRU5ErkJggg==\"}]}"},{"id":1197,"title":"Numerical Integration","description":"Input\r\n\r\n* |x0|, a real number greater than 0\r\n\r\nOutput\r\n\r\n* |I|, a numerical estimate of the integral\r\n\r\n      x0\r\n      /\r\n  I = |  cosh(x) / sqrt(cosh(x0) - cosh(x)) dx\r\n      /\r\n      0\r\n\r\nExample:\r\n\r\n   x0=1.0  --\u003e  I = 2.6405789412796\r\n\r\n\r\nRemarks:\r\n\r\n* Aim at a relative precision better than 1e-10\r\n* The problem arises studying the frictionless movement of a mass point on a hanging wire, which follows the curve cosh(x).","description_html":"\u003cp\u003eInput\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ctt\u003ex0\u003c/tt\u003e, a real number greater than 0\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eOutput\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ctt\u003eI\u003c/tt\u003e, a numerical estimate of the integral\u003c/li\u003e\u003c/ul\u003e\u003cpre\u003e      x0\r\n      /\r\n  I = |  cosh(x) / sqrt(cosh(x0) - cosh(x)) dx\r\n      /\r\n      0\u003c/pre\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e   x0=1.0  --\u003e  I = 2.6405789412796\u003c/pre\u003e\u003cp\u003eRemarks:\u003c/p\u003e\u003cul\u003e\u003cli\u003eAim at a relative precision better than 1e-10\u003c/li\u003e\u003cli\u003eThe problem arises studying the frictionless movement of a mass point on a hanging wire, which follows the curve cosh(x).\u003c/li\u003e\u003c/ul\u003e","function_template":"function I = coshint(x0)\r\n  I = x0;\r\nend","test_suite":"%%\r\nx0 = 1;\r\nI_correct = 2.6405789412796;\r\nfprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\nassert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\n\r\n%%\r\nx0 = 2;\r\nI_correct = 3.9464053536380;\r\nfprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\nassert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\n\r\n%%\r\nx0 = 13;\r\nI_correct = 9.4065231838369e+02;\r\nfprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\nassert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\n\r\n%% randomized test for small values of x0 where \r\n % cosh(x) ~ 1 + x^2/2 + ...\r\n % and up to x0=1e-5 Integrating (analytically) the approximation is\r\n % accurate enough\r\nfor l=1:5\r\n   x0 = 1e-6 * (1+rand);\r\n   I_correct = pi*(4+x0^2)/4/sqrt(2);\r\n   fprintf('Relative difference to reference solution: %e\\n',norm(coshint(x0)-I_correct)/I_correct)\r\n   assert(norm(coshint(x0)-I_correct)/I_correct \u003c= 1e-10)\r\nend","published":true,"deleted":false,"likes_count":1,"comments_count":9,"created_by":203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":106,"test_suite_updated_at":"2013-01-11T15:08:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-01-11T14:11:17.000Z","updated_at":"2026-03-13T22:59:58.000Z","published_at":"2013-01-11T15:08:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, a real number greater than 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eI\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, a numerical estimate of the integral\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[      x0\\n      /\\n  I = |  cosh(x) / sqrt(cosh(x0) - cosh(x)) dx\\n      /\\n      0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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[   x0=1.0  --\u003e  I = 2.6405789412796]]\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\u003eRemarks:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAim at a relative precision better than 1e-10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe problem arises studying the frictionless movement of a mass point on a hanging wire, which follows the curve cosh(x).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42455,"title":"Divisible by n, prime divisors - 11, 13, 17, \u0026 19","description":"Divisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:\r\n\r\n* 2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -\u003e 2392 is divisible by 13.\r\n\r\nFor 17, subtract five times the last digit from the rest:\r\n\r\n* 3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -\u003e 3281 is divisible by 17.\r\n\r\nFor 19, add two times the last digit to the rest:\r\n\r\n* 16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -\u003e 16863 is not divisible by 19.\r\n\r\nAnd, for 11, subtract the last digit from the rest:\r\n\r\n* 269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -\u003e 269830 is divisible by 11.\r\n\r\nWrite a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.\r\n\r\nRestrictions on Java, mod, ceil, round, and floor are still in effect.\r\n\r\nPrevious problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers Divisible by n, prime divisors (including powers)\u003e. Next problem: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200 Divisible by n, prime divisors from 20 to 200\u003e.","description_html":"\u003cp\u003eDivisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -\u0026gt; 2392 is divisible by 13.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor 17, subtract five times the last digit from the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -\u0026gt; 3281 is divisible by 17.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor 19, add two times the last digit to the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -\u0026gt; 16863 is not divisible by 19.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eAnd, for 11, subtract the last digit from the rest:\u003c/p\u003e\u003cul\u003e\u003cli\u003e269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -\u0026gt; 269830 is divisible by 11.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWrite a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.\u003c/p\u003e\u003cp\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\u003c/p\u003e\u003cp\u003ePrevious problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42454-divisible-by-n-prime-divisors-including-powers\"\u003eDivisible by n, prime divisors (including powers)\u003c/a\u003e. Next problem: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42508-divisible-by-n-prime-divisors-from-20-to-200\"\u003eDivisible by n, prime divisors from 20 to 200\u003c/a\u003e.\u003c/p\u003e","function_template":"function [tf] = prime_divisors_11_to_20(n)\r\n\r\np_digits = [11 13 17 19];\r\ntf = zeros(1,4); %[11 13 17 19]\r\n\t\r\nend\r\n","test_suite":"%%\r\nfiletext = fileread('prime_divisors_11_to_20.m');\r\nassert(isempty(strfind(filetext, 'mod')),'mod() forbidden')\r\nassert(isempty(strfind(filetext, 'round')),'round() forbidden')\r\nassert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden')\r\nassert(isempty(strfind(filetext, 'floor')),'floor() forbidden')\r\nassert(isempty(strfind(filetext, 'java')),'java forbidden')\r\n\r\n%%\r\nn = '143';\r\ntf = [1 1 0 0]; %[11 13 17 19]\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '187';\r\ntf = [1 0 1 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '221';\r\ntf = [0 1 1 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '247';\r\ntf = [0 1 0 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '46189';\r\ntf = [1 1 1 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '2133423721';\r\ntf = [1 1 1 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '233296158667';\r\ntf = [1 1 1 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '1011001000101010101010110101001010101001010101001001011010101000101010101010101010010101010010101010100101010101001100101010010101';\r\ntf = [0 0 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '1011001000101010101010110101001010101001010101001001011010101000101010101010101010010101010010101010100101010101001100101010010103';\r\ntf = [0 1 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '1011001000101010101010110101001010101001010101001001011010101000101010101010101010010101010010101010100101010101001100101010010107';\r\ntf = [0 0 0 1];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%\r\nn = '14300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = [1 1 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '14300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001';\r\ntf = [0 0 0 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%%\r\nn = '22100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\ntf = [0 1 1 0];\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = '221';\r\n\t\ttf = [0 1 1 0];\r\n\tcase 2\r\n\t\tn = '233296158667';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 3\r\n\t\tn = '46189';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 4\r\n\t\tn = '247';\r\n\t\ttf = [0 1 0 1];\r\nend\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = '187';\r\n\t\ttf = [1 0 1 0];\r\n\tcase 2\r\n\t\tn = '143';\r\n\t\ttf = [1 1 0 0];\r\n\tcase 3\r\n\t\tn = '221';\r\n\t\ttf = [0 1 1 0];\r\n\tcase 4\r\n\t\tn = '233296158667';\r\n\t\ttf = [1 1 1 1];\r\nend\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n\r\n%% anti-cheating test\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tn = '2133423721';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 2\r\n\t\tn = '46189';\r\n\t\ttf = [1 1 1 1];\r\n\tcase 3\r\n\t\tn = '187';\r\n\t\ttf = [1 0 1 0];\r\n\tcase 4\r\n\t\tn = '247';\r\n\t\ttf = [0 1 0 1];\r\nend\r\nassert(isequal(prime_divisors_11_to_20(n),tf))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":22,"created_at":"2015-07-09T04:18:06.000Z","updated_at":"2025-12-28T20:47:42.000Z","published_at":"2015-07-09T04:18: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\u003eDivisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -\u0026gt; 2392 is divisible by 13.\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 17, subtract five times the last digit from the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -\u0026gt; 3281 is divisible by 17.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor 19, add two times the last digit to the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -\u0026gt; 16863 is not divisible by 19.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnd, for 11, subtract the last digit from the rest:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -\u0026gt; 269830 is divisible by 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.\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\u003eRestrictions on Java, mod, ceil, round, and floor are still in effect.\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\u003ePrevious problem:\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/42454-divisible-by-n-prime-divisors-including-powers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors (including powers)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem:\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/42508-divisible-by-n-prime-divisors-from-20-to-200\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDivisible by n, prime divisors from 20 to 200\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1165,"title":"Convert double scalar to half-precision floating point (IEEE 754r)","description":"Use MATLAB to convert a scalar double into a half-precision floating point.  The return value should be a uint16.\r\n\r\nThe half-precision floating point format is specified here, and is the source for much of the test suite:\r\n\r\n\u003chttp://en.wikipedia.org/wiki/Half-precision_floating-point_format\u003e\r\n\r\nThis is an implementation in C if you want some inspiration to get started:\r\n\r\n\u003chttp://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\u003e\r\n\r\nAs other problems related to half-precision are added, I will try to link them here.","description_html":"\u003cp\u003eUse MATLAB to convert a scalar double into a half-precision floating point.  The return value should be a uint16.\u003c/p\u003e\u003cp\u003eThe half-precision floating point format is specified here, and is the source for much of the test suite:\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://en.wikipedia.org/wiki/Half-precision_floating-point_format\"\u003ehttp://en.wikipedia.org/wiki/Half-precision_floating-point_format\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThis is an implementation in C if you want some inspiration to get started:\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\"\u003ehttp://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\u003c/a\u003e\u003c/p\u003e\u003cp\u003eAs other problems related to half-precision are added, I will try to link them here.\u003c/p\u003e","function_template":"function H = double2half(D)\r\n  H = D;\r\nend","test_suite":"%%\r\nassert(double2half(2^(-24)) == uint16(1)) % Smallest number\r\n%%\r\nassert(double2half(2^(-25)) == uint16(1)) % Rounds up to smallest number\r\n%%\r\nassert(double2half(2^(-26)) == uint16(0)) % Rounds down to zero\r\n%%\r\nassert(bin2dec('0 01111 0000000000') == double2half(1))\r\n%%\r\nassert(bin2dec('0 01111 0000000001') == double2half(1 + 2^(-10)))\r\n%%\r\nassert(bin2dec('1 10000 0000000000') == double2half(-2))\r\n%%\r\nassert(bin2dec('0 11110 1111111111') == double2half(65504))\r\n%%\r\nassert(bin2dec('0 00001 0000000000') == double2half(2^(-14)))\r\n%%\r\nassert(bin2dec('0 00000 1111111111') == double2half(2^(-14) - 2^(-24)))\r\n%%\r\nassert(bin2dec('0 00000 0000000001') == double2half(2^(-24)))\r\n%%\r\nassert(bin2dec('0 00000 0000000000') == double2half(0))\r\n%%\r\nassert(bin2dec('1 00000 0000000000') == double2half(-0))\r\n%%\r\nassert(bin2dec('0 11111 0000000000') == double2half(inf))\r\n%%\r\nassert(bin2dec('1 11111 0000000000') == double2half(-inf))\r\n%%\r\nassert(bin2dec('0 01101 0101010101') == double2half(0.33325))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":8780,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":"2013-01-03T17:42:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-01-03T17:31:54.000Z","updated_at":"2025-12-21T07:22:06.000Z","published_at":"2013-01-03T17:42:13.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\u003eUse MATLAB to convert a scalar double into a half-precision floating point. The return value should be a uint16.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe half-precision floating point format is specified here, and is the source for much of the test suite:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Half-precision_floating-point_format\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Half-precision_floating-point_format\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is an implementation in C if you want some inspiration to get started:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/fileexchange/23173-ieee-754r-half-precision-floating-point-converter\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs other problems related to half-precision are added, I will try to link them here.\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":44545,"title":"\"Percentages may not total 100 due to rounding\"","description":"*Percentages* are commonly *rounded* when presented in tables.  As a result, the sum of the individual numbers does not always add up to 100%.  A warning is therefore sometimes appended to such tables, along the lines: _\"Percentages may not total 100 due to rounding\"_.\r\n\r\nEXAMPLE 1:\r\nA survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral.  Percentage-wise this becomes\r\n\r\n  In favour:          45% (5 of 11)\r\n  Undecided/neutral:   9% (1 of 11)  \r\n  Opposed:            45% (5 of 11)  \r\n\r\nThe total of these is 99%, rather than the expected 100%.  Despite this conflict, in this example *all of the individual numbers have been correctly entered*.  \r\n\r\nEXAMPLE 2:\r\nIn the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral.  Suppose the data were presented in the following table\r\n\r\n  In favour:          45%\r\n  Undecided/neutral:  20%\r\n  Opposed:            45%\r\n\r\nGiven the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%.  In fact, we would probably guess that a copy-and-paste mistake had occurred.  However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example *one or more of the individual numbers must have been entered incorrectly*.  \r\n\r\nYOUR JOB:  \r\nGiven a list (vector) of integer percentages, determine whether among the individual values at least one of them _must_ have been incorrectly entered (return |true|), as in Example 2, or whether there might not be any incorrect entries (return |false|), as in Example 1.","description_html":"\u003cp\u003e\u003cb\u003ePercentages\u003c/b\u003e are commonly \u003cb\u003erounded\u003c/b\u003e when presented in tables.  As a result, the sum of the individual numbers does not always add up to 100%.  A warning is therefore sometimes appended to such tables, along the lines: \u003ci\u003e\"Percentages may not total 100 due to rounding\"\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eEXAMPLE 1:\r\nA survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral.  Percentage-wise this becomes\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eIn favour:          45% (5 of 11)\r\nUndecided/neutral:   9% (1 of 11)  \r\nOpposed:            45% (5 of 11)  \r\n\u003c/pre\u003e\u003cp\u003eThe total of these is 99%, rather than the expected 100%.  Despite this conflict, in this example \u003cb\u003eall of the individual numbers have been correctly entered\u003c/b\u003e.\u003c/p\u003e\u003cp\u003eEXAMPLE 2:\r\nIn the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral.  Suppose the data were presented in the following table\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eIn favour:          45%\r\nUndecided/neutral:  20%\r\nOpposed:            45%\r\n\u003c/pre\u003e\u003cp\u003eGiven the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%.  In fact, we would probably guess that a copy-and-paste mistake had occurred.  However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example \u003cb\u003eone or more of the individual numbers must have been entered incorrectly\u003c/b\u003e.\u003c/p\u003e\u003cp\u003eYOUR JOB:  \r\nGiven a list (vector) of integer percentages, determine whether among the individual values at least one of them \u003ci\u003emust\u003c/i\u003e have been incorrectly entered (return \u003ctt\u003etrue\u003c/tt\u003e), as in Example 2, or whether there might not be any incorrect entries (return \u003ctt\u003efalse\u003c/tt\u003e), as in Example 1.\u003c/p\u003e","function_template":"% \"May not sum to total due to rounding: the probability of rounding errors\"\r\n% Henry Bottomley, 03 June 2008\r\n% http://www.se16.info/hgb/rounding.pdf\r\n\r\n% \"How to make rounded percentages add up to 100%\"\r\n% https://stackoverflow.com/questions/13483430/how-to-make-rounded-percentages-add-up-to-100\r\n% cf. https://stackoverflow.com/questions/5227215/how-to-deal-with-the-sum-of-rounded-percentage-not-being-100\r\nfunction containsMistake = checkForMistake(z)\r\n    containsMistake = true * + false,\r\nend","test_suite":"%% Basics\r\nassessFunctionAbsence({'regexp', 'regexpi'}, 'FileName','checkForMistake.m')\r\n\r\n%% Example 1 (Row vector)\r\nxVec = round( 100*[5 1 5]/11 );\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) )\r\n\r\n%% Example 1 (Column vector)\r\nxVec = round( 100*[5 1 5]/11 )';\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) )\r\n\r\n%% Example 2 (Row vector)\r\nxVec = [42 20 45];\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) )\r\n\r\n%% One percentage, over and under\r\nxVec = [100];\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test a')\r\nxVec = round([100.5]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test b')\r\nxVec = round([99.49]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test c')\r\n\r\n%% Two percentages, over and under\r\nxVec = [50 50];\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test a')\r\nxVec = round([49.5 50.5]);\r\ncontainsMistake = false;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test b')\r\nxVec = round([50.5 50.5]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test c')\r\nxVec = round([49.49 50.49]);\r\ncontainsMistake = true;\r\nassert( isequal(checkForMistake(xVec), containsMistake) , 'Failed test d')\r\n\r\n%% Equal percentages\r\nfor j = [2:250 1000:1000:10000]\r\n    xVec = round( repelem(100/j, j) );\r\n    containsMistake = false;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Geometric series (from Bottomley, §5)\r\nfor j = 10:30\r\n    xVec = round( 10 * (9/10).^[0:j] );\r\n    containsMistake = j \u003c 21;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Geometric series (from Bottomley, §5), permuted\r\nfor j = 2:40\r\n    xVec = round( 10 * (9/10).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 21;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) I\r\nfor j = 2:100\r\n    xVec = round( (99/100).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 66;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) II\r\nfor j = 2:30\r\n    xVec = round( 20 * (4/5).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 12;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) III\r\nfor j = 2:20\r\n    xVec = round( 25 * (3/4).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 10;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Other geometric series (permuted) IV\r\nfor j = 2:20\r\n    xVec = round( 50 * (1/2).^[0:j] );\r\n    xVec = xVec( randperm(j+1) );\r\n    containsMistake = j \u003c 5;\r\n    assert( isequal(checkForMistake(xVec), containsMistake) )\r\nend;\r\n\r\n%% Systematic overestimation\r\nfor j = 2:100\r\n    num = randi(round(100/j)+1) - 1;\r\n    xRaw = repelem(num+0.5, j);   % cf. https://oletus.github.io/float16-simulator.js/\r\n    sm = sum(xRaw);\r\n    xRaw = [xRaw max(100-sm, 0)];\r\n    if sm \u003e 100.5,                % Not sm\u003e100, because need to account for extra zero added.\r\n        containsMistake = true;\r\n    else\r\n        containsMistake = false;\r\n    end;\r\n    xVec = round( xRaw );\r\n    xVec = xVec( randperm(j+1) );\r\n    assert( isequal(checkForMistake(xVec), containsMistake) , ['Failed with xRaw = ' num2str(xRaw)] )\r\nend;\r\n\r\n%% Systematic underestimation\r\nfor j = 2:100\r\n    num = randi(round(100/j)+1) - 1;\r\n    xRaw = repelem(num+0.499755859375, j);   % cf. https://oletus.github.io/float16-simulator.js/ \u0026 https://au.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html\r\n    cs = cumsum(xRaw);\r\n    if cs(end) \u003e 100,\r\n        xRaw( cs \u003e 100 ) = [];\r\n        containsMistake = true;\r\n    else\r\n        xRaw = [xRaw (100-cs(end))];\r\n        containsMistake = false;\r\n    end;\r\n    xVec = round( xRaw );\r\n    assert( isequal(checkForMistake(xVec), containsMistake) , ['Failed with xRaw = ' num2str(xRaw)] )\r\nend;","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-03-23T08:02:20.000Z","updated_at":"2018-03-24T13:53:40.000Z","published_at":"2018-03-24T13:53:40.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ePercentages\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are commonly\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\u003erounded\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e when presented in tables. As a result, the sum of the individual numbers does not always add up to 100%. A warning is therefore sometimes appended to such tables, along the lines:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\\\"Percentages may not total 100 due to rounding\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE 1: A survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral. Percentage-wise this becomes\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[In favour:          45% (5 of 11)\\nUndecided/neutral:   9% (1 of 11)  \\nOpposed:            45% (5 of 11)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe total of these is 99%, rather than the expected 100%. Despite this conflict, in this example\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\u003eall of the individual numbers have been correctly entered\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE 2: In the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral. Suppose the data were presented in the following table\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[In favour:          45%\\nUndecided/neutral:  20%\\nOpposed:            45%]]\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\u003eGiven the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%. In fact, we would probably guess that a copy-and-paste mistake had occurred. However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eone or more of the individual numbers must have been entered incorrectly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYOUR JOB: Given a list (vector) of integer percentages, determine whether among the individual values at least one of them\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\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e have been incorrectly entered (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), as in Example 2, or whether there might not be any incorrect entries (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\u003efalse\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e), as in Example 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"precision\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"precision\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"precision\"","","\"","precision","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f53495d4758\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f53495d46b8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f53495d3df8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f53495d4a78\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f53495d49d8\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f53495d4938\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f53495d47f8\u003e":"tag:\"precision\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f53495d47f8\u003e":"tag:\"precision\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"precision\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"precision\"","","\"","precision","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f53495d4758\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f53495d46b8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f53495d3df8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f53495d4a78\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f53495d49d8\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f53495d4938\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f53495d47f8\u003e":"tag:\"precision\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f53495d47f8\u003e":"tag:\"precision\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":42412,"difficulty_rating":"easy"},{"id":42407,"difficulty_rating":"easy-medium"},{"id":42404,"difficulty_rating":"easy-medium"},{"id":42411,"difficulty_rating":"easy-medium"},{"id":42408,"difficulty_rating":"easy-medium"},{"id":42417,"difficulty_rating":"easy-medium"},{"id":42406,"difficulty_rating":"easy-medium"},{"id":42509,"difficulty_rating":"easy-medium"},{"id":42414,"difficulty_rating":"easy-medium"},{"id":42410,"difficulty_rating":"easy-medium"},{"id":42454,"difficulty_rating":"easy-medium"},{"id":42413,"difficulty_rating":"easy-medium"},{"id":42416,"difficulty_rating":"easy-medium"},{"id":42418,"difficulty_rating":"easy-medium"},{"id":42405,"difficulty_rating":"easy-medium"},{"id":42510,"difficulty_rating":"easy-medium"},{"id":42453,"difficulty_rating":"easy-medium"},{"id":563,"difficulty_rating":"medium"},{"id":42415,"difficulty_rating":"medium"},{"id":3077,"difficulty_rating":"medium"},{"id":42409,"difficulty_rating":"medium"},{"id":42508,"difficulty_rating":"medium"},{"id":44513,"difficulty_rating":"medium"},{"id":44695,"difficulty_rating":"medium"},{"id":1197,"difficulty_rating":"medium"},{"id":42455,"difficulty_rating":"medium"},{"id":1165,"difficulty_rating":"hard"},{"id":44545,"difficulty_rating":"unrated"}]}}