{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.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":"2025-12-14T00: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":45988,"title":"Evaluate the zeta function for real arguments \u003e 1","description":"The \u003chttps://en.wikipedia.org/wiki/Riemann_zeta_function Riemann zeta function\u003e is important in number theory. In particular, the \u003chttps://en.wikipedia.org/wiki/Riemann_hypothesis Riemann hypothesis\u003e, one of the seven \u003chttps://en.wikipedia.org/wiki/Millennium_Prize_Problems Millenium Prize Problems\u003e, states that the non-trivial zeros of the zeta function all have real part equal to 1/2. The truth of the Riemann hypothesis has consequences for the distribution of prime numbers. \r\n\r\nThis problem deals only with values of the zeta function for real arguments greater than 1. For a positive integer argument x, the zeta function is the sum of the reciprocals of integers raised to the power of x. Euler showed that when x is an even integer, the value of the zeta function is proportional to pi^x, and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function Cody Problem 45939\u003e uses this fact to estimate pi. Less is known about the zeta function for odd integer arguments, but Apery provided that zeta(3), now known as \u003chttps://en.wikipedia.org/wiki/Apéry's_constant Apery's constant\u003e, is irrational. \r\n\r\nEvaluate the zeta function for real arguments greater than 1. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 207px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 103.5px; transform-origin: 407px 103.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 12.0667px 7.8px; transform-origin: 12.0667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Riemann_zeta_function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eRiemann zeta function\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.733px 7.8px; transform-origin: 145.733px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is important in number theory. In particular, the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Riemann_hypothesis\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eRiemann hypothesis\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 55.6167px 7.8px; transform-origin: 55.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, one of the seven\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Millennium_Prize_Problems\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMillenium Prize Problems\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 335.65px 7.8px; transform-origin: 335.65px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, states that the non-trivial zeros of the zeta function all have real part equal to 1/2. The truth of the Riemann hypothesis has consequences for the distribution of prime numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 378.467px 7.8px; transform-origin: 378.467px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals only with values of the zeta function for real arguments greater than 1. For a positive integer argument \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAkCAYAAACaJFpUAAAA60lEQVRIie2U0Q2DIBBA3w5s4AIu4ASdgA3cwA1cgRkcwR26gjOwgv3gLhKi0kT0o+UlJuIFH3B3QKVSqVR+kgawwCDvaWyQ+GVewATMwCrPFMVt9H3dWcwlVOoBA3TAIotyyUKK0LPtRGVdaUlMGwk9hXKWw4tweUIGIU8r8H5CZkR0S0Xu4RLhrTm0hLwZtjy6u2StyFoZax61cPSom2jsCH07yvgUIz+dCL3nCc2txP1oRWYP4qtIT+mSCX0SbzLx9LrzOaFOGji+SbpMXOfPPNRCysgXR1oKLbZs0ZSU3X45KJaHdlb5Ez4sHUr70Yy5uAAAAABJRU5ErkJggg==\" alt=\"x\" style=\"width: 14px; height: 18px;\" width=\"14\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 248.15px 7.8px; transform-origin: 248.15px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e the zeta function is the sum of the reciprocals of integers raised to the power of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 80.5167px 7.8px; transform-origin: 80.5167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Euler showed that when \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 35.7833px 7.8px; transform-origin: 35.7833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is an even integer, the value of the zeta function is proportional to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAmCAYAAACh1knUAAABLklEQVRYhe2WXa3EIBBGjwccYAADq6AK6qAO6mAtVMNKqIdauBqwwH1gJkAvm93tpjQ34SQ80D8+5psZCp1Op9P5CAfcsrmRuWklwAITsAFBFnfAj8znVkKUSRa+A6sIvAQnQgIwXCVCCURLLsWQ8uIrWywx0V6NZ4s8SAk7HhEwknbyznCVbwwi5CbPLMQIvV0xywcC9v5bYnXMxEgYGQHw8u28rzzlLruwMvYLjaRyrGHk/YXSrokUnZcYeUGZ+dt8VlKDaoan9F8j5FuKUAtyW7RLLi2FqAV5LmgVHSrDI6gFeS7krbrZyanl6yvXtuzawImHmOZBoKwg7Y4qxHFS0lrKTuopLcgbmObPKbmSR6J2ZG+7+48zREDcvXbV2n+Dk3srDaum0+l0/hW/ktdyQqlGSvEAAAAASUVORK5CYII=\" alt=\"pi^x\" style=\"width: 17px; height: 19px;\" width=\"17\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5667px 7.8px; transform-origin: 15.5667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45939\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 80.8833px 7.8px; transform-origin: 80.8833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e uses this fact to estimate \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.6167px 7.8px; transform-origin: 27.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Less is known about the zeta function for odd integer arguments, but Apery proved that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAAlCAYAAADx5+EfAAACb0lEQVRoge2Z0XGDMAyGvx3YgAVYIBNkgmyQDdggKzADI7BDVsgMWYE+oP8gKcWS7b7x3XHpJUaWZEuWVTg5OTkpowG6ivJqytrlUvh+A0zUVfRhT3WuwHNH+BXogdYhw2twC9xM7t0xHtNrcIxzcwVm+9x+97LvZ1MuxTMxTk6Zd57Rfj9idOrhQoq0NvGwo1CKh8n5i4bFKS+WVb7Y59YJqXla4E2l0Olt0skUkxJSMEVr44/ywcDimL3VHO39N+kw6k3HKtxs0hf+OBMDx6vcJn5XeM2OeeVgz2IkGfBt4xwlWo5X8MK60qm4hkXPIye6eJC/Ze6s+SAXyfAeS8VzXvF7eI+JJSRyaez9KaCDdkbWFlc2vKYGHqAEmDu/Mnp01SI744ORvDgWiufo5K298+bzaOwDMrKcrS1ScuZJRkTZ1sb3LA7PNfxJRh6aKFtlyDP6m4Zl1WW056yGtahxo21ZEstQx2ihAsWrV9joO2UZW9Q0uiNW54dPDZWbpUjRGkbDarTnKAonshf16lfvhcQry1t0zASvmpGSL0VWFt1Bu8azehobumZur3Kl1zRl3hSXxFxKZJ5VvpFx3G4z5faoGFniMyJMXj/KuKqV5ehvwwZileFIRunb8bso+H4iW+fFcXwpy2+fiTUDP/CXoY3pntVBaVj7VCpH9bcaCN6Y13Y7Gt+aoqrG1D2Jont/jXz0gdpFEcET/9Sx3KAbWZUGwjc5LZmq/as/eFDpeNQFQDElb+bETEcsLCKoRV1FthLam8X40sLlQqwh4KGrLXPb/VRWLRXeUTfueirvnoY1q/77/4xOTk5OcvgB1Ovi8l4suQ0AAAAASUVORK5CYII=\" alt=\"zeta(3)\" style=\"width: 30.5px; height: 18.5px;\" width=\"30.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 48.2333px 7.8px; transform-origin: 48.2333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, now known as\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Ap%C3%A9ry's_constant\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eApery's constant\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 10.8833px 7.8px; transform-origin: 10.8833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, is irrational.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 186.7px 7.8px; transform-origin: 186.7px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEvaluate the zeta function for real arguments greater than 1.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function z = zeta1(x)\r\n  z = f(x);\r\nend","test_suite":"%%\r\nx = 3/2;\r\nz_correct = 2.612375348685488;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%  \r\nx = 2;\r\nz_correct = pi^2/6;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nx = 3;\r\nz_correct = 1.202056903159594;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nx = 4;\r\nz_correct = pi^4/90;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nx = 5;\r\nz_correct = 1.036927755143370;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nB = [1/6 -1/30 1/42 -1/30 5/66 -691/2730 7/6 -3617/510 43867/798 -174611/330];\r\nn = randi(10);\r\nx = 2*n;\r\nz_correct = (-1)^(n+1)*B(n)*(2*pi)^(2*n)/(2*factorial(2*n));\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-24T20:47:20.000Z","updated_at":"2026-01-09T12:24:36.000Z","published_at":"2020-06-24T21:36:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe\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://en.wikipedia.org/wiki/Riemann_zeta_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRiemann zeta function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is important in number theory. In particular, the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Riemann_hypothesis\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRiemann hypothesis\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, one of the seven\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://en.wikipedia.org/wiki/Millennium_Prize_Problems\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMillenium Prize Problems\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, states that the non-trivial zeros of the zeta function all have real part equal to 1/2. The truth of the Riemann hypothesis has consequences for the distribution of prime numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem deals only with values of the zeta function for real arguments greater than 1. For a positive integer argument \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e the zeta function is the sum of the reciprocals of integers raised to the power of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Euler showed that when \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is an even integer, the value of the zeta function is proportional to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi^x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi^x\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45939\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e uses this fact to estimate \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Less is known about the zeta function for odd integer arguments, but Apery proved that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"zeta(3)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\zeta(3)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, now known as\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://en.wikipedia.org/wiki/Apéry's_constant\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eApery's constant\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, is irrational.\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\u003eEvaluate the zeta function for real arguments greater than 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46111,"title":"Evaluate the prime zeta function","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 126.417px 7.79167px; transform-origin: 126.417px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn its original definition, the zeta function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAAlCAYAAAATO/pmAAACVklEQVRoge2YUbGDMBBFjwccYAADVYCCOqgDHNRCNSABD7WABizwPpZb0j6g2ST948y8eR0mhN3k7mazcHJycvJOBTSZ79eFbNnlkvl+BQzkO9oD10xbNmmBJ3DfeN4Rt8IlnAx5UtjZFpiX/+GzcXk+A7dIw2LGxVItNpRaOAbMmXqZ/MHq4IzJ6Bv3ZZ7SaMGrEpN1mEMDtitycCROOvUyPje+9xj4H1LJXIEJc+6GTy4PfrOb4sqquGwexEn0E+3mTzJkwIQpL4s7JtkUbhRc7QN6TG3JtNhqpQb7kGBAgy1QhymhXuw4ChflkaQFrTEn228DD1ASi0UZfcCSlxz4PN4+uUSM2aUnLS6F4jM2I8rYmXcF3Tee7b3rjlO9mHMYez8e7l743Ybv4VPhW9QXA3m7CX5HVYHNmIRDYrK2N0xeksuJTUiTU1hWeo8kt6M38jKtSHE0jNMJXzW1pYRDVOrl0pCWIMJYfRK34EnJaKSMoxBf9H+ii0SshOWoS+6STYkbwZPvi6YzMySUcEwmVQXmOiXC61fuXU9n4BEj25Lz3HUf2Oa46IOPhImhXwzyOK84PcrguvKFClLmn4gr6yaciUjGTfx3NvzzdArGAyPkkBTUsrZtYrNuVnFTYYHdsZaC+r21A0fovrg1XgU7i6EdazEfO//P7rsqvD3JqmgXIECh8ZNrYIf/+NFNqFgja6FYw63mvZ2pzlvK5A0FG1mYQtwJaA8lJbUqcouJCybjXGevFHQS3rt+KppzjWzI6yHVlO0PA+aU2hql4+vk5OTkxR+y5cyLRnUL3QAAAABJRU5ErkJggg==\" alt=\"zeta(s)\" style=\"width: 29px; height: 18.5px;\" width=\"29\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 226.233px 7.79167px; transform-origin: 226.233px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which is important in number theory, is the sum of the reciprocals of the positive integers raised to the power \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003es\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 17.8833px 7.79167px; transform-origin: 17.8833px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 61.0667px 7.79167px; transform-origin: 61.0667px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprime zeta function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADsAAAAlCAYAAAD8+ZFYAAACTUlEQVRoge2YbZGEMAyGHw84wAAGUICCdYADHKyF1YCE9YAFNGDh7gfNkPZo6Rf3i2eGuTm2tEmbpG8LDw8PD3F0QFPwfVv4/b/xAj6FfXTA1/ytQg9MEU+f0GcNR4UWWKnocAcswI96vuxOvoHNvNvM/yEGY1zN8Otq9zlxOLo6vzXYk+FbtZZ9QlKiIJY3MNfq7EPYmQF75c/C6sMeEXfQsE/kUKOzlcORl6eNdtYdtDXv71hV4cPfqEtGDJWn9bTTbcY7DLmgo8KEvvDnqya0shv1KnCI4nFmDid81Vbn7IZdGXvC4e9Db3uD6XMkXHW/FEaQbC1nKyboajw5v0kljw0vXd3f5js94SFnp4g2XmRVfAM1jiFn5V8qeawBYvDivF9O3vm+zcpbvb9u2Kpp5lj1lb9FSfiaNrFIe1cojFxvXZJOWVuQKxZcmTjgr85CqrNvNabO85brFZNIdFPpkgY7hHNLeqqzeqvbSNO92c66FTaXVGfBTp+F6+gRciu/JRFLdKcUsFRkkkJ62yW7QMVIxBQDUo9honevlNvZWLGRABzSK2UgH7EV0hUjYIdzTIWVHSKJUQ1Sqmml0IWKhu+goPf5mMhYyUg5nS9XB/IYZsKCQJxyDRVdfiUm4IjGpJTTqyoDlV57iNG+dNCHDZGIL/aQjL2FmEgM4Vr3TGes+KOk55jQAVu0pPSfvL/eRc8+8yXFzsfI/eflZKreFRnkbqvaDWNNZvyHhhwWynTArTTsiqiGgbX6uZ2JsrvegXsv8B4eHh7+j1+w0exGXMhTLwAAAABJRU5ErkJggg==\" alt=\"P(s)\" style=\"width: 29.5px; height: 18.5px;\" width=\"29.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 110.45px 7.79167px; transform-origin: 110.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the sum of the reciprocals of the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 21.0083px 7.79167px; transform-origin: 21.0083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprimes\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.725px 7.79167px; transform-origin: 30.725px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e raised to the power \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003es\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 183.2px 7.79167px; transform-origin: 183.2px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEvaluate the prime zeta function for the specified values of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003es\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 128.367px 7.79167px; transform-origin: 128.367px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which are positive and greater than one.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function P = PrimeZeta(s)\r\n  P = f(s);\r\nend","test_suite":"%%\r\ns = 1.39943332872633;\r\nP_rounded = 1;\r\nassert(isequal(round(PrimeZeta(s),4),P_rounded))\r\n\r\n%%\r\ns = 2;\r\nP_correct = 0.4522474200410654985065;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 2e-10)\r\n\r\n%%\r\ns = 3;\r\nP_correct = 0.1747626392994435364;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-12)\r\n\r\n%%\r\ns = 4;\r\nP_correct = 0.07699313976424684494;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-13)\r\n\r\n%%\r\ns = 5;\r\nP_correct = 0.0357550174839242571;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-15)\r\n\r\n%%\r\ns = 9;\r\nP_correct = 0.002004467574962450;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-15)\r\n\r\n%%\r\ns = 6;\r\nstr = num2str(PrimeZeta(s));\r\nP_correct = 0.007878441974176;\r\nassert(abs(PrimeZeta(str2num(str(end-2:end))/100)-P_correct) \u003c 1e-12)","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2020-12-31T19:12:56.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-08-06T19:51:40.000Z","updated_at":"2026-01-09T11:53:30.000Z","published_at":"2020-08-06T21:33:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn its original definition, the zeta function \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"zeta(s)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\zeta(s)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, which is important in number theory, is the sum of the reciprocals of the positive integers raised to the power \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"s\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprime zeta function \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"P(s)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eP(s)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the sum of the reciprocals of the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprimes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e raised to the power \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"s\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEvaluate the prime zeta function for the specified values of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"s\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, which are positive and greater than one.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45939,"title":"Estimate π from certain values of the zeta function","description":"Cody Problems \u003chttps://www.mathworks.com/matlabcentral/cody/problems/2908-approximation-of-pi 2908\u003e and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/2909-approximation-of-pi-vector-inputs 2909\u003e ask us to estimate π by summing a given number of terms in an infinite sum, the Leibniz formula.\r\n\r\nHere you are asked to estimate π by summing a given number of terms in other infinite sums corresponding to the \u003chttps://en.wikipedia.org/wiki/Riemann_zeta_function Riemann zeta function\u003e evaluated at positive even integers. For example, in solving the \u003chttps://en.wikipedia.org/wiki/Basel_problem Basel problem\u003e, Euler summed the reciprocals of the squares of positive integers and showed that ζ(2) = π^2/6.\r\n\r\nWrite a function that takes a vector n with the numbers of terms to sum and a vector m with the values at which to estimate the zeta function. The function should return an array of character strings with the absolute value of the relative error of the estimate E--that is, |abs(E-pi)/pi|. Report the relative error in scientific notation using num2str(...,'%10.2e').\r\n\r\nFor example, PiByZeta(30,2) should return\r\n\r\n '1.00e-02'\r\n \r\nwhile PiByZeta([25 30],[2 8]) should return \r\n\r\n '1.20e-02  1.00e-02'\r\n '2.53e-12  7.22e-13'\r\n  \r\n ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 329.2px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 164.6px; transform-origin: 407px 164.6px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 47.85px 7.8px; transform-origin: 47.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCody Problems\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/2908-approximation-of-pi\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e2908\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 13.6167px 7.8px; transform-origin: 13.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/2909-approximation-of-pi-vector-inputs\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e2909\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 60.2833px 7.8px; transform-origin: 60.2833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e ask us to estimate \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 211.217px 7.8px; transform-origin: 211.217px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by summing a given number of terms in an infinite sum, the Leibniz formula.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 99.1833px 7.8px; transform-origin: 99.1833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHere you are asked to estimate \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 248.95px 7.8px; transform-origin: 248.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by summing a given number of terms in other infinite sums corresponding to the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Riemann_zeta_function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 69.6333px 7.8px; transform-origin: 69.6333px 7.8px; \"\u003eRiemann zeta function\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 197.217px 7.8px; transform-origin: 197.217px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e evaluated at positive even integers. For example, in solving the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Basel_problem\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eBasel problem\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 62.6167px 7.8px; transform-origin: 62.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, Euler summed the reciprocals of the squares of positive integers and showed that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJwAAAAnCAYAAAD6tSH7AAAEz0lEQVR4nO2bbbHqMBCGXw91UAM1gIKroA5wgAMsVAMS8IAFNNQC90d4J0tos5sPoHDyzGTmXg60abJf2d0CjUaj0Wg0Go1GYwsMAHYA+k9PpPHbjABmADcxjmiC13gB/wBc4awb/0/hmzKvOQHYl0/ts0xwmliLM9zi/nUu8MJG/sEJ3AygS7xed//trnxq6fRwgnIJPu/gJmR9GKuwMQaxPuzZeN1f5rDyOV1rqsCNcBYzhR7OIh4BnJBpHQc4DZEPRAHkw1guPN0nEuOA5xiEcUhswTo4ZfiINm6cG9IFB3BKrO0XGeHWn+67aB9OeNSQMDC9Qtee0fA9TnhtnJXf75DnOn6ZAV5hU+jvvwtddEgHty+UgyoKT0t2xKNVozRrG9zBCULM5R3gLSWv1+PZ4mkLN8EpSMPB9UtVwj2ew6cQej4ag2on4Q5uI3lx+mbrDQ6Im3QGp2sCuYMXuFm5FzW6uVav6DkHqgviYRKvTcumWcJk6BJTpZgTi01+D90qSXerPdwF+WmAXyI3aKfSxvaabvSGF2QIGLPlxEYjdCE5QLdIdLkWgeN3/3Isd0C+0vGEuQb39Abd7SZDP51rMk/Q3aAFCpFF8OmCvzk3x3STNpb2ZcSywPSwKeEV8Xhbeht+r4/MxwxTDWv5HQsznPkthYcVy4GAMWHOvK0brY3cAHqHR3eljdBlruXOeJrUYHViTTDpbuX9r8FnM/Q01iIHlJlMbnyNeIoPZT0M8OSUijyglIyc2Em6KuuQgs25X+CeXQ4tjiYT4vu1D+7PhPsOTljPwd/MQsc8TIlb4gKUWEh5nZR0xxV5AjfgebNyRuq6hXVQKhgFivuxZgA6uPWJzcmavorN/QgvUGv7IVNn5vzfUhkrlVoCd0b6CZma9i3I/CPXTSoMY9jStYxhKWVZTqed+I7psKnlxazUELg98g4t3yZwElZ2pAukxaue7wruq1kkKXCxucjvqWEQY4nSzHGpwDFAzXHrjFu+DbpOuf5ch5x6aOp9NYGmMlhSXeZ49oQ6+ZUSgWM6JjeGzD0df/qUyo2S68+Y6JXJbEspC3gUpJjlShK4i/HmFnIWqlTYeN+cmuonT6mAd51SSVlCemVeUStlEfbXac9oFUwA3nzXyNSnnhZ76MJGKxS7Roll/cQpFXhMiwwLn3E/2CtYC0spS2LpIqZVni3XlRJcKnS8sQVrollr4qQWflMBn61VoWWWaYjuPmoXy49IMwrhnJaQvXEqsnRBC8VCcEp3L+A339JXdYFv9FwbPAzE5sDOlm8hrCzsVv7G9akdy2mlrBDZKbI0F4Yl5lSW9NNLI7XRjqWONShs1vhIO7pfDd/ZCmGpKJz3Ec9rX7MpgcKRes0BPt6Ub4XRUi+9X6FOZIK3KLP4N7XNOkk2Acb+nhIfxR6EyvJNr8Xt4Z5rKQhnL+IZbp1qd8BopSyNEX5+bEmv/m4Jzbz14Rl3vON1M25Mw0ZpNuAtaB28S7zjfQPmkv5yH1wK7HPcHOFBIeVtHsmIOq1KSzCmeGXp59ewlLLeDoP5M5zgsaEy14qUdKKuwV6vJmx2WC/f3JqF74iWdP+SEXXjuQkbXLiNw8bJzTHA91nVSAQ3toG1lNVoVMFUcmo0Go1Go7FZ/gO65zOW4y09BQAAAABJRU5ErkJggg==\" alt=\"zeta(2) = pi^2/6\" style=\"width: 78px; height: 19.5px;\" width=\"78\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.9px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.95px; text-align: left; transform-origin: 384px 31.95px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 109.55px 7.8px; transform-origin: 109.55px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.8px; transform-origin: 3.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 147.783px 7.8px; transform-origin: 147.783px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with the numbers of terms to sum and a vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.8px; transform-origin: 3.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003em\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 113.967px 7.8px; transform-origin: 113.967px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with the values at which to estimate the zeta function. The function should return an array of character strings with the absolute value of the relative error of the estimate E--that is,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46.2px 7.8px; transform-origin: 46.2px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 46.2px 8.25px; transform-origin: 46.2px 8.25px; \"\u003eabs(E-pi)/pi\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 227.483px 7.8px; transform-origin: 227.483px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Report the relative error in scientific notation using num2str(...,'%10.2e').\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 132.25px 7.8px; transform-origin: 132.25px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, PiByZeta(30,2) should return\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 42.35px 8.25px; transform-origin: 42.35px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 38.5px 8.25px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 38.5px 8.25px; \"\u003e'1.00e-02'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 130.7px 7.8px; transform-origin: 130.7px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewhile PiByZeta([25 30],[2 8]) should return\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 20.4333px; transform-origin: 404px 20.4333px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 80.85px 8.25px; transform-origin: 80.85px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 77px 8.25px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 77px 8.25px; \"\u003e'1.20e-02  1.00e-02'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 80.85px 8.25px; transform-origin: 80.85px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 77px 8.25px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 77px 8.25px; \"\u003e'2.53e-12  7.22e-13'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = PiByZeta(n,m)\r\n  s = num2str(ans,'%10.2e');\r\nend","test_suite":"%%\r\nn = 30;\r\nm = 2;\r\ny_correct = '1.00e-02';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 30;\r\nm = 8;\r\ny_correct = '7.22e-13';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 1;\r\nm = 20;\r\ny_correct = '4.77e-08';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 5:5:30;\r\nm = 2;\r\ny_correct = '5.67e-02  2.94e-02  1.98e-02  1.49e-02  1.20e-02  1.00e-02';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 10;\r\nm = 2:2:10;\r\ny_correct = ['2.94e-02'; '6.62e-05'; '2.54e-07'; '1.24e-09'; '6.92e-12'];\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = [25 30];\r\nm = [2 8];\r\ny_correct = ['1.20e-02  1.00e-02'; '2.53e-12  7.22e-13'];\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 1:5;\r\nm = 2:2:10;\r\ny_correct = ['2.20e-01  1.28e-01  9.04e-02  6.97e-02  5.67e-02'; ...\r\n    '1.96e-02  4.61e-03  1.73e-03  8.26e-04  4.56e-04'; ...\r\n    '2.86e-03  2.82e-04  5.67e-05  1.67e-05  6.25e-06'; ...\r\n    '5.09e-04  2.13e-05  2.33e-06  4.27e-07  1.09e-07'; ...\r\n    '9.94e-05  1.80e-06  1.08e-07  1.24e-08  2.14e-09'];\r\nassert(isequal(PiByZeta(n,m),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-14T14:03:44.000Z","updated_at":"2026-01-09T15:30:33.000Z","published_at":"2020-06-14T16:19:39.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problems\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/2908-approximation-of-pi\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2908\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/2909-approximation-of-pi-vector-inputs\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2909\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e ask us to estimate \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e by summing a given number of terms in an infinite sum, the Leibniz formula.\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\u003eHere you are asked to estimate \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e by summing a given number of terms in other infinite sums corresponding to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Riemann_zeta_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRiemann zeta function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e evaluated at positive even integers. For example, in solving the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Basel_problem\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBasel problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, Euler summed the reciprocals of the squares of positive integers and showed that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"zeta(2) = pi^2/6\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\zeta(2) = \\\\pi^2/6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with the numbers of terms to sum and a vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with the values at which to estimate the zeta function. The function should return an array of character strings with the absolute value of the relative error of the estimate E--that is,\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eabs(E-pi)/pi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Report the relative error in scientific notation using num2str(...,'%10.2e').\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, PiByZeta(30,2) should return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ '1.00e-02']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhile PiByZeta([25 30],[2 8]) should return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ '1.20e-02  1.00e-02'\\n '2.53e-12  7.22e-13']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45997,"title":"Evaluate the zeta function for complex arguments","description":"\u003chttps://www.mathworks.com/matlabcentral/cody/problems/45988 Cody Problem 45988\u003e involved computing the Riemann zeta function for real arguments greater than 1. Code that works for that problem can reveal the connection between pi and the values of the zeta function evaluated at positive even integers; this connection is explored in \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function Cody Problem 45939\u003e. However, to test the Riemann hypothesis--that all non-trivial zeros of the zeta function have a real part of 1/2, one needs to compute the zeta function for complex arguments.\r\n\r\nWrite a function to evaluate the zeta function for complex arguments.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 114px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 57px; transform-origin: 407px 57px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45988\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45988\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 315.85px 7.8px; transform-origin: 315.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e involved computing the Riemann zeta function for real arguments greater than 1. Code that works for that problem can reveal the connection between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 222.1px 7.8px; transform-origin: 222.1px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and the values of the zeta function evaluated at positive even integers; this connection is explored in\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45939\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 217.433px 7.8px; transform-origin: 217.433px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. However, to test the Riemann hypothesis--that all non-trivial zeros of the zeta function have a real part of 1/2, one needs to compute the zeta function for complex arguments.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 213.017px 7.8px; transform-origin: 213.017px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to evaluate the zeta function for complex arguments.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function z = zeta2(s)\r\n  z = f(s);\r\nend","test_suite":"%%\r\ns = 2;\r\nz_correct = pi^2/6;\r\nassert(abs(zeta2(s)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\ns = 1;\r\nassert(isinf(zeta2(s)))\r\n\r\n%%\r\ns = 1/2;\r\nz_correct = -1.460354508809587;\r\nassert(abs((zeta2(s)-z_correct)/z_correct) \u003c 1e-8)\r\n\r\n%%\r\ns = 0;\r\nz_correct = -0.5;\r\nassert(abs((zeta2(s)-z_correct)/z_correct) \u003c 1e-8)\r\n\r\n%%\r\ns = -1;\r\nz_correct = -1/12;\r\nassert(abs((zeta2(s)-z_correct)/z_correct) \u003c 1e-8)\r\n\r\n%%\r\ns = -2;\r\nz_correct = 0;\r\nassert(abs(zeta2(s)) \u003c 1e-12)\r\n\r\n%%\r\ns = 3+2*i;\r\nz_correct = 0.973041960418942 - 0.147695593000454i;\r\nassert(abs(real(zeta2(s))-real(z_correct))/real(z_correct) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = -1+2*i;\r\nz_correct = 0.168915669770846 - 0.070515988908259i;\r\nassert(abs((real(zeta2(s))-real(z_correct))/real(z_correct)) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = 0.75-3*i;\r\nz_correct = 0.580900396083837 + 0.095281202690117i;\r\nassert(abs(real(zeta2(s))-real(z_correct))/real(z_correct) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = 5+2*i;\r\nz_correct = 1.001916538615071 - 0.034217062736354i;\r\nassert(abs((real(zeta2(s))-real(z_correct))/real(z_correct)) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = 0.5+14.13472514173469379*i;\r\nassert(abs(real(zeta2(s))) \u003c 1e-12) \r\nassert(abs(imag(zeta2(s))) \u003c 1e-12)\r\n\r\n%%\r\ns = 0.5+21*i;\r\nz_correct = -0.005162064638102 - 0.024546964575122i;\r\nassert(abs((real(zeta2(s))-real(z_correct))/real(z_correct)) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2020-06-29T02:07:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-28T04:41:50.000Z","updated_at":"2026-01-09T13:36:37.000Z","published_at":"2020-06-28T05:14:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45988\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45988\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e involved computing the Riemann zeta function for real arguments greater than 1. Code that works for that problem can reveal the connection between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and the values of the zeta function evaluated at positive even integers; this connection is explored in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45939\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. However, to test the Riemann hypothesis--that all non-trivial zeros of the zeta function have a real part of 1/2, one needs to compute the zeta function for complex arguments.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to evaluate the zeta function for complex arguments.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":45988,"title":"Evaluate the zeta function for real arguments \u003e 1","description":"The \u003chttps://en.wikipedia.org/wiki/Riemann_zeta_function Riemann zeta function\u003e is important in number theory. In particular, the \u003chttps://en.wikipedia.org/wiki/Riemann_hypothesis Riemann hypothesis\u003e, one of the seven \u003chttps://en.wikipedia.org/wiki/Millennium_Prize_Problems Millenium Prize Problems\u003e, states that the non-trivial zeros of the zeta function all have real part equal to 1/2. The truth of the Riemann hypothesis has consequences for the distribution of prime numbers. \r\n\r\nThis problem deals only with values of the zeta function for real arguments greater than 1. For a positive integer argument x, the zeta function is the sum of the reciprocals of integers raised to the power of x. Euler showed that when x is an even integer, the value of the zeta function is proportional to pi^x, and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function Cody Problem 45939\u003e uses this fact to estimate pi. Less is known about the zeta function for odd integer arguments, but Apery provided that zeta(3), now known as \u003chttps://en.wikipedia.org/wiki/Apéry's_constant Apery's constant\u003e, is irrational. \r\n\r\nEvaluate the zeta function for real arguments greater than 1. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 207px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 103.5px; transform-origin: 407px 103.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 12.0667px 7.8px; transform-origin: 12.0667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Riemann_zeta_function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eRiemann zeta function\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.733px 7.8px; transform-origin: 145.733px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is important in number theory. In particular, the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Riemann_hypothesis\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eRiemann hypothesis\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 55.6167px 7.8px; transform-origin: 55.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, one of the seven\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Millennium_Prize_Problems\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMillenium Prize Problems\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 335.65px 7.8px; transform-origin: 335.65px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, states that the non-trivial zeros of the zeta function all have real part equal to 1/2. The truth of the Riemann hypothesis has consequences for the distribution of prime numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 378.467px 7.8px; transform-origin: 378.467px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals only with values of the zeta function for real arguments greater than 1. For a positive integer argument \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAkCAYAAACaJFpUAAAA60lEQVRIie2U0Q2DIBBA3w5s4AIu4ASdgA3cwA1cgRkcwR26gjOwgv3gLhKi0kT0o+UlJuIFH3B3QKVSqVR+kgawwCDvaWyQ+GVewATMwCrPFMVt9H3dWcwlVOoBA3TAIotyyUKK0LPtRGVdaUlMGwk9hXKWw4tweUIGIU8r8H5CZkR0S0Xu4RLhrTm0hLwZtjy6u2StyFoZax61cPSom2jsCH07yvgUIz+dCL3nCc2txP1oRWYP4qtIT+mSCX0SbzLx9LrzOaFOGji+SbpMXOfPPNRCysgXR1oKLbZs0ZSU3X45KJaHdlb5Ez4sHUr70Yy5uAAAAABJRU5ErkJggg==\" alt=\"x\" style=\"width: 14px; height: 18px;\" width=\"14\" height=\"18\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 248.15px 7.8px; transform-origin: 248.15px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e the zeta function is the sum of the reciprocals of integers raised to the power of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 80.5167px 7.8px; transform-origin: 80.5167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Euler showed that when \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 35.7833px 7.8px; transform-origin: 35.7833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is an even integer, the value of the zeta function is proportional to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAmCAYAAACh1knUAAABLklEQVRYhe2WXa3EIBBGjwccYAADq6AK6qAO6mAtVMNKqIdauBqwwH1gJkAvm93tpjQ34SQ80D8+5psZCp1Op9P5CAfcsrmRuWklwAITsAFBFnfAj8znVkKUSRa+A6sIvAQnQgIwXCVCCURLLsWQ8uIrWywx0V6NZ4s8SAk7HhEwknbyznCVbwwi5CbPLMQIvV0xywcC9v5bYnXMxEgYGQHw8u28rzzlLruwMvYLjaRyrGHk/YXSrokUnZcYeUGZ+dt8VlKDaoan9F8j5FuKUAtyW7RLLi2FqAV5LmgVHSrDI6gFeS7krbrZyanl6yvXtuzawImHmOZBoKwg7Y4qxHFS0lrKTuopLcgbmObPKbmSR6J2ZG+7+48zREDcvXbV2n+Dk3srDaum0+l0/hW/ktdyQqlGSvEAAAAASUVORK5CYII=\" alt=\"pi^x\" style=\"width: 17px; height: 19px;\" width=\"17\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.5667px 7.8px; transform-origin: 15.5667px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45939\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 80.8833px 7.8px; transform-origin: 80.8833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e uses this fact to estimate \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 27.6167px 7.8px; transform-origin: 27.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Less is known about the zeta function for odd integer arguments, but Apery proved that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAAlCAYAAADx5+EfAAACb0lEQVRoge2Z0XGDMAyGvx3YgAVYIBNkgmyQDdggKzADI7BDVsgMWYE+oP8gKcWS7b7x3XHpJUaWZEuWVTg5OTkpowG6ivJqytrlUvh+A0zUVfRhT3WuwHNH+BXogdYhw2twC9xM7t0xHtNrcIxzcwVm+9x+97LvZ1MuxTMxTk6Zd57Rfj9idOrhQoq0NvGwo1CKh8n5i4bFKS+WVb7Y59YJqXla4E2l0Olt0skUkxJSMEVr44/ywcDimL3VHO39N+kw6k3HKtxs0hf+OBMDx6vcJn5XeM2OeeVgz2IkGfBt4xwlWo5X8MK60qm4hkXPIye6eJC/Ze6s+SAXyfAeS8VzXvF7eI+JJSRyaez9KaCDdkbWFlc2vKYGHqAEmDu/Mnp01SI744ORvDgWiufo5K298+bzaOwDMrKcrS1ScuZJRkTZ1sb3LA7PNfxJRh6aKFtlyDP6m4Zl1WW056yGtahxo21ZEstQx2ihAsWrV9joO2UZW9Q0uiNW54dPDZWbpUjRGkbDarTnKAonshf16lfvhcQry1t0zASvmpGSL0VWFt1Bu8azehobumZur3Kl1zRl3hSXxFxKZJ5VvpFx3G4z5faoGFniMyJMXj/KuKqV5ehvwwZileFIRunb8bso+H4iW+fFcXwpy2+fiTUDP/CXoY3pntVBaVj7VCpH9bcaCN6Y13Y7Gt+aoqrG1D2Jont/jXz0gdpFEcET/9Sx3KAbWZUGwjc5LZmq/as/eFDpeNQFQDElb+bETEcsLCKoRV1FthLam8X40sLlQqwh4KGrLXPb/VRWLRXeUTfueirvnoY1q/77/4xOTk5OcvgB1Ovi8l4suQ0AAAAASUVORK5CYII=\" alt=\"zeta(3)\" style=\"width: 30.5px; height: 18.5px;\" width=\"30.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 48.2333px 7.8px; transform-origin: 48.2333px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, now known as\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Ap%C3%A9ry's_constant\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eApery's constant\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 10.8833px 7.8px; transform-origin: 10.8833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, is irrational.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 186.7px 7.8px; transform-origin: 186.7px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEvaluate the zeta function for real arguments greater than 1.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function z = zeta1(x)\r\n  z = f(x);\r\nend","test_suite":"%%\r\nx = 3/2;\r\nz_correct = 2.612375348685488;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%  \r\nx = 2;\r\nz_correct = pi^2/6;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nx = 3;\r\nz_correct = 1.202056903159594;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nx = 4;\r\nz_correct = pi^4/90;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nx = 5;\r\nz_correct = 1.036927755143370;\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\nB = [1/6 -1/30 1/42 -1/30 5/66 -691/2730 7/6 -3617/510 43867/798 -174611/330];\r\nn = randi(10);\r\nx = 2*n;\r\nz_correct = (-1)^(n+1)*B(n)*(2*pi)^(2*n)/(2*factorial(2*n));\r\nassert(abs(zeta1(x)-z_correct)/z_correct \u003c 1e-8)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-24T20:47:20.000Z","updated_at":"2026-01-09T12:24:36.000Z","published_at":"2020-06-24T21:36:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe\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://en.wikipedia.org/wiki/Riemann_zeta_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRiemann zeta function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is important in number theory. In particular, the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Riemann_hypothesis\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRiemann hypothesis\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, one of the seven\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://en.wikipedia.org/wiki/Millennium_Prize_Problems\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMillenium Prize Problems\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, states that the non-trivial zeros of the zeta function all have real part equal to 1/2. The truth of the Riemann hypothesis has consequences for the distribution of prime numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem deals only with values of the zeta function for real arguments greater than 1. For a positive integer argument \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e the zeta function is the sum of the reciprocals of integers raised to the power of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Euler showed that when \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is an even integer, the value of the zeta function is proportional to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi^x\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi^x\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45939\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e uses this fact to estimate \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Less is known about the zeta function for odd integer arguments, but Apery proved that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"zeta(3)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\zeta(3)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, now known as\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://en.wikipedia.org/wiki/Apéry's_constant\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eApery's constant\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, is irrational.\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\u003eEvaluate the zeta function for real arguments greater than 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46111,"title":"Evaluate the prime zeta function","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 126.417px 7.79167px; transform-origin: 126.417px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn its original definition, the zeta function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAAlCAYAAAATO/pmAAACVklEQVRoge2YUbGDMBBFjwccYAADVYCCOqgDHNRCNSABD7WABizwPpZb0j6g2ST948y8eR0mhN3k7mazcHJycvJOBTSZ79eFbNnlkvl+BQzkO9oD10xbNmmBJ3DfeN4Rt8IlnAx5UtjZFpiX/+GzcXk+A7dIw2LGxVItNpRaOAbMmXqZ/MHq4IzJ6Bv3ZZ7SaMGrEpN1mEMDtitycCROOvUyPje+9xj4H1LJXIEJc+6GTy4PfrOb4sqquGwexEn0E+3mTzJkwIQpL4s7JtkUbhRc7QN6TG3JtNhqpQb7kGBAgy1QhymhXuw4ChflkaQFrTEn228DD1ASi0UZfcCSlxz4PN4+uUSM2aUnLS6F4jM2I8rYmXcF3Tee7b3rjlO9mHMYez8e7l743Ybv4VPhW9QXA3m7CX5HVYHNmIRDYrK2N0xeksuJTUiTU1hWeo8kt6M38jKtSHE0jNMJXzW1pYRDVOrl0pCWIMJYfRK34EnJaKSMoxBf9H+ii0SshOWoS+6STYkbwZPvi6YzMySUcEwmVQXmOiXC61fuXU9n4BEj25Lz3HUf2Oa46IOPhImhXwzyOK84PcrguvKFClLmn4gr6yaciUjGTfx3NvzzdArGAyPkkBTUsrZtYrNuVnFTYYHdsZaC+r21A0fovrg1XgU7i6EdazEfO//P7rsqvD3JqmgXIECh8ZNrYIf/+NFNqFgja6FYw63mvZ2pzlvK5A0FG1mYQtwJaA8lJbUqcouJCybjXGevFHQS3rt+KppzjWzI6yHVlO0PA+aU2hql4+vk5OTkxR+y5cyLRnUL3QAAAABJRU5ErkJggg==\" alt=\"zeta(s)\" style=\"width: 29px; height: 18.5px;\" width=\"29\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 226.233px 7.79167px; transform-origin: 226.233px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which is important in number theory, is the sum of the reciprocals of the positive integers raised to the power \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003es\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 17.8833px 7.79167px; transform-origin: 17.8833px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 61.0667px 7.79167px; transform-origin: 61.0667px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprime zeta function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADsAAAAlCAYAAAD8+ZFYAAACTUlEQVRoge2YbZGEMAyGHw84wAAGUICCdYADHKyF1YCE9YAFNGDh7gfNkPZo6Rf3i2eGuTm2tEmbpG8LDw8PD3F0QFPwfVv4/b/xAj6FfXTA1/ytQg9MEU+f0GcNR4UWWKnocAcswI96vuxOvoHNvNvM/yEGY1zN8Otq9zlxOLo6vzXYk+FbtZZ9QlKiIJY3MNfq7EPYmQF75c/C6sMeEXfQsE/kUKOzlcORl6eNdtYdtDXv71hV4cPfqEtGDJWn9bTTbcY7DLmgo8KEvvDnqya0shv1KnCI4nFmDid81Vbn7IZdGXvC4e9Db3uD6XMkXHW/FEaQbC1nKyboajw5v0kljw0vXd3f5js94SFnp4g2XmRVfAM1jiFn5V8qeawBYvDivF9O3vm+zcpbvb9u2Kpp5lj1lb9FSfiaNrFIe1cojFxvXZJOWVuQKxZcmTjgr85CqrNvNabO85brFZNIdFPpkgY7hHNLeqqzeqvbSNO92c66FTaXVGfBTp+F6+gRciu/JRFLdKcUsFRkkkJ62yW7QMVIxBQDUo9honevlNvZWLGRABzSK2UgH7EV0hUjYIdzTIWVHSKJUQ1Sqmml0IWKhu+goPf5mMhYyUg5nS9XB/IYZsKCQJxyDRVdfiUm4IjGpJTTqyoDlV57iNG+dNCHDZGIL/aQjL2FmEgM4Vr3TGes+KOk55jQAVu0pPSfvL/eRc8+8yXFzsfI/eflZKreFRnkbqvaDWNNZvyHhhwWynTArTTsiqiGgbX6uZ2JsrvegXsv8B4eHh7+j1+w0exGXMhTLwAAAABJRU5ErkJggg==\" alt=\"P(s)\" style=\"width: 29.5px; height: 18.5px;\" width=\"29.5\" height=\"18.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 110.45px 7.79167px; transform-origin: 110.45px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the sum of the reciprocals of the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 21.0083px 7.79167px; transform-origin: 21.0083px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprimes\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.725px 7.79167px; transform-origin: 30.725px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e raised to the power \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003es\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 183.2px 7.79167px; transform-origin: 183.2px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEvaluate the prime zeta function for the specified values of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003es\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 128.367px 7.79167px; transform-origin: 128.367px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which are positive and greater than one.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function P = PrimeZeta(s)\r\n  P = f(s);\r\nend","test_suite":"%%\r\ns = 1.39943332872633;\r\nP_rounded = 1;\r\nassert(isequal(round(PrimeZeta(s),4),P_rounded))\r\n\r\n%%\r\ns = 2;\r\nP_correct = 0.4522474200410654985065;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 2e-10)\r\n\r\n%%\r\ns = 3;\r\nP_correct = 0.1747626392994435364;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-12)\r\n\r\n%%\r\ns = 4;\r\nP_correct = 0.07699313976424684494;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-13)\r\n\r\n%%\r\ns = 5;\r\nP_correct = 0.0357550174839242571;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-15)\r\n\r\n%%\r\ns = 9;\r\nP_correct = 0.002004467574962450;\r\nassert(abs(PrimeZeta(s)-P_correct) \u003c 1e-15)\r\n\r\n%%\r\ns = 6;\r\nstr = num2str(PrimeZeta(s));\r\nP_correct = 0.007878441974176;\r\nassert(abs(PrimeZeta(str2num(str(end-2:end))/100)-P_correct) \u003c 1e-12)","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2020-12-31T19:12:56.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-08-06T19:51:40.000Z","updated_at":"2026-01-09T11:53:30.000Z","published_at":"2020-08-06T21:33:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn its original definition, the zeta function \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"zeta(s)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\zeta(s)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, which is important in number theory, is the sum of the reciprocals of the positive integers raised to the power \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"s\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprime zeta function \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"P(s)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eP(s)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the sum of the reciprocals of the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprimes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e raised to the power \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"s\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEvaluate the prime zeta function for the specified values of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"s\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, which are positive and greater than one.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45939,"title":"Estimate π from certain values of the zeta function","description":"Cody Problems \u003chttps://www.mathworks.com/matlabcentral/cody/problems/2908-approximation-of-pi 2908\u003e and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/2909-approximation-of-pi-vector-inputs 2909\u003e ask us to estimate π by summing a given number of terms in an infinite sum, the Leibniz formula.\r\n\r\nHere you are asked to estimate π by summing a given number of terms in other infinite sums corresponding to the \u003chttps://en.wikipedia.org/wiki/Riemann_zeta_function Riemann zeta function\u003e evaluated at positive even integers. For example, in solving the \u003chttps://en.wikipedia.org/wiki/Basel_problem Basel problem\u003e, Euler summed the reciprocals of the squares of positive integers and showed that ζ(2) = π^2/6.\r\n\r\nWrite a function that takes a vector n with the numbers of terms to sum and a vector m with the values at which to estimate the zeta function. The function should return an array of character strings with the absolute value of the relative error of the estimate E--that is, |abs(E-pi)/pi|. Report the relative error in scientific notation using num2str(...,'%10.2e').\r\n\r\nFor example, PiByZeta(30,2) should return\r\n\r\n '1.00e-02'\r\n \r\nwhile PiByZeta([25 30],[2 8]) should return \r\n\r\n '1.20e-02  1.00e-02'\r\n '2.53e-12  7.22e-13'\r\n  \r\n ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 329.2px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 164.6px; transform-origin: 407px 164.6px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 47.85px 7.8px; transform-origin: 47.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCody Problems\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/2908-approximation-of-pi\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e2908\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 13.6167px 7.8px; transform-origin: 13.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/2909-approximation-of-pi-vector-inputs\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e2909\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 60.2833px 7.8px; transform-origin: 60.2833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e ask us to estimate \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 211.217px 7.8px; transform-origin: 211.217px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by summing a given number of terms in an infinite sum, the Leibniz formula.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 99.1833px 7.8px; transform-origin: 99.1833px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHere you are asked to estimate \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 248.95px 7.8px; transform-origin: 248.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by summing a given number of terms in other infinite sums corresponding to the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Riemann_zeta_function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 69.6333px 7.8px; transform-origin: 69.6333px 7.8px; \"\u003eRiemann zeta function\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 197.217px 7.8px; transform-origin: 197.217px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e evaluated at positive even integers. For example, in solving the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Basel_problem\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eBasel problem\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 62.6167px 7.8px; transform-origin: 62.6167px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, Euler summed the reciprocals of the squares of positive integers and showed that \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJwAAAAnCAYAAAD6tSH7AAAEz0lEQVR4nO2bbbHqMBCGXw91UAM1gIKroA5wgAMsVAMS8IAFNNQC90d4J0tos5sPoHDyzGTmXg60abJf2d0CjUaj0Wg0Go1GYwsMAHYA+k9PpPHbjABmADcxjmiC13gB/wBc4awb/0/hmzKvOQHYl0/ts0xwmliLM9zi/nUu8MJG/sEJ3AygS7xed//trnxq6fRwgnIJPu/gJmR9GKuwMQaxPuzZeN1f5rDyOV1rqsCNcBYzhR7OIh4BnJBpHQc4DZEPRAHkw1guPN0nEuOA5xiEcUhswTo4ZfiINm6cG9IFB3BKrO0XGeHWn+67aB9OeNSQMDC9Qtee0fA9TnhtnJXf75DnOn6ZAV5hU+jvvwtddEgHty+UgyoKT0t2xKNVozRrG9zBCULM5R3gLSWv1+PZ4mkLN8EpSMPB9UtVwj2ew6cQej4ag2on4Q5uI3lx+mbrDQ6Im3QGp2sCuYMXuFm5FzW6uVav6DkHqgviYRKvTcumWcJk6BJTpZgTi01+D90qSXerPdwF+WmAXyI3aKfSxvaabvSGF2QIGLPlxEYjdCE5QLdIdLkWgeN3/3Isd0C+0vGEuQb39Abd7SZDP51rMk/Q3aAFCpFF8OmCvzk3x3STNpb2ZcSywPSwKeEV8Xhbeht+r4/MxwxTDWv5HQsznPkthYcVy4GAMWHOvK0brY3cAHqHR3eljdBlruXOeJrUYHViTTDpbuX9r8FnM/Q01iIHlJlMbnyNeIoPZT0M8OSUijyglIyc2Em6KuuQgs25X+CeXQ4tjiYT4vu1D+7PhPsOTljPwd/MQsc8TIlb4gKUWEh5nZR0xxV5AjfgebNyRuq6hXVQKhgFivuxZgA6uPWJzcmavorN/QgvUGv7IVNn5vzfUhkrlVoCd0b6CZma9i3I/CPXTSoMY9jStYxhKWVZTqed+I7psKnlxazUELg98g4t3yZwElZ2pAukxaue7wruq1kkKXCxucjvqWEQY4nSzHGpwDFAzXHrjFu+DbpOuf5ch5x6aOp9NYGmMlhSXeZ49oQ6+ZUSgWM6JjeGzD0df/qUyo2S68+Y6JXJbEspC3gUpJjlShK4i/HmFnIWqlTYeN+cmuonT6mAd51SSVlCemVeUStlEfbXac9oFUwA3nzXyNSnnhZ76MJGKxS7Roll/cQpFXhMiwwLn3E/2CtYC0spS2LpIqZVni3XlRJcKnS8sQVrollr4qQWflMBn61VoWWWaYjuPmoXy49IMwrhnJaQvXEqsnRBC8VCcEp3L+A339JXdYFv9FwbPAzE5sDOlm8hrCzsVv7G9akdy2mlrBDZKbI0F4Yl5lSW9NNLI7XRjqWONShs1vhIO7pfDd/ZCmGpKJz3Ec9rX7MpgcKRes0BPt6Ub4XRUi+9X6FOZIK3KLP4N7XNOkk2Acb+nhIfxR6EyvJNr8Xt4Z5rKQhnL+IZbp1qd8BopSyNEX5+bEmv/m4Jzbz14Rl3vON1M25Mw0ZpNuAtaB28S7zjfQPmkv5yH1wK7HPcHOFBIeVtHsmIOq1KSzCmeGXp59ewlLLeDoP5M5zgsaEy14qUdKKuwV6vJmx2WC/f3JqF74iWdP+SEXXjuQkbXLiNw8bJzTHA91nVSAQ3toG1lNVoVMFUcmo0Go1Go7FZ/gO65zOW4y09BQAAAABJRU5ErkJggg==\" alt=\"zeta(2) = pi^2/6\" style=\"width: 78px; height: 19.5px;\" width=\"78\" height=\"19.5\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.9px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.95px; text-align: left; transform-origin: 384px 31.95px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 109.55px 7.8px; transform-origin: 109.55px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.8px; transform-origin: 3.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 147.783px 7.8px; transform-origin: 147.783px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with the numbers of terms to sum and a vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.85px 7.8px; transform-origin: 3.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003em\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 113.967px 7.8px; transform-origin: 113.967px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with the values at which to estimate the zeta function. The function should return an array of character strings with the absolute value of the relative error of the estimate E--that is,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46.2px 7.8px; transform-origin: 46.2px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 46.2px 8.25px; transform-origin: 46.2px 8.25px; \"\u003eabs(E-pi)/pi\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 227.483px 7.8px; transform-origin: 227.483px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Report the relative error in scientific notation using num2str(...,'%10.2e').\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 132.25px 7.8px; transform-origin: 132.25px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, PiByZeta(30,2) should return\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 42.35px 8.25px; transform-origin: 42.35px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 38.5px 8.25px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 38.5px 8.25px; \"\u003e'1.00e-02'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 130.7px 7.8px; transform-origin: 130.7px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewhile PiByZeta([25 30],[2 8]) should return\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 20.4333px; transform-origin: 404px 20.4333px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 80.85px 8.25px; transform-origin: 80.85px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 77px 8.25px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 77px 8.25px; \"\u003e'1.20e-02  1.00e-02'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.916667px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.916667px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.916667px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.916667px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 80.85px 8.25px; transform-origin: 80.85px 8.25px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.25px; transform-origin: 3.85px 8.25px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 77px 8.25px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 77px 8.25px; \"\u003e'2.53e-12  7.22e-13'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = PiByZeta(n,m)\r\n  s = num2str(ans,'%10.2e');\r\nend","test_suite":"%%\r\nn = 30;\r\nm = 2;\r\ny_correct = '1.00e-02';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 30;\r\nm = 8;\r\ny_correct = '7.22e-13';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 1;\r\nm = 20;\r\ny_correct = '4.77e-08';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 5:5:30;\r\nm = 2;\r\ny_correct = '5.67e-02  2.94e-02  1.98e-02  1.49e-02  1.20e-02  1.00e-02';\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 10;\r\nm = 2:2:10;\r\ny_correct = ['2.94e-02'; '6.62e-05'; '2.54e-07'; '1.24e-09'; '6.92e-12'];\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = [25 30];\r\nm = [2 8];\r\ny_correct = ['1.20e-02  1.00e-02'; '2.53e-12  7.22e-13'];\r\nassert(isequal(PiByZeta(n,m),y_correct))\r\n\r\n%%\r\nn = 1:5;\r\nm = 2:2:10;\r\ny_correct = ['2.20e-01  1.28e-01  9.04e-02  6.97e-02  5.67e-02'; ...\r\n    '1.96e-02  4.61e-03  1.73e-03  8.26e-04  4.56e-04'; ...\r\n    '2.86e-03  2.82e-04  5.67e-05  1.67e-05  6.25e-06'; ...\r\n    '5.09e-04  2.13e-05  2.33e-06  4.27e-07  1.09e-07'; ...\r\n    '9.94e-05  1.80e-06  1.08e-07  1.24e-08  2.14e-09'];\r\nassert(isequal(PiByZeta(n,m),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-14T14:03:44.000Z","updated_at":"2026-01-09T15:30:33.000Z","published_at":"2020-06-14T16:19:39.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problems\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/2908-approximation-of-pi\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2908\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/2909-approximation-of-pi-vector-inputs\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e2909\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e ask us to estimate \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e by summing a given number of terms in an infinite sum, the Leibniz formula.\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\u003eHere you are asked to estimate \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e by summing a given number of terms in other infinite sums corresponding to the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Riemann_zeta_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRiemann zeta function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e evaluated at positive even integers. For example, in solving the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Basel_problem\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBasel problem\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, Euler summed the reciprocals of the squares of positive integers and showed that \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"zeta(2) = pi^2/6\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\zeta(2) = \\\\pi^2/6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with the numbers of terms to sum and a vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with the values at which to estimate the zeta function. The function should return an array of character strings with the absolute value of the relative error of the estimate E--that is,\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eabs(E-pi)/pi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Report the relative error in scientific notation using num2str(...,'%10.2e').\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, PiByZeta(30,2) should return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ '1.00e-02']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhile PiByZeta([25 30],[2 8]) should return\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ '1.20e-02  1.00e-02'\\n '2.53e-12  7.22e-13']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45997,"title":"Evaluate the zeta function for complex arguments","description":"\u003chttps://www.mathworks.com/matlabcentral/cody/problems/45988 Cody Problem 45988\u003e involved computing the Riemann zeta function for real arguments greater than 1. Code that works for that problem can reveal the connection between pi and the values of the zeta function evaluated at positive even integers; this connection is explored in \u003chttps://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function Cody Problem 45939\u003e. However, to test the Riemann hypothesis--that all non-trivial zeros of the zeta function have a real part of 1/2, one needs to compute the zeta function for complex arguments.\r\n\r\nWrite a function to evaluate the zeta function for complex arguments.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 114px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 57px; transform-origin: 407px 57px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45988\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45988\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 315.85px 7.8px; transform-origin: 315.85px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e involved computing the Riemann zeta function for real arguments greater than 1. Code that works for that problem can reveal the connection between \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eπ\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 222.1px 7.8px; transform-origin: 222.1px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and the values of the zeta function evaluated at positive even integers; this connection is explored in\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.95px 7.8px; transform-origin: 1.95px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 45939\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 217.433px 7.8px; transform-origin: 217.433px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. However, to test the Riemann hypothesis--that all non-trivial zeros of the zeta function have a real part of 1/2, one needs to compute the zeta function for complex arguments.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 213.017px 7.8px; transform-origin: 213.017px 7.8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to evaluate the zeta function for complex arguments.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function z = zeta2(s)\r\n  z = f(s);\r\nend","test_suite":"%%\r\ns = 2;\r\nz_correct = pi^2/6;\r\nassert(abs(zeta2(s)-z_correct)/z_correct \u003c 1e-8)\r\n\r\n%%\r\ns = 1;\r\nassert(isinf(zeta2(s)))\r\n\r\n%%\r\ns = 1/2;\r\nz_correct = -1.460354508809587;\r\nassert(abs((zeta2(s)-z_correct)/z_correct) \u003c 1e-8)\r\n\r\n%%\r\ns = 0;\r\nz_correct = -0.5;\r\nassert(abs((zeta2(s)-z_correct)/z_correct) \u003c 1e-8)\r\n\r\n%%\r\ns = -1;\r\nz_correct = -1/12;\r\nassert(abs((zeta2(s)-z_correct)/z_correct) \u003c 1e-8)\r\n\r\n%%\r\ns = -2;\r\nz_correct = 0;\r\nassert(abs(zeta2(s)) \u003c 1e-12)\r\n\r\n%%\r\ns = 3+2*i;\r\nz_correct = 0.973041960418942 - 0.147695593000454i;\r\nassert(abs(real(zeta2(s))-real(z_correct))/real(z_correct) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = -1+2*i;\r\nz_correct = 0.168915669770846 - 0.070515988908259i;\r\nassert(abs((real(zeta2(s))-real(z_correct))/real(z_correct)) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = 0.75-3*i;\r\nz_correct = 0.580900396083837 + 0.095281202690117i;\r\nassert(abs(real(zeta2(s))-real(z_correct))/real(z_correct) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = 5+2*i;\r\nz_correct = 1.001916538615071 - 0.034217062736354i;\r\nassert(abs((real(zeta2(s))-real(z_correct))/real(z_correct)) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n%%\r\ns = 0.5+14.13472514173469379*i;\r\nassert(abs(real(zeta2(s))) \u003c 1e-12) \r\nassert(abs(imag(zeta2(s))) \u003c 1e-12)\r\n\r\n%%\r\ns = 0.5+21*i;\r\nz_correct = -0.005162064638102 - 0.024546964575122i;\r\nassert(abs((real(zeta2(s))-real(z_correct))/real(z_correct)) \u003c 1e-8) \r\nassert(abs((imag(zeta2(s))-imag(z_correct))/imag(z_correct)) \u003c 1e-8)\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2020-06-29T02:07:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-06-28T04:41:50.000Z","updated_at":"2026-01-09T13:36:37.000Z","published_at":"2020-06-28T05:14:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45988\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45988\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e involved computing the Riemann zeta function for real arguments greater than 1. Code that works for that problem can reveal the connection between \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"pi\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\pi\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and the values of the zeta function evaluated at positive even integers; this connection is explored in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/45939-estimate-pi-from-certain-values-of-the-zeta-function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 45939\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. However, to test the Riemann hypothesis--that all non-trivial zeros of the zeta function have a real part of 1/2, one needs to compute the zeta function for complex arguments.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to evaluate the zeta function for complex arguments.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"zeta function\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"zeta function\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"zeta function\"","","\"","zeta function","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f4a01b65bf0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f4a01b65ab0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f4a01b650b0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f4a01b65e70\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f4a01b65dd0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f4a01b65d30\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f4a01b65c90\u003e":"tag:\"zeta function\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f4a01b65c90\u003e":"tag:\"zeta function\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"zeta function\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"zeta function\"","","\"","zeta function","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f4a01b65bf0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f4a01b65ab0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f4a01b650b0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f4a01b65e70\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f4a01b65dd0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f4a01b65d30\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f4a01b65c90\u003e":"tag:\"zeta function\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f4a01b65c90\u003e":"tag:\"zeta function\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":45988,"difficulty_rating":"easy-medium"},{"id":46111,"difficulty_rating":"easy-medium"},{"id":45939,"difficulty_rating":"medium"},{"id":45997,"difficulty_rating":"medium-hard"}]}}