{"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":44338,"title":"Recaman Sequence - I","description":"Recaman Sequence (A005132 - \u003chttp://oeis.org/A005132 - OEIS Link\u003e) is defined as follow;\r\n\r\n  seq(0) = 0; \r\n  for n \u003e 0, seq(n) = seq(n-1) - n if positive and not already in the sequence, \r\n  otherwise seq(n) = seq(n-1) + n. \r\n\r\n  seq = 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9 ...\r\nindex = 1, 2, 3 ,...\r\n\r\nTo avoid zero index, start indexing from 1.\r\nreturn the first n elements in Recaman Sequence\r\n\r\n*Related Challenges :*\r\n\r\n# Recaman Sequence - I\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44339 Recaman Sequence - II\u003e\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44340 Recaman Sequence - III\u003e\r\n","description_html":"\u003cp\u003eRecaman Sequence (A005132 - \u003ca href = \"http://oeis.org/A005132\"\u003e- OEIS Link\u003c/a\u003e) is defined as follow;\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eseq(0) = 0; \r\nfor n \u0026gt; 0, seq(n) = seq(n-1) - n if positive and not already in the sequence, \r\notherwise seq(n) = seq(n-1) + n. \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eseq = 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9 ...\r\nindex = 1, 2, 3 ,...\r\n\u003c/pre\u003e\u003cp\u003eTo avoid zero index, start indexing from 1.\r\nreturn the first n elements in Recaman Sequence\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges :\u003c/b\u003e\u003c/p\u003e\u003col\u003e\u003cli\u003eRecaman Sequence - I\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44339\"\u003eRecaman Sequence - II\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44340\"\u003eRecaman Sequence - III\u003c/a\u003e\u003c/li\u003e\u003c/ol\u003e","function_template":"function y = Recaman(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0;\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = [0 1 3 6 2];\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 8;\r\ny_correct = [0 1 3 6 2 7 13 20];\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 10;\r\ny_correct = [0 1 3 6 2 7 13 20 12 21];\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 5e4;\r\ny = Recaman(x);\r\nassert(isequal(length(Recaman(x)),x))\r\nassert(isequal(y(954),739))\r\nassert(isequal(y(7589),17654))\r\nassert(isequal(y(12345),18554))\r\n\r\n%%\r\nx = 1e5;\r\ny = Recaman(x);\r\nassert(isequal(length(Recaman(x)),x))\r\nassert(isequal(y(1e4),8658))\r\nassert(isequal(y(2e4),34358))\r\nassert(isequal(y(3e4),92474))\r\nassert(isequal(y(4e4),102344))","published":true,"deleted":false,"likes_count":3,"comments_count":8,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":321,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-19T06:55:43.000Z","updated_at":"2026-03-22T11:16:16.000Z","published_at":"2017-10-16T01:45:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence (A005132 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://oeis.org/A005132\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e- OEIS Link\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) is defined as follow;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[seq(0) = 0; \\nfor n \u003e 0, seq(n) = seq(n-1) - n if positive and not already in the sequence, \\notherwise seq(n) = seq(n-1) + n. \\n\\nseq = 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9 ...\\nindex = 1, 2, 3 ,...]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTo avoid zero index, start indexing from 1. return the first n elements in Recaman Sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44339\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - II\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44340\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - III\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44321,"title":"Van Eck's Sequence's nth member","description":"Return the Van Eck's Sequence's nth member.\r\n\r\nFor detailed info : \u003chttp://oeis.org/A181391 OEIS link\u003e and \u003chttps://www.theguardian.com/science/alexs-adventures-in-numberland/2014/oct/07/neil-sloane-the-man-who-loved-only-integer-sequences here\u003e\r\n\r\n seq = 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5...\r\n\r\nFirst member is 0;\r\n\r\nSecond member is 0;\r\n\r\nthird member is 1 etc\r\n","description_html":"\u003cp\u003eReturn the Van Eck's Sequence's nth member.\u003c/p\u003e\u003cp\u003eFor detailed info : \u003ca href = \"http://oeis.org/A181391\"\u003eOEIS link\u003c/a\u003e and \u003ca href = \"https://www.theguardian.com/science/alexs-adventures-in-numberland/2014/oct/07/neil-sloane-the-man-who-loved-only-integer-sequences\"\u003ehere\u003c/a\u003e\u003c/p\u003e\u003cpre\u003e seq = 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5...\u003c/pre\u003e\u003cp\u003eFirst member is 0;\u003c/p\u003e\u003cp\u003eSecond member is 0;\u003c/p\u003e\u003cp\u003ethird member is 1 etc\u003c/p\u003e","function_template":"function result = VanEcksSequence(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 6;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 11;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 50;\r\ny_correct = 3;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 500;\r\ny_correct = 4;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n\r\n%%\r\nx = 5000;\r\ny_correct = 402;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 50000;\r\ny_correct = 114;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":1,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":331,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-13T08:14:57.000Z","updated_at":"2026-03-24T14:52:41.000Z","published_at":"2017-10-16T01:45:07.000Z","restored_at":"2017-09-28T06:15:18.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the Van Eck's Sequence's nth member.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor detailed info :\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://oeis.org/A181391\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOEIS link\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.theguardian.com/science/alexs-adventures-in-numberland/2014/oct/07/neil-sloane-the-man-who-loved-only-integer-sequences\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehere\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ seq = 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5...]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFirst member is 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSecond member is 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethird member is 1 etc\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44339,"title":"Recaman Sequence - II","description":"Take an arbitrary starting point as input and create Recaman Sequence. Then find the 1, return its index.\r\n\r\nFor example: if n = 0 (default Recaman sequence)\r\n  \r\n  seq = [0 1 3 6 2];\r\n\r\n1 is in the second place. \r\n\r\nif n = 10;\r\n\r\n  seq = [10 9 7 4 8 3 9 2 10 1 11 22 34 21];\r\n\r\n1 is in the 10th place\r\n\r\n*Related Challenges :*\r\n\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44338 Recaman Sequence - I\u003e\r\n# Recaman Sequence - II\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44340 Recaman Sequence - III\u003e","description_html":"\u003cp\u003eTake an arbitrary starting point as input and create Recaman Sequence. Then find the 1, return its index.\u003c/p\u003e\u003cp\u003eFor example: if n = 0 (default Recaman sequence)\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eseq = [0 1 3 6 2];\r\n\u003c/pre\u003e\u003cp\u003e1 is in the second place.\u003c/p\u003e\u003cp\u003eif n = 10;\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eseq = [10 9 7 4 8 3 9 2 10 1 11 22 34 21];\r\n\u003c/pre\u003e\u003cp\u003e1 is in the 10th place\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges :\u003c/b\u003e\u003c/p\u003e\u003col\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44338\"\u003eRecaman Sequence - I\u003c/a\u003e\u003c/li\u003e\u003cli\u003eRecaman Sequence - II\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44340\"\u003eRecaman Sequence - III\u003c/a\u003e\u003c/li\u003e\u003c/ol\u003e","function_template":"function y = RecamanII(startPoint)\r\n\r\nend","test_suite":"%%\r\nx = 0;\r\ny_correct = 2;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 4;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 90;\r\ny_correct = 35;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 123456;\r\ny_correct = 895;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 123456789;\r\ny_correct = 46633;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":280,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-19T07:08:59.000Z","updated_at":"2026-03-22T11:06:47.000Z","published_at":"2017-10-16T01:45:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake an arbitrary starting point as input and create Recaman Sequence. Then find the 1, return its index.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example: if n = 0 (default Recaman sequence)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[seq = [0 1 3 6 2];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 is in the second place.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif n = 10;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[seq = [10 9 7 4 8 3 9 2 10 1 11 22 34 21];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 is in the 10th place\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44338\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - II\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44340\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - III\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2423,"title":"Integer Sequence - II : New Fibonacci","description":"Crack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also part of original Fibonacci 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: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 21px; transform-origin: 407px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 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: 374px 8px; transform-origin: 374px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCrack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also part of original Fibonacci Sequence)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = newFibo(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('newFibo.m');\r\nillegal = contains(filetext, 'if') || contains(filetext, 'interp') || ...\r\n          contains(filetext, 'str2num') || contains(filetext, 'regexp') ...\r\n          || contains(filetext, 'switch'); \r\nassert(~illegal)\r\n\r\n%%\r\nassert(isequal(newFibo(1),1))\r\n\r\n%%\r\nassert(isequal(newFibo(2),1))\r\n\r\n%%\r\nassert(isequal(newFibo(3),1))\r\n\r\n%%\r\nassert(isequal(newFibo(4),2))\r\n\r\n%%\r\nassert(isequal(newFibo(5),5))\r\n\r\n%%\r\nassert(isequal(newFibo(6),21))\r\n\r\n%%\r\nassert(isequal(newFibo(8),10946))\r\n\r\n%%\r\nassert(isequal(newFibo(9),5702887))\r\n\r\n%%\r\nassert(isequal(newFibo(10),139583862445))","published":true,"deleted":false,"likes_count":20,"comments_count":13,"created_by":17203,"edited_by":223089,"edited_at":"2022-12-26T07:26:12.000Z","deleted_by":null,"deleted_at":null,"solvers_count":679,"test_suite_updated_at":"2022-12-26T07:26:12.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2014-07-14T07:40:27.000Z","updated_at":"2026-03-01T13:32:27.000Z","published_at":"2014-07-14T07:40:27.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\u003eCrack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also part of original Fibonacci 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":2371,"title":"Integer sequence - 2 : Kolakoski sequence","description":"Get the n-th term of Kolakoski Sequence.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 10.5px; transform-origin: 408px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 60.6583px 8px; transform-origin: 60.6583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGet the n-th term of\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 \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A000002\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003eKolakoski Sequence\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n    \r\nend","test_suite":"%%\r\nfiletext = fileread('your_fcn_name.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp ''') || ...\r\n        contains(filetext, 'oeis') || contains(filetext, 'str2num');\r\nassert(~illegal)\r\n\r\n%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 9;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 12;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 31;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 34;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 37;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 50;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = randi(20, 1, 10);\r\ny = [1 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 2 1];\r\nassert(isequal(arrayfun(@your_fcn_name, x),y(x)))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":6,"created_by":17203,"edited_by":223089,"edited_at":"2026-01-28T14:20:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":190,"test_suite_updated_at":"2026-01-28T14:20:54.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2014-06-18T07:19:02.000Z","updated_at":"2026-03-25T04:59:59.000Z","published_at":"2014-06-18T07:19:35.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\u003eGet the n-th term of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A000002\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKolakoski Sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":44338,"title":"Recaman Sequence - I","description":"Recaman Sequence (A005132 - \u003chttp://oeis.org/A005132 - OEIS Link\u003e) is defined as follow;\r\n\r\n  seq(0) = 0; \r\n  for n \u003e 0, seq(n) = seq(n-1) - n if positive and not already in the sequence, \r\n  otherwise seq(n) = seq(n-1) + n. \r\n\r\n  seq = 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9 ...\r\nindex = 1, 2, 3 ,...\r\n\r\nTo avoid zero index, start indexing from 1.\r\nreturn the first n elements in Recaman Sequence\r\n\r\n*Related Challenges :*\r\n\r\n# Recaman Sequence - I\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44339 Recaman Sequence - II\u003e\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44340 Recaman Sequence - III\u003e\r\n","description_html":"\u003cp\u003eRecaman Sequence (A005132 - \u003ca href = \"http://oeis.org/A005132\"\u003e- OEIS Link\u003c/a\u003e) is defined as follow;\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eseq(0) = 0; \r\nfor n \u0026gt; 0, seq(n) = seq(n-1) - n if positive and not already in the sequence, \r\notherwise seq(n) = seq(n-1) + n. \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eseq = 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9 ...\r\nindex = 1, 2, 3 ,...\r\n\u003c/pre\u003e\u003cp\u003eTo avoid zero index, start indexing from 1.\r\nreturn the first n elements in Recaman Sequence\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges :\u003c/b\u003e\u003c/p\u003e\u003col\u003e\u003cli\u003eRecaman Sequence - I\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44339\"\u003eRecaman Sequence - II\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44340\"\u003eRecaman Sequence - III\u003c/a\u003e\u003c/li\u003e\u003c/ol\u003e","function_template":"function y = Recaman(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0;\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = [0 1 3 6 2];\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 8;\r\ny_correct = [0 1 3 6 2 7 13 20];\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 10;\r\ny_correct = [0 1 3 6 2 7 13 20 12 21];\r\nassert(isequal(Recaman(x),y_correct))\r\n\r\n%%\r\nx = 5e4;\r\ny = Recaman(x);\r\nassert(isequal(length(Recaman(x)),x))\r\nassert(isequal(y(954),739))\r\nassert(isequal(y(7589),17654))\r\nassert(isequal(y(12345),18554))\r\n\r\n%%\r\nx = 1e5;\r\ny = Recaman(x);\r\nassert(isequal(length(Recaman(x)),x))\r\nassert(isequal(y(1e4),8658))\r\nassert(isequal(y(2e4),34358))\r\nassert(isequal(y(3e4),92474))\r\nassert(isequal(y(4e4),102344))","published":true,"deleted":false,"likes_count":3,"comments_count":8,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":321,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-19T06:55:43.000Z","updated_at":"2026-03-22T11:16:16.000Z","published_at":"2017-10-16T01:45:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence (A005132 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://oeis.org/A005132\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e- OEIS Link\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) is defined as follow;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[seq(0) = 0; \\nfor n \u003e 0, seq(n) = seq(n-1) - n if positive and not already in the sequence, \\notherwise seq(n) = seq(n-1) + n. \\n\\nseq = 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9 ...\\nindex = 1, 2, 3 ,...]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTo avoid zero index, start indexing from 1. return the first n elements in Recaman Sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44339\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - II\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44340\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - III\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44321,"title":"Van Eck's Sequence's nth member","description":"Return the Van Eck's Sequence's nth member.\r\n\r\nFor detailed info : \u003chttp://oeis.org/A181391 OEIS link\u003e and \u003chttps://www.theguardian.com/science/alexs-adventures-in-numberland/2014/oct/07/neil-sloane-the-man-who-loved-only-integer-sequences here\u003e\r\n\r\n seq = 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5...\r\n\r\nFirst member is 0;\r\n\r\nSecond member is 0;\r\n\r\nthird member is 1 etc\r\n","description_html":"\u003cp\u003eReturn the Van Eck's Sequence's nth member.\u003c/p\u003e\u003cp\u003eFor detailed info : \u003ca href = \"http://oeis.org/A181391\"\u003eOEIS link\u003c/a\u003e and \u003ca href = \"https://www.theguardian.com/science/alexs-adventures-in-numberland/2014/oct/07/neil-sloane-the-man-who-loved-only-integer-sequences\"\u003ehere\u003c/a\u003e\u003c/p\u003e\u003cpre\u003e seq = 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5...\u003c/pre\u003e\u003cp\u003eFirst member is 0;\u003c/p\u003e\u003cp\u003eSecond member is 0;\u003c/p\u003e\u003cp\u003ethird member is 1 etc\u003c/p\u003e","function_template":"function result = VanEcksSequence(n)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 6;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 11;\r\ny_correct = 0;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 50;\r\ny_correct = 3;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 500;\r\ny_correct = 4;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n\r\n%%\r\nx = 5000;\r\ny_correct = 402;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n\r\n%%\r\nx = 50000;\r\ny_correct = 114;\r\nassert(isequal(VanEcksSequence(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":1,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":331,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-13T08:14:57.000Z","updated_at":"2026-03-24T14:52:41.000Z","published_at":"2017-10-16T01:45:07.000Z","restored_at":"2017-09-28T06:15:18.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the Van Eck's Sequence's nth member.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor detailed info :\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://oeis.org/A181391\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOEIS link\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.theguardian.com/science/alexs-adventures-in-numberland/2014/oct/07/neil-sloane-the-man-who-loved-only-integer-sequences\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehere\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ seq = 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5...]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFirst member is 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSecond member is 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethird member is 1 etc\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44339,"title":"Recaman Sequence - II","description":"Take an arbitrary starting point as input and create Recaman Sequence. Then find the 1, return its index.\r\n\r\nFor example: if n = 0 (default Recaman sequence)\r\n  \r\n  seq = [0 1 3 6 2];\r\n\r\n1 is in the second place. \r\n\r\nif n = 10;\r\n\r\n  seq = [10 9 7 4 8 3 9 2 10 1 11 22 34 21];\r\n\r\n1 is in the 10th place\r\n\r\n*Related Challenges :*\r\n\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44338 Recaman Sequence - I\u003e\r\n# Recaman Sequence - II\r\n# \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44340 Recaman Sequence - III\u003e","description_html":"\u003cp\u003eTake an arbitrary starting point as input and create Recaman Sequence. Then find the 1, return its index.\u003c/p\u003e\u003cp\u003eFor example: if n = 0 (default Recaman sequence)\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eseq = [0 1 3 6 2];\r\n\u003c/pre\u003e\u003cp\u003e1 is in the second place.\u003c/p\u003e\u003cp\u003eif n = 10;\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eseq = [10 9 7 4 8 3 9 2 10 1 11 22 34 21];\r\n\u003c/pre\u003e\u003cp\u003e1 is in the 10th place\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges :\u003c/b\u003e\u003c/p\u003e\u003col\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44338\"\u003eRecaman Sequence - I\u003c/a\u003e\u003c/li\u003e\u003cli\u003eRecaman Sequence - II\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44340\"\u003eRecaman Sequence - III\u003c/a\u003e\u003c/li\u003e\u003c/ol\u003e","function_template":"function y = RecamanII(startPoint)\r\n\r\nend","test_suite":"%%\r\nx = 0;\r\ny_correct = 2;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 4;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 90;\r\ny_correct = 35;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 123456;\r\ny_correct = 895;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n%%\r\nx = 123456789;\r\ny_correct = 46633;\r\nassert(isequal(RecamanII(x),y_correct))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":280,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-19T07:08:59.000Z","updated_at":"2026-03-22T11:06:47.000Z","published_at":"2017-10-16T01:45:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake an arbitrary starting point as input and create Recaman Sequence. Then find the 1, return its index.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example: if n = 0 (default Recaman sequence)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[seq = [0 1 3 6 2];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 is in the second place.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eif n = 10;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[seq = [10 9 7 4 8 3 9 2 10 1 11 22 34 21];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 is in the 10th place\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44338\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - I\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - II\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44340\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRecaman Sequence - III\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2423,"title":"Integer Sequence - II : New Fibonacci","description":"Crack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also part of original Fibonacci 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: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 21px; transform-origin: 407px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 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: 374px 8px; transform-origin: 374px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCrack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also part of original Fibonacci Sequence)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = newFibo(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('newFibo.m');\r\nillegal = contains(filetext, 'if') || contains(filetext, 'interp') || ...\r\n          contains(filetext, 'str2num') || contains(filetext, 'regexp') ...\r\n          || contains(filetext, 'switch'); \r\nassert(~illegal)\r\n\r\n%%\r\nassert(isequal(newFibo(1),1))\r\n\r\n%%\r\nassert(isequal(newFibo(2),1))\r\n\r\n%%\r\nassert(isequal(newFibo(3),1))\r\n\r\n%%\r\nassert(isequal(newFibo(4),2))\r\n\r\n%%\r\nassert(isequal(newFibo(5),5))\r\n\r\n%%\r\nassert(isequal(newFibo(6),21))\r\n\r\n%%\r\nassert(isequal(newFibo(8),10946))\r\n\r\n%%\r\nassert(isequal(newFibo(9),5702887))\r\n\r\n%%\r\nassert(isequal(newFibo(10),139583862445))","published":true,"deleted":false,"likes_count":20,"comments_count":13,"created_by":17203,"edited_by":223089,"edited_at":"2022-12-26T07:26:12.000Z","deleted_by":null,"deleted_at":null,"solvers_count":679,"test_suite_updated_at":"2022-12-26T07:26:12.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2014-07-14T07:40:27.000Z","updated_at":"2026-03-01T13:32:27.000Z","published_at":"2014-07-14T07:40:27.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\u003eCrack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also part of original Fibonacci 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":2371,"title":"Integer sequence - 2 : Kolakoski sequence","description":"Get the n-th term of Kolakoski Sequence.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 10.5px; transform-origin: 408px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 60.6583px 8px; transform-origin: 60.6583px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGet the n-th term of\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 \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://oeis.org/A000002\"\u003e\u003cspan style=\"border-block-end-color: rgb(0, 91, 130); border-block-start-color: rgb(0, 91, 130); border-bottom-color: rgb(0, 91, 130); border-inline-end-color: rgb(0, 91, 130); border-inline-start-color: rgb(0, 91, 130); border-left-color: rgb(0, 91, 130); border-right-color: rgb(0, 91, 130); border-top-color: rgb(0, 91, 130); caret-color: rgb(0, 91, 130); color: rgb(0, 91, 130); column-rule-color: rgb(0, 91, 130); outline-color: rgb(0, 91, 130); text-decoration-color: rgb(0, 91, 130); text-emphasis-color: rgb(0, 91, 130); \"\u003e\u003cspan style=\"\"\u003eKolakoski Sequence\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n    \r\nend","test_suite":"%%\r\nfiletext = fileread('your_fcn_name.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp ''') || ...\r\n        contains(filetext, 'oeis') || contains(filetext, 'str2num');\r\nassert(~illegal)\r\n\r\n%%\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 9;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 12;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 31;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 34;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 37;\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 50;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 200;\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = randi(20, 1, 10);\r\ny = [1 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 2 1];\r\nassert(isequal(arrayfun(@your_fcn_name, x),y(x)))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":6,"created_by":17203,"edited_by":223089,"edited_at":"2026-01-28T14:20:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":190,"test_suite_updated_at":"2026-01-28T14:20:54.000Z","rescore_all_solutions":false,"group_id":27,"created_at":"2014-06-18T07:19:02.000Z","updated_at":"2026-03-25T04:59:59.000Z","published_at":"2014-06-18T07:19:35.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\u003eGet the n-th term of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A000002\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKolakoski Sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"integer sequence\"","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:\"integer sequence\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"integer sequence\"","","\"","integer sequence","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf93e88\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f9c4bf93de8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf93528\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf94108\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f9c4bf94068\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f9c4bf93fc8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f9c4bf93f28\u003e":"tag:\"integer sequence\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf93f28\u003e":"tag:\"integer sequence\""},"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:\"integer sequence\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"integer sequence\"","","\"","integer sequence","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf93e88\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f9c4bf93de8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf93528\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf94108\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f9c4bf94068\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f9c4bf93fc8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f9c4bf93f28\u003e":"tag:\"integer sequence\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f9c4bf93f28\u003e":"tag:\"integer sequence\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44338,"difficulty_rating":"easy-medium"},{"id":44321,"difficulty_rating":"easy-medium"},{"id":44339,"difficulty_rating":"easy-medium"},{"id":2423,"difficulty_rating":"medium"},{"id":2371,"difficulty_rating":"medium"}]}}