{"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":56593,"title":"List the nth term of Rozhenko’s inventory sequence","description":"Consider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few inventories are\r\n0\r\n1, 1, 0\r\n2, 2, 2, 0\r\n3, 2, 4, 1, 1, 0\r\n4, 4, 4, 1, 4, 0\r\nWhen the sequence is empty, there are zero 0s. We start a new inventory on the second line—looking at all numbers written so far: one 0, one 1, zero 2s. The zero triggers a new inventory, and the third line reports two 0s, two 1s, two 2s (from the beginning of the third line), and zero 3s. And so on. The sequence then is the rows strung together. For example, the 19th term is 4. \r\nThis sequence produces interesting plots and music. See the related Numberphile video for more. \r\nWrite a function to report the th term of this sequence. ","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: 345px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 172.5px; transform-origin: 407px 172.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.6px 8px; transform-origin: 374.6px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eConsider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few inventories are\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.4417px 8px; transform-origin: 19.4417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e1, 1, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.2167px 8px; transform-origin: 27.2167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e2, 2, 2, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 42.7667px 8px; transform-origin: 42.7667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e3, 2, 4, 1, 1, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 42.7667px 8px; transform-origin: 42.7667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e4, 4, 4, 1, 4, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhen the sequence is empty, there are zero 0s. We start a new inventory on the second line—looking at all numbers written so far: one 0, one 1, zero 2s. The zero triggers a new inventory, and the third line reports two 0s, two 1s, two 2s (from the beginning of the third line), and zero 3s. And so on. The sequence then is the rows strung together. For example, the 19\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: 5.83333px 8px; transform-origin: 5.83333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth\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 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e term is 4. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 112.425px 8px; transform-origin: 112.425px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis sequence produces interesting \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A342585/graph\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eplots\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: 15.5583px 8px; transform-origin: 15.5583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/play?seq=A342585\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003emusic\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: 18.275px 8px; transform-origin: 18.275px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. See \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=rBU9E-ZOZAI\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ethe related Numberphile video\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: 31.8833px 8px; transform-origin: 31.8833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for more. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 90.1px 8px; transform-origin: 90.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to report the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 78.5583px 8px; transform-origin: 78.5583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term of this sequence. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = Rozhenko(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 19;\r\ny_correct = 4;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 53;\r\ny_correct = 5;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 347;\r\ny_correct = 25;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 823;\r\ny_correct = 27;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 1997;\r\ny_correct = 20;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 4721;\r\ny_correct = 68;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 13859;\r\ny_correct = 18;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 19793;\r\ny_correct = 7;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 24677;\r\ny_correct = 51;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 41903;\r\ny_correct = 357;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 25537;\r\ny_correct = 4;\r\nassert(isequal(Rozhenko(Rozhenko(Rozhenko(n))),y_correct))\r\n\r\n%%\r\nn = [1 4 8 14 20 28 37 46 57 69 82 95 110 125 142 159 177 196 216 238 260 285 310 335 362 390 418 448 478 511];\r\na = arrayfun(@Rozhenko,n);\r\ns_correct = 0;\r\nassert(isequal(sum(a),s_correct))\r\n\r\n%%\r\nfiletext = fileread('Rozhenko.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'oeis'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2022-11-13T14:07:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-11-13T04:07:55.000Z","updated_at":"2026-01-24T12:19:36.000Z","published_at":"2022-11-13T04:08:12.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\u003eConsider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few inventories are\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1, 1, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2, 2, 2, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3, 2, 4, 1, 1, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4, 4, 4, 1, 4, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhen the sequence is empty, there are zero 0s. We start a new inventory on the second line—looking at all numbers written so far: one 0, one 1, zero 2s. The zero triggers a new inventory, and the third line reports two 0s, two 1s, two 2s (from the beginning of the third line), and zero 3s. And so on. The sequence then is the rows strung together. For example, the 19\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eth\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e term is 4. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis sequence produces interesting \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A342585/graph\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eplots\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:hyperlink w:docLocation=\\\"https://oeis.org/play?seq=A342585\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emusic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. See \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=rBU9E-ZOZAI\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethe related Numberphile video\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for more. \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 report the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth term of this sequence. \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":60788,"title":"Construct the number counts sequence","description":"A sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.\r\nWrite a function to report the th term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 135px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 67.5px; transform-origin: 407px 67.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to report the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = numberCounts(n)\r\n  y = randi(9,1,n);\r\nend","test_suite":"%%\r\nn = 0;\r\ny = numberCounts(n);\r\ny_correct = 1;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 3;\r\ny = numberCounts(n);\r\ny_correct = 3;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 19;\r\ny = numberCounts(n);\r\ny_correct = 3;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 58;\r\n[y,m] = numberCounts(n);\r\ny_correct = 8;\r\nm_correct = 9;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 134;\r\n[y,m] = numberCounts(n);\r\ny_correct = 13;\r\nm_correct = 12;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 507;\r\n[y,m] = numberCounts(n);\r\ny_correct = 3;\r\nm_correct = 19;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 1362;\r\n[y,m] = numberCounts(n);\r\ny_correct = 82;\r\nm_correct = 28;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 4111;\r\n[y,m] = numberCounts(n);\r\ny_correct = 91;\r\nm_correct = 42;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 9891;\r\n[y,m] = numberCounts(n);\r\ny_correct = 69;\r\nm_correct = 60;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 25003;\r\n[y,m] = numberCounts(n);\r\ny_correct = 24;\r\nm_correct = 88;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 87326;\r\n[y,m] = numberCounts(n);\r\ny_correct = 520;\r\nm_correct = 146;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 233054;\r\n[y,m] = numberCounts(n);\r\ny_correct = 195;\r\nm_correct = 217;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 804523;\r\n[y,m] = numberCounts(n);\r\ny_correct = 173;\r\nm_correct = 360;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 3604788;\r\n[y,m] = numberCounts(n);\r\ny_correct = 6761;\r\nm_correct = 664;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2025-01-26T01:22:37.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-01-26T01:17:13.000Z","updated_at":"2025-01-29T05:08:13.000Z","published_at":"2025-01-26T01:21:13.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\u003eA sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.\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 report the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1. \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":56593,"title":"List the nth term of Rozhenko’s inventory sequence","description":"Consider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few inventories are\r\n0\r\n1, 1, 0\r\n2, 2, 2, 0\r\n3, 2, 4, 1, 1, 0\r\n4, 4, 4, 1, 4, 0\r\nWhen the sequence is empty, there are zero 0s. We start a new inventory on the second line—looking at all numbers written so far: one 0, one 1, zero 2s. The zero triggers a new inventory, and the third line reports two 0s, two 1s, two 2s (from the beginning of the third line), and zero 3s. And so on. The sequence then is the rows strung together. For example, the 19th term is 4. \r\nThis sequence produces interesting plots and music. See the related Numberphile video for more. \r\nWrite a function to report the th term of this sequence. ","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: 345px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 172.5px; transform-origin: 407px 172.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.6px 8px; transform-origin: 374.6px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eConsider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few inventories are\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.89167px 8px; transform-origin: 3.89167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.4417px 8px; transform-origin: 19.4417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e1, 1, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.2167px 8px; transform-origin: 27.2167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e2, 2, 2, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 42.7667px 8px; transform-origin: 42.7667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e3, 2, 4, 1, 1, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 42.7667px 8px; transform-origin: 42.7667px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e4, 4, 4, 1, 4, 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhen the sequence is empty, there are zero 0s. We start a new inventory on the second line—looking at all numbers written so far: one 0, one 1, zero 2s. The zero triggers a new inventory, and the third line reports two 0s, two 1s, two 2s (from the beginning of the third line), and zero 3s. And so on. The sequence then is the rows strung together. For example, the 19\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: 5.83333px 8px; transform-origin: 5.83333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth\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 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e term is 4. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 112.425px 8px; transform-origin: 112.425px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis sequence produces interesting \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A342585/graph\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eplots\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: 15.5583px 8px; transform-origin: 15.5583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/play?seq=A342585\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003emusic\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: 18.275px 8px; transform-origin: 18.275px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. See \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=rBU9E-ZOZAI\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ethe related Numberphile video\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: 31.8833px 8px; transform-origin: 31.8833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for more. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 90.1px 8px; transform-origin: 90.1px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to report the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 78.5583px 8px; transform-origin: 78.5583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term of this sequence. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = Rozhenko(n)\r\n  y = f(n);\r\nend","test_suite":"%%\r\nn = 19;\r\ny_correct = 4;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 53;\r\ny_correct = 5;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 347;\r\ny_correct = 25;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 823;\r\ny_correct = 27;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 1997;\r\ny_correct = 20;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 4721;\r\ny_correct = 68;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 13859;\r\ny_correct = 18;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 19793;\r\ny_correct = 7;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 24677;\r\ny_correct = 51;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 41903;\r\ny_correct = 357;\r\nassert(isequal(Rozhenko(n),y_correct))\r\n\r\n%%\r\nn = 25537;\r\ny_correct = 4;\r\nassert(isequal(Rozhenko(Rozhenko(Rozhenko(n))),y_correct))\r\n\r\n%%\r\nn = [1 4 8 14 20 28 37 46 57 69 82 95 110 125 142 159 177 196 216 238 260 285 310 335 362 390 418 448 478 511];\r\na = arrayfun(@Rozhenko,n);\r\ns_correct = 0;\r\nassert(isequal(sum(a),s_correct))\r\n\r\n%%\r\nfiletext = fileread('Rozhenko.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'oeis'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2022-11-13T14:07:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-11-13T04:07:55.000Z","updated_at":"2026-01-24T12:19:36.000Z","published_at":"2022-11-13T04:08:12.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\u003eConsider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few inventories are\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1, 1, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2, 2, 2, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3, 2, 4, 1, 1, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e4, 4, 4, 1, 4, 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhen the sequence is empty, there are zero 0s. We start a new inventory on the second line—looking at all numbers written so far: one 0, one 1, zero 2s. The zero triggers a new inventory, and the third line reports two 0s, two 1s, two 2s (from the beginning of the third line), and zero 3s. And so on. The sequence then is the rows strung together. For example, the 19\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eth\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e term is 4. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis sequence produces interesting \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A342585/graph\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eplots\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:hyperlink w:docLocation=\\\"https://oeis.org/play?seq=A342585\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emusic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. See \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=rBU9E-ZOZAI\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethe related Numberphile video\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for more. \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 report the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth term of this sequence. \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":60788,"title":"Construct the number counts sequence","description":"A sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.\r\nWrite a function to report the th term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 135px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 67.5px; transform-origin: 407px 67.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to report the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003en\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eth term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = numberCounts(n)\r\n  y = randi(9,1,n);\r\nend","test_suite":"%%\r\nn = 0;\r\ny = numberCounts(n);\r\ny_correct = 1;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 3;\r\ny = numberCounts(n);\r\ny_correct = 3;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 19;\r\ny = numberCounts(n);\r\ny_correct = 3;\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nn = 58;\r\n[y,m] = numberCounts(n);\r\ny_correct = 8;\r\nm_correct = 9;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 134;\r\n[y,m] = numberCounts(n);\r\ny_correct = 13;\r\nm_correct = 12;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 507;\r\n[y,m] = numberCounts(n);\r\ny_correct = 3;\r\nm_correct = 19;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 1362;\r\n[y,m] = numberCounts(n);\r\ny_correct = 82;\r\nm_correct = 28;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 4111;\r\n[y,m] = numberCounts(n);\r\ny_correct = 91;\r\nm_correct = 42;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 9891;\r\n[y,m] = numberCounts(n);\r\ny_correct = 69;\r\nm_correct = 60;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 25003;\r\n[y,m] = numberCounts(n);\r\ny_correct = 24;\r\nm_correct = 88;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 87326;\r\n[y,m] = numberCounts(n);\r\ny_correct = 520;\r\nm_correct = 146;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 233054;\r\n[y,m] = numberCounts(n);\r\ny_correct = 195;\r\nm_correct = 217;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 804523;\r\n[y,m] = numberCounts(n);\r\ny_correct = 173;\r\nm_correct = 360;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))\r\n\r\n%%\r\nn = 3604788;\r\n[y,m] = numberCounts(n);\r\ny_correct = 6761;\r\nm_correct = 664;\r\nassert(isequal(y,y_correct))\r\nassert(isequal(m,m_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2025-01-26T01:22:37.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-01-26T01:17:13.000Z","updated_at":"2025-01-29T05:08:13.000Z","published_at":"2025-01-26T01:21:13.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\u003eA sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.\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 report the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"n\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003eth term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1. \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:\"inventory\"","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:\"inventory\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"inventory\"","","\"","inventory","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48c280\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fdb9b48c1e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48b380\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48cbe0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdb9b48cb40\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdb9b48caa0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdb9b48ca00\u003e":"tag:\"inventory\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48ca00\u003e":"tag:\"inventory\""},"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:\"inventory\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"inventory\"","","\"","inventory","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48c280\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fdb9b48c1e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48b380\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48cbe0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdb9b48cb40\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdb9b48caa0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdb9b48ca00\u003e":"tag:\"inventory\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdb9b48ca00\u003e":"tag:\"inventory\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":56593,"difficulty_rating":"easy-medium"},{"id":60788,"difficulty_rating":"medium"}]}}