{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":60351,"title":"List the smallest numbers with n distinct prime factors","description":"The author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote\r\nHe replied, “Sixty, sandwiched between two primes, has the property that no smaller number has more distinct prime factors. Other than that, nothing special.”\r\nBut something is wrong here, right? The prime factors of 60 are 2, 2, 3, and 5, so the distinct prime factors are 2, 3, and 5. Therefore, 30 is the smallest number with three distinct prime factors.* \r\nWrite a function to compute the smallest number with n distinct prime factors. The output should be a character string.\r\n*It’s also sandwiched between two primes, but that does not matter for this problem.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 183px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 91.5px; transform-origin: 407px 91.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 295.475px 8px; transform-origin: 295.475px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eHe replied, “Sixty, sandwiched between two primes, has the property that no smaller number has more distinct prime factors. Other than that, nothing special.”\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 263.692px 8px; transform-origin: 263.692px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut something is wrong here, right? The prime factors of 60 are 2, 2, 3, and 5, so 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: 21.7833px 8px; transform-origin: 21.7833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003edistinct\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: 93.3333px 8px; transform-origin: 93.3333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e prime factors are 2, 3, and 5. Therefore, 30 is the smallest number with three distinct prime factors.* \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 363.925px 8px; transform-origin: 363.925px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to compute the smallest number with n distinct prime factors. The output should be a character string.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 259.3px 8px; transform-origin: 259.3px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e*It’s also sandwiched between two primes, but that does not matter for this problem.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = distinctPrimeFactors(n)\r\n  y = 60;\r\nend","test_suite":"%%\r\nassert(isequal(distinctPrimeFactors(3),'30'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(5),'2310'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(8),'9699690'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(13),'304250263527210'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(21),'40729680599249024150621323470'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(34),'10014646650599190067509233131649940057366334653200433090'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(55),'16516447045902521732188973253623425320896207954043566485360902980990824644545340710198976591011245999110'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(89),'10102574809838931493563579754057136575994012365333403682475788728812063979234193977195222615030954044197955428585419874540003126019373287245560908992012558535497807870905292679023395158616370'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(144),'171727669756972376902861738254114655280597474114759472116177793400917216844871513640350014879098605654571658417576687171673403061797149009342311588300977096341524273767934137776255806424522072216733108035072933813297489814109474049970727407109550488178191646465447556477892206443477687876305870160975542239330730972069972474028928388608248065290'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(233),'9189414087491039800880055609146522608640643105710865848524831931143932408765270813943136733480610427141427827168818980561173676774505553959155462375635200349289561211614264532001730364154844778738378568626947597222427066339686267023434687656281991821410303331300350025119702187952416937287517972284229291367191868188561306640463207376861638527435083849567105972953756885305836802485587419093231307441697083897783707881090616860003137399108322810240796894808935587729160656382418392094202940338440165153847121104809166464739518796564902972032381814182975606086119103246399044321497028008027937126480989340561536762110'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(377),'91056602623681839933000277835660278306268909917966787703571558831735142729992563438764310372664351007643252888315275872467010162675153979148609248057839914280052645124456782610163170079161660673195683241770655848064007554874928596707851448215509804850897012637752963522919554375826208067252747225160569310969963688995404118996523465159836079780354593283047505648669864007991030579367800727005029349594956447441760933334942334655235779637319648168271867486861513186678602618915029739785440677957954389527683449179505211582176461345723411714039141794059906076894833813399824592672650607918217408272911372379019448797586309640381609042137546726830379168744914269647294017413251860984267338296824190213257545934155841331731249481120369355573167636777962138057634325375260100397639154483275616350894858210638193678101209236317751647693772781961807833690589779166504293901239072979554683660361493687791429181784621494591906888879721879590386403823844556310210698357796211990473658787964378826644530668862588903679049846095133514629852938713169969916463201231562639602344148689362026263819214879190'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(610),'154538384872666018323632009495551272757909237514517502369722177507664050977692825430313028076772381944144041698512981244638531639772788077945759098030440575235639372363823714551379653536529131308318092753294939109353090179664000275256551549707765030239320532803520046095990914794568645585457140827863740762043967931923952954145564641162811856178265005557909234379776917847344945204501015981851056264000658659073172308287581951081634882324502599895371532886359091762963220447803302559973301197314909601535890229012285967040540641966675970891858138753732145081862078674809760481870639257824072716271675847792405754780564079522028552372524629386410548563441931774516023658093746010233873680442526575511595753540249300555268893403360450739861940347831016864065401736061987533760891025470904771359354705195443190877516149398053324042859657294420709527228316498465782890254300406688483541479354452946365578452088730448025010614642680374577425673853880206098180379136686709483555956464728741753743963998370774141131662674571160018119242728456348419264193248283824256720405239274772927898881602190621605349816610516677028157390226442753362180514189607021471847917318558496435885560817672744725821092417848734434739911804203364598702775918478230478367256845755906505264812851191987706609687335287735185395622616188976067364310190309836252791168226659213022945053676548032644641531316670917766059892322823985604366926592174416606022743262725884967750191753470645144454633935789765310391194329804486002393830214465703982014365174091011185420863032054820245694528694369302087331310910405737039072770229885376513972117585017767280444272002093402494639059753791845084461610834943866078396584128769479869906069923267036361519487672424517458176514834465870063351624403259570840303230723617427832212717008396671372712409114832150580926625792547080848001656475949139530061636562797621503724914108206977191992702534749320749525211385130'))\r\n\r\n%%\r\ny = distinctPrimeFactors(987);\r\nassert(isequal(sum(y-'0'),14973) \u0026\u0026 isequal(length(y),3343))\r\n\r\n%%\r\ny = distinctPrimeFactors(1597);\r\nassert(isequal(sum(y-'0'),26166) \u0026\u0026 isequal(length(y),5795))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2024-05-22T03:13:14.000Z","deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-05-22T03:08:39.000Z","updated_at":"2024-05-22T03:13:14.000Z","published_at":"2024-05-22T03:08:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHe replied, “Sixty, sandwiched between two primes, has the property that no smaller number has more distinct prime factors. Other than that, nothing special.”\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBut something is wrong here, right? The prime factors of 60 are 2, 2, 3, and 5, so the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edistinct\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e prime factors are 2, 3, and 5. Therefore, 30 is the smallest number with three distinct prime 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to compute the smallest number with n distinct prime factors. The output should be a character 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e*It’s also sandwiched between two primes, but that does not matter for this problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":60351,"title":"List the smallest numbers with n distinct prime factors","description":"The author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote\r\nHe replied, “Sixty, sandwiched between two primes, has the property that no smaller number has more distinct prime factors. Other than that, nothing special.”\r\nBut something is wrong here, right? The prime factors of 60 are 2, 2, 3, and 5, so the distinct prime factors are 2, 3, and 5. Therefore, 30 is the smallest number with three distinct prime factors.* \r\nWrite a function to compute the smallest number with n distinct prime factors. The output should be a character string.\r\n*It’s also sandwiched between two primes, but that does not matter for this problem.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 183px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 91.5px; transform-origin: 407px 91.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 295.475px 8px; transform-origin: 295.475px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eHe replied, “Sixty, sandwiched between two primes, has the property that no smaller number has more distinct prime factors. Other than that, nothing special.”\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 263.692px 8px; transform-origin: 263.692px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut something is wrong here, right? The prime factors of 60 are 2, 2, 3, and 5, so 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: 21.7833px 8px; transform-origin: 21.7833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003edistinct\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: 93.3333px 8px; transform-origin: 93.3333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e prime factors are 2, 3, and 5. Therefore, 30 is the smallest number with three distinct prime factors.* \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 363.925px 8px; transform-origin: 363.925px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to compute the smallest number with n distinct prime factors. The output should be a character string.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 259.3px 8px; transform-origin: 259.3px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e*It’s also sandwiched between two primes, but that does not matter for this problem.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = distinctPrimeFactors(n)\r\n  y = 60;\r\nend","test_suite":"%%\r\nassert(isequal(distinctPrimeFactors(3),'30'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(5),'2310'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(8),'9699690'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(13),'304250263527210'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(21),'40729680599249024150621323470'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(34),'10014646650599190067509233131649940057366334653200433090'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(55),'16516447045902521732188973253623425320896207954043566485360902980990824644545340710198976591011245999110'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(89),'10102574809838931493563579754057136575994012365333403682475788728812063979234193977195222615030954044197955428585419874540003126019373287245560908992012558535497807870905292679023395158616370'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(144),'171727669756972376902861738254114655280597474114759472116177793400917216844871513640350014879098605654571658417576687171673403061797149009342311588300977096341524273767934137776255806424522072216733108035072933813297489814109474049970727407109550488178191646465447556477892206443477687876305870160975542239330730972069972474028928388608248065290'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(233),'9189414087491039800880055609146522608640643105710865848524831931143932408765270813943136733480610427141427827168818980561173676774505553959155462375635200349289561211614264532001730364154844778738378568626947597222427066339686267023434687656281991821410303331300350025119702187952416937287517972284229291367191868188561306640463207376861638527435083849567105972953756885305836802485587419093231307441697083897783707881090616860003137399108322810240796894808935587729160656382418392094202940338440165153847121104809166464739518796564902972032381814182975606086119103246399044321497028008027937126480989340561536762110'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(377),'91056602623681839933000277835660278306268909917966787703571558831735142729992563438764310372664351007643252888315275872467010162675153979148609248057839914280052645124456782610163170079161660673195683241770655848064007554874928596707851448215509804850897012637752963522919554375826208067252747225160569310969963688995404118996523465159836079780354593283047505648669864007991030579367800727005029349594956447441760933334942334655235779637319648168271867486861513186678602618915029739785440677957954389527683449179505211582176461345723411714039141794059906076894833813399824592672650607918217408272911372379019448797586309640381609042137546726830379168744914269647294017413251860984267338296824190213257545934155841331731249481120369355573167636777962138057634325375260100397639154483275616350894858210638193678101209236317751647693772781961807833690589779166504293901239072979554683660361493687791429181784621494591906888879721879590386403823844556310210698357796211990473658787964378826644530668862588903679049846095133514629852938713169969916463201231562639602344148689362026263819214879190'))\r\n\r\n%%\r\nassert(isequal(distinctPrimeFactors(610),'154538384872666018323632009495551272757909237514517502369722177507664050977692825430313028076772381944144041698512981244638531639772788077945759098030440575235639372363823714551379653536529131308318092753294939109353090179664000275256551549707765030239320532803520046095990914794568645585457140827863740762043967931923952954145564641162811856178265005557909234379776917847344945204501015981851056264000658659073172308287581951081634882324502599895371532886359091762963220447803302559973301197314909601535890229012285967040540641966675970891858138753732145081862078674809760481870639257824072716271675847792405754780564079522028552372524629386410548563441931774516023658093746010233873680442526575511595753540249300555268893403360450739861940347831016864065401736061987533760891025470904771359354705195443190877516149398053324042859657294420709527228316498465782890254300406688483541479354452946365578452088730448025010614642680374577425673853880206098180379136686709483555956464728741753743963998370774141131662674571160018119242728456348419264193248283824256720405239274772927898881602190621605349816610516677028157390226442753362180514189607021471847917318558496435885560817672744725821092417848734434739911804203364598702775918478230478367256845755906505264812851191987706609687335287735185395622616188976067364310190309836252791168226659213022945053676548032644641531316670917766059892322823985604366926592174416606022743262725884967750191753470645144454633935789765310391194329804486002393830214465703982014365174091011185420863032054820245694528694369302087331310910405737039072770229885376513972117585017767280444272002093402494639059753791845084461610834943866078396584128769479869906069923267036361519487672424517458176514834465870063351624403259570840303230723617427832212717008396671372712409114832150580926625792547080848001656475949139530061636562797621503724914108206977191992702534749320749525211385130'))\r\n\r\n%%\r\ny = distinctPrimeFactors(987);\r\nassert(isequal(sum(y-'0'),14973) \u0026\u0026 isequal(length(y),3343))\r\n\r\n%%\r\ny = distinctPrimeFactors(1597);\r\nassert(isequal(sum(y-'0'),26166) \u0026\u0026 isequal(length(y),5795))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2024-05-22T03:13:14.000Z","deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-05-22T03:08:39.000Z","updated_at":"2024-05-22T03:13:14.000Z","published_at":"2024-05-22T03:08:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHe replied, “Sixty, sandwiched between two primes, has the property that no smaller number has more distinct prime factors. Other than that, nothing special.”\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBut something is wrong here, right? The prime factors of 60 are 2, 2, 3, and 5, so the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edistinct\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e prime factors are 2, 3, and 5. Therefore, 30 is the smallest number with three distinct prime 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to compute the smallest number with n distinct prime factors. The output should be a character 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e*It’s also sandwiched between two primes, but that does not matter for this problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"46087\"","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:\"46087\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"46087\"","","\"","46087","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac92d00\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f9c6ac92c60\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac90c80\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac93020\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f9c6ac92ee0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f9c6ac92e40\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f9c6ac92da0\u003e":"tag:\"46087\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac92da0\u003e":"tag:\"46087\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"46087\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"46087\"","","\"","46087","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac92d00\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f9c6ac92c60\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac90c80\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac93020\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f9c6ac92ee0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f9c6ac92e40\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f9c6ac92da0\u003e":"tag:\"46087\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f9c6ac92da0\u003e":"tag:\"46087\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":60351,"difficulty_rating":"medium"}]}}