{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-06-25T00:23:38.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-06-25T00: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":61414,"title":"Count divisors of n!","description":"The factorial of 5, or 5! = 120, has 16 divisors: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. How many does n! have in general?\r\nWrite a function to count the divisors of n!. Express the answer as a character string. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 469px 25.5px; transform-origin: 469px 25.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 445px 10.5px; text-align: left; transform-origin: 445px 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe factorial of 5, or 5! = 120, has 16 divisors: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. How many does n! have in general?\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: 445px 10.5px; text-align: left; transform-origin: 445px 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to count the divisors of n!. Express the answer as a character string. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = factdiv(n)\r\n  y = num2str(length(divisor(factorial(n))));\r\nend","test_suite":"%%\r\nassert(isequal(factdiv(0),'1'))\r\n\r\n%%\r\nassert(isequal(factdiv(1),'1'))\r\n\r\n%%\r\nassert(isequal(factdiv(2),'2'))\r\n\r\n%%\r\nassert(isequal(factdiv(3),'4'))\r\n\r\n%%\r\nassert(isequal(factdiv(4),'8'))\r\n\r\n%%\r\nassert(isequal(factdiv(5),'16'))\r\n\r\n%%\r\nassert(isequal(factdiv(6),'30'))\r\n\r\n%%\r\nassert(isequal(factdiv(15),'4032'))\r\n\r\n%%\r\nassert(isequal(factdiv(71),'7087690874880'))\r\n\r\n%%\r\nassert(isequal(factdiv(95),'12282857127936000'))\r\n\r\n%%\r\nassert(isequal(factdiv(203),'333557340202801337204736000000'))\r\n\r\n%%\r\nassert(isequal(factdiv(950),'1246142817179437186158111398013413982877332495477217120427560889821922577556881469278781440000000000000'))\r\n\r\n%%\r\nassert(isequal(factdiv(9709),'31871475078256673561802023367879686068066973204851011849424241211020401048808048030076184995680308280142312121153105273191127198616933047701638912837583055915566578539182389389841827092466839735790449096058536600004311851959854900280212491923757609066066864262423062382705865637819342809338342516259965140276342446498231379337767349204794515997417280987749719438271406160239935092846609000827512919798885738361876121852708093709746345912128909110975045155904539006604221844620530898720465408820863679887294381526441424849219924552141379859747857986785810986570960751585878752460871688225019939750650709016576000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'))\r\n\r\n%%\r\nassert(isequal(factdiv(22222),'467130016414116311392793737273393058501114054601498483008218122176736077385984514635725391012256389797728949291160435827604627506868894531954727908934078641200805615751274975392278007131577743280765076909159191218015949564102902445870558153362420914652569553720870080314381763274363810783970609808104990505729533908181356903535876868562397236785733265166456441285955473538815950958897003708150765527854058354584732951208574920930252136119200848254432457302142871781208674354878520535324185708333824231574396029565105734071212489214108861679976096869151986357235012997095080574251112872511832136898918085462268876066513923677502276627754981603506101896650709701146570161335005313930179099500484160818161097869269729884552242886960346702548895809905625609992292244954081984004577360519676881694525465575607761026612204216013077104543428808933948808331105559935231929775317743296856564143757094015992628127123955713518798785075071236482400281646106480537452879526909200065140520409928831330875687792909798026433799965297102560061650647921359702914247434929598167105993922544043959741430660470588335391101042749694465777919280164610865298050240535023187402657211979483112732895842674513794289970246362415061429445922390258657731332871108488530493944410377880589578018329654512844800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'))\r\n\r\n%%\r\ny = factdiv(30204);\r\nd = y-'0';\r\nn = length(y);\r\nassert(n,1960)\r\nassert(isequal(sum(d),7344))\r\nassert(isequal(sum(d.*(-1).^(1:n)),132))\r\n\r\n%%\r\nfiletext = fileread('factdiv.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2026-06-27T03:45:32.000Z","deleted_by":null,"deleted_at":null,"solvers_count":0,"test_suite_updated_at":"2026-06-27T03:45:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2026-06-27T03:43:16.000Z","updated_at":"2026-06-27T03:45:32.000Z","published_at":"2026-06-27T03:45:32.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe factorial of 5, or 5! = 120, has 16 divisors: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. How many does n! have in general?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 count the divisors of n!. Express the answer as a character string. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"problems":[{"id":61414,"title":"Count divisors of n!","description":"The factorial of 5, or 5! = 120, has 16 divisors: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. How many does n! have in general?\r\nWrite a function to count the divisors of n!. Express the answer as a character string. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 469px 25.5px; transform-origin: 469px 25.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 445px 10.5px; text-align: left; transform-origin: 445px 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe factorial of 5, or 5! = 120, has 16 divisors: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. How many does n! have in general?\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: 445px 10.5px; text-align: left; transform-origin: 445px 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to count the divisors of n!. Express the answer as a character string. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = factdiv(n)\r\n  y = num2str(length(divisor(factorial(n))));\r\nend","test_suite":"%%\r\nassert(isequal(factdiv(0),'1'))\r\n\r\n%%\r\nassert(isequal(factdiv(1),'1'))\r\n\r\n%%\r\nassert(isequal(factdiv(2),'2'))\r\n\r\n%%\r\nassert(isequal(factdiv(3),'4'))\r\n\r\n%%\r\nassert(isequal(factdiv(4),'8'))\r\n\r\n%%\r\nassert(isequal(factdiv(5),'16'))\r\n\r\n%%\r\nassert(isequal(factdiv(6),'30'))\r\n\r\n%%\r\nassert(isequal(factdiv(15),'4032'))\r\n\r\n%%\r\nassert(isequal(factdiv(71),'7087690874880'))\r\n\r\n%%\r\nassert(isequal(factdiv(95),'12282857127936000'))\r\n\r\n%%\r\nassert(isequal(factdiv(203),'333557340202801337204736000000'))\r\n\r\n%%\r\nassert(isequal(factdiv(950),'1246142817179437186158111398013413982877332495477217120427560889821922577556881469278781440000000000000'))\r\n\r\n%%\r\nassert(isequal(factdiv(9709),'31871475078256673561802023367879686068066973204851011849424241211020401048808048030076184995680308280142312121153105273191127198616933047701638912837583055915566578539182389389841827092466839735790449096058536600004311851959854900280212491923757609066066864262423062382705865637819342809338342516259965140276342446498231379337767349204794515997417280987749719438271406160239935092846609000827512919798885738361876121852708093709746345912128909110975045155904539006604221844620530898720465408820863679887294381526441424849219924552141379859747857986785810986570960751585878752460871688225019939750650709016576000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'))\r\n\r\n%%\r\nassert(isequal(factdiv(22222),'467130016414116311392793737273393058501114054601498483008218122176736077385984514635725391012256389797728949291160435827604627506868894531954727908934078641200805615751274975392278007131577743280765076909159191218015949564102902445870558153362420914652569553720870080314381763274363810783970609808104990505729533908181356903535876868562397236785733265166456441285955473538815950958897003708150765527854058354584732951208574920930252136119200848254432457302142871781208674354878520535324185708333824231574396029565105734071212489214108861679976096869151986357235012997095080574251112872511832136898918085462268876066513923677502276627754981603506101896650709701146570161335005313930179099500484160818161097869269729884552242886960346702548895809905625609992292244954081984004577360519676881694525465575607761026612204216013077104543428808933948808331105559935231929775317743296856564143757094015992628127123955713518798785075071236482400281646106480537452879526909200065140520409928831330875687792909798026433799965297102560061650647921359702914247434929598167105993922544043959741430660470588335391101042749694465777919280164610865298050240535023187402657211979483112732895842674513794289970246362415061429445922390258657731332871108488530493944410377880589578018329654512844800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'))\r\n\r\n%%\r\ny = factdiv(30204);\r\nd = y-'0';\r\nn = length(y);\r\nassert(n,1960)\r\nassert(isequal(sum(d),7344))\r\nassert(isequal(sum(d.*(-1).^(1:n)),132))\r\n\r\n%%\r\nfiletext = fileread('factdiv.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2026-06-27T03:45:32.000Z","deleted_by":null,"deleted_at":null,"solvers_count":0,"test_suite_updated_at":"2026-06-27T03:45:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2026-06-27T03:43:16.000Z","updated_at":"2026-06-27T03:45:32.000Z","published_at":"2026-06-27T03:45:32.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe factorial of 5, or 5! = 120, has 16 divisors: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. How many does n! have in general?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\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 count the divisors of n!. Express the answer as a character string. \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\"}]}"}],"errors":[],"facets":[[],[{"value":"unrated","count":4,"selected":true}]],"term":"difficulty_rating_bin:unrated","page":1,"per_page":50,"sort":"map(difficulty_value,0,0,999) asc"}}