{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-05-26T00:16:20.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-05-26T00: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":42765,"title":"Maximize Non-Co-Planar Points in an N-Cube","description":"This Challenge is to find a set with the maximum number of integer points that create planar surfaces with a maximum of three points from the set. No four points may be co-planar.\r\nGiven the size N and the number of expected points Q find a set of Q points. Only N=2/Q=5 and N=3/Q=8 will be tested. N=4/Q=10 or N=5/Q=13 are too large to process.\r\n\r\n  N=2 contains 8 points [0,0,0;0,1,0;1,0,0;1,1,0;0,0,1;0,1,1;1,0,1;1,1,1]\r\n  N=3 contains 27 points [0,0,0;0,0,1;0,0,2;...2,2,2]\r\n\r\nOutput is a Qx3 matrix of the non-co-planar points.\r\n\r\nReference: The \u003chttp://68.173.157.131/Contest/Tetrahedra March 2016 Al Zimmermann Non-Coplanar contest\u003e is N=primes less than 100. Maximize the number of points in an NxNxN cube with no 4 points in a common plane.\r\n\r\nTheory: The N=2 and N=3 cases can be processed by brute force if care is taken. Assumption of [0,0,0] greatly reduces number of cases. Solving \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42762-is-3d-point-set-co-planar Cody Co-Planar Check\u003e may improve speed. ","description_html":"\u003cp\u003eThis Challenge is to find a set with the maximum number of integer points that create planar surfaces with a maximum of three points from the set. No four points may be co-planar.\r\nGiven the size N and the number of expected points Q find a set of Q points. Only N=2/Q=5 and N=3/Q=8 will be tested. N=4/Q=10 or N=5/Q=13 are too large to process.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eN=2 contains 8 points [0,0,0;0,1,0;1,0,0;1,1,0;0,0,1;0,1,1;1,0,1;1,1,1]\r\nN=3 contains 27 points [0,0,0;0,0,1;0,0,2;...2,2,2]\r\n\u003c/pre\u003e\u003cp\u003eOutput is a Qx3 matrix of the non-co-planar points.\u003c/p\u003e\u003cp\u003eReference: The \u003ca href = \"http://68.173.157.131/Contest/Tetrahedra\"\u003eMarch 2016 Al Zimmermann Non-Coplanar contest\u003c/a\u003e is N=primes less than 100. Maximize the number of points in an NxNxN cube with no 4 points in a common plane.\u003c/p\u003e\u003cp\u003eTheory: The N=2 and N=3 cases can be processed by brute force if care is taken. Assumption of [0,0,0] greatly reduces number of cases. Solving \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42762-is-3d-point-set-co-planar\"\u003eCody Co-Planar Check\u003c/a\u003e may improve speed.\u003c/p\u003e","function_template":"function m=MaxNonCoplanarPts(N,Q);\r\n% Place Q or more points in an 0:N-1 #D grid such that each plane created uses only 3 points from the set provided\r\n% N is Cube size\r\n% Q is expected number of points in solution\r\n% Hint: Point [0,0,0] can be assumed to be in the solution for N=2 and N=3\r\n% N=3 is the 27 points [0,0,0;0,0,1;0,0,2;...2,2,2]\r\n  m=[];\r\nend","test_suite":"%%\r\nN=2;\r\nQ=5;\r\nm=MaxNonCoplanarPts(N,Q);\r\nm=floor(abs(m))\r\n% Perform m check\r\nvalid=1;\r\nif size(m,1)\u003cQ,valid=0;end % Must be Q pts or more\r\nif max(m(:))\u003eN-1,valid=0;end\r\npset=nchoosek(1:size(m,1),4);\r\nfor i=1:length(pset)\r\n m4=m(pset(i,:),:);\r\n% Coplanar check method courtesy of Tim\r\n if ~det([m4 ones(4,1)]) % coplanar det=0\r\n  valid=0;\r\n  break\r\n end\r\nend\r\nassert(isequal(1,valid))\r\n%%\r\nN=3;\r\nQ=8;\r\nm=MaxNonCoplanarPts(N,Q);\r\nm=floor(abs(m))\r\n% Perform m check\r\nvalid=1;\r\nif size(m,1)\u003cQ,valid=0;end % Must be Q pts or more\r\nif max(m(:))\u003eN-1,valid=0;end\r\npset=nchoosek(1:size(m,1),4);\r\nfor i=1:length(pset)\r\n m4=m(pset(i,:),:);\r\n% Coplanar check method courtesy of Tim\r\n if ~det([m4 ones(4,1)]) % coplanar det=0\r\n  valid=0;\r\n  break\r\n end\r\nend\r\nassert(isequal(1,valid))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-03-07T00:22:02.000Z","updated_at":"2026-05-28T15:03:39.000Z","published_at":"2016-03-07T01:01:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to find a set with the maximum number of integer points that create planar surfaces with a maximum of three points from the set. No four points may be co-planar. Given the size N and the number of expected points Q find a set of Q points. Only N=2/Q=5 and N=3/Q=8 will be tested. N=4/Q=10 or N=5/Q=13 are too large to process.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[N=2 contains 8 points [0,0,0;0,1,0;1,0,0;1,1,0;0,0,1;0,1,1;1,0,1;1,1,1]\\nN=3 contains 27 points [0,0,0;0,0,1;0,0,2;...2,2,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\u003eOutput is a Qx3 matrix of the non-co-planar points.\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\u003eReference: The\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://68.173.157.131/Contest/Tetrahedra\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMarch 2016 Al Zimmermann Non-Coplanar contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is N=primes less than 100. Maximize the number of points in an NxNxN cube with no 4 points in a common plane.\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\u003eTheory: The N=2 and N=3 cases can be processed by brute force if care is taken. Assumption of [0,0,0] greatly reduces number of cases. Solving\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42762-is-3d-point-set-co-planar\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Co-Planar Check\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e may improve speed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"problems":[{"id":42765,"title":"Maximize Non-Co-Planar Points in an N-Cube","description":"This Challenge is to find a set with the maximum number of integer points that create planar surfaces with a maximum of three points from the set. No four points may be co-planar.\r\nGiven the size N and the number of expected points Q find a set of Q points. Only N=2/Q=5 and N=3/Q=8 will be tested. N=4/Q=10 or N=5/Q=13 are too large to process.\r\n\r\n  N=2 contains 8 points [0,0,0;0,1,0;1,0,0;1,1,0;0,0,1;0,1,1;1,0,1;1,1,1]\r\n  N=3 contains 27 points [0,0,0;0,0,1;0,0,2;...2,2,2]\r\n\r\nOutput is a Qx3 matrix of the non-co-planar points.\r\n\r\nReference: The \u003chttp://68.173.157.131/Contest/Tetrahedra March 2016 Al Zimmermann Non-Coplanar contest\u003e is N=primes less than 100. Maximize the number of points in an NxNxN cube with no 4 points in a common plane.\r\n\r\nTheory: The N=2 and N=3 cases can be processed by brute force if care is taken. Assumption of [0,0,0] greatly reduces number of cases. Solving \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42762-is-3d-point-set-co-planar Cody Co-Planar Check\u003e may improve speed. ","description_html":"\u003cp\u003eThis Challenge is to find a set with the maximum number of integer points that create planar surfaces with a maximum of three points from the set. No four points may be co-planar.\r\nGiven the size N and the number of expected points Q find a set of Q points. Only N=2/Q=5 and N=3/Q=8 will be tested. N=4/Q=10 or N=5/Q=13 are too large to process.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eN=2 contains 8 points [0,0,0;0,1,0;1,0,0;1,1,0;0,0,1;0,1,1;1,0,1;1,1,1]\r\nN=3 contains 27 points [0,0,0;0,0,1;0,0,2;...2,2,2]\r\n\u003c/pre\u003e\u003cp\u003eOutput is a Qx3 matrix of the non-co-planar points.\u003c/p\u003e\u003cp\u003eReference: The \u003ca href = \"http://68.173.157.131/Contest/Tetrahedra\"\u003eMarch 2016 Al Zimmermann Non-Coplanar contest\u003c/a\u003e is N=primes less than 100. Maximize the number of points in an NxNxN cube with no 4 points in a common plane.\u003c/p\u003e\u003cp\u003eTheory: The N=2 and N=3 cases can be processed by brute force if care is taken. Assumption of [0,0,0] greatly reduces number of cases. Solving \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42762-is-3d-point-set-co-planar\"\u003eCody Co-Planar Check\u003c/a\u003e may improve speed.\u003c/p\u003e","function_template":"function m=MaxNonCoplanarPts(N,Q);\r\n% Place Q or more points in an 0:N-1 #D grid such that each plane created uses only 3 points from the set provided\r\n% N is Cube size\r\n% Q is expected number of points in solution\r\n% Hint: Point [0,0,0] can be assumed to be in the solution for N=2 and N=3\r\n% N=3 is the 27 points [0,0,0;0,0,1;0,0,2;...2,2,2]\r\n  m=[];\r\nend","test_suite":"%%\r\nN=2;\r\nQ=5;\r\nm=MaxNonCoplanarPts(N,Q);\r\nm=floor(abs(m))\r\n% Perform m check\r\nvalid=1;\r\nif size(m,1)\u003cQ,valid=0;end % Must be Q pts or more\r\nif max(m(:))\u003eN-1,valid=0;end\r\npset=nchoosek(1:size(m,1),4);\r\nfor i=1:length(pset)\r\n m4=m(pset(i,:),:);\r\n% Coplanar check method courtesy of Tim\r\n if ~det([m4 ones(4,1)]) % coplanar det=0\r\n  valid=0;\r\n  break\r\n end\r\nend\r\nassert(isequal(1,valid))\r\n%%\r\nN=3;\r\nQ=8;\r\nm=MaxNonCoplanarPts(N,Q);\r\nm=floor(abs(m))\r\n% Perform m check\r\nvalid=1;\r\nif size(m,1)\u003cQ,valid=0;end % Must be Q pts or more\r\nif max(m(:))\u003eN-1,valid=0;end\r\npset=nchoosek(1:size(m,1),4);\r\nfor i=1:length(pset)\r\n m4=m(pset(i,:),:);\r\n% Coplanar check method courtesy of Tim\r\n if ~det([m4 ones(4,1)]) % coplanar det=0\r\n  valid=0;\r\n  break\r\n end\r\nend\r\nassert(isequal(1,valid))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-03-07T00:22:02.000Z","updated_at":"2026-05-28T15:03:39.000Z","published_at":"2016-03-07T01:01:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to find a set with the maximum number of integer points that create planar surfaces with a maximum of three points from the set. No four points may be co-planar. Given the size N and the number of expected points Q find a set of Q points. Only N=2/Q=5 and N=3/Q=8 will be tested. N=4/Q=10 or N=5/Q=13 are too large to process.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[N=2 contains 8 points [0,0,0;0,1,0;1,0,0;1,1,0;0,0,1;0,1,1;1,0,1;1,1,1]\\nN=3 contains 27 points [0,0,0;0,0,1;0,0,2;...2,2,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\u003eOutput is a Qx3 matrix of the non-co-planar points.\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\u003eReference: The\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://68.173.157.131/Contest/Tetrahedra\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMarch 2016 Al Zimmermann Non-Coplanar contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is N=primes less than 100. Maximize the number of points in an NxNxN cube with no 4 points in a common plane.\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\u003eTheory: The N=2 and N=3 cases can be processed by brute force if care is taken. Assumption of [0,0,0] greatly reduces number of cases. Solving\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42762-is-3d-point-set-co-planar\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Co-Planar Check\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e may improve speed.\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\"}]}"}],"errors":[],"facets":[[],[{"value":"medium","count":1,"selected":false}]],"term":"tag:\"brute force\"","page":1,"per_page":50,"sort":"map(difficulty_value,0,0,999) asc"}}