{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-07-25T00:41:33.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-07-25T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":1489,"title":"Hexagonal Tiling Dots in a Circle","description":"Return how many \u003chttp://en.wikipedia.org/wiki/Hexagonal_grid Hexagonal Tiling\u003e grid points there are inside a circle of radius _r_ centred at (0,0) (including points on the edge).  Assume that a Hexagonal Tiling grid is a \u003chttp://en.wikipedia.org/wiki/Regular_tiling 2D Regular Hexagonal Tessellation\u003e with equal edges of size _e_=1.  \r\n\r\nFor symmetry purposes, assume that (0,0) point is a _vacancy_; i.e., there _are_ points at (\u0026plusmn;1,0), (\u0026plusmn;1/2,\u0026plusmn;\u0026radic;3/2), etcetera.\r\n\r\nNeither *string operations* nor *interpolations* are allowed!","description_html":"\u003cp\u003eReturn how many \u003ca href = \"http://en.wikipedia.org/wiki/Hexagonal_grid\"\u003eHexagonal Tiling\u003c/a\u003e grid points there are inside a circle of radius \u003ci\u003er\u003c/i\u003e centred at (0,0) (including points on the edge).  Assume that a Hexagonal Tiling grid is a \u003ca href = \"http://en.wikipedia.org/wiki/Regular_tiling\"\u003e2D Regular Hexagonal Tessellation\u003c/a\u003e with equal edges of size \u003ci\u003ee\u003c/i\u003e=1.\u003c/p\u003e\u003cp\u003eFor symmetry purposes, assume that (0,0) point is a \u003ci\u003evacancy\u003c/i\u003e; i.e., there \u003ci\u003eare\u003c/i\u003e points at (\u0026plusmn;1,0), (\u0026plusmn;1/2,\u0026plusmn;\u0026radic;3/2), etcetera.\u003c/p\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function n = hexagonal_tiling_dots_in_circle(r)\r\n  n = r;\r\nend","test_suite":"%%\r\nuser_solution = fileread('hexagonal_tiling_dots_in_circle.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nr = 0;\r\nN_correct = 0;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 0.5;\r\nN_correct = 0;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 1;\r\nN_correct = 6;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 1.5;\r\nN_correct = 6;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 2;\r\nN_correct = 12;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 2.5;\r\nN_correct = 12;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 3;\r\nN_correct = 24;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 5;\r\nN_correct = 60;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 7.5;\r\nN_correct = 138;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 10;\r\nN_correct = 246;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 15;\r\nN_correct = 552;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 20;\r\nN_correct = 960;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 25;\r\nN_correct = 1506;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 50;\r\nN_correct = 6024;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 100;\r\nN_correct = 24186;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":29,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":20,"created_at":"2013-05-05T10:39:46.000Z","updated_at":"2026-03-25T00:01:03.000Z","published_at":"2013-05-05T10:54:39.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\u003eReturn how many\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://en.wikipedia.org/wiki/Hexagonal_grid\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eHexagonal Tiling\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e grid points there are inside a circle of radius\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e centred at (0,0) (including points on the edge). Assume that a Hexagonal Tiling grid is a\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://en.wikipedia.org/wiki/Regular_tiling\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2D Regular Hexagonal Tessellation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e with equal edges of size\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ee\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e=1.\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 symmetry purposes, assume that (0,0) point is a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003evacancy\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; i.e., there\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eare\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e points at (±1,0), (±1/2,±√3/2), etcetera.\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\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\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":1452,"title":"Minimum Distance between two N-sided Polygons","description":"This Challenge is to determine the minimum distance between two non-overlapping polygons. The input is a cell array of two vectors that represent the sequential points of 3 to 100 sided polygons. [x0 y0 x1 y1 ... xn yn]\r\n\r\n*Input:* polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\r\n\r\n*Output:* 0.5  \r\n\r\n\r\nRelated Challenges:\r\n\r\n1) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1446-minimum-distance-point-to-segment Minimum Distance Point to Segment\u003e\r\n\r\n2) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1457-usc-spring-2013-acm-walking-on-thin-ice USC Spring 2013 ACM Walking on Thin Ice\u003e","description_html":"\u003cp\u003eThis Challenge is to determine the minimum distance between two non-overlapping polygons. The input is a cell array of two vectors that represent the sequential points of 3 to 100 sided polygons. [x0 y0 x1 y1 ... xn yn]\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e 0.5\u003c/p\u003e\u003cp\u003eRelated Challenges:\u003c/p\u003e\u003cp\u003e1) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1446-minimum-distance-point-to-segment\"\u003eMinimum Distance Point to Segment\u003c/a\u003e\u003c/p\u003e\u003cp\u003e2) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1457-usc-spring-2013-acm-walking-on-thin-ice\"\u003eUSC Spring 2013 ACM Walking on Thin Ice\u003c/a\u003e\u003c/p\u003e","function_template":"function pdistmin=PolytoPol(polycell)\r\n% Convert [x0 y0 x1 y1 ... xn yn] to nx2 array\r\n% Length of polycell{1} may vary from polycell{2}\r\n p1=reshape(polycell{1},2,[])';\r\n p2=reshape(polycell{2},2,[])';\r\n \r\n pdistmin=0;\r\nend","test_suite":"polycell={[0 0 5 10 10 0] [5 -1 6 -5 5 -5]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-1)\u003c.01);\r\n%%\r\npolycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-0.5)\u003c.01);\r\n%%\r\npolycell={[0 10 0 90 50 50 100 90 100 10] [0 110 100 110 50 70]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-15.617376)\u003c.01);\r\n%%\r\npolycell={[0 110 100 110 50 70] [20 5 50 7 30 5]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-63)\u003c.01);\r\n%%\r\npolycell={[-5 -5 -4 -4 -3 -3 -2 -2 5 5 5 0] [6 10 6 -10 20 0]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-1)\u003c.01);\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":20,"created_at":"2013-04-24T01:39:41.000Z","updated_at":"2026-02-16T10:57:04.000Z","published_at":"2013-04-24T02:03:10.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 determine the minimum distance between two non-overlapping polygons. The input is a cell array of two vectors that represent the sequential points of 3 to 100 sided polygons. [x0 y0 x1 y1 ... xn yn]\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 0.5\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\u003eRelated Challenges:\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)\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/1446-minimum-distance-point-to-segment\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMinimum Distance Point to Segment\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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2)\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/1457-usc-spring-2013-acm-walking-on-thin-ice\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eUSC Spring 2013 ACM Walking on Thin Ice\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":1283,"title":"Points on a Sphere","description":"Given a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates.  Do not output the actual coordinates, but just the number of points.\r\n\r\nFor example, a sphere of radius 1 has 6 points with three integer coordinates:\r\n\r\n* (1,0,0)\r\n* (-1,0,0)\r\n* (0,-1,0)\r\n* (0,1,0)\r\n* (0,0,1)\r\n* (0,0,-1)\r\n\r\nYour output of surface_points(1) would be 6.  Good luck!","description_html":"\u003cp\u003eGiven a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates.  Do not output the actual coordinates, but just the number of points.\u003c/p\u003e\u003cp\u003eFor example, a sphere of radius 1 has 6 points with three integer coordinates:\u003c/p\u003e\u003cul\u003e\u003cli\u003e(1,0,0)\u003c/li\u003e\u003cli\u003e(-1,0,0)\u003c/li\u003e\u003cli\u003e(0,-1,0)\u003c/li\u003e\u003cli\u003e(0,1,0)\u003c/li\u003e\u003cli\u003e(0,0,1)\u003c/li\u003e\u003cli\u003e(0,0,-1)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYour output of surface_points(1) would be 6.  Good luck!\u003c/p\u003e","function_template":"function y = surface_points(r)\r\ny=6;\r\nend","test_suite":"%%\r\nx = 1; y_correct = 6;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 1024; y_correct = 6;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 7581; y_correct = 108270;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 450; y_correct = 2550;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 123456; y_correct = 19350;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx=ceil(rand*8); y_correct=[6 30 30 150 510 4590 4590 43470];\r\nassert(isequal(surface_points(factorial(x+1)),y_correct(x)))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":"2013-02-22T17:25:38.000Z","rescore_all_solutions":false,"group_id":20,"created_at":"2013-02-20T16:48:12.000Z","updated_at":"2026-04-17T13:51:38.000Z","published_at":"2013-02-20T16:49:36.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\u003eGiven a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates. Do not output the actual coordinates, but just the number of 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\u003eFor example, a sphere of radius 1 has 6 points with three integer coordinates:\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(1,0,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(-1,0,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,-1,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,1,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,0,1)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,0,-1)\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\u003eYour output of surface_points(1) would be 6. Good luck!\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":1493,"title":"Dots in a Diamond","description":"Return how many \u003chttp://en.wikipedia.org/wiki/Diamond_cubic Diamond Cubic\u003e lattice grid points there are inside a 3D sphere of radius _r_ centred at (0,0,0) (including points on the edge).  \r\n\r\nSet the distance between two adjacent lattice grid points to be _e_ =1. In addition, assume that (0,0,0) is a grid point.\r\n\r\nNeither *string operations* nor *interpolations* are allowed!","description_html":"\u003cp\u003eReturn how many \u003ca href = \"http://en.wikipedia.org/wiki/Diamond_cubic\"\u003eDiamond Cubic\u003c/a\u003e lattice grid points there are inside a 3D sphere of radius \u003ci\u003er\u003c/i\u003e centred at (0,0,0) (including points on the edge).\u003c/p\u003e\u003cp\u003eSet the distance between two adjacent lattice grid points to be \u003ci\u003ee\u003c/i\u003e =1. In addition, assume that (0,0,0) is a grid point.\u003c/p\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function n = dots_in_diamond(r)\r\n  n = r;\r\nend","test_suite":"%%\r\nuser_solution = fileread('dots_in_diamond.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nr = 0;\r\nN_correct = 1;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 0.5;\r\nN_correct = 1;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 1;\r\nN_correct = 5;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 1.5;\r\nN_correct = 5;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 1.74;\r\nN_correct = 17;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 2;\r\nN_correct = 29;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 2.5;\r\nN_correct = 35;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 3;\r\nN_correct = 87;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 4;\r\nN_correct = 167;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 5;\r\nN_correct = 357;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 6;\r\nN_correct = 633;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 7;\r\nN_correct = 943;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 8;\r\nN_correct = 1371;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 9;\r\nN_correct = 1963;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 10;\r\nN_correct = 2809;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 12.5;\r\nN_correct = 5359;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 15;\r\nN_correct = 9249;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 17.5;\r\nN_correct = 14451;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 20;\r\nN_correct = 21777;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 22.5;\r\nN_correct = 31075;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 25;\r\nN_correct = 42509;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2013-05-10T08:33:38.000Z","rescore_all_solutions":false,"group_id":20,"created_at":"2013-05-08T09:16:44.000Z","updated_at":"2026-04-24T02:54:04.000Z","published_at":"2013-05-08T09:58:42.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\u003eReturn how many\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://en.wikipedia.org/wiki/Diamond_cubic\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDiamond Cubic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e lattice grid points there are inside a 3D sphere of radius\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e centred at (0,0,0) (including points on the edge).\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\u003eSet the distance between two adjacent lattice grid points to be\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ee\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e =1. In addition, assume that (0,0,0) is a grid point.\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\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\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":1387,"title":"Points on a circle.","description":"This problem is related to \u003curl=http://www.mathworks.com/matlabcentral/cody/problems/1283-points-on-a-sphere\u003eProblem 1283, Points on a Sphere.\u003e  In this case, instead of a sphere, you have a circle.  Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates.  For a circle of radius 5, you would have 12 points:\r\n\r\n* (0, 5) and (0, -5)\r\n* (5, 0) and (-5, 0)\r\n* (4, 3) and (4, -3)\r\n* (-4, 3) and (-4, -3)\r\n* (3, 4) and (3, -4)\r\n* (-3, 4) and (-3, -4)\r\n\r\nSome radii are quite large, so watch out.  Good luck!","description_html":"\u003cp\u003eThis problem is related to \u003ca href = \"url=http://www.mathworks.com/matlabcentral/cody/problems/1283-points-on-a-sphere\u0026gt;Problem\"\u003e1283, Points on a Sphere.\u003c/a\u003e  In this case, instead of a sphere, you have a circle.  Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates.  For a circle of radius 5, you would have 12 points:\u003c/p\u003e\u003cul\u003e\u003cli\u003e(0, 5) and (0, -5)\u003c/li\u003e\u003cli\u003e(5, 0) and (-5, 0)\u003c/li\u003e\u003cli\u003e(4, 3) and (4, -3)\u003c/li\u003e\u003cli\u003e(-4, 3) and (-4, -3)\u003c/li\u003e\u003cli\u003e(3, 4) and (3, -4)\u003c/li\u003e\u003cli\u003e(-3, 4) and (-3, -4)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eSome radii are quite large, so watch out.  Good luck!\u003c/p\u003e","function_template":"function y = circle_points(r)\r\n  y = r;\r\nend","test_suite":"%%\r\nassert(isequal(circle_points(1),4))\r\n%%\r\nassert(isequal(circle_points(3),4))\r\n%%\r\nassert(isequal(circle_points(5),12))\r\n%%\r\nassert(isequal(circle_points(65),36))\r\n%%\r\nassert(isequal(circle_points(64090),324))\r\n%%\r\nassert(isequal(circle_points(326441),12))\r\n%%\r\nassert(isequal(circle_points(359125),420))\r\n%%\r\nassert(isequal(circle_points(1000001),36))\r\n%%\r\nassert(isequal(circle_points(2417899275),20))\r\n%%\r\nassert(isequal(circle_points(31432690549),8748))\r\n%%\r\nassert(isequal(circle_points(11472932050385),78732))\r\n%%\r\nassert(isequal(circle_points(1021090952484265),236196))\r\n%%\r\nassert(isequal(circle_points(6095127531752228),78732))\r\n%%\r\nassert(isequal(circle_points(5*circle_points(630209)),12))\r\n%%\r\ny=arrayfun(@(x) circle_points(x),1000:2000);\r\n[m1,m2]=max(y);\r\nassert(isequal(m1-m2,2));\r\n[h1,h2]=hist(y,unique(y));\r\nassert(isequal(prod(h1-h2),1399066124544000))","published":true,"deleted":false,"likes_count":2,"comments_count":5,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2018-02-22T17:55:59.000Z","rescore_all_solutions":true,"group_id":20,"created_at":"2013-03-25T18:05:05.000Z","updated_at":"2026-02-16T11:09:55.000Z","published_at":"2013-03-25T18:44:35.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 problem is related to\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=\\\"url=http://www.mathworks.com/matlabcentral/cody/problems/1283-points-on-a-sphere\u003eProblem\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1283, Points on a Sphere.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e In this case, instead of a sphere, you have a circle. Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates. For a circle of radius 5, you would have 12 points:\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0, 5) and (0, -5)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(5, 0) and (-5, 0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(4, 3) and (4, -3)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(-4, 3) and (-4, -3)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(3, 4) and (3, -4)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(-3, 4) and (-3, -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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome radii are quite large, so watch out. Good luck!\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":1489,"title":"Hexagonal Tiling Dots in a Circle","description":"Return how many \u003chttp://en.wikipedia.org/wiki/Hexagonal_grid Hexagonal Tiling\u003e grid points there are inside a circle of radius _r_ centred at (0,0) (including points on the edge).  Assume that a Hexagonal Tiling grid is a \u003chttp://en.wikipedia.org/wiki/Regular_tiling 2D Regular Hexagonal Tessellation\u003e with equal edges of size _e_=1.  \r\n\r\nFor symmetry purposes, assume that (0,0) point is a _vacancy_; i.e., there _are_ points at (\u0026plusmn;1,0), (\u0026plusmn;1/2,\u0026plusmn;\u0026radic;3/2), etcetera.\r\n\r\nNeither *string operations* nor *interpolations* are allowed!","description_html":"\u003cp\u003eReturn how many \u003ca href = \"http://en.wikipedia.org/wiki/Hexagonal_grid\"\u003eHexagonal Tiling\u003c/a\u003e grid points there are inside a circle of radius \u003ci\u003er\u003c/i\u003e centred at (0,0) (including points on the edge).  Assume that a Hexagonal Tiling grid is a \u003ca href = \"http://en.wikipedia.org/wiki/Regular_tiling\"\u003e2D Regular Hexagonal Tessellation\u003c/a\u003e with equal edges of size \u003ci\u003ee\u003c/i\u003e=1.\u003c/p\u003e\u003cp\u003eFor symmetry purposes, assume that (0,0) point is a \u003ci\u003evacancy\u003c/i\u003e; i.e., there \u003ci\u003eare\u003c/i\u003e points at (\u0026plusmn;1,0), (\u0026plusmn;1/2,\u0026plusmn;\u0026radic;3/2), etcetera.\u003c/p\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function n = hexagonal_tiling_dots_in_circle(r)\r\n  n = r;\r\nend","test_suite":"%%\r\nuser_solution = fileread('hexagonal_tiling_dots_in_circle.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nr = 0;\r\nN_correct = 0;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 0.5;\r\nN_correct = 0;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 1;\r\nN_correct = 6;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 1.5;\r\nN_correct = 6;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 2;\r\nN_correct = 12;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 2.5;\r\nN_correct = 12;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 3;\r\nN_correct = 24;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 5;\r\nN_correct = 60;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 7.5;\r\nN_correct = 138;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 10;\r\nN_correct = 246;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 15;\r\nN_correct = 552;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 20;\r\nN_correct = 960;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 25;\r\nN_correct = 1506;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 50;\r\nN_correct = 6024;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n\r\n%%\r\nr = 100;\r\nN_correct = 24186;\r\nassert(isequal(hexagonal_tiling_dots_in_circle(r),N_correct));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":29,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":20,"created_at":"2013-05-05T10:39:46.000Z","updated_at":"2026-03-25T00:01:03.000Z","published_at":"2013-05-05T10:54:39.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\u003eReturn how many\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://en.wikipedia.org/wiki/Hexagonal_grid\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eHexagonal Tiling\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e grid points there are inside a circle of radius\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e centred at (0,0) (including points on the edge). Assume that a Hexagonal Tiling grid is a\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://en.wikipedia.org/wiki/Regular_tiling\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2D Regular Hexagonal Tessellation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e with equal edges of size\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ee\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e=1.\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 symmetry purposes, assume that (0,0) point is a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003evacancy\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; i.e., there\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eare\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e points at (±1,0), (±1/2,±√3/2), etcetera.\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\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\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":1452,"title":"Minimum Distance between two N-sided Polygons","description":"This Challenge is to determine the minimum distance between two non-overlapping polygons. The input is a cell array of two vectors that represent the sequential points of 3 to 100 sided polygons. [x0 y0 x1 y1 ... xn yn]\r\n\r\n*Input:* polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\r\n\r\n*Output:* 0.5  \r\n\r\n\r\nRelated Challenges:\r\n\r\n1) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1446-minimum-distance-point-to-segment Minimum Distance Point to Segment\u003e\r\n\r\n2) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1457-usc-spring-2013-acm-walking-on-thin-ice USC Spring 2013 ACM Walking on Thin Ice\u003e","description_html":"\u003cp\u003eThis Challenge is to determine the minimum distance between two non-overlapping polygons. The input is a cell array of two vectors that represent the sequential points of 3 to 100 sided polygons. [x0 y0 x1 y1 ... xn yn]\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e 0.5\u003c/p\u003e\u003cp\u003eRelated Challenges:\u003c/p\u003e\u003cp\u003e1) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1446-minimum-distance-point-to-segment\"\u003eMinimum Distance Point to Segment\u003c/a\u003e\u003c/p\u003e\u003cp\u003e2) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1457-usc-spring-2013-acm-walking-on-thin-ice\"\u003eUSC Spring 2013 ACM Walking on Thin Ice\u003c/a\u003e\u003c/p\u003e","function_template":"function pdistmin=PolytoPol(polycell)\r\n% Convert [x0 y0 x1 y1 ... xn yn] to nx2 array\r\n% Length of polycell{1} may vary from polycell{2}\r\n p1=reshape(polycell{1},2,[])';\r\n p2=reshape(polycell{2},2,[])';\r\n \r\n pdistmin=0;\r\nend","test_suite":"polycell={[0 0 5 10 10 0] [5 -1 6 -5 5 -5]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-1)\u003c.01);\r\n%%\r\npolycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-0.5)\u003c.01);\r\n%%\r\npolycell={[0 10 0 90 50 50 100 90 100 10] [0 110 100 110 50 70]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-15.617376)\u003c.01);\r\n%%\r\npolycell={[0 110 100 110 50 70] [20 5 50 7 30 5]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-63)\u003c.01);\r\n%%\r\npolycell={[-5 -5 -4 -4 -3 -3 -2 -2 5 5 5 0] [6 10 6 -10 20 0]};\r\np2p_min=PolytoPol(polycell);\r\nassert(abs(p2p_min-1)\u003c.01);\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":20,"created_at":"2013-04-24T01:39:41.000Z","updated_at":"2026-02-16T10:57:04.000Z","published_at":"2013-04-24T02:03:10.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 determine the minimum distance between two non-overlapping polygons. The input is a cell array of two vectors that represent the sequential points of 3 to 100 sided polygons. [x0 y0 x1 y1 ... xn yn]\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\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]};\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\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 0.5\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\u003eRelated Challenges:\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)\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/1446-minimum-distance-point-to-segment\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMinimum Distance Point to Segment\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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2)\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/1457-usc-spring-2013-acm-walking-on-thin-ice\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eUSC Spring 2013 ACM Walking on Thin Ice\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":1283,"title":"Points on a Sphere","description":"Given a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates.  Do not output the actual coordinates, but just the number of points.\r\n\r\nFor example, a sphere of radius 1 has 6 points with three integer coordinates:\r\n\r\n* (1,0,0)\r\n* (-1,0,0)\r\n* (0,-1,0)\r\n* (0,1,0)\r\n* (0,0,1)\r\n* (0,0,-1)\r\n\r\nYour output of surface_points(1) would be 6.  Good luck!","description_html":"\u003cp\u003eGiven a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates.  Do not output the actual coordinates, but just the number of points.\u003c/p\u003e\u003cp\u003eFor example, a sphere of radius 1 has 6 points with three integer coordinates:\u003c/p\u003e\u003cul\u003e\u003cli\u003e(1,0,0)\u003c/li\u003e\u003cli\u003e(-1,0,0)\u003c/li\u003e\u003cli\u003e(0,-1,0)\u003c/li\u003e\u003cli\u003e(0,1,0)\u003c/li\u003e\u003cli\u003e(0,0,1)\u003c/li\u003e\u003cli\u003e(0,0,-1)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYour output of surface_points(1) would be 6.  Good luck!\u003c/p\u003e","function_template":"function y = surface_points(r)\r\ny=6;\r\nend","test_suite":"%%\r\nx = 1; y_correct = 6;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 1024; y_correct = 6;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 7581; y_correct = 108270;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 450; y_correct = 2550;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx = 123456; y_correct = 19350;\r\nassert(isequal(surface_points(x),y_correct))\r\n%%\r\nx=ceil(rand*8); y_correct=[6 30 30 150 510 4590 4590 43470];\r\nassert(isequal(surface_points(factorial(x+1)),y_correct(x)))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":"2013-02-22T17:25:38.000Z","rescore_all_solutions":false,"group_id":20,"created_at":"2013-02-20T16:48:12.000Z","updated_at":"2026-04-17T13:51:38.000Z","published_at":"2013-02-20T16:49:36.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\u003eGiven a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates. Do not output the actual coordinates, but just the number of 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\u003eFor example, a sphere of radius 1 has 6 points with three integer coordinates:\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(1,0,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(-1,0,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,-1,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,1,0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,0,1)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0,0,-1)\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\u003eYour output of surface_points(1) would be 6. Good luck!\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":1493,"title":"Dots in a Diamond","description":"Return how many \u003chttp://en.wikipedia.org/wiki/Diamond_cubic Diamond Cubic\u003e lattice grid points there are inside a 3D sphere of radius _r_ centred at (0,0,0) (including points on the edge).  \r\n\r\nSet the distance between two adjacent lattice grid points to be _e_ =1. In addition, assume that (0,0,0) is a grid point.\r\n\r\nNeither *string operations* nor *interpolations* are allowed!","description_html":"\u003cp\u003eReturn how many \u003ca href = \"http://en.wikipedia.org/wiki/Diamond_cubic\"\u003eDiamond Cubic\u003c/a\u003e lattice grid points there are inside a 3D sphere of radius \u003ci\u003er\u003c/i\u003e centred at (0,0,0) (including points on the edge).\u003c/p\u003e\u003cp\u003eSet the distance between two adjacent lattice grid points to be \u003ci\u003ee\u003c/i\u003e =1. In addition, assume that (0,0,0) is a grid point.\u003c/p\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function n = dots_in_diamond(r)\r\n  n = r;\r\nend","test_suite":"%%\r\nuser_solution = fileread('dots_in_diamond.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nr = 0;\r\nN_correct = 1;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 0.5;\r\nN_correct = 1;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 1;\r\nN_correct = 5;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 1.5;\r\nN_correct = 5;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 1.74;\r\nN_correct = 17;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 2;\r\nN_correct = 29;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 2.5;\r\nN_correct = 35;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 3;\r\nN_correct = 87;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 4;\r\nN_correct = 167;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 5;\r\nN_correct = 357;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 6;\r\nN_correct = 633;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 7;\r\nN_correct = 943;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 8;\r\nN_correct = 1371;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 9;\r\nN_correct = 1963;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 10;\r\nN_correct = 2809;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 12.5;\r\nN_correct = 5359;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 15;\r\nN_correct = 9249;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 17.5;\r\nN_correct = 14451;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 20;\r\nN_correct = 21777;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 22.5;\r\nN_correct = 31075;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n\r\n%%\r\nr = 25;\r\nN_correct = 42509;\r\nassert(isequal(dots_in_diamond(r),N_correct));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2013-05-10T08:33:38.000Z","rescore_all_solutions":false,"group_id":20,"created_at":"2013-05-08T09:16:44.000Z","updated_at":"2026-04-24T02:54:04.000Z","published_at":"2013-05-08T09:58:42.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\u003eReturn how many\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://en.wikipedia.org/wiki/Diamond_cubic\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDiamond Cubic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e lattice grid points there are inside a 3D sphere of radius\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e centred at (0,0,0) (including points on the edge).\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\u003eSet the distance between two adjacent lattice grid points to be\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ee\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e =1. In addition, assume that (0,0,0) is a grid point.\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\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\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":1387,"title":"Points on a circle.","description":"This problem is related to \u003curl=http://www.mathworks.com/matlabcentral/cody/problems/1283-points-on-a-sphere\u003eProblem 1283, Points on a Sphere.\u003e  In this case, instead of a sphere, you have a circle.  Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates.  For a circle of radius 5, you would have 12 points:\r\n\r\n* (0, 5) and (0, -5)\r\n* (5, 0) and (-5, 0)\r\n* (4, 3) and (4, -3)\r\n* (-4, 3) and (-4, -3)\r\n* (3, 4) and (3, -4)\r\n* (-3, 4) and (-3, -4)\r\n\r\nSome radii are quite large, so watch out.  Good luck!","description_html":"\u003cp\u003eThis problem is related to \u003ca href = \"url=http://www.mathworks.com/matlabcentral/cody/problems/1283-points-on-a-sphere\u0026gt;Problem\"\u003e1283, Points on a Sphere.\u003c/a\u003e  In this case, instead of a sphere, you have a circle.  Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates.  For a circle of radius 5, you would have 12 points:\u003c/p\u003e\u003cul\u003e\u003cli\u003e(0, 5) and (0, -5)\u003c/li\u003e\u003cli\u003e(5, 0) and (-5, 0)\u003c/li\u003e\u003cli\u003e(4, 3) and (4, -3)\u003c/li\u003e\u003cli\u003e(-4, 3) and (-4, -3)\u003c/li\u003e\u003cli\u003e(3, 4) and (3, -4)\u003c/li\u003e\u003cli\u003e(-3, 4) and (-3, -4)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eSome radii are quite large, so watch out.  Good luck!\u003c/p\u003e","function_template":"function y = circle_points(r)\r\n  y = r;\r\nend","test_suite":"%%\r\nassert(isequal(circle_points(1),4))\r\n%%\r\nassert(isequal(circle_points(3),4))\r\n%%\r\nassert(isequal(circle_points(5),12))\r\n%%\r\nassert(isequal(circle_points(65),36))\r\n%%\r\nassert(isequal(circle_points(64090),324))\r\n%%\r\nassert(isequal(circle_points(326441),12))\r\n%%\r\nassert(isequal(circle_points(359125),420))\r\n%%\r\nassert(isequal(circle_points(1000001),36))\r\n%%\r\nassert(isequal(circle_points(2417899275),20))\r\n%%\r\nassert(isequal(circle_points(31432690549),8748))\r\n%%\r\nassert(isequal(circle_points(11472932050385),78732))\r\n%%\r\nassert(isequal(circle_points(1021090952484265),236196))\r\n%%\r\nassert(isequal(circle_points(6095127531752228),78732))\r\n%%\r\nassert(isequal(circle_points(5*circle_points(630209)),12))\r\n%%\r\ny=arrayfun(@(x) circle_points(x),1000:2000);\r\n[m1,m2]=max(y);\r\nassert(isequal(m1-m2,2));\r\n[h1,h2]=hist(y,unique(y));\r\nassert(isequal(prod(h1-h2),1399066124544000))","published":true,"deleted":false,"likes_count":2,"comments_count":5,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2018-02-22T17:55:59.000Z","rescore_all_solutions":true,"group_id":20,"created_at":"2013-03-25T18:05:05.000Z","updated_at":"2026-02-16T11:09:55.000Z","published_at":"2013-03-25T18:44:35.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 problem is related to\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=\\\"url=http://www.mathworks.com/matlabcentral/cody/problems/1283-points-on-a-sphere\u003eProblem\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e1283, Points on a Sphere.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e In this case, instead of a sphere, you have a circle. Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates. For a circle of radius 5, you would have 12 points:\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(0, 5) and (0, -5)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(5, 0) and (-5, 0)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(4, 3) and (4, -3)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(-4, 3) and (-4, -3)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(3, 4) and (3, -4)\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=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(-3, 4) and (-3, -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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSome radii are quite large, so watch out. Good luck!\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":"Computational Geometry II","count":5,"selected":true}],[{"value":"hard","count":5,"selected":true}]],"term":"difficulty_rating_bin:hard group:\"Computational Geometry II\"","page":1,"per_page":50,"sort":"map(difficulty_value,0,0,999) asc"}}