{"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":1092,"title":"Decimation","description":"When dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and lots would be drawn.  The person who was unlucky enough to draw the short straw would be executed by the other nine members of his group.\r\n\r\nThe bloodthirsty Roman Centurion Carnage Maximus decided to apply this to his prisoners, with a few gruesome differences.  Rather than kill every tenth prisoner and allow the rest to live, he is going to leave only one prisoner alive and kill all of the others.  Instead of killing every tenth prisoner, he chooses a number (kill_every).  If kill_every=3, he kills every third prisoner.  If kill_every=5, he kills every fifth prisoner.  He always chooses a number between 2 and the number of prisoners he has, and this process will be repeated until there is only one prisoner left.  For example, if there are 10 prisoners, and kill_every=3\r\n\r\nFirst iteration: 1 2 3 4 5 6 7 8 9 10\r\n\r\n1-2-3 4-5-6 7-8-9 10\r\n\r\nPrisoners 3, 6 and 9 will be killed.\r\n\r\nSecond iteration: 1 2 4 5 7 8 10\r\n\r\nBecause Prisoner 10 was counted during the first iteration, the executions\r\nwill proceed as such: 10-1-2 4-5-7 8-10, so prisoners 2 and 7 will be killed\r\n\r\nThird iteration: 1 4 5 8 10\r\n8-10-1 4-5-8 10, so prisoners 1 and 8 executed.\r\n\r\nFourth Iteration:  10-4-5 10\r\nPrisoner 5 is executed.\r\n\r\nFifth iteration:  10-4 10\r\nPrisoner 10 is executed\r\n\r\nSince the sole survivor is prisoner 4, he is released.\r\n\r\nYou are an unlucky prisoner caught by Carnage Maximum.  Prior to lining up the prisoners, he reveals the number of prisoners he has and his value of kill_every for the day.  Your job is to figure out which prisoner you need to be in order to survive.  Write a MATLAB script that takes the values of num_prisoners and kill_every.  The output will be survivor, which is the position of the person who survives.  If you write your script quickly enough, that person will be you.\r\n\r\nGood luck!","description_html":"\u003cp\u003eWhen dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and lots would be drawn.  The person who was unlucky enough to draw the short straw would be executed by the other nine members of his group.\u003c/p\u003e\u003cp\u003eThe bloodthirsty Roman Centurion Carnage Maximus decided to apply this to his prisoners, with a few gruesome differences.  Rather than kill every tenth prisoner and allow the rest to live, he is going to leave only one prisoner alive and kill all of the others.  Instead of killing every tenth prisoner, he chooses a number (kill_every).  If kill_every=3, he kills every third prisoner.  If kill_every=5, he kills every fifth prisoner.  He always chooses a number between 2 and the number of prisoners he has, and this process will be repeated until there is only one prisoner left.  For example, if there are 10 prisoners, and kill_every=3\u003c/p\u003e\u003cp\u003eFirst iteration: 1 2 3 4 5 6 7 8 9 10\u003c/p\u003e\u003cp\u003e1-2-3 4-5-6 7-8-9 10\u003c/p\u003e\u003cp\u003ePrisoners 3, 6 and 9 will be killed.\u003c/p\u003e\u003cp\u003eSecond iteration: 1 2 4 5 7 8 10\u003c/p\u003e\u003cp\u003eBecause Prisoner 10 was counted during the first iteration, the executions\r\nwill proceed as such: 10-1-2 4-5-7 8-10, so prisoners 2 and 7 will be killed\u003c/p\u003e\u003cp\u003eThird iteration: 1 4 5 8 10\r\n8-10-1 4-5-8 10, so prisoners 1 and 8 executed.\u003c/p\u003e\u003cp\u003eFourth Iteration:  10-4-5 10\r\nPrisoner 5 is executed.\u003c/p\u003e\u003cp\u003eFifth iteration:  10-4 10\r\nPrisoner 10 is executed\u003c/p\u003e\u003cp\u003eSince the sole survivor is prisoner 4, he is released.\u003c/p\u003e\u003cp\u003eYou are an unlucky prisoner caught by Carnage Maximum.  Prior to lining up the prisoners, he reveals the number of prisoners he has and his value of kill_every for the day.  Your job is to figure out which prisoner you need to be in order to survive.  Write a MATLAB script that takes the values of num_prisoners and kill_every.  The output will be survivor, which is the position of the person who survives.  If you write your script quickly enough, that person will be you.\u003c/p\u003e\u003cp\u003eGood luck!\u003c/p\u003e","function_template":"function survivor=decimate(num_prisoners,kill_every)\r\nsurvivor=4;\r\nend","test_suite":"%%\r\nassert(isequal(decimate(10,3),4))\r\n%%\r\nassert(isequal(decimate(1024,3),676))\r\n%%\r\nassert(isequal(decimate(2012,50),543))\r\n%%\r\nassert(isequal(decimate(30,5),3))\r\n%%\r\nassert(isequal(decimate(10,10),8))\r\n%%\r\nassert(isequal(decimate(2048,2),1))","published":true,"deleted":false,"likes_count":20,"comments_count":14,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":325,"test_suite_updated_at":"2012-12-04T21:28:04.000Z","rescore_all_solutions":false,"group_id":13,"created_at":"2012-12-04T19:47:49.000Z","updated_at":"2026-07-15T20:44:18.000Z","published_at":"2012-12-04T19:53:55.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eWhen dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and lots would be drawn. The person who was unlucky enough to draw the short straw would be executed by the other nine members of his group.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe bloodthirsty Roman Centurion Carnage Maximus decided to apply this to his prisoners, with a few gruesome differences. Rather than kill every tenth prisoner and allow the rest to live, he is going to leave only one prisoner alive and kill all of the others. Instead of killing every tenth prisoner, he chooses a number (kill_every). If kill_every=3, he kills every third prisoner. If kill_every=5, he kills every fifth prisoner. He always chooses a number between 2 and the number of prisoners he has, and this process will be repeated until there is only one prisoner left. For example, if there are 10 prisoners, and kill_every=3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFirst iteration: 1 2 3 4 5 6 7 8 9 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1-2-3 4-5-6 7-8-9 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrisoners 3, 6 and 9 will be killed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSecond iteration: 1 2 4 5 7 8 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBecause Prisoner 10 was counted during the first iteration, the executions will proceed as such: 10-1-2 4-5-7 8-10, so prisoners 2 and 7 will be killed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThird iteration: 1 4 5 8 10 8-10-1 4-5-8 10, so prisoners 1 and 8 executed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFourth Iteration: 10-4-5 10 Prisoner 5 is executed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFifth iteration: 10-4 10 Prisoner 10 is executed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSince the sole survivor is prisoner 4, he is released.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are an unlucky prisoner caught by Carnage Maximum. Prior to lining up the prisoners, he reveals the number of prisoners he has and his value of kill_every for the day. Your job is to figure out which prisoner you need to be in order to survive. Write a MATLAB script that takes the values of num_prisoners and kill_every. The output will be survivor, which is the position of the person who survives. If you write your script quickly enough, that person will be you.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGood 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":2674,"title":"Generalised Hamming Number","description":"Inspired by Project Euler n°204 and Problem 1308 by James\r\n\r\nA generalised Hamming number of type n, has no prime factor larger than n.\r\n\r\nFor example a generalised Hamming number of type 5 has no prime factor larger than 5.\r\n\r\nGiven a number X, determine how many generalised Hamming numbers n are less than or equal to that number. Please note that 1 counts as a Hamming number. \r\n\r\n\r\n","description_html":"\u003cp\u003eInspired by Project Euler n°204 and Problem 1308 by James\u003c/p\u003e\u003cp\u003eA generalised Hamming number of type n, has no prime factor larger than n.\u003c/p\u003e\u003cp\u003eFor example a generalised Hamming number of type 5 has no prime factor larger than 5.\u003c/p\u003e\u003cp\u003eGiven a number X, determine how many generalised Hamming numbers n are less than or equal to that number. Please note that 1 counts as a Hamming number.\u003c/p\u003e","function_template":"function y = hamming2(X,n)\r\n  X=n;\r\nend","test_suite":"%%\r\nX = 5;\r\nn=5;\r\ny_correct = 5;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10;\r\nn=5;\r\ny_correct = 9;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=5;\r\ny_correct = 34;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=7;\r\ny_correct = 46;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=100;\r\ny_correct = 100;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=13;\r\ny_correct = 62;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^13;\r\nn=7;\r\ny_correct = 19674;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^5;\r\nn=13;\r\ny_correct = 1848;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^5;\r\nn=5;\r\ny_correct = 313;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 123456;\r\nn=5;\r\ny_correct = 327;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^13;\r\nn=3;\r\ny_correct = 624;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 123456;\r\nn=2;\r\ny_correct = 17;\r\nassert(isequal(hamming2(X,n),y_correct))","published":true,"deleted":false,"likes_count":13,"comments_count":5,"created_by":5390,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":362,"test_suite_updated_at":"2014-11-17T10:17:26.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2014-11-17T09:33:12.000Z","updated_at":"2026-04-16T12:29:28.000Z","published_at":"2014-11-17T10:14:18.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eInspired by Project Euler n°204 and Problem 1308 by James\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA generalised Hamming number of type n, has no prime factor larger than n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example a generalised Hamming number of type 5 has no prime factor larger than 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a number X, determine how many generalised Hamming numbers n are less than or equal to that number. Please note that 1 counts as a Hamming number.\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":44793,"title":"Project Euler 249: Prime Subset Sums","description":"Inspired by Problem 249 of Project Euler.\r\n\u003chttps://projecteuler.net/problem=249\u003e\r\n\r\nLet S = {2, 3, 5, ...} be the set of prime numbers less than N.\r\n\r\nFind the number of subsets of S, the sum of whose elements is a prime number.\r\nEnter the rightmost 16 digits as your answer.\r\nThe answer must be a uint64 integer.","description_html":"\u003cp\u003eInspired by Problem 249 of Project Euler. \u003ca href = \"https://projecteuler.net/problem=249\"\u003ehttps://projecteuler.net/problem=249\u003c/a\u003e\u003c/p\u003e\u003cp\u003eLet S = {2, 3, 5, ...} be the set of prime numbers less than N.\u003c/p\u003e\u003cp\u003eFind the number of subsets of S, the sum of whose elements is a prime number.\r\nEnter the rightmost 16 digits as your answer.\r\nThe answer must be a uint64 integer.\u003c/p\u003e","function_template":"function num = euler249(N)\r\n  num = uint64(7) % answer for N = 10\r\nend","test_suite":"%%\r\ntic;\r\nSUM = euler249(10)\r\ntoc;\r\nassert(isequal(SUM, uint64(7)))\r\n\r\n%%\r\ntic;\r\nSUM = euler249(100)\r\ntoc;\r\nassert(isequal(SUM, uint64(5253640)))\r\n\r\n%%\r\ntic;\r\nSUM = euler249(1000)\r\ntoc;\r\nassert(isequal(SUM, uint64(5725053962252706)))\r\n%%\r\ntic;\r\nSUM = euler249(2000)\r\ntoc;\r\nassert(isequal(SUM, uint64(9536598422264105)))\r\n%%\r\ntic;\r\nSUM = euler249(4900)\r\ntoc;\r\nassert(isequal(SUM, uint64(2455225028344813)))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":8269,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-11-22T00:50:24.000Z","updated_at":"2026-04-27T09:32:31.000Z","published_at":"2018-11-22T00:50:24.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\u003eInspired by Problem 249 of Project Euler.\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://projecteuler.net/problem=249\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://projecteuler.net/problem=249\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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\u003eLet S = {2, 3, 5, ...} be the set of prime numbers less than N.\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\u003eFind the number of subsets of S, the sum of whose elements is a prime number. Enter the rightmost 16 digits as your answer. The answer must be a uint64 integer.\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":1092,"title":"Decimation","description":"When dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and lots would be drawn.  The person who was unlucky enough to draw the short straw would be executed by the other nine members of his group.\r\n\r\nThe bloodthirsty Roman Centurion Carnage Maximus decided to apply this to his prisoners, with a few gruesome differences.  Rather than kill every tenth prisoner and allow the rest to live, he is going to leave only one prisoner alive and kill all of the others.  Instead of killing every tenth prisoner, he chooses a number (kill_every).  If kill_every=3, he kills every third prisoner.  If kill_every=5, he kills every fifth prisoner.  He always chooses a number between 2 and the number of prisoners he has, and this process will be repeated until there is only one prisoner left.  For example, if there are 10 prisoners, and kill_every=3\r\n\r\nFirst iteration: 1 2 3 4 5 6 7 8 9 10\r\n\r\n1-2-3 4-5-6 7-8-9 10\r\n\r\nPrisoners 3, 6 and 9 will be killed.\r\n\r\nSecond iteration: 1 2 4 5 7 8 10\r\n\r\nBecause Prisoner 10 was counted during the first iteration, the executions\r\nwill proceed as such: 10-1-2 4-5-7 8-10, so prisoners 2 and 7 will be killed\r\n\r\nThird iteration: 1 4 5 8 10\r\n8-10-1 4-5-8 10, so prisoners 1 and 8 executed.\r\n\r\nFourth Iteration:  10-4-5 10\r\nPrisoner 5 is executed.\r\n\r\nFifth iteration:  10-4 10\r\nPrisoner 10 is executed\r\n\r\nSince the sole survivor is prisoner 4, he is released.\r\n\r\nYou are an unlucky prisoner caught by Carnage Maximum.  Prior to lining up the prisoners, he reveals the number of prisoners he has and his value of kill_every for the day.  Your job is to figure out which prisoner you need to be in order to survive.  Write a MATLAB script that takes the values of num_prisoners and kill_every.  The output will be survivor, which is the position of the person who survives.  If you write your script quickly enough, that person will be you.\r\n\r\nGood luck!","description_html":"\u003cp\u003eWhen dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and lots would be drawn.  The person who was unlucky enough to draw the short straw would be executed by the other nine members of his group.\u003c/p\u003e\u003cp\u003eThe bloodthirsty Roman Centurion Carnage Maximus decided to apply this to his prisoners, with a few gruesome differences.  Rather than kill every tenth prisoner and allow the rest to live, he is going to leave only one prisoner alive and kill all of the others.  Instead of killing every tenth prisoner, he chooses a number (kill_every).  If kill_every=3, he kills every third prisoner.  If kill_every=5, he kills every fifth prisoner.  He always chooses a number between 2 and the number of prisoners he has, and this process will be repeated until there is only one prisoner left.  For example, if there are 10 prisoners, and kill_every=3\u003c/p\u003e\u003cp\u003eFirst iteration: 1 2 3 4 5 6 7 8 9 10\u003c/p\u003e\u003cp\u003e1-2-3 4-5-6 7-8-9 10\u003c/p\u003e\u003cp\u003ePrisoners 3, 6 and 9 will be killed.\u003c/p\u003e\u003cp\u003eSecond iteration: 1 2 4 5 7 8 10\u003c/p\u003e\u003cp\u003eBecause Prisoner 10 was counted during the first iteration, the executions\r\nwill proceed as such: 10-1-2 4-5-7 8-10, so prisoners 2 and 7 will be killed\u003c/p\u003e\u003cp\u003eThird iteration: 1 4 5 8 10\r\n8-10-1 4-5-8 10, so prisoners 1 and 8 executed.\u003c/p\u003e\u003cp\u003eFourth Iteration:  10-4-5 10\r\nPrisoner 5 is executed.\u003c/p\u003e\u003cp\u003eFifth iteration:  10-4 10\r\nPrisoner 10 is executed\u003c/p\u003e\u003cp\u003eSince the sole survivor is prisoner 4, he is released.\u003c/p\u003e\u003cp\u003eYou are an unlucky prisoner caught by Carnage Maximum.  Prior to lining up the prisoners, he reveals the number of prisoners he has and his value of kill_every for the day.  Your job is to figure out which prisoner you need to be in order to survive.  Write a MATLAB script that takes the values of num_prisoners and kill_every.  The output will be survivor, which is the position of the person who survives.  If you write your script quickly enough, that person will be you.\u003c/p\u003e\u003cp\u003eGood luck!\u003c/p\u003e","function_template":"function survivor=decimate(num_prisoners,kill_every)\r\nsurvivor=4;\r\nend","test_suite":"%%\r\nassert(isequal(decimate(10,3),4))\r\n%%\r\nassert(isequal(decimate(1024,3),676))\r\n%%\r\nassert(isequal(decimate(2012,50),543))\r\n%%\r\nassert(isequal(decimate(30,5),3))\r\n%%\r\nassert(isequal(decimate(10,10),8))\r\n%%\r\nassert(isequal(decimate(2048,2),1))","published":true,"deleted":false,"likes_count":20,"comments_count":14,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":325,"test_suite_updated_at":"2012-12-04T21:28:04.000Z","rescore_all_solutions":false,"group_id":13,"created_at":"2012-12-04T19:47:49.000Z","updated_at":"2026-07-15T20:44:18.000Z","published_at":"2012-12-04T19:53:55.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eWhen dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and lots would be drawn. The person who was unlucky enough to draw the short straw would be executed by the other nine members of his group.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe bloodthirsty Roman Centurion Carnage Maximus decided to apply this to his prisoners, with a few gruesome differences. Rather than kill every tenth prisoner and allow the rest to live, he is going to leave only one prisoner alive and kill all of the others. Instead of killing every tenth prisoner, he chooses a number (kill_every). If kill_every=3, he kills every third prisoner. If kill_every=5, he kills every fifth prisoner. He always chooses a number between 2 and the number of prisoners he has, and this process will be repeated until there is only one prisoner left. For example, if there are 10 prisoners, and kill_every=3\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFirst iteration: 1 2 3 4 5 6 7 8 9 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1-2-3 4-5-6 7-8-9 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrisoners 3, 6 and 9 will be killed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSecond iteration: 1 2 4 5 7 8 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBecause Prisoner 10 was counted during the first iteration, the executions will proceed as such: 10-1-2 4-5-7 8-10, so prisoners 2 and 7 will be killed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThird iteration: 1 4 5 8 10 8-10-1 4-5-8 10, so prisoners 1 and 8 executed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFourth Iteration: 10-4-5 10 Prisoner 5 is executed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFifth iteration: 10-4 10 Prisoner 10 is executed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSince the sole survivor is prisoner 4, he is released.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are an unlucky prisoner caught by Carnage Maximum. Prior to lining up the prisoners, he reveals the number of prisoners he has and his value of kill_every for the day. Your job is to figure out which prisoner you need to be in order to survive. Write a MATLAB script that takes the values of num_prisoners and kill_every. The output will be survivor, which is the position of the person who survives. If you write your script quickly enough, that person will be you.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGood 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":2674,"title":"Generalised Hamming Number","description":"Inspired by Project Euler n°204 and Problem 1308 by James\r\n\r\nA generalised Hamming number of type n, has no prime factor larger than n.\r\n\r\nFor example a generalised Hamming number of type 5 has no prime factor larger than 5.\r\n\r\nGiven a number X, determine how many generalised Hamming numbers n are less than or equal to that number. Please note that 1 counts as a Hamming number. \r\n\r\n\r\n","description_html":"\u003cp\u003eInspired by Project Euler n°204 and Problem 1308 by James\u003c/p\u003e\u003cp\u003eA generalised Hamming number of type n, has no prime factor larger than n.\u003c/p\u003e\u003cp\u003eFor example a generalised Hamming number of type 5 has no prime factor larger than 5.\u003c/p\u003e\u003cp\u003eGiven a number X, determine how many generalised Hamming numbers n are less than or equal to that number. Please note that 1 counts as a Hamming number.\u003c/p\u003e","function_template":"function y = hamming2(X,n)\r\n  X=n;\r\nend","test_suite":"%%\r\nX = 5;\r\nn=5;\r\ny_correct = 5;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10;\r\nn=5;\r\ny_correct = 9;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=5;\r\ny_correct = 34;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=7;\r\ny_correct = 46;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=100;\r\ny_correct = 100;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 100;\r\nn=13;\r\ny_correct = 62;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^13;\r\nn=7;\r\ny_correct = 19674;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^5;\r\nn=13;\r\ny_correct = 1848;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^5;\r\nn=5;\r\ny_correct = 313;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 123456;\r\nn=5;\r\ny_correct = 327;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 10^13;\r\nn=3;\r\ny_correct = 624;\r\nassert(isequal(hamming2(X,n),y_correct))\r\n%%\r\nX = 123456;\r\nn=2;\r\ny_correct = 17;\r\nassert(isequal(hamming2(X,n),y_correct))","published":true,"deleted":false,"likes_count":13,"comments_count":5,"created_by":5390,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":362,"test_suite_updated_at":"2014-11-17T10:17:26.000Z","rescore_all_solutions":false,"group_id":8,"created_at":"2014-11-17T09:33:12.000Z","updated_at":"2026-04-16T12:29:28.000Z","published_at":"2014-11-17T10:14:18.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eInspired by Project Euler n°204 and Problem 1308 by James\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA generalised Hamming number of type n, has no prime factor larger than n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example a generalised Hamming number of type 5 has no prime factor larger than 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a number X, determine how many generalised Hamming numbers n are less than or equal to that number. Please note that 1 counts as a Hamming number.\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":44793,"title":"Project Euler 249: Prime Subset Sums","description":"Inspired by Problem 249 of Project Euler.\r\n\u003chttps://projecteuler.net/problem=249\u003e\r\n\r\nLet S = {2, 3, 5, ...} be the set of prime numbers less than N.\r\n\r\nFind the number of subsets of S, the sum of whose elements is a prime number.\r\nEnter the rightmost 16 digits as your answer.\r\nThe answer must be a uint64 integer.","description_html":"\u003cp\u003eInspired by Problem 249 of Project Euler. \u003ca href = \"https://projecteuler.net/problem=249\"\u003ehttps://projecteuler.net/problem=249\u003c/a\u003e\u003c/p\u003e\u003cp\u003eLet S = {2, 3, 5, ...} be the set of prime numbers less than N.\u003c/p\u003e\u003cp\u003eFind the number of subsets of S, the sum of whose elements is a prime number.\r\nEnter the rightmost 16 digits as your answer.\r\nThe answer must be a uint64 integer.\u003c/p\u003e","function_template":"function num = euler249(N)\r\n  num = uint64(7) % answer for N = 10\r\nend","test_suite":"%%\r\ntic;\r\nSUM = euler249(10)\r\ntoc;\r\nassert(isequal(SUM, uint64(7)))\r\n\r\n%%\r\ntic;\r\nSUM = euler249(100)\r\ntoc;\r\nassert(isequal(SUM, uint64(5253640)))\r\n\r\n%%\r\ntic;\r\nSUM = euler249(1000)\r\ntoc;\r\nassert(isequal(SUM, uint64(5725053962252706)))\r\n%%\r\ntic;\r\nSUM = euler249(2000)\r\ntoc;\r\nassert(isequal(SUM, uint64(9536598422264105)))\r\n%%\r\ntic;\r\nSUM = euler249(4900)\r\ntoc;\r\nassert(isequal(SUM, uint64(2455225028344813)))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":8269,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-11-22T00:50:24.000Z","updated_at":"2026-04-27T09:32:31.000Z","published_at":"2018-11-22T00:50:24.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\u003eInspired by Problem 249 of Project Euler.\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://projecteuler.net/problem=249\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://projecteuler.net/problem=249\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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\u003eLet S = {2, 3, 5, ...} be the set of prime numbers less than N.\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\u003eFind the number of subsets of S, the sum of whose elements is a prime number. Enter the rightmost 16 digits as your answer. The answer must be a uint64 integer.\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":"Project Euler IV","count":3,"selected":true},{"value":"Basics - Factorization","count":1,"selected":false},{"value":"Indexing II","count":1,"selected":false},{"value":"Magic Numbers","count":1,"selected":false},{"value":"Tough Stuff","count":1,"selected":false}],[{"value":"hard","count":3,"selected":true}]],"term":"group:\"Project Euler IV\" difficulty_rating_bin:hard","page":1,"per_page":50,"sort":"map(difficulty_value,0,0,999) asc"}}