@mhg/blog
Version:
9 lines • 498 kB
HTML
<!DOCTYPE html><html lang="zh-Hans"><head hexo-theme="https://github.com/volantis-x/hexo-theme-volantis/#6.0.3"><meta name="generator" content="Hexo 8.1.2"><meta name="Volantis" content="6.0.3"><meta charset="utf-8"><meta name="robots" content="index,follow,max-image-preview:large"><link rel="canonical" href="https://blog.mhuig.top/notes/P-2000/7"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://static.mhuig.top"><link rel="preconnect" href="https://static.mhuig.top" crossorigin=""><meta name="renderer" content="webkit"><meta name="force-rendering" content="webkit"><meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"><meta name="HandheldFriendly" content="True"><meta name="mobile-web-app-capable" content="yes"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=5"><meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"><meta content="telephone=no" name="format-detection"><script>function registerServiceWorker(e){"localhost"!=window.location.hostname&&"serviceWorker"in navigator&&navigator.serviceWorker.register(`${e}`).then((function(e){"localhost"==window.location.hostname&&(e.onupdatefound=function(){var r=e.installing;r.onstatechange=function(){switch(r.state){case"installed":navigator.serviceWorker.controller?console.log("Updated Service Worker."):console.log("Service Worker Sucess!");break;case"redundant":console.log("The installing service worker became redundant.")}}})})).catch((function(e){console.error("Error during service worker registration:",e),"undefined"==typeof swinstallretry&&(swinstallretry=1,registerServiceWorker("/jquery.js"))}))}registerServiceWorker("/jquery.js")</script><link rel="apple-touch-icon" sizes="180x180" href="/lib/favicon/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/lib/favicon/favicon-32x32.png"><link rel="icon" type="image/png" sizes="192x192" href="/lib/favicon/android-chrome-192x192.png"><link rel="icon" type="image/png" sizes="144x144" href="/lib/favicon/android-chrome-144x144.png"><link rel="icon" type="image/png" sizes="16x16" href="/lib/favicon/favicon-16x16.png"><link rel="manifest" href="/lib/favicon/site.webmanifest"><link rel="mask-icon" href="/lib/favicon/safari-pinned-tab.svg" color="#5bbad5"><meta name="apple-mobile-web-app-title" content="MHuiG Magicland"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="application-name" content="MHuiG Magicland"><meta name="msapplication-TileColor" content="#87ceeb"><meta name="msapplication-TileImage" content="/lib/favicon/mstile-144x144.png"><meta name="theme-color" content="#87ceeb" media="(prefers-color-scheme: light)"><meta name="theme-color" content="#21232f" media="(prefers-color-scheme: dark)"><link href="/opensearch.xml" rel="search" title="MHuiG Magicland" type="application/opensearchdescription+xml"><link rel="sitemap" type="application/xml" title="MHuiG Blog Site Map" href="https://blog.mhuig.top/sitemap.xml"><link rel="author" href="https://mhuig.top"><meta name="author" content="MHuiG"><meta name="creator" content="MHuiG"><link rel="archives" href="https://blog.mhuig.top/archives/"><link rel="preload" href="/css/style.css" as="style"><link rel="preload" href="https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/fonts/VarelaRound/VarelaRound-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous"><link rel="preload" href="https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/fonts/VarelaRound/VarelaRound-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous"><link rel="alternate" href="/atom.xml" title="Magicland" type="application/atom+xml"><link rel="alternate" href="/rss2.xml" title="Magicland" type="application/rss+xml"><title>P-2000 Problem: P-2000问题与子集和问题的计算复杂性关联分析 - Magicland</title><meta name="keywords" content="数学,P-2000, Math,P-2000问题,Sharp-P完全性,子集和问题,MHuiG, @MHuiG, Blog, 博客, Magicland, 魔法世界"><meta desc="" name="description" content="P-2000问题要求统计集合{1,2,...,2000}中元素和为素数的子集数量,是组合枚举与数论分析结合的经典难题。其本质困难推动研究者探索与计算复杂性理论的关联,通过动态规划与素数筛选结合建立求解框架,时间复杂度为O(n·S_max + S_max·log log S_max)。研究表明经典子集和问题可多项式归约到该问题,强化了#P类与NP类问题的难度分野。 - MHuiG - Magicland"><meta property="og:type" content="website"><meta property="og:title" content="Magicland"><meta property="og:url" content="https://blog.mhuig.top/notes/P-2000/7"><meta property="og:site_name" content="Magicland"><meta property="og:description" content="P-2000问题要求统计集合{1,2,...,2000}中元素和为素数的子集数量,是组合枚举与数论分析结合的经典难题。其本质困难推动研究者探索与计算复杂性理论的关联,通过动态规划与素数筛选结合建立求解框架,时间复杂度为O(n·S_max + S_max·log log S_max)。研究表明经典子集和问题可多项式归约到该问题,强化了#P类与NP类问题的难度分野。"><meta property="og:locale"><meta property="og:image" content="https://blog.mhuig.top/lib/favicon/android-chrome-192x192.png"><meta property="article:published_time" content="2025-12-09T09:23:00.000Z"><meta property="article:modified_time" content="2025-12-09T09:25:00.000Z"><meta property="article:author" content="MHuiG"><meta property="article:tag" content="Math"><meta property="article:tag" content="P-2000问题"><meta property="article:tag" content="Sharp-P完全性"><meta property="article:tag" content="子集和问题"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://blog.mhuig.top/lib/favicon/android-chrome-192x192.png"><meta name="twitter:creator" content="@iMHuiG"><meta name="twitter:site" content="@iMHuiG"><style>#safearea{display:none}.post-story+.post-story{content-visibility:auto;contain-intrinsic-size:10px 500px}:root{--color-site-body:#87ceeb;--color-site-bg:#87ceeb;--color-site-inner:#555;--color-site-footer:#666;--color-card:#fff;--color-text:#444;--color-block:#f6f6f6;--color-inlinecode:#d56d28;--color-codeblock:#fff7ea;--color-h1:#3a3a3a;--color-h2:#3a3a3a;--color-h3:#333;--color-h4:#444;--color-h5:#555;--color-h6:#666;--color-p:#444;--color-list:#666;--color-list-hl:#1a78c2;--color-meta:#888;--color-read-bkg:#e0d8c8;--color-read-post:#f8f1e2;--color-copyright-bkg:#f5f5f5}*{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;outline:0;margin:0;padding:0}::-webkit-scrollbar{height:4px;width:4px}::-webkit-scrollbar-track-piece{background:0 0}::-webkit-scrollbar-thumb{background:#2196f3;cursor:pointer;border-radius:2px;-webkit-border-radius:2px}::-webkit-scrollbar-thumb:hover{background:#ff5722}html{color:var(--color-text);width:100%;height:100%;font-family:"Varela Round","PingFang SC","Microsoft YaHei",Helvetica,Arial,Menlo,Monaco,monospace,sans-serif;font-size:16px}html>::-webkit-scrollbar{height:4px;width:4px}html>::-webkit-scrollbar-track-piece{background:0 0}html>::-webkit-scrollbar-thumb{background:#2196f3;cursor:pointer;border-radius:2px;-webkit-border-radius:2px}html>::-webkit-scrollbar-thumb:hover{background:#ff5722}body{background-color:var(--color-site-body);text-rendering:optimizelegibility;-webkit-tap-highlight-color:transparent;line-height:1.6;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body.modal-active{overflow:hidden}@media screen and (max-width:680px){body.modal-active{position:fixed;top:0;right:0;bottom:0;left:0}}a{color:#2196f3;cursor:pointer;text-decoration:none;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}a:hover{color:#ff5722}a:active,a:hover{outline:0}ol,ul{padding-left:0}ol li,ul li{list-style:none}header{display:-webkit-box;display:-moz-box;display:block}img{border:0;background:0 0;max-width:100%}svg:not(:root){overflow:hidden}hr{-moz-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;height:0;border:0;border-radius:1px;-webkit-border-radius:1px;border-bottom:1px solid rgba(68,68,68,.1)}button,input{color:inherit;font:inherit;margin:0}button{overflow:visible;text-transform:none;-webkit-appearance:button;cursor:pointer}@supports (backdrop-filter:blur(20px)){.blur{background:rgba(255,255,255,.9)!important;backdrop-filter:saturate(200%) blur(20px)}}.shadow{box-shadow:0 1px 2px 0 rgba(0,0,0,.1);-webkit-box-shadow:0 1px 2px 0 rgba(0,0,0,.1)}.shadow.floatable{transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}.shadow.floatable:hover{box-shadow:0 2px 4px 0 rgba(0,0,0,.1),0 4px 8px 0 rgba(0,0,0,.1),0 8px 16px 0 rgba(0,0,0,.1);-webkit-box-shadow:0 2px 4px 0 rgba(0,0,0,.1),0 4px 8px 0 rgba(0,0,0,.1),0 8px 16px 0 rgba(0,0,0,.1)}#l_cover{min-height:64px}.cover-wrapper{top:0;left:0;max-width:100%;height:100vh;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-khtml-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-o-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-webkit-box-direction:normal;-moz-box-direction:normal;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;align-items:center;align-self:center;align-content:center;color:var(--color-site-inner);padding:0 16px;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;position:relative;overflow:hidden;margin-bottom:-100px}.cover-wrapper .cover-bg{position:absolute;width:100%;height:100%;background-position:center;background-size:cover;-webkit-background-size:cover;-moz-background-size:cover}.cover-wrapper .cover-bg.lazyload:not(.loaded){opacity:0;-webkit-opacity:0;-moz-opacity:0}.cover-wrapper .cover-bg.lazyload.loaded{animation-delay:0s;animation-duration:.5s;animation-fill-mode:forwards;animation-timing-function:ease-out;animation-name:fadeIn}@-moz-keyframes fadeIn{0%{opacity:0;-webkit-opacity:0;-moz-opacity:0;filter:blur(12px);transform:scale(1.02);-webkit-transform:scale(1.02);-khtml-transform:scale(1.02);-moz-transform:scale(1.02);-o-transform:scale(1.02);-ms-transform:scale(1.02)}100%{opacity:1;-webkit-opacity:1;-moz-opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0;-webkit-opacity:0;-moz-opacity:0;filter:blur(12px);transform:scale(1.02);-webkit-transform:scale(1.02);-khtml-transform:scale(1.02);-moz-transform:scale(1.02);-o-transform:scale(1.02);-ms-transform:scale(1.02)}100%{opacity:1;-webkit-opacity:1;-moz-opacity:1}}@-o-keyframes fadeIn{0%{opacity:0;-webkit-opacity:0;-moz-opacity:0;filter:blur(12px);transform:scale(1.02);-webkit-transform:scale(1.02);-khtml-transform:scale(1.02);-moz-transform:scale(1.02);-o-transform:scale(1.02);-ms-transform:scale(1.02)}100%{opacity:1;-webkit-opacity:1;-moz-opacity:1}}@keyframes fadeIn{0%{opacity:0;-webkit-opacity:0;-moz-opacity:0;filter:blur(12px);transform:scale(1.02);-webkit-transform:scale(1.02);-khtml-transform:scale(1.02);-moz-transform:scale(1.02);-o-transform:scale(1.02);-ms-transform:scale(1.02)}100%{opacity:1;-webkit-opacity:1;-moz-opacity:1}}.cover-wrapper .cover-body{z-index:1;position:relative;width:100%;height:100%}.cover-wrapper#full{height:calc(100vh + 100px);padding-bottom:100px}.cover-wrapper#half{max-height:640px;min-height:400px;height:calc(36vh - 64px + 200px)}.cover-wrapper #scroll-down{width:100%;height:64px;position:absolute;bottom:100px;text-align:center;cursor:pointer}.cover-wrapper #scroll-down .scroll-down-effects{color:#fff;font-size:24px;line-height:64px;position:absolute;width:24px;left:calc(50% - 12px);text-shadow:0 1px 2px rgba(0,0,0,.1);animation:scroll-down-effect 1.5s infinite;-webkit-animation:scroll-down-effect 1.5s infinite;-khtml-animation:scroll-down-effect 1.5s infinite;-moz-animation:scroll-down-effect 1.5s infinite;-o-animation:scroll-down-effect 1.5s infinite;-ms-animation:scroll-down-effect 1.5s infinite}@-moz-keyframes scroll-down-effect{0%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}50%{top:-16px;opacity:.4;-webkit-opacity:0.4;-moz-opacity:0.4}100%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}}@-webkit-keyframes scroll-down-effect{0%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}50%{top:-16px;opacity:.4;-webkit-opacity:0.4;-moz-opacity:0.4}100%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}}@-o-keyframes scroll-down-effect{0%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}50%{top:-16px;opacity:.4;-webkit-opacity:0.4;-moz-opacity:0.4}100%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}}@keyframes scroll-down-effect{0%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}50%{top:-16px;opacity:.4;-webkit-opacity:0.4;-moz-opacity:0.4}100%{top:0;opacity:1;-webkit-opacity:1;-moz-opacity:1}}.cover-wrapper .cover-body{margin-top:64px;margin-bottom:100px}.cover-wrapper .cover-body,.cover-wrapper .cover-body .bottom,.cover-wrapper .cover-body .top{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;-webkit-box-direction:normal;-moz-box-direction:normal;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;align-items:center;justify-content:center;-webkit-justify-content:center;-khtml-justify-content:center;-moz-justify-content:center;-o-justify-content:center;-ms-justify-content:center;max-width:100%}.cover-wrapper .cover-body .bottom{margin-top:32px}.cover-wrapper .cover-body .title{font-family:"Varela Round","PingFang SC","Microsoft YaHei",Helvetica,Arial,Helvetica,monospace;font-size:3.125rem;line-height:1.2;text-shadow:0 1px 2px rgba(0,0,0,.1)}.cover-wrapper .cover-body .subtitle{font-size:20px}.cover-wrapper .cover-body .logo{max-height:120px;max-width:calc(100% - 4 * 16px)}@media screen and (min-height:1024px){.cover-wrapper .cover-body .title{font-size:3rem}.cover-wrapper .cover-body .subtitle{font-size:1.05rem}.cover-wrapper .cover-body .logo{max-height:150px}}.cover-wrapper .cover-body .m_search{position:relative;max-width:calc(100% - 16px);width:320px;vertical-align:middle}.cover-wrapper .cover-body .m_search .form{position:relative;display:-webkit-box;display:-moz-box;display:block;width:100%}.cover-wrapper .cover-body .m_search .icon,.cover-wrapper .cover-body .m_search .input{transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}.cover-wrapper .cover-body .m_search .icon{position:absolute;display:-webkit-box;display:-moz-box;display:block;line-height:2.5rem;width:32px;top:0;left:5px;color:rgba(68,68,68,.75)}.cover-wrapper .cover-body .m_search .input{display:-webkit-box;display:-moz-box;display:block;height:2.5rem;width:100%;box-shadow:none;-webkit-box-shadow:none;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;font-size:.875rem;-webkit-appearance:none;padding-left:36px;border-radius:1.4rem;-webkit-border-radius:1.4rem;background:rgba(255,255,255,.6);backdrop-filter:blur(10px);border:none;color:var(--color-text)}@media screen and (max-width:500px){.cover-wrapper .cover-body .m_search .input{padding-left:36px}}.cover-wrapper .cover-body .m_search .input:hover{background:rgba(255,255,255,.8)}.cover-wrapper .cover-body .m_search .input:focus{background:#fff}.cover-wrapper .list-h{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;-webkit-box-direction:normal;-moz-box-direction:normal;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;flex-wrap:wrap;-webkit-flex-wrap:wrap;-khtml-flex-wrap:wrap;-moz-flex-wrap:wrap;-o-flex-wrap:wrap;-ms-flex-wrap:wrap;align-items:stretch;border-radius:4px;-webkit-border-radius:4px;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.cover-wrapper .list-h a{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1 0;-ms-flex:1 0;flex:1 0;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;font-weight:600}.cover-wrapper .list-h a img{display:-webkit-box;display:-moz-box;display:block;border-radius:2px;-webkit-border-radius:2px;margin:4px;min-width:40px;max-width:44px}@media screen and (max-width:768px){.cover-wrapper .list-h a img{min-width:36px;max-width:40px}}@media screen and (max-width:500px){.cover-wrapper .list-h a img{margin:2px 4px;min-width:32px;max-width:36px}}@media screen and (max-width:375px){.cover-wrapper .list-h a img{min-width:28px;max-width:32px}}.cover-wrapper{max-width:100%}.cover-wrapper.search .bottom .menu{margin-top:16px}.cover-wrapper.search .bottom .menu .list-h a{white-space:nowrap;-webkit-box-direction:normal;-moz-box-direction:normal;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;align-items:baseline;padding:2px;margin:4px;color:var(--color-site-inner);opacity:.75;-webkit-opacity:0.75;-moz-opacity:0.75;text-shadow:0 1px 2px rgba(0,0,0,.05);border-bottom:2px solid transparent}.cover-wrapper.search .bottom .menu .list-h a i{margin-right:4px}.cover-wrapper.search .bottom .menu .list-h a p{font-size:.9375rem}.cover-wrapper.search .bottom .menu .list-h a.active,.cover-wrapper.search .bottom .menu .list-h a:active,.cover-wrapper.search .bottom .menu .list-h a:hover{opacity:1;-webkit-opacity:1;-moz-opacity:1;border-bottom:2px solid var(--color-site-inner)}.cover-wrapper.dock .menu,.cover-wrapper.featured .menu,.cover-wrapper.focus .menu{border-radius:6px;-webkit-border-radius:6px}.cover-wrapper.dock .menu .list-h a,.cover-wrapper.featured .menu .list-h a,.cover-wrapper.focus .menu .list-h a{-webkit-box-direction:normal;-moz-box-direction:normal;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;align-items:center;padding:12px;line-height:24px;border-radius:4px;-webkit-border-radius:4px;border-bottom:none;text-align:center;align-content:flex-end;color:rgba(68,68,68,.7);font-size:1.5rem}@media screen and (max-width:500px){.cover-wrapper.dock .menu .list-h a,.cover-wrapper.featured .menu .list-h a,.cover-wrapper.focus .menu .list-h a{padding:12px 8px}}.cover-wrapper.dock .menu .list-h a i,.cover-wrapper.featured .menu .list-h a i,.cover-wrapper.focus .menu .list-h a i{margin:8px}.cover-wrapper.dock .menu .list-h a p,.cover-wrapper.featured .menu .list-h a p,.cover-wrapper.focus .menu .list-h a p{font-size:.875rem}.cover-wrapper.dock .menu .list-h a.active,.cover-wrapper.featured .menu .list-h a.active,.cover-wrapper.focus .menu .list-h a.active{background:var(--color-card);backdrop-filter:none}.cover-wrapper.dock .menu .list-h a.active i,.cover-wrapper.dock .menu .list-h a.active i+p,.cover-wrapper.featured .menu .list-h a.active i,.cover-wrapper.featured .menu .list-h a.active i+p,.cover-wrapper.focus .menu .list-h a.active i,.cover-wrapper.focus .menu .list-h a.active i+p{color:#2196f3}.cover-wrapper.dock .menu .list-h a.active img+p,.cover-wrapper.featured .menu .list-h a.active img+p,.cover-wrapper.focus .menu .list-h a.active img+p{color:var(--color-text)}.cover-wrapper.dock .menu .list-h a:hover,.cover-wrapper.featured .menu .list-h a:hover,.cover-wrapper.focus .menu .list-h a:hover{background:var(--color-card)}.cover-wrapper.featured .menu .list-h{margin:-2px}.cover-wrapper.featured .menu .list-h a{margin:2px;background:rgba(255,255,255,.5)}@supports (backdrop-filter:blur(20px)){.cover-wrapper.featured .menu .list-h a{background:rgba(255,255,255,.5);backdrop-filter:saturate(200%) blur(20px)}}@media (prefers-color-scheme:dark){:root{--color-mode:'dark'}:root:not([color-scheme]){--color-site-body:#121212;--color-read-bkg:#21232f;--color-read-post:#252d38;--color-site-bg:#21232f;--color-site-inner:#efefef;--color-site-footer:#666;--color-card:#252d38;--color-text:rgba(238,238,238,0.871);--color-block:rgba(68,68,68,0.65);--color-codeblock:#444;--color-inlinecode:#d56d28;--color-h1:rgba(255,255,255,0.871);--color-h2:rgba(255,255,255,0.871);--color-h3:rgba(255,255,255,0.6);--color-h4:rgba(255,255,255,0.6);--color-h5:rgba(255,255,255,0.6);--color-h6:rgba(255,255,255,0.6);--color-p:rgba(217,217,217,0.871);--color-list:rgba(217,217,217,0.871);--color-list-hl:#4dabf5;--color-meta:rgba(191,191,191,0.871);--color-link:rgba(191,191,191,0.871);--color-copyright-bkg:#21252b}:root:not([color-scheme]) img{filter:brightness(70%)!important}:root:not([color-scheme]) .blur{background:rgba(33,35,47,.9)!important}:root:not([color-scheme]) .white-box.blur{background:rgba(37,45,56,.9)!important}:root:not([color-scheme]) .nav-main .u-search-input{background:var(--color-card)!important}:root:not([color-scheme]) #l_main .article .prev-next>a{background:var(--color-block)!important}:root:not([color-scheme]) #l_main .article .prev-next>a:hover{background:var(--color-site-bg)!important}:root:not([color-scheme]) .article blockquote{background:var(--color-block)!important}:root:not([color-scheme]) .article-title a{color:var(--color-h1)!important}:root:not([color-scheme]) details>summary{color:var(--color-p)!important;background:var(--color-site-bg)!important}:root:not([color-scheme]) details{border:1px solid var(--color-site-bg)!important;background:var(--color-site-bg)!important}:root:not([color-scheme]) #u-search .modal,:root:not([color-scheme]) #u-search .modal-body,:root:not([color-scheme]) #u-search .modal-header{background:var(--color-card)!important}:root:not([color-scheme]) #u-search .modal-body .modal-results .result:hover{background:var(--color-block)!important}:root:not([color-scheme]) .u-search-input:hover{background:var(--color-block)!important}:root:not([color-scheme]) .u-search-input:focus{background:var(--color-site-body)!important}}[color-scheme=dark]{--color-site-body:#121212;--color-read-bkg:#21232f;--color-read-post:#252d38;--color-site-bg:#21232f;--color-site-inner:#efefef;--color-site-footer:#666;--color-card:#252d38;--color-text:rgba(238,238,238,0.871);--color-block:rgba(68,68,68,0.65);--color-codeblock:#444;--color-inlinecode:#d56d28;--color-h1:rgba(255,255,255,0.871);--color-h2:rgba(255,255,255,0.871);--color-h3:rgba(255,255,255,0.6);--color-h4:rgba(255,255,255,0.6);--color-h5:rgba(255,255,255,0.6);--color-h6:rgba(255,255,255,0.6);--color-p:rgba(217,217,217,0.871);--color-list:rgba(217,217,217,0.871);--color-list-hl:#4dabf5;--color-meta:rgba(191,191,191,0.871);--color-link:rgba(191,191,191,0.871);--color-copyright-bkg:#21252b}[color-scheme=dark] img{filter:brightness(70%)!important}[color-scheme=dark] .blur{background:rgba(33,35,47,.9)!important}[color-scheme=dark] .white-box.blur{background:rgba(37,45,56,.9)!important}[color-scheme=dark] .nav-main .u-search-input{background:var(--color-card)!important}[color-scheme=dark] #l_main .article .prev-next>a{background:var(--color-block)!important}[color-scheme=dark] #l_main .article .prev-next>a:hover{background:var(--color-site-bg)!important}[color-scheme=dark] .article blockquote{background:var(--color-block)!important}[color-scheme=dark] .article-title a{color:var(--color-h1)!important}[color-scheme=dark] details>summary{color:var(--color-p)!important;background:var(--color-site-bg)!important}[color-scheme=dark] details{border:1px solid var(--color-site-bg)!important;background:var(--color-site-bg)!important}[color-scheme=dark] #u-search .modal,[color-scheme=dark] #u-search .modal-body,[color-scheme=dark] #u-search .modal-header{background:var(--color-card)!important}[color-scheme=dark] #u-search .modal-body .modal-results .result:hover{background:var(--color-block)!important}[color-scheme=dark] .u-search-input:hover{background:var(--color-block)!important}[color-scheme=dark] .u-search-input:focus{background:var(--color-site-body)!important}@media screen and (max-width:500px){[color-scheme=dark] .l_header .m_search{background:var(--color-site-bg)!important}}@font-face{font-family:'Varela Round';src:url("https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/fonts/VarelaRound/VarelaRound-Regular.ttf");font-weight:'normal';font-style:'normal';font-display:swap}@font-face{font-family:'Varela Round';src:url("https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/fonts/VarelaRound/VarelaRound-Regular.ttf");font-weight:'normal';font-style:'normal';font-display:swap}.l_header{position:fixed;z-index:1000;top:0;width:100%;height:64px;background:var(--color-card);box-shadow:0 1px 2px 0 rgba(0,0,0,.1);-webkit-box-shadow:0 1px 2px 0 rgba(0,0,0,.1)}.l_header.auto{transition:opacity .4s ease;-webkit-transition:opacity .4s ease;-khtml-transition:opacity 0.4s ease;-moz-transition:opacity .4s ease;-o-transition:opacity .4s ease;-ms-transition:opacity .4s ease;visibility:hidden}.l_header.auto.show{opacity:1!important;-webkit-opacity:1!important;-moz-opacity:1!important;visibility:visible}.l_header .container{margin-left:16px;margin-right:16px}.l_header #wrapper{height:100%;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.l_header #wrapper .nav-main,.l_header #wrapper .nav-sub{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-khtml-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-o-flex-wrap:nowrap;-ms-flex-wrap:nowrap;justify-content:space-between;-webkit-justify-content:space-between;-khtml-justify-content:space-between;-moz-justify-content:space-between;-o-justify-content:space-between;-ms-justify-content:space-between;align-items:center}.l_header #wrapper .nav-main{transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}.l_header #wrapper.sub .nav-main{transform:translateY(-64px);-webkit-transform:translateY(-64px);-khtml-transform:translateY(-64px);-moz-transform:translateY(-64px);-o-transform:translateY(-64px);-ms-transform:translateY(-64px)}.l_header #wrapper .nav-sub{transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease;opacity:0;-webkit-opacity:0;-moz-opacity:0;height:64px;width:calc(100% - 2 * 16px);position:absolute}.l_header #wrapper .nav-sub ::-webkit-scrollbar{display:-webkit-box;display:-moz-box;display:none}@media screen and (min-width:2048px){.l_header #wrapper .nav-sub{max-width:55vw;margin:auto}}.l_header #wrapper.sub .nav-sub{opacity:1;-webkit-opacity:1;-moz-opacity:1}.l_header #wrapper .title{position:relative;color:var(--color-text);padding-left:24px;max-height:64px}.l_header #wrapper .nav-main .title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0;line-height:64px;padding:0 24px;font-size:1.25rem;font-family:"Varela Round","PingFang SC","Microsoft YaHei",Helvetica,Arial,Helvetica,monospace}.l_header #wrapper .nav-main .title img{height:64px}.l_header .nav-sub{max-width:1080px;margin:auto}.l_header .nav-sub .title{font-weight:700;font-family:"Varela Round","PingFang SC","Microsoft YaHei",Helvetica,Arial,Menlo,Monaco,monospace,sans-serif;line-height:1.2;max-height:64px;white-space:normal;flex-shrink:1}.l_header .switcher{display:-webkit-box;display:-moz-box;display:none;line-height:64px;align-items:center}.l_header .switcher .s-toc{display:-webkit-box;display:-moz-box;display:none}@media screen and (max-width:768px){.l_header .switcher .s-toc{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex}}.l_header .switcher>li{height:48px;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease;margin:2px}@media screen and (max-width:500px){.l_header .switcher>li{margin:0 1px;height:48px}}.l_header .switcher>li>a{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;justify-content:center;-webkit-justify-content:center;-khtml-justify-content:center;-moz-justify-content:center;-o-justify-content:center;-ms-justify-content:center;align-items:center;width:48px;height:48px;padding:.85em 1.1em;border-radius:100px;-webkit-border-radius:100px;border:none;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease;color:#2196f3}.l_header .switcher>li>a:hover{border:none}.l_header .switcher>li>a.active,.l_header .switcher>li>a:active{border:none;background:var(--color-site-bg)}@media screen and (max-width:500px){.l_header .switcher>li>a{width:36px;height:48px}}.l_header .nav-sub .switcher{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex}.l_header .m_search{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;height:64px;width:240px;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}@media screen and (max-width:1024px){.l_header .m_search{width:44px;min-width:44px}.l_header .m_search input::placeholder{opacity:0;-webkit-opacity:0;-moz-opacity:0}.l_header .m_search:hover{width:240px}.l_header .m_search:hover input::placeholder{opacity:1;-webkit-opacity:1;-moz-opacity:1}}@media screen and (min-width:500px){.l_header .m_search:hover .input{width:100%}.l_header .m_search:hover .input::placeholder{opacity:1;-webkit-opacity:1;-moz-opacity:1}}@media screen and (max-width:500px){.l_header .m_search{min-width:0}.l_header .m_search input::placeholder{opacity:1;-webkit-opacity:1;-moz-opacity:1}}.l_header .m_search .form{position:relative;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;width:100%;align-items:center}.l_header .m_search .icon{position:absolute;width:36px;left:5px;color:var(--color-meta)}@media screen and (max-width:500px){.l_header .m_search .icon{display:-webkit-box;display:-moz-box;display:none}}.l_header .m_search .input{display:-webkit-box;display:-moz-box;display:block;padding-top:8px;padding-bottom:8px;line-height:1.3;width:100%;color:var(--color-text);background:#fafafa;box-shadow:none;-webkit-box-shadow:none;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding-left:40px;font-size:.875rem;border-radius:8px;-webkit-border-radius:8px;border:none;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}@media screen and (min-width:500px){.l_header .m_search .input:focus{box-shadow:0 4px 8px 0 rgba(0,0,0,.1);-webkit-box-shadow:0 4px 8px 0 rgba(0,0,0,.1)}}@media screen and (max-width:500px){.l_header .m_search .input{background:var(--color-block);padding-left:8px;border:none}.l_header .m_search .input:focus,.l_header .m_search .input:hover{border:none}}@media (max-width:500px){.l_header .m_search{left:0;width:0;overflow:hidden;position:absolute;background:#fff;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}.l_header .m_search .input{border-radius:32px;-webkit-border-radius:32px;margin-left:16px;padding-left:16px}.l_header.z_search-open .m_search{width:100%}.l_header.z_search-open .m_search .input{width:calc(100% - 120px)}}ul.m-pc>li>a{color:inherit;border-bottom:2px solid transparent}ul.m-pc>li>a.active,ul.m-pc>li>a:active{border-bottom:2px solid #2196f3}ul.list-v li:hover>ul.list-v,ul.m-pc li:hover>ul.list-v{display:-webkit-box;display:-moz-box;display:block}ul.nav-list-h{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;align-items:stretch}ul.nav-list-h>li{position:relative;justify-content:center;-webkit-justify-content:center;-khtml-justify-content:center;-moz-justify-content:center;-o-justify-content:center;-ms-justify-content:center;height:100%;line-height:2.4;border-radius:4px;-webkit-border-radius:4px}ul.nav-list-h>li>a{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:600}ul.list-v{z-index:1;display:-webkit-box;display:-moz-box;display:none;position:absolute;background:var(--color-card);box-shadow:0 2px 4px 0 rgba(0,0,0,.08),0 4px 8px 0 rgba(0,0,0,.08),0 8px 16px 0 rgba(0,0,0,.08);-webkit-box-shadow:0 2px 4px 0 rgba(0,0,0,.08),0 4px 8px 0 rgba(0,0,0,.08),0 8px 16px 0 rgba(0,0,0,.08);margin-top:-6px;border-radius:4px;-webkit-border-radius:4px;padding:8px 0}ul.list-v.show{display:-webkit-box;display:-moz-box;display:block}ul.list-v hr{margin-top:8px;margin-bottom:8px}ul.list-v>li{white-space:nowrap;word-break:keep-all}ul.list-v>li.header{font-size:.78125rem;font-weight:700;line-height:2em;color:var(--color-meta);margin:8px 16px 4px}ul.list-v>li.header i{margin-right:8px}ul.list-v>li ul{margin-left:0;display:-webkit-box;display:-moz-box;display:none;margin-top:-40px}ul.list-v .aplayer-container{min-height:64px;padding:6px 16px}ul.list-v>li>a{transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease;display:-webkit-box;display:-moz-box;display:block;color:var(--color-list);font-size:.875rem;font-weight:700;line-height:36px;padding:0 20px 0 16px;text-overflow:ellipsis;margin:0 4px;border-radius:4px;-webkit-border-radius:4px}@media screen and (max-width:1024px){ul.list-v>li>a{line-height:40px}}ul.list-v>li>a>i{margin-right:8px}ul.list-v>li>a.active,ul.list-v>li>a:active{color:var(--color-list-hl)}ul.list-v>li>a:hover{color:var(--color-list-hl);background:var(--color-site-bg)}.l_header .menu>ul>li>a{display:-webkit-box;display:-moz-box;display:block;padding:0 8px}.l_header .menu>ul>li>a>i{margin-right:4px}.l_header ul.nav-list-h>li{color:var(--color-list);line-height:64px}.l_header ul.nav-list-h>li>a{max-height:64px;overflow:hidden;color:inherit}.l_header ul.nav-list-h>li>a.active,.l_header ul.nav-list-h>li>a:active{color:#2196f3}.l_header ul.nav-list-h>li:hover>a{color:var(--color-list-hl)}.l_header ul.nav-list-h>li i.music{animation:rotate-effect 1.5s linear infinite;-webkit-animation:rotate-effect 1.5s linear infinite;-khtml-animation:rotate-effect 1.5s linear infinite;-moz-animation:rotate-effect 1.5s linear infinite;-o-animation:rotate-effect 1.5s linear infinite;-ms-animation:rotate-effect 1.5s linear infinite}@-moz-keyframes rotate-effect{0%{transform:rotate(0);-webkit-transform:rotate(0);-khtml-transform:rotate(0);-moz-transform:rotate(0);-o-transform:rotate(0);-ms-transform:rotate(0)}25%{transform:rotate(90deg);-webkit-transform:rotate(90deg);-khtml-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-ms-transform:rotate(90deg)}50%{transform:rotate(180deg);-webkit-transform:rotate(180deg);-khtml-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg)}75%{transform:rotate(270deg);-webkit-transform:rotate(270deg);-khtml-transform:rotate(270deg);-moz-transform:rotate(270deg);-o-transform:rotate(270deg);-ms-transform:rotate(270deg)}100%{transform:rotate(360deg);-webkit-transform:rotate(360deg);-khtml-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);-ms-transform:rotate(360deg)}}@-webkit-keyframes rotate-effect{0%{transform:rotate(0);-webkit-transform:rotate(0);-khtml-transform:rotate(0);-moz-transform:rotate(0);-o-transform:rotate(0);-ms-transform:rotate(0)}25%{transform:rotate(90deg);-webkit-transform:rotate(90deg);-khtml-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-ms-transform:rotate(90deg)}50%{transform:rotate(180deg);-webkit-transform:rotate(180deg);-khtml-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg)}75%{transform:rotate(270deg);-webkit-transform:rotate(270deg);-khtml-transform:rotate(270deg);-moz-transform:rotate(270deg);-o-transform:rotate(270deg);-ms-transform:rotate(270deg)}100%{transform:rotate(360deg);-webkit-transform:rotate(360deg);-khtml-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);-ms-transform:rotate(360deg)}}@-o-keyframes rotate-effect{0%{transform:rotate(0);-webkit-transform:rotate(0);-khtml-transform:rotate(0);-moz-transform:rotate(0);-o-transform:rotate(0);-ms-transform:rotate(0)}25%{transform:rotate(90deg);-webkit-transform:rotate(90deg);-khtml-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-ms-transform:rotate(90deg)}50%{transform:rotate(180deg);-webkit-transform:rotate(180deg);-khtml-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg)}75%{transform:rotate(270deg);-webkit-transform:rotate(270deg);-khtml-transform:rotate(270deg);-moz-transform:rotate(270deg);-o-transform:rotate(270deg);-ms-transform:rotate(270deg)}100%{transform:rotate(360deg);-webkit-transform:rotate(360deg);-khtml-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);-ms-transform:rotate(360deg)}}@keyframes rotate-effect{0%{transform:rotate(0);-webkit-transform:rotate(0);-khtml-transform:rotate(0);-moz-transform:rotate(0);-o-transform:rotate(0);-ms-transform:rotate(0)}25%{transform:rotate(90deg);-webkit-transform:rotate(90deg);-khtml-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-ms-transform:rotate(90deg)}50%{transform:rotate(180deg);-webkit-transform:rotate(180deg);-khtml-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg)}75%{transform:rotate(270deg);-webkit-transform:rotate(270deg);-khtml-transform:rotate(270deg);-moz-transform:rotate(270deg);-o-transform:rotate(270deg);-ms-transform:rotate(270deg)}100%{transform:rotate(360deg);-webkit-transform:rotate(360deg);-khtml-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);-ms-transform:rotate(360deg)}}.menu-phone li ul.list-v{right:calc(100% - .5 * 16px)}.menu-phone li ul.list-v ul{right:calc(100% - .5 * 16px)}#wrapper{max-width:1080px;margin:auto}@media screen and (min-width:2048px){#wrapper{max-width:55vw}}#wrapper .menu{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1 1;-ms-flex:1 1;flex:1 1;margin:0 16px 0 0}#wrapper .menu .list-v ul{left:calc(100% - .5 * 16px)}.menu-phone{display:-webkit-box;display:-moz-box;display:none;margin-top:16px;right:8px;transition:all .28s ease;-webkit-transition:all .28s ease;-khtml-transition:all 0.28s ease;-moz-transition:all .28s ease;-o-transition:all .28s ease;-ms-transition:all .28s ease}.menu-phone ul{right:calc(100% - .5 * 16px)}@media screen and (max-width:500px){.menu-phone{display:-webkit-box;display:-moz-box;display:block}}.l_header{max-width:65vw;left:calc((100% - 65vw) * .5);border-bottom-left-radius:8px;border-bottom-right-radius:8px}@media screen and (max-width:2048px){.l_header{max-width:1112px;left:calc((100% - 1112px) * .5)}}@media screen and (max-width:1112px){.l_header{left:0;border-radius:0;-webkit-border-radius:0;max-width:100%}}@media screen and (max-width:500px){.l_header .container{margin-left:0;margin-right:0}.l_header #wrapper .nav-main .title{padding-left:16px;padding-right:16px}.l_header #wrapper .nav-sub{width:100%}.l_header #wrapper .nav-sub .title{overflow-y:scroll;margin-top:2px;padding:8px 16px}.l_header #wrapper .switcher{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;display:flex;margin-right:8px}.l_header .menu{display:-webkit-box;display:-moz-box;display:none}}@media screen and (max-width:500px){.list-v li{max-width:270px}}#u-search{display:-webkit-box;display:-moz-box;display:none;position:fixed;top:0;left:0;width:100%;height:100%;padding:60px 20px;z-index:1001}@media screen and (max-width:680px){#u-search{padding:0}}@media screen and (prefers-color-scheme:dark) and (max-width:500px){.l_header .m_search{background:var(--color-site-bg)!important}}.cover-wrapper .cover-body .subtitle{font-size:.875rem}.fa-brands.color-github,.fa-duotone.color-github,.fa-light.color-github,.fa-regular.color-github,.fa-solid.color-github,.fa-thin.color-github,.fa.color-github,.fad.color-github,.fal.color-github,.far.color-github,.fas.color-github,.iziToast>.iziToast-body .iziToast-icon.color-github{color:#000}.fa-brands.color-friends,.fa-duotone.color-friends,.fa-light.color-friends,.fa-regular.color-friends,.fa-solid.color-friends,.fa-thin.color-friends,.fa.color-friends,.fad.color-friends,.fal.color-friends,.far.color-friends,.fas.color-friends,.iziToast>.iziToast-body .iziToast-icon.color-friends{color:#d31ee9}.fa-brands.color-about,.fa-duotone.color-about,.fa-light.color-about,.fa-regular.color-about,.fa-solid.color-about,.fa-thin.color-about,.fa.color-about,.fad.color-about,.fal.color-about,.far.color-about,.fas.color-about,.iziToast>.iziToast-body .iziToast-icon.color-about{color:#0095ff}.fa-brands.color-travellings,.fa-duotone.color-travellings,.fa-light.color-travellings,.fa-regular.color-travellings,.fa-solid.color-travellings,.fa-thin.color-travellings,.fa.color-travellings,.fad.color-travellings,.fal.color-travellings,.far.color-travellings,.fas.color-travellings,.iziToast>.iziToast-body .iziToast-icon.color-travellings{color:#734ae6}mjx-container{padding:0 0!important}mjx-container:not([display=true]){padding:4px 2px 4px 6px!important}mjx-container[jax=SVG]{direction:ltr}mjx-container[jax=SVG]>svg{overflow:visible}mjx-container[jax=SVG][display=true]{display:-webkit-box;display:-moz-box;display:block;text-align:center;margin:1em 0}mjx-container[jax=SVG][justify=left]{text-align:left}mjx-container[jax=SVG][justify=right]{text-align:right}g[data-mml-node=merror]>g{fill:#f00;stroke:#f00}g[data-mml-node=merror]>rect[data-background]{fill:#ff0;stroke:none}g[data-mml-node=mtable]>line[data-line]{stroke-width:70px;fill:none}g[data-mml-node=mtable]>rect[data-frame]{stroke-width:70px;fill:none}g[data-mml-node=mtable]>.mjx-dashed{stroke-dasharray:140}g[data-mml-node=mtable]>.mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}g[data-mml-node=mtable]>svg{overflow:visible}[jax=SVG] mjx-tool{display:-webkit-box;display:-moz-box;display:inline-block;position:relative;width:0;height:0}[jax=SVG] mjx-tool>mjx-tip{position:absolute;top:0;left:0}mjx-tool>mjx-tip{display:-webkit-box;display:-moz-box;display:inline-block;padding:.2em;border:1px solid #888;font-size:70%;background-color:#f8f8f8;color:#000;box-shadow:2px 2px 5px #aaa;-webkit-box-shadow:2px 2px 5px #aaa}g[data-mml-node=maction][data-toggle]{cursor:pointer}mjx-status{display:-webkit-box;display:-moz-box;display:block;position:fixed;left:1em;bottom:1em;min-width:25%;padding:.2em .4em;border:1px solid #888;font-size:90%;background-color:#f8f8f8;color:#000}foreignObject[data-mjx-xml]{font-family:initial;line-height:normal;overflow:visible}.MathJax path{stroke-width:3}mjx-container[display=true]{overflow:auto hidden}mjx-container[display=true]+br{display:-webkit-box;display:-moz-box;display:none}</style><link rel="stylesheet" href="/css/style.css" media="print" onload='this.media="all",this.onload=null'><noscript><link rel="stylesheet" href="/css/style.css"></noscript><script>let userColorScheme=localStorage.getItem("color-scheme");userColorScheme&&document.documentElement.setAttribute("color-scheme",userColorScheme)</script><script>window.MSInputMethodContext&&document.documentMode&&document.write('<style>html{overflow-x: hidden !important;overflow-y: hidden !important;}.kill-ie{text-align:center;height: 100%;margin-top: 15%;margin-bottom: 5500%;}.kill-t{font-size: 2rem;}.kill-c{font-size: 1.2rem;}#l_header,#l_body{display: none;}</style><div class="kill-ie"><span class="kill-t"><b>抱歉,您的浏览器无法访问本站</b></span><br/><span class="kill-c">微软已经于2016年终止了对 Internet Explorer (IE) 10 及更早版本的支持,<br/>继续使用存在极大的安全隐患,请使用当代主流的浏览器进行访问。</span><br/><a target="_blank" rel="noopener" href="https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/"><strong>了解详情 ></strong></a></div>')</script><noscript><style>html{overflow-x:hidden!important;overflow-y:hidden!important}.kill-noscript{text-align:center;height:100%;margin-top:15%;margin-bottom:5500%}.kill-t{font-size:2rem}.kill-c{font-size:1.2rem}#l_body,#l_header{display:none}</style><div class="kill-noscript"> <span class="kill-t"><b>抱歉,您的浏览器无法访问本站</b></span><br> <span class="kill-c">本页面需要浏览器支持(启用)JavaScript</span><br> <a target="_blank" rel="external nofollow noopener noreferrer" href="https://www.baidu.com/s?wd=启用JavaScript"><strong>了解详情 ></strong></a></div></noscript><script>function volantisEventListener(e,t,n){this.type=e,this.f=t,this.ele=n}function volantisDom(e){return e||(e=document.createElement("div")),this.ele=e,this.ele.find=e=>{let t=this.ele.querySelector(e);if(t)return new volantisDom(t)},this.ele.hasClass=e=>this.ele.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)")),this.ele.addClass=e=>(this.ele.classList.add(e),this.ele),this.ele.removeClass=e=>(this.ele.classList.remove(e),this.ele),this.ele.toggleClass=e=>(this.ele.hasClass(e)?this.ele.removeClass(e):this.ele.addClass(e),this.ele),this.ele.on=(e,t,n=1)=>(this.ele.addEventListener(e,t,!1),n&&volantis.EventListener.list.push(new volantisEventListener(e,t,this.ele)),this.ele),this.ele.click=(e,t)=>(this.ele.on("click",e,t),this.ele),this.ele.scroll=(e,t)=>(this.ele.on("scroll",e,t),this.ele),this.ele.html=e=>(this.ele.innerHTML=e,this.ele),this.ele.hide=e=>(this.ele.style.display="none",this.ele),this.ele.show=e=>(this.ele.style.display="block",this.ele),this.ele}function RunItem(){function e(e,t){this.name=t||volantis.getFunctionHash(e),this.run=()=>{try{e()}catch(e){console.log(e)}}}this.list=[],this.start=()=>{for(var e=0;e<this.list.length;e++)this.list[e].run()},this.push=(t,n,o=!0)=>{if("function"!=typeof t)return;let l=t;o&&(l=()=>{volantis.requestAnimationFrame(t)}),n=n||volantis.getFunctionHash(t);const i=this.list.findIndex((e=>e.name===n));-1===i?this.list.push(new e(l,n)):this.list[i]=new e(l,n)},this.remove=e=>{for(let t=0;t<this.list.length;t++){this.list[t].name==e&&this.list.splice(t,1)}}}function errorImgAvatar(e){e.src="https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/placeholder/avatar/round/3442075.svg",e.onerror=null}function errorImgCover(e){e.src="https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/placeholder/cover/76b86c0226ffd.svg",e.onerror=null}!function(){const e=new WeakMap,t=new Proxy({},{get(n,o){const l=e.get(t);return l?.[o]},set(n,o,l){e.has(t)||e.set(t,Object.create(null));return e.get(t)[o]=l,!0},deleteProperty(n,o){const l=e.get(t);return!(!l||!Object.prototype.hasOwnProperty.call(l,o))&&(delete l[o],0===Object.keys(l).length&&e.delete(t),!0)},ownKeys(n){const o=e.get(t);return o?Object.keys(o):[]},getOwnPropertyDescriptor(n,o){const l=e.get(t);if(l&&Object.prototype.hasOwnProperty.call(l,o))return{value:l[o],writable:!0,enumerable:!0,configurable:!0}}});Object.defineProperty(window,"volantis",{value:t,writable:!0,configurable:!0,enumerable:!0})}(),volantis.debug="false",volantis.dom={},volantis.simpleTextHash=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n),t&=t;return t.toString(16).padStart(8,"0")},volantis.getFunctionHash=e=>{const t=e.toString();return volantis.simpleTextHash(t)},volantis.EventListener={},volantis.EventListener.list=[],volantis.EventListener.remove=()=>{volantis.EventListener.list.forEach((function(e){e.ele.removeEventListener(e.type,e.f,!1)})),volantis.EventListener.list=[]},volantis.dom.$=e=>e?new volantisDom(e):null,volantis.pjax={},volantis.pjax.method={complete:new RunItem,error:new RunItem,send:new RunItem},volantis.pjax=Object.assign(volantis.pjax,{push:volantis.pjax.method.complete.push,error:volantis.pjax.method.error.push,send:volantis.pjax.method.send.push}),volantis.rightmenu={},volantis.rightmenu.method={handle:new RunItem},volantis.rightmenu=Object.assign(volantis.rightmenu,{handle:volantis.rightmenu.method.handle.push}),volantis.dark={},volantis.dark.method={toggle:new RunItem},volantis.dark=Object.assign(volantis.dark,{push:volantis.dark.method.toggle.push}),volantis.js=(e,t)=>new Promise((n=>{setTimeout((function(){var o=document.getElementsByTagName("head")[0]||document.documentElement,l=document.createElement("script");if(l.setAttribute("type","text/javascript"),t)if(JSON.stringify(t))for(let e in t)"onload"==e?l[e]=()=>{t[e](),n()}:(l[e]=t[e],l.onload=n);else l.onload=()=>{t(),n()};else l.onload=n;l.setAttribute("src",e),o.appendChild(l)}))})),volantis.css=e=>new Promise((t=>{setTimeout((function(){var n=document.createElement("link");n.rel="stylesheet",n.href=e,n.onload=t,document.getElementsByTagName("head")[0].appendChild(n)}))})),volantis.import={jQuery:()=>"undefined"==typeof jQuery?volantis.js("https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"):new Promise((e=>{e()}))},volantis.throttle=(e,t=200)=>{let n=0;return function(...o){const l=Date.now();l-n>=t&&(e.apply(this,o),n=l)}},volantis.debounce=(e,t=200)=>{let n=null;return function(){n&&clearTimeout(n),n=setTimeout((()=>{e.apply(this,arguments),n=null}),t)}},volantis.requestAnimationFrame=e=>(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)}),window.requestAnimationFrame(e)),volantis.layoutHelper=(e,t,n)=>{function o(e,t,n){volantis.tempDiv=document.createElement("div"),volantis.tempDiv.innerHTML=t;let o=document.querySelector("#layoutHelper-"+e);o&&(n&&(o.innerHTML=""),o.append(volantis.tempDiv))}n=Object.assign({clean:!1,pjax:!0},n),o(e,t,n.clean),n.pjax&&volantis.pjax.push((()=>{o(e,t,n.clean)}),"layoutHelper-"+e)},volantis.scroll={engine:new RunItem,unengine:new RunItem},volantis.scroll=Object.assign(volantis.scroll,{push:volantis.scroll.engine.push}),volantis.scroll.getScrollTop=()=>{let e;return window.pageYOffset?e=window.pageYOffset:document.compatMode&&"BackCompat"!=document.compatMode?e=document.documentElement.scrollTop:document.body&&(e=document.body.scrollTop),e},volantis.scroll.scrollHeight=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},volantis.scroll.offsetHeight=function(){return Math.min(document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},volantis.scroll.progress=function(){return volantis.scroll.getScrollTop()/(volantis.scroll.scrollHeight()-volantis.scroll.offsetHeight())},volantis.scroll.handleScrollEvents=()=>{volantis.scroll.lastScrollTop=volantis.scroll.getScrollTop(),volantis.requestAnimationFrame((function e(){const t=volantis.scroll.getScrollTop();volantis.scroll.lastScrollTop!==t?(volantis.scroll.del=t-volantis.scroll.lastScrollTop,volantis.scroll.lastScrollTop=t,volantis.scroll.unengine.list=[],volantis.scroll.engine.start()):volantis.scroll.unengine.start(),volantis.requestAnimationFrame(e)}))},volantis.scroll.handleScrollEvents(),volantis.scroll.ele=null,volantis.scroll.to=(e,t={})=>{e&&(volantis.scroll.ele=e,opt={top:e.getBoundingClientRect().top+document.documentElement.scrollTop,behavior:"smooth"},"top"in t&&(opt.top=t.top),"behavior"in t&&(opt.behavior=t.behavior),"addTop"in t&&(opt.top+=t.addTop),"observerDic"in t||(t.observerDic=100),window.scrollTo(opt),t.observer&&setTimeout((()=>{volantis.scroll.ele==e&&volantis.scroll.unengine.push((()=>{let n=e.getBoundingClientRect().top;n>=-t.observerDic&&n<=t.observerDic||volantis.scroll.to(e,t),volantis.scroll.unengine.remove("unengineObserver")}),"unengineObserver")}),1e3))},volantis.cleanContentVisibility=()=>{document.querySelector(".post-story")&&(console.log("cleanContentVisibility"),document.querySelectorAll(".post-story").forEach((e=>{e.classList.remove("post-story")})))};const nativeSetTimeout=window.setTimeout,nativeSetInterval=window.setInterval,nativeClearTimeout=window.clearTimeout,nativeClearInterval=window.clearInterval;volantis.activeTimeout=[],volantis.activeInterval=[],window.setTimeout=function(e,t,...n){const o=nativeSetTimeout((function(...t){try{return e.apply(this,t)}finally{const e=volantis.activeTimeout.indexOf(o);-1!==e&&volantis.activeTimeout.splice(e,1)}}),t,...n);return volantis.activeTimeout.push(o),o},window.setInterval=function(e,t,...n){const o=nativeSetInterval(e,t,...n);return volantis.activeInterval.push(o),o},window.clearTimeout=function(e){nativeClearTimeout(e);const t=volantis.activeTimeout.indexOf(e);-1!==t&&volantis.activeTimeout.splice(t,1)},window.clearInterval=function(e){nativeClearInterval(e);const t=volantis.activeInterval.indexOf(e);-1!==t&&volantis.activeInterval.splice(t,1)},volantis.getActiveInterval=function(){return[...volantis.activeInterval]},volantis.getActiveTimeout=function(){return[...volantis.activeTimeout]},volantis.clearAllTimers=function(){volantis.getActiveInterval().forEach((function(e){clearInterval(e)})),volantis.getActiveTimeout().forEach((function(e){clearTimeout(e)}))},volantis.pjax.send(volantis.clearAllTimers,"clearAllTimers")</script><script>volantis.GLOBAL_CONFIG={root:"/",debug:!1,default:{avatar:"https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/placeholder/avatar/round/3442075.svg",link:"https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/placeholder/link/8f277b4ee0ecd.svg",cover:"https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/placeholder/cover/76b86c0226ffd.svg",image:"https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/media/placeholder/image/2659360.svg"},lastupdate:new Date(1779510804521),cdn:{izitoast_css:"https://cdn.bootcdn.net/ajax/libs/izitoast/1.4.0/css/iziToast.min.css",izitoast_js:"https://cdn.bootcdn.net/ajax/libs/izitoast/1.4.0/js/iziToast.min.js",fancybox_css:"https://cdn.bootcdn.net/ajax/libs/fancyapps-ui/4.0.31/fancybox.min.css",fancybox_js:"https://cdn.bootcdn.net/ajax/libs/fancyapps-ui/4.0.31/fancybox.umd.min.js"},sidebar:{for_page:["blogger","navigation","webinfo"],for_post:["toc"],webinfo:{lastupd:{enable:!1,friendlyShow:!0},runtime:{data:"2019/08/19",unit:"天"}}},plugins:{message:{enable:!1,icon:{default:"fa-solid fa-info-circle light-blue",quection:"fa-solid fa-question-circle light-blue"},time:{default:5e3,quection:2e4},position:"topRight",transitionIn:"bounceInLeft",transitionOut:"fadeOutRight",titleColor:"var(--color-text)",messageColor:"var(--color-text)",backgroundColor:"var(--color-card)",zindex:2147483647,copyright:{enable:!0,title:"知识共享许可协议",message:"请遵守 CC BY-NC-SA 4.0 协议。",icon:"far fa-copyright light-blue"},aplayer:{enable:!0,play:"fa-solid fa-play",pause:"fa-solid fa-pause"},rightmenu:{enable:!0,notice:!0}},aplayer:{id:1480000098,enable:!0}},search:{dataPath:("/".endsWith("/")?"/":"//")+"content.json"},languages:{search:{hits_empty:"找不到您查询的内容:${query}",hits_stats:"找到 ${hits} 条结果,用时 ${time} 毫秒"}}}</script><script type="application/ld+json">[{"@context":"http://schema.org","@type":"Organization","name":"MHuiG Magicland","url":"https://blog.mhuig.top/","logo":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png","width":192,"height":192}},{"@context":"http://schema.org","@type":"Person","name":"MHuiG","image":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png"},"url":"https://blog.mhuig.top/","sameAs":["https://github.com/MHuiG","https://twitter.com/iMHuiG","https://t.me/MHuiG","https://keybase.io/MHuiG"],"description":"「Be Yourself, Make a Difference.」"},{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https://blog.mhuig.top/","name":"Magicland"}},{"@type":"ListItem","position":2,"item":{"@id":"https://blog.mhuig.top/categories/数学/","name":"数学"}},{"@type":"ListItem","position":2,"item":{"@id":"https://blog.mhuig.top/categories/数学/P-2000/","name":"P-2000"}},{"@type":"ListItem","position":3,"item":{"@id":"https://blog.mhuig.top/notes/P-2000/7.html","name":"P-2000问题与子集和问题的计算复杂性关联分析"}}]},{"@context":"http://schema.org","@type":"WebSite","name":"MHuiG Magicland","url":"https://blog.mhuig.top/","keywords":"MHuiG, @MHuiG, Blog, 博客, Magicland, 魔法世界","description":"宠辱不惊,看庭前花开花落;去留无意,望天上云卷云舒。「Be Yourself, Make a Difference.」 - Magic Island","author":{"@type":"Person","name":"MHuiG","image":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png"},"url":"https://blog.mhuig.top/","description":"「Be Yourself, Make a Difference.」"},"publisher":{"@type":"Organization","name":"MHuiG Magicland","url":"https://blog.mhuig.top/","logo":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png","width":192,"height":192}},"potentialAction":{"@type":"SearchAction","name":"Coco | The Cat of MHuiG","target":{"@type":"EntryPoint","urlTemplate":"https://blog.mhuig.top/havefun/Coco/?s={search_term_string}"},"query-input":"required name=search_term_string"}},{"@context":"http://schema.org","@type":"BlogPosting","headline":"P-2000问题与子集和问题的计算复杂性关联分析","description":"P-2000问题要求统计集合{1,2,...,2000}中元素和为素数的子集数量,是组合枚举与数论分析结合的经典难题。其本质困难推动研究者探索与计算复杂性理论的关联,通过动态规划与素数筛选结合建立求解框架,时间复杂度为O(n·S_max + S_max·log log S_max)。研究表明经典子集和问题可多项式归约到该问题,强化了#P类与NP类问题的难度分野。","inLanguage":"zh-Hans","mainEntityOfPage":{"@type":"WebPage","@id":"https://blog.mhuig.top/notes/P-2000/7"},"author":{"@type":"Person","name":"MHuiG","image":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png"},"url":"https://blog.mhuig.top/"},"publisher":{"@type":"Organization","name":"MHuiG Magicland","logo":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png","width":192,"height":192}},"url":"https://blog.mhuig.top/notes/P-2000/7","wordCount":0,"datePublished":"2025-12-09T09:23:00.000Z","dateModified":"2025-12-09T09:25:00.000Z","articleSection":"数学","keywords":"Math,P-2000问题,Sharp-P完全性,子集和问题","image":{"@type":"ImageObject","url":"/lib/favicon/android-chrome-192x192.png","width":192,"height":192}}]</script></head><body itemscope="" itemtype="http://schema.org/WebPage"><pjax></pjax><header itemscope="" itemtype="http://schema.org/WPHeader" id="l_header" class="l_header auto shadow floatable blur show" style="opacity:0"><div class="container"><div id="wrapper"><div class="nav-sub"><p class="title"></p><ul class="switcher nav-list-h m-phone" id="pjax-header-nav-list"><li><a id="s-comment" class="fa-solid fa-comments fa-fw" target="_self" title="comment"></a></li><li><a id="s-toc" class="s-toc fa-solid fa-list fa-fw" target="_self" title="toc"></a></li></ul></div><div class="nav-main"> <a class="title flat-box" target="_self" href="/">MHuiG</a><div class="menu navigation"><ul class="nav-list-h m-pc"><li><a class="menuitem flat-box faa-parent animated-hover" title="索引"><i class="fa-duotone fa-list-alt fa-fw"></i> 索引</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/notes/" title="便签" active-action="action-notes"><i class="fa-duotone fa-books fa-fw"></i> 便签</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/categories/" title="分类" active-action="action-categories"><i class="fa-duotone fa-folder-open fa-fw"></i> 分类</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/tags/" title="标签" active-action="action-tags"><i class="fa-duotone fa-tags fa-fw"></i> 标签</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/archives/" title="归档" active-action="action-archives"><i class="fa-duotone fa-archive fa-fw"></i> 归档</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/friends/" title="友链" active-action="action-pagesfriends"><i class="fa-duotone fa-link fa-fw"></i> 友链</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="https://www.travellings.cn/go-by-clouds.html" title="Travelling" target="_blank" active-action="action-https:wwwtravellingscngo-by-cloudshtml" rel="external nofollow noopener noreferrer"><i class="fa-duotone fa-subway fa-fw"></i> Travelling</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/about/" title="关于" active-action="action-pagesabout"><i class="fa-duotone fa-user-tie fa-fw"></i> 关于</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/time-machine/" title="时光机" active-action="action-pagestime-machine"><i class="fa-duotone fa-clock fa-fw"></i> 时光机</a></li><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="noopener" href="https://mhuig.top/privacy-policy/" title="隐私政策" active-action="action-https:mhuigtopprivacy-policy"><i class="fa-duotone fa-user-secret fa-fw"></i> 隐私政策</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover" title="更多"><i class="fa-duotone fa-fan fa-spin fa-fw"></i> 更多</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/beer/" title="Sponsor" active-action="action-pagesbeer"><i class="fa-duotone fa-heart-square fa-fw"></i> Sponsor</a></li><hr><li><a class="menuitem flat-box faa-parent animated-hover" title="博客管理"><i class="fa-duotone fa-user-shield fa-fw"></i> 博客管理</a><ul class="list-v"><li><a class="menuitem flat-box header toggle-mode-btn"><i class="fa-duotone fa-bat fa-fw"></i> 暗黑模式</a></li><li></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/rss/" title="RSS订阅" active-action="action-pagesrss"><i class="fa-duotone fa-rss fa-fw"></i> RSS订阅</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/sitemap.xml" title="站点地图" active-action="action-sitemapxml"><i class="fa-duotone fa-sitemap fa-fw"></i> 站点地图</a></li><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://mhuig.instatus.com/" title="Monitors" active-action="action-https:mhuiginstatuscom"><i class="fa-duotone fa-telescope fa-fw"></i> Monitors</a></li><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://ssl.mhuig.top/" title="SSL Status" active-action="action-https:sslmhuigtop"><i class="fa-brands fa-expeditedssl fa-fw"></i> SSL Status</a></li></ul></li><hr><li><a class="menuitem flat-box faa-parent animated-hover" title="工具箱"><i class="fa-duotone fa-tools fa-fw"></i> 工具箱</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://rssbox.mhuig.top/" title="RSS Box" active-action="action-https:rssboxmhuigtop"><i class="fa-duotone fa-conveyor-belt-boxes fa-fw"></i> RSS Box</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/havefun/Coco/" title="My Cat" active-action="action-havefunCoco"><i class="fa-duotone fa-cat fa-fw"></i> My Cat</a></li><li><a class="menuitem flat-box"><i class="fa-duotone fa-compact-disc fa-spin fa-fw music"></i> Music</a><ul class="list-v"><li><div class="aplayer-container"><div class="aplayer-local"></div></div></li></ul></li><li></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/talk/" title="碎言碎语" active-action="action-pagestalk"><i class="fa-duotone fa-comments fa-fw"></i> 碎言碎语</a></li></ul></li><hr><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://github.com/MHuiG" title="GitHub" active-action="action-https:githubcomMHuiG"><i class="fa-brands fa-github fa-fw"></i> GitHub</a></li></ul></li></ul></div><div class="m_search"><form name="searchform" class="form u-search-form"><i class="icon fa-solid fa-search fa-fw"></i> <input type="text" class="input u-search-input" placeholder="Search..."></form></div><ul class="switcher nav-list-h m-phone"><li><a class="s-search fa-solid fa-search fa-fw" target="_self" title="search"></a></li><li><a class="s-menu fa-solid fa-bars fa-fw" target="_self" title="menu"></a><ul class="menu-phone list-v navigation white-box"><li><a class="menuitem flat-box faa-parent animated-hover" title="索引"><i class="fa-duotone fa-list-alt fa-fw"></i> 索引</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/notes/" title="便签" active-action="action-notes"><i class="fa-duotone fa-books fa-fw"></i> 便签</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/categories/" title="分类" active-action="action-categories"><i class="fa-duotone fa-folder-open fa-fw"></i> 分类</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/tags/" title="标签" active-action="action-tags"><i class="fa-duotone fa-tags fa-fw"></i> 标签</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/archives/" title="归档" active-action="action-archives"><i class="fa-duotone fa-archive fa-fw"></i> 归档</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/friends/" title="友链" active-action="action-pagesfriends"><i class="fa-duotone fa-link fa-fw"></i> 友链</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="https://www.travellings.cn/go-by-clouds.html" title="Travelling" target="_blank" active-action="action-https:wwwtravellingscngo-by-cloudshtml" rel="external nofollow noopener noreferrer"><i class="fa-duotone fa-subway fa-fw"></i> Travelling</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/about/" title="关于" active-action="action-pagesabout"><i class="fa-duotone fa-user-tie fa-fw"></i> 关于</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/time-machine/" title="时光机" active-action="action-pagestime-machine"><i class="fa-duotone fa-clock fa-fw"></i> 时光机</a></li><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="noopener" href="https://mhuig.top/privacy-policy/" title="隐私政策" active-action="action-https:mhuigtopprivacy-policy"><i class="fa-duotone fa-user-secret fa-fw"></i> 隐私政策</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover" title="更多"><i class="fa-duotone fa-fan fa-spin fa-fw"></i> 更多</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/beer/" title="Sponsor" active-action="action-pagesbeer"><i class="fa-duotone fa-heart-square fa-fw"></i> Sponsor</a></li><hr><li><a class="menuitem flat-box faa-parent animated-hover" title="博客管理"><i class="fa-duotone fa-user-shield fa-fw"></i> 博客管理</a><ul class="list-v"><li><a class="menuitem flat-box header toggle-mode-btn"><i class="fa-duotone fa-bat fa-fw"></i> 暗黑模式</a></li><li></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/rss/" title="RSS订阅" active-action="action-pagesrss"><i class="fa-duotone fa-rss fa-fw"></i> RSS订阅</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/sitemap.xml" title="站点地图" active-action="action-sitemapxml"><i class="fa-duotone fa-sitemap fa-fw"></i> 站点地图</a></li><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://mhuig.instatus.com/" title="Monitors" active-action="action-https:mhuiginstatuscom"><i class="fa-duotone fa-telescope fa-fw"></i> Monitors</a></li><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://ssl.mhuig.top/" title="SSL Status" active-action="action-https:sslmhuigtop"><i class="fa-brands fa-expeditedssl fa-fw"></i> SSL Status</a></li></ul></li><hr><li><a class="menuitem flat-box faa-parent animated-hover" title="工具箱"><i class="fa-duotone fa-tools fa-fw"></i> 工具箱</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://rssbox.mhuig.top/" title="RSS Box" active-action="action-https:rssboxmhuigtop"><i class="fa-duotone fa-conveyor-belt-boxes fa-fw"></i> RSS Box</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/havefun/Coco/" title="My Cat" active-action="action-havefunCoco"><i class="fa-duotone fa-cat fa-fw"></i> My Cat</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/pages/talk/" title="碎言碎语" active-action="action-pagestalk"><i class="fa-duotone fa-comments fa-fw"></i> 碎言碎语</a></li></ul></li><hr><li><a class="menuitem flat-box faa-parent animated-hover" target="_blank" rel="external nofollow noopener noreferrer" href="https://github.com/MHuiG" title="GitHub" active-action="action-https:githubcomMHuiG"><i class="fa-brands fa-github fa-fw"></i> GitHub</a></li></ul></li></ul></li></ul></div></div></div></header><div id="l_body"><div id="l_cover"><div id="none" class="cover-wrapper docs featured" style="display:none"><div class="cover-bg lazyload placeholder" data-bg=""></div><div class="cover-body"><div class="top"><p class="title">Magicland</p><p class="subtitle">「看庭前花开花落,望天上云卷云舒」</p></div><div class="bottom"><div class="menu navigation"><div class="list-h"><a target="_blank" rel="external nofollow noopener noreferrer" href="https://github.com/MHuiG" active-action="action-https:githubcomMHuiG"><i class="fa-brands fa-github color-github fa-fw"></i><p>Github</p></a><a href="/pages/friends/" active-action="action-pagesfriends"><i class="fa-duotone fa-link color-friends fa-fw"></i><p>友链</p></a><a href="/pages/about/" active-action="action-pagesabout"><i class="fa-duotone fa-user-tie color-about fa-fw"></i><p>关于</p></a><a href="https://www.travellings.cn/go-by-clouds.html" target="_blank" active-action="action-https:wwwtravellingscngo-by-cloudshtml" rel="external nofollow noopener noreferrer"><i class="fa-duotone fa-subway color-travellings fa-fw"></i><p>Travelling</p></a></div></div></div></div><div id="scroll-down" style="display:none"><i class="fa fa-chevron-down scroll-down-effects"></i></div></div></div><div id="safearea"><div class="body-wrapper"><div id="l_main" class=""><article itemscope="" itemtype="http://schema.org/Article" class="article post white-box reveal md shadow floatable blur article-type-docs" id="docs" itemprop="blogPost"><link itemprop="mainEntityOfPage" href="https://blog.mhuig.top/notes/P-2000/7"><span hidden="" itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization"><meta itemprop="name" content="Magicland"></span><span hidden="" itemprop="post" itemscope="" itemtype="http://schema.org/CreativeWork"><meta itemprop="name" content="P-2000问题与子集和问题的计算复杂性关联分析"><meta itemprop="description" content="P-2000问题要求统计集合{1,2,...,2000}中元素和为素数的子集数量,是组合枚举与数论分析结合的经典难题。其本质困难推动研究者探索与计算复杂性理论的关联,通过动态规划与素数筛选结合建立求解框架,时间复杂度为O(n·S_max + S_max·log log S_max)。研究表明经典子集和问题可多项式归约到该问题,强化了#P类与NP类问题的难度分野。"></span><span hidden=""><meta itemprop="image" content="/lib/favicon/android-chrome-192x192.png"></span><div class="article-meta" id="top"><span hidden="" itemprop="name headline"></span></div><div id="layoutHelper-page-plugins"></div><div id="post-body" itemprop="articleBody"><p> <span class="p logo center large">P-2000 问题与子集和问题的计算复杂性关联分析</span></p><br><h1 hidden="">P-2000 问题与子集和问题的计算复杂性关联分析</h1><div class="story post-story"><h2 id="问题背景与历史渊源"><a href="#问题背景与历史渊源" class="headerlink" title="问题背景与历史渊源"></a>问题背景与历史渊源</h2><p>P-2000 问题源于组合数学与数论的交叉领域,其核心是在集合<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="14.339ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6337.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\{1,2,\dots,2000\}"><g data-mml-node="mo" data-latex="\{"><path data-c="7B" d="M286-122 286 126C286 183 251 225 182 250 251 275 286 317 286 374L286 622C286 680 348 718 409 718 420 718 425 723 425 734 425 745 420 750 409 750 363 750 321 740 284 721 237 697 214 664 214 622L214 374C214 311 154 266 91 266 80 266 75 261 75 250 75 239 80 234 91 234 155 234 214 188 214 126L214-122C214-164 237-197 284-221 321-240 363-250 409-250 420-250 425-245 425-234 425-223 420-218 409-218 348-218 286-180 286-122Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(500,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(1000,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(1444.7,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(1944.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mo" transform="translate(2389.3,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106 664 106 638 83 638 53 638 23 664 0 695 0 725 0 751 23 751 53M475 53C475 83 449 106 419 106 388 106 363 83 363 53 363 23 388 0 419 0 449 0 475 23 475 53M200 53C200 83 174 106 143 106 113 106 87 83 87 53 87 23 113 0 143 0 173 0 200 23 200 53Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(3393,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mn" data-latex="000" transform="translate(3837.7,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g><g data-mml-node="mo" data-latex="\}" transform="translate(5837.7,0)"><path data-c="7D" d="M286 374 286 622C286 664 263 697 216 721 179 740 137 750 91 750 80 750 75 745 75 734 75 723 80 718 91 718 152 718 214 680 214 622L214 374C214 317 249 275 318 250 249 225 214 183 214 126L214-122C214-180 152-218 91-218 80-218 75-223 75-234 75-245 80-250 91-250 137-250 179-240 216-221 263-197 286-164 286-122L286 126C286 188 345 234 409 234 420 234 425 239 425 250 425 261 420 266 409 266 345 266 286 312 286 374Z"></path></g></g></g></svg></mjx-container> 的所有子集(共<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="4.519ex" height="1.887ex" role="img" focusable="false" viewBox="0 -833.9 1997.2 833.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="2^{2000}"><g data-mml-node="msup" data-latex="2^{2000}"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="TeXAtom" transform="translate(533,363) scale(0.707)" data-latex="{000}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="000"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></g></g></svg></mjx-container> 个)中,统计元素和为素数的子集数量。这一问题的研究可追溯至 20 世纪 70 年代计算复杂性理论兴起时期,当时类似的 "子集和素数计数" 问题被用于检验算法设计与复杂性归约的边界。与经典的子集和问题(判定是否存在和为目标值的子集)不同,P-2000 问题要求对所有可能的素数目标值进行计数,这使其兼具组合枚举与数论分析的双重挑战。</p><p>历史上,类似问题的小规模版本(如集合规模为 20 或 30)曾通过回溯法或动态规划求解,例如采用深度优先搜索 (DFS) 结合素数判断实现解决方案。但当集合规模扩展至 2000 时,直接枚举的复杂度达到<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="4.519ex" height="1.887ex" role="img" focusable="false" viewBox="0 -833.9 1997.2 833.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="2^{2000}"><g data-mml-node="msup" data-latex="2^{2000}"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="TeXAtom" transform="translate(533,363) scale(0.707)" data-latex="{000}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="000"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></g></g></svg></mjx-container> ,这在物理上是不可行的,即使每微秒处理<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.05ex" xmlns="http://www.w3.org/2000/svg" width="3.25ex" height="2.005ex" role="img" focusable="false" viewBox="0 -864 1436.6 886"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="10^{6}"><g data-mml-node="msup" data-latex="10^{6}"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{6}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="6"><path data-c="36" d="M383 504C416 504 432 521 432 555 432 627 378 666 304 666 221 666 155 627 106 548 63 480 42 403 42 316 42 189 65 100 112 47 152 1 198-22 251-22 312-22 362 1 401 47 438 91 457 144 457 205 457 266 439 318 403 361 365 407 316 431 257 431 205 431 165 402 138 346L138 352C138 465 166 561 226 605 252 624 279 633 306 633 342 633 368 623 385 602 351 602 334 583 334 553 334 525 355 504 383 504M344 340C355 317 361 272 361 206 361 141 356 98 345 76 325 35 294 14 251 14 222 14 200 24 184 44 171 60 162 74 158 85 146 116 140 163 140 227 140 255 144 282 151 308 164 355 201 399 256 399 295 399 325 379 344 340Z"></path></g></g></g></g></g></svg></mjx-container> 个子集,所需时间也远超宇宙年龄。因此,P-2000 问题的本质困难推动研究者探索其与计算复杂性理论中经典问题的关联。</p></div><div class="story post-story"><h2 id="核心定义与数学表述"><a href="#核心定义与数学表述" class="headerlink" title="核心定义与数学表述"></a>核心定义与数学表述</h2><h3 id="子集和素数计数问题的形式化定义"><a href="#子集和素数计数问题的形式化定义" class="headerlink" title="子集和素数计数问题的形式化定义"></a>子集和素数计数问题的形式化定义</h3><p>对于集合<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.459ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 645 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S = \{1,2,\dots,N\}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="14.196ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6274.4 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S = \{1,2,\dots,N\}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mo" data-latex="\{" transform="translate(1055.8,0)"><path data-c="7B" d="M286-122 286 126C286 183 251 225 182 250 251 275 286 317 286 374L286 622C286 680 348 718 409 718 420 718 425 723 425 734 425 745 420 750 409 750 363 750 321 740 284 721 237 697 214 664 214 622L214 374C214 311 154 266 91 266 80 266 75 261 75 250 75 239 80 234 91 234 155 234 214 188 214 126L214-122C214-164 237-197 284-221 321-240 363-250 409-250 420-250 425-245 425-234 425-223 420-218 409-218 348-218 286-180 286-122Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(1555.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(2055.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(2500.4,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(3000.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mo" transform="translate(3445.1,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106 664 106 638 83 638 53 638 23 664 0 695 0 725 0 751 23 751 53M475 53C475 83 449 106 419 106 388 106 363 83 363 53 363 23 388 0 419 0 449 0 475 23 475 53M200 53C200 83 174 106 143 106 113 106 87 83 87 53 87 23 113 0 143 0 173 0 200 23 200 53Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(4448.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mi" data-latex="N" transform="translate(4893.4,0)"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g><g data-mml-node="mo" data-latex="\}" transform="translate(5774.4,0)"><path data-c="7D" d="M286 374 286 622C286 664 263 697 216 721 179 740 137 750 91 750 80 750 75 745 75 734 75 723 80 718 91 718 152 718 214 680 214 622L214 374C214 317 249 275 318 250 249 225 214 183 214 126L214-122C214-180 152-218 91-218 80-218 75-223 75-234 75-245 80-250 91-250 137-250 179-240 216-221 263-197 286-164 286-122L286 126C286 188 345 234 409 234 420 234 425 239 425 250 425 261 420 266 409 266 345 266 286 312 286 374Z"></path></g></g></g></svg></mjx-container> (此处<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.993ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 881 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N=2000"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.914ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3055.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N=2000"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="000" transform="translate(1055.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></svg></mjx-container> ),定义:</p><p>子集和函数 :对任意子集<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.593ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 704 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="T \subseteq S"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.848ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1700.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="T \subseteq S"><g data-mml-node="mo" data-latex="\subseteq"><path data-c="2286" d="M669 87 378 87C309 87 252 110 204 158 156 206 132 264 132 333 132 402 156 460 204 508 252 556 309 579 378 579L669 579C685 579 693 587 693 603 693 619 685 627 669 627L378 627C296 627 227 599 170 542 113 485 85 415 85 333 85 251 113 181 170 124 227 67 296 39 378 39L669 39C685 39 693 47 693 63 693 76 682 87 669 87M669-80 130-80C115-80 107-88 107-103 107-119 115-127 130-127L669-127C685-127 693-119 693-103 693-91 682-80 669-80Z"></path></g><g data-mml-node="mi" data-latex="S" transform="translate(1055.8,0)"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg></mjx-container> ,记<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.602ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2034 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(T) = \sum_{x \in T} x"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705 400 705 357 665 334 586 329 568 318 517 302 433L237 433C215 433 204 432 204 411 204 400 214 395 235 395L295 395 222 8C211-49 201-91 192-119 180-156 163-175 141-175 126-175 114-171 103-164 135-159 151-140 151-108 151-82 138-69 111-69 77-69 53-99 53-133 53-177 94-205 141-205 166-205 189-195 208-174 240-141 265-94 283-31 294 8 304 46 311 84L369 395 451 395C474 395 484 396 484 419 484 428 474 433 454 433L377 433C383 474 411 625 420 644 430 665 444 675 462 675 477 675 490 671 501 664 470 657 454 639 454 608 454 582 467 569 494 569 528 569 552 599 552 633Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(941,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(1645,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.714ex" xmlns="http://www.w3.org/2000/svg" width="9.745ex" height="2.411ex" role="img" focusable="false" viewBox="0 -750 4307.4 1065.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(T) = \sum_{x \in T} x"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="munder" data-latex="\sum_{x\in T}" transform="translate(1055.8,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713 417 216 67-217C60-225 57-231 57-235 57-245 67-250 88-250L913-250 1001 5 967 5C954-33 933-66 902-95 825-166 719-188 565-188L152-188 490 232C497 240 500 246 500 250 500 254 498 259 493 266L175 702 560 702C682 702 764 691 854 644 907 616 944 571 967 510L1001 510 913 750 88 750C57 750 56 746 56 713Z"></path></g><g data-mml-node="TeXAtom" transform="translate(1089,-285.4) scale(0.707)" data-latex="{x\in T}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g><g data-mml-node="mo" data-latex="\in" transform="translate(572,0)"><path data-c="2208" d="M563 4 373 4C310 4 254 25 208 68 162 111 136 163 130 226L563 226C579 226 587 234 587 250 587 266 579 274 563 274L130 274C136 337 162 389 208 432 254 475 310 496 373 496L563 496C579 496 587 504 587 519 587 535 579 543 563 543L373 543C292 543 223 515 166 458 109 401 81 332 81 250 81 168 109 99 166 42 223-15 292-43 373-43L563-43C579-43 587-35 587-19 587-7 576 4 563 4Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(1239,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g></g></g><g data-mml-node="mi" data-latex="x" transform="translate(3735.4,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g></g></g></svg></mjx-container></p><p>素数计数目标 :计算集合<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="2.724ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1204 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\{ T \subseteq S \mid f(T) \in \mathbb{P} \}"><g data-mml-node="mo" data-latex="\{"><path data-c="7B" d="M286-122 286 126C286 183 251 225 182 250 251 275 286 317 286 374L286 622C286 680 348 718 409 718 420 718 425 723 425 734 425 745 420 750 409 750 363 750 321 740 284 721 237 697 214 664 214 622L214 374C214 311 154 266 91 266 80 266 75 261 75 250 75 239 80 234 91 234 155 234 214 188 214 126L214-122C214-164 237-197 284-221 321-240 363-250 409-250 420-250 425-245 425-234 425-223 420-218 409-218 348-218 286-180 286-122Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(500,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.848ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1700.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\{ T \subseteq S \mid f(T) \in \mathbb{P} \}"><g data-mml-node="mo" data-latex="\subseteq"><path data-c="2286" d="M669 87 378 87C309 87 252 110 204 158 156 206 132 264 132 333 132 402 156 460 204 508 252 556 309 579 378 579L669 579C685 579 693 587 693 603 693 619 685 627 669 627L378 627C296 627 227 599 170 542 113 485 85 415 85 333 85 251 113 181 170 124 227 67 296 39 378 39L669 39C685 39 693 47 693 63 693 76 682 87 669 87M669-80 130-80C115-80 107-88 107-103 107-119 115-127 130-127L669-127C685-127 693-119 693-103 693-91 682-80 669-80Z"></path></g><g data-mml-node="mi" data-latex="S" transform="translate(1055.8,0)"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.859ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2589.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\{ T \subseteq S \mid f(T) \in \mathbb{P} \}"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750 126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"></path></g><g data-mml-node="mi" data-latex="f" transform="translate(555.8,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705 400 705 357 665 334 586 329 568 318 517 302 433L237 433C215 433 204 432 204 411 204 400 214 395 235 395L295 395 222 8C211-49 201-91 192-119 180-156 163-175 141-175 126-175 114-171 103-164 135-159 151-140 151-108 151-82 138-69 111-69 77-69 53-99 53-133 53-177 94-205 141-205 166-205 189-195 208-174 240-141 265-94 283-31 294 8 304 46 311 84L369 395 451 395C474 395 484 396 484 419 484 428 474 433 454 433L377 433C383 474 411 625 420 644 430 665 444 675 462 675 477 675 490 671 501 664 470 657 454 639 454 608 454 582 467 569 494 569 528 569 552 599 552 633Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(1107.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(1496.8,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(2200.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.651ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2055.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\{ T \subseteq S \mid f(T) \in \mathbb{P} \}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4 373 4C310 4 254 25 208 68 162 111 136 163 130 226L563 226C579 226 587 234 587 250 587 266 579 274 563 274L130 274C136 337 162 389 208 432 254 475 310 496 373 496L563 496C579 496 587 504 587 519 587 535 579 543 563 543L373 543C292 543 223 515 166 458 109 401 81 332 81 250 81 168 109 99 166 42 223-15 292-43 373-43L563-43C579-43 587-35 587-19 587-7 576 4 563 4Z"></path></g><g data-mml-node="TeXAtom" data-latex="\mathbb{P}" data-mjx-texclass="ORD" transform="translate(944.8,0)"><g data-mml-node="mi" data-latex="P"><path data-c="2119" d="M599 495C599 565 572 615 518 644 469 671 410 685 342 685L53 685C28 685 16 678 16 663 16 649 26 642 47 642 95 642 98 638 98 590L98 95C98 48 95 43 49 43 27 43 16 36 16 22 16 4 30 0 53 0L318 0C342 0 354 7 354 22 354 36 344 43 323 43 271 43 267 45 267 95L267 304C280 304 287 304 288 303L323 303C470 303 599 360 599 495M438 631C517 610 557 565 557 495 557 428 516 382 435 359 454 390 464 436 464 496 464 556 455 601 438 631M421 496C421 429 410 387 388 369 370 354 345 347 312 347L267 347 267 593C267 630 279 642 322 642 409 642 421 591 421 496M134 642 233 642C227 631 224 616 224 596L224 93C224 72 226 55 230 43L134 43C138 55 140 72 140 93L140 592C140 613 138 630 134 642Z"></path></g></g><g data-mml-node="mo" data-latex="\}" transform="translate(1555.8,0)"><path data-c="7D" d="M286 374 286 622C286 664 263 697 216 721 179 740 137 750 91 750 80 750 75 745 75 734 75 723 80 718 91 718 152 718 214 680 214 622L214 374C214 317 249 275 318 250 249 225 214 183 214 126L214-122C214-180 152-218 91-218 80-218 75-223 75-234 75-245 80-250 91-250 137-250 179-240 216-221 263-197 286-164 286-122L286 126C286 188 345 234 409 234 420 234 425 239 425 250 425 261 420 266 409 266 345 266 286 312 286 374Z"></path></g></g></g></svg></mjx-container> 的基数,其中<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="1.382ex" height="1.55ex" role="img" focusable="false" viewBox="0 -685 611 685"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbb{P}"><g data-mml-node="TeXAtom" data-latex="\mathbb{P}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="P"><path data-c="2119" d="M599 495C599 565 572 615 518 644 469 671 410 685 342 685L53 685C28 685 16 678 16 663 16 649 26 642 47 642 95 642 98 638 98 590L98 95C98 48 95 43 49 43 27 43 16 36 16 22 16 4 30 0 53 0L318 0C342 0 354 7 354 22 354 36 344 43 323 43 271 43 267 45 267 95L267 304C280 304 287 304 288 303L323 303C470 303 599 360 599 495M438 631C517 610 557 565 557 495 557 428 516 382 435 359 454 390 464 436 464 496 464 556 455 601 438 631M421 496C421 429 410 387 388 369 370 354 345 347 312 347L267 347 267 593C267 630 279 642 322 642 409 642 421 591 421 496M134 642 233 642C227 631 224 616 224 596L224 93C224 72 226 55 230 43L134 43C138 55 140 72 140 93L140 592C140 613 138 630 134 642Z"></path></g></g></g></g></svg></mjx-container> 表示素数集合</p><p>该问题的输入规模为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="1.993ex" height="1.545ex" role="img" focusable="false" viewBox="0 -683 881 683"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g></g></g></svg></mjx-container> ,输出为满足条件的子集数量。关键约束包括:</p><p>子集和的取值范围:最小和为 0(空集),最大和为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2011.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } = \frac{N(N+1)}{2} = 2001000"><g data-mml-node="msub" data-latex="S_{\text{max}}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.781ex" xmlns="http://www.w3.org/2000/svg" width="9.492ex" height="3.143ex" role="img" focusable="false" viewBox="0 -1044.3 4195.5 1389.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } = \frac{N(N+1)}{2} = 2001000"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mfrac" data-latex="\frac{N(N+1)}{2}" transform="translate(1055.8,0)"><g data-mml-node="mrow" transform="translate(220,515.4) scale(0.707)" data-latex="N(N+1)"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(881,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="N" transform="translate(1270,0)"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g><g data-mml-node="mo" data-latex="+" transform="translate(2151,0)"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(2929,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(3429,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g><g data-mml-node="mn" transform="translate(1393.1,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><rect width="2899.7" height="60" x="120" y="220"></rect></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="10.307ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } = \frac{N(N+1)}{2} = 2001000"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="001000" transform="translate(1055.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(1500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(2000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(2500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(3000,0)"></path></g></g></g></svg></mjx-container> (全集)</p><p>素数判断的有效性:需验证区间<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.947ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3512.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[2, S_{\text{max} } ] "><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(278,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(778,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1222.7,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex="]" transform="translate(3234.6,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> 内的数是否为素数</p><p>计数的完备性:需遍历所有可能子集并统计符合条件的情况</p><h3 id="与子集和问题的关系"><a href="#与子集和问题的关系" class="headerlink" title="与子集和问题的关系"></a>与子集和问题的关系</h3><p>经典子集和问题(SUBSET - SUM)定义为:给定集合<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="1.697ex" height="1.62ex" role="img" focusable="false" viewBox="0 -716 750 716"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A"><g data-mml-node="mi" data-latex="A"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g></g></g></svg></mjx-container> 和目标<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> ,判定是否存在子集<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="2.536ex" height="2.265ex" role="img" focusable="false" viewBox="0 -751.2 1120.8 1001.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A' \subseteq A"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="A"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g><g data-mml-node="mo" transform="translate(783,363) scale(0.707)"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96 110 96 332 463C337 472 340 482 340 493 340 523 314 549 284 549Z"></path></g></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.085ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1805.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A' \subseteq A"><g data-mml-node="mo" data-latex="\subseteq"><path data-c="2286" d="M669 87 378 87C309 87 252 110 204 158 156 206 132 264 132 333 132 402 156 460 204 508 252 556 309 579 378 579L669 579C685 579 693 587 693 603 693 619 685 627 669 627L378 627C296 627 227 599 170 542 113 485 85 415 85 333 85 251 113 181 170 124 227 67 296 39 378 39L669 39C685 39 693 47 693 63 693 76 682 87 669 87M669-80 130-80C115-80 107-88 107-103 107-119 115-127 130-127L669-127C685-127 693-119 693-103 693-91 682-80 669-80Z"></path></g><g data-mml-node="mi" data-latex="A" transform="translate(1055.8,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g></g></g></svg></mjx-container> 使得<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.302ex" height="2.265ex" role="img" focusable="false" viewBox="0 -751.2 2343.5 1001.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\sum A' = t"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713 417 216 67-217C60-225 57-231 57-235 57-245 67-250 88-250L913-250 1001 5 967 5C954-33 933-66 902-95 825-166 719-188 565-188L152-188 490 232C497 240 500 246 500 250 500 254 498 259 493 266L175 702 560 702C682 702 764 691 854 644 907 616 944 571 967 510L1001 510 913 750 88 750C57 750 56 746 56 713Z"></path></g><g data-mml-node="msup" transform="translate(1222.7,0)"><g data-mml-node="mi" data-latex="A"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g><g data-mml-node="mo" transform="translate(783,363) scale(0.707)"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96 110 96 332 463C337 472 340 482 340 493 340 523 314 549 284 549Z"></path></g></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.205ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1416.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\sum A' = t"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mi" data-latex="t" transform="translate(1055.8,0)"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> 。该问题已被证明是 NP 完全的,即所有 NP 问题可多项式归约到它。P-2000 问题可视为 SUBSET - SUM 的 "计数变种" 与 "多目标变种" 的结合体,它要求对所有素数目标<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> 计算解的数量,而非仅判定特定<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> 是否存在解。</p></div><div class="story post-story"><h2 id="多种推导方法的详细展开"><a href="#多种推导方法的详细展开" class="headerlink" title="多种推导方法的详细展开"></a>多种推导方法的详细展开</h2><h3 id="动态规划基础框架"><a href="#动态规划基础框架" class="headerlink" title="动态规划基础框架"></a>动态规划基础框架</h3><h4 id="状态定义与转移方程"><a href="#状态定义与转移方程" class="headerlink" title="状态定义与转移方程"></a>状态定义与转移方程</h4><p>设<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.672ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2949 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[i] [s] "><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1301,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(1646,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1924,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(2202,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(2671,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> 表示前<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.781ex" height="1.52ex" role="img" focusable="false" viewBox="0 -661 345 672"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g></svg></mjx-container> 个元素构成的子集中和为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="1.061ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 469 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="s"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g></g></g></svg></mjx-container> 的子集数量。初始状态为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.093ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3135 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[0] [0] = 1"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="0" transform="translate(1301,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(1801,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(2079,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="0" transform="translate(2357,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(2857,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[0] [0] = 1"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(1055.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g></g></g></svg></mjx-container> (空集),<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.023ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3104 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[0] [s] = 0"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="0" transform="translate(1301,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(1801,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(2079,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(2357,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(2826,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[0] [s] = 0"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="0" transform="translate(1055.8,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path></g></g></g></svg></mjx-container> (<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.061ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 469 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="s > 0"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="s > 0"><g data-mml-node="mo" data-latex=">"><path data-c="3E" d="M686 227C696 232 701 239 701 250 701 261 696 268 686 273L112 545C109 546 105 547 101 547 85 547 77 539 77 522 77 513 82 506 91 502L625 250 91-2C82-6 77-13 77-22 77-39 85-47 101-47 105-47 109-46 112-45Z"></path></g><g data-mml-node="mn" data-latex="0" transform="translate(1055.8,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path></g></g></g></svg></mjx-container> )。对于第<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.781ex" height="1.52ex" role="img" focusable="false" viewBox="0 -661 345 672"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g></svg></mjx-container> 个元素<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="2.034ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 899 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_i = i"><g data-mml-node="msub" data-latex="x_i"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.169ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1400.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_i = i"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1055.8,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g></svg></mjx-container> ,转移方程为:</p><p><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true" width="full" style="min-width:83.454ex"><svg style="vertical-align:-1.923ex;min-width:83.454ex" xmlns="http://www.w3.org/2000/svg" width="100%" height="4.977ex" role="img" focusable="false"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(0.0181,-0.0181) translate(0, -1350)"><g data-mml-node="math" data-latex="
dp[i] [s] = \begin{cases} dp[i-1] [s] & \text{若 } s < i \text{(不选第 } i \text{ 个元素)} \\ dp[i-1] [s] + dp[i-1] [s - i] & \text{若 } s \geq i \text{(选或不选第 } i \text{ 个元素)} \end{cases}
"><g data-mml-node="mtable" data-latex="
dp[i] [s] = \begin{cases} dp[i-1] [s] & \text{若 } s < i \text{(不选第 } i \text{ 个元素)} \\ dp[i-1] [s] + dp[i-1] [s - i] & \text{若 } s \geq i \text{(选或不选第 } i \text{ 个元素)} \end{cases}
" transform="translate(2078,0) translate(-2078,0)"><g transform="translate(0 1350) matrix(1 0 0 -1 0 0) scale(55.25)"><svg data-table="true" preserveAspectRatio="xMidYMid" viewBox="16365.4 -1350 1 2200"><g transform="matrix(1 0 0 -1 0 0)"><g data-mml-node="mlabeledtr"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1301,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(1646,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1924,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(2202,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(2671,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="=" transform="translate(3226.8,0)"><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mrow" data-latex-item="{cases}" data-latex="{cases}" transform="translate(4282.6,0)"><g data-mml-node="mo"><path data-c="7B" d="M196 250C291 293 401 389 401 511L401 1035C401 1084 421 1131 460 1174 497 1215 541 1241 590 1253 602 1256 608 1264 608 1276 608 1292 600 1300 584 1300 581 1300 579 1300 578 1299 511 1286 447 1252 387 1195 334 1144 307 1091 307 1035L307 511C307 458 288 408 251 362 214 316 169 286 118 273 106 270 100 262 100 250 100 238 106 230 118 227 169 214 214 184 251 138 288 92 307 42 307-11L307-535C307-591 334-644 387-695 447-752 511-786 578-799 579-800 581-800 584-800 600-800 608-792 608-776 608-764 602-756 590-753 541-741 497-715 460-674 421-631 401-584 401-535L401-11C401 111 291 207 196 250Z"></path></g><g data-mml-node="mtable" transform="translate(707,0)"><g data-mml-node="mtr" transform="translate(0,600)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1301,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="-" transform="translate(1868.2,0)"><path data-c="2212" d="M698 270 80 270C64 270 56 263 56 250 56 237 64 230 80 230L698 230C714 230 722 237 722 250 722 262 710 270 698 270Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(2868.4,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(3368.4,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(3646.4,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(3924.4,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(4393.4,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g><g data-mml-node="mtd" transform="translate(13132.8,0)"><g data-mml-node="mtext" data-latex="\text{若 }"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">若</text><path data-c="A0" d="" transform="translate(1000,0)"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(1332,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="<" transform="translate(2078.8,0)"><path data-c="3C" d="M666-45C683-52 701-39 701-23 701-13 696-6 687-2L153 250 687 502C696 506 701 513 701 522 701 539 693 547 677 547 673 547 669 546 666 545L92 273C82 268 77 261 77 250 77 239 82 232 92 227Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(3134.6,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mtext" data-latex="\text{(不选第 }" transform="translate(3479.6,0)"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">(不选第</text><path data-c="A0" d="" transform="translate(4000,0)"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(7811.6,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mtext" data-latex="\text{ 个元素)}" transform="translate(8156.6,0)"><path data-c="A0" d=""></path><text data-variant="normal" transform="translate(332,0) scale(1,-1)" font-size="884px" font-family="serif">个元素)</text></g></g></g><g data-mml-node="mtr" transform="translate(0,-600)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1301,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="-" transform="translate(1868.2,0)"><path data-c="2212" d="M698 270 80 270C64 270 56 263 56 250 56 237 64 230 80 230L698 230C714 230 722 237 722 250 722 262 710 270 698 270Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(2868.4,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(3368.4,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(3646.4,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(3924.4,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(4393.4,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="+" transform="translate(4893.7,0)"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mi" data-latex="d" transform="translate(5893.9,0)"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(6413.9,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(6916.9,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(7194.9,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="-" transform="translate(7762.1,0)"><path data-c="2212" d="M698 270 80 270C64 270 56 263 56 250 56 237 64 230 80 230L698 230C714 230 722 237 722 250 722 262 710 270 698 270Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(8762.3,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(9262.3,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(9540.3,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(9818.3,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="-" transform="translate(10509.6,0)"><path data-c="2212" d="M698 270 80 270C64 270 56 263 56 250 56 237 64 230 80 230L698 230C714 230 722 237 722 250 722 262 710 270 698 270Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(11509.8,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(11854.8,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g><g data-mml-node="mtd" transform="translate(13132.8,0)"><g data-mml-node="mtext" data-latex="\text{若 }"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">若</text><path data-c="A0" d="" transform="translate(1000,0)"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(1332,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="\geq" transform="translate(2078.8,0)"><path data-c="2265" d="M684 310C694 315 699 322 699 333 699 344 694 352 684 357L110 629C107 630 103 631 99 631 83 631 75 623 75 606 75 597 80 590 89 586L623 333 89 80C80 76 75 69 75 60 75 43 83 35 99 35 103 35 107 36 110 38M678-72 100-72C84-72 76-80 76-95 76-111 84-119 100-119L678-119C694-119 702-111 702-95 702-83 691-72 678-72Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(3134.6,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mtext" data-latex="\text{(选或不选第 }" transform="translate(3479.6,0)"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">(选或不选第</text><path data-c="A0" d="" transform="translate(6000,0)"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(9811.6,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mtext" data-latex="\text{ 个元素)}" transform="translate(10156.6,0)"><path data-c="A0" d=""></path><text data-variant="normal" transform="translate(332,0) scale(1,-1)" font-size="884px" font-family="serif">个元素)</text></g></g></g></g><g data-mml-node="mo" transform="translate(28328.3,0) translate(0 250)"></g></g></g></g></g></svg><svg data-labels="true" preserveAspectRatio="xMaxYMid" viewBox="1278 -1350 1 2200"><g data-labels="true" transform="matrix(1 0 0 -1 0 0)"><g data-mml-node="mtd" id="mjx-eqn:1"><g data-mml-node="mtext" data-latex="\text{(1)}"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(389,0)"></path><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z" transform="translate(889,0)"></path></g></g></g></svg></g></g></g></g></svg></mjx-container></p><h4 id="复杂度分析"><a href="#复杂度分析" class="headerlink" title="复杂度分析"></a>复杂度分析</h4><p>时间复杂度:<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.819ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1688 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="n" transform="translate(1088,0)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18 427 18 420 28 420 47 420 61 426 84 438 115 478 224 498 296 498 333 498 403 451 442 381 442 322 442 271 416 230 363 222 407 187 442 136 442 80 442 58 390 44 345 34 313 29 294 29 287 29 278 34 273 45 273 50 273 53 274 56 276 61 285 64 292 65 299 83 375 106 413 133 413 151 413 160 399 160 371 160 358 155 331 144 290L87 63C84 50 78 24 78 19 78-1 89-11 111-11 130-11 144-1 151 19 153 24 159 49 170 92L191 181 221 295C232 318 249 341 270 365 299 397 335 413 378 413 411 413 427 391 427 348 427 310 406 234 363 120 356 102 353 87 353 74 353 25 390-11 438-11 482-11 517 14 542 64 561 104 571 131 571 144 571 153 566 158 555 158 552 158 537 149 537 137Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.564ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2901.1 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="mo" data-latex="\cdot"><path data-c="22C5" d="M192 250C192 279 168 303 139 303 110 303 86 279 86 250 86 221 110 197 139 197 168 197 192 221 192 250Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(500.2,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2512.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="9.375ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4143.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1754.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mn" data-latex="000" transform="translate(2143.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(1000.2,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.393ex" height="2.52ex" role="img" focusable="false" viewBox="0 -864 2825.8 1114"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="msup" data-latex="0^{6}" transform="translate(1000.2,0)"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{6}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="6"><path data-c="36" d="M383 504C416 504 432 521 432 555 432 627 378 666 304 666 221 666 155 627 106 548 63 480 42 403 42 316 42 189 65 100 112 47 152 1 198-22 251-22 312-22 362 1 401 47 438 91 457 144 457 205 457 266 439 318 403 361 365 407 316 431 257 431 205 431 165 402 138 346L138 352C138 465 166 561 226 605 252 624 279 633 306 633 342 633 368 623 385 602 351 602 334 583 334 553 334 525 355 504 383 504M344 340C355 317 361 272 361 206 361 141 356 98 345 76 325 35 294 14 251 14 222 14 200 24 184 44 171 60 162 74 158 85 146 116 140 163 140 227 140 255 144 282 151 308 164 355 201 399 256 399 295 399 325 379 344 340Z"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2436.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.981ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2643.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1754.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mn" data-latex="4" transform="translate(2143.8,0)"><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199 28 163 289 163 289 81C289 63 285 51 278 46 271 41 252 39 219 39L194 39 194 0C223 2 269 3 331 3 393 3 439 2 468 0L468 39 443 39C410 39 391 41 384 46 377 51 373 63 373 81L373 163 471 163 471 202 373 202 373 660C373 670 366 677 353 677M295 553 295 202 67 202Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.393ex" height="2.52ex" role="img" focusable="false" viewBox="0 -864 2825.8 1114"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } ) = \mathcal{O}(2000 \times 2 \times 10^{6}) = \mathcal{O}(4 \times 10^{9})"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="msup" data-latex="0^{9}" transform="translate(1000.2,0)"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{9}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="9"><path data-c="39" d="M116 140C83 140 67 123 67 89 67 14 128-22 207-22 287-22 351 18 398 99 437 166 457 243 457 329 457 456 434 546 388 599 349 644 304 666 253 666 194 666 145 645 106 602 63 557 42 503 42 440 42 379 60 327 96 284 134 238 183 215 242 215 294 215 334 243 361 299L361 286C361 177 342 103 303 63 272 30 239 14 206 14 166 14 137 23 118 42 149 42 165 60 165 91 165 119 144 140 116 140M243 246C204 246 175 266 155 306 144 329 138 374 138 439 138 504 145 548 158 573 180 613 212 633 253 633 294 633 324 608 343 558 354 531 361 485 361 420 361 333 322 246 243 246Z"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2436.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container></p><p>空间复杂度:通过滚动数组优化可降至<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.893ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3488.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(S_{\text{max} } ) = \mathcal{O}(2 \times 10^{6})"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1088,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3099.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.981ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2643.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(S_{\text{max} } ) = \mathcal{O}(2 \times 10^{6})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1754.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(2143.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.393ex" height="2.52ex" role="img" focusable="false" viewBox="0 -864 2825.8 1114"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(S_{\text{max} } ) = \mathcal{O}(2 \times 10^{6})"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="msup" data-latex="0^{6}" transform="translate(1000.2,0)"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{6}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="6"><path data-c="36" d="M383 504C416 504 432 521 432 555 432 627 378 666 304 666 221 666 155 627 106 548 63 480 42 403 42 316 42 189 65 100 112 47 152 1 198-22 251-22 312-22 362 1 401 47 438 91 457 144 457 205 457 266 439 318 403 361 365 407 316 431 257 431 205 431 165 402 138 346L138 352C138 465 166 561 226 605 252 624 279 633 306 633 342 633 368 623 385 602 351 602 334 583 334 553 334 525 355 504 383 504M344 340C355 317 361 272 361 206 361 141 356 98 345 76 325 35 294 14 251 14 222 14 200 24 184 44 171 60 162 74 158 85 146 116 140 163 140 227 140 255 144 282 151 308 164 355 201 399 256 399 295 399 325 379 344 340Z"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2436.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container></p><p>这一方法属于伪多项式算法,因为其复杂度依赖于<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.357ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="1.952ex" role="img" focusable="false" viewBox="0 -705 2011.9 862.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } "><g data-mml-node="msub" data-latex="S_{\text{max} } "><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg></mjx-container> 而非输入规模的二进制表示长度。对于<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.993ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 881 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N=2000"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.914ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3055.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N=2000"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="000" transform="translate(1055.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></svg></mjx-container> ,直接应用此框架仍面临计算资源挑战,需结合优化技术。</p><h3 id="素数筛选与计数结合"><a href="#素数筛选与计数结合" class="headerlink" title="素数筛选与计数结合"></a>素数筛选与计数结合</h3><h4 id="厄拉多塞筛法预处理"><a href="#厄拉多塞筛法预处理" class="headerlink" title="厄拉多塞筛法预处理"></a>厄拉多塞筛法预处理</h4><p>首先用筛法标记<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.947ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3512.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[2, S_{\text{max} } ] "><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(278,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(778,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1222.7,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex="]" transform="translate(3234.6,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> 内的所有素数:</p><ol><li>初始化布尔数组<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="16.23ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 7173.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{IsPrime}[0..S_{\text{max} } ] "><g data-mml-node="mtext" data-latex="\text{IsPrime}"><path data-c="49" d="M180 3C257 3 308 2 333 0L333 39 304 39C268 39 246 41 239 46 232 51 228 63 228 81L228 602C228 620 232 631 239 636 246 641 268 644 304 644L333 644 333 683C308 681 257 680 181 680 104 680 53 681 28 683L28 644 57 644C93 644 115 641 122 636 129 631 133 620 133 602L133 81C133 63 129 51 122 46 115 41 93 39 57 39L28 39 28 0C53 2 104 3 180 3Z"></path><path data-c="73" d="M360 130C360 206 308 254 205 274 158 283 128 294 112 305 96 316 88 332 88 351 88 398 123 421 193 421 261 421 298 383 303 306 304 298 309 294 319 294 330 294 336 303 336 321L336 420C336 439 331 448 321 448 310 448 295 430 285 422 260 439 229 448 193 448 104 448 33 408 33 323 33 289 47 260 76 237 111 208 144 202 207 191 272 178 305 149 305 104 305 47 270 18 199 18 130 18 86 64 67 155 64 168 59 175 50 175 39 175 33 165 33 146L33 17C33-2 38-11 48-11 51-11 56-8 64-1 82 15 74 12 92 30 121 3 157-11 199-11 294-11 360 38 360 130Z" transform="translate(361,0)"></path><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z" transform="translate(755,0)"></path><path data-c="72" d="M364 378C364 417 327 442 288 442 237 442 198 412 172 351L172 442 28 431 28 393C63 393 84 390 92 384 100 378 104 365 104 342L104 79C104 60 101 48 94 44 87 40 65 38 28 38L28 0 143 3C185 4 228 3 271 0L271 38 247 38C214 38 193 41 186 46 179 51 176 63 176 81L176 232C176 275 184 314 199 347 219 390 248 412 287 413 277 403 272 391 272 377 272 346 287 331 318 331 345 331 364 352 364 378Z" transform="translate(1436,0)"></path><path data-c="69" d="M194 601C194 631 169 657 139 657 109 657 83 631 83 601 83 571 108 544 138 544 169 544 194 570 194 601M143 3 247 0 247 39C214 39 194 41 188 45 182 49 180 60 180 78L180 445 37 433 37 395C70 395 91 392 98 387 105 382 108 368 108 345L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z" transform="translate(1828,0)"></path><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(2106,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(2939,0)"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(3383,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="." transform="translate(3661,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path><path data-c="2E" d="M192 53C192 82 168 106 139 106 110 106 86 82 86 53 86 24 110 0 139 0 168 0 192 24 192 53Z" transform="translate(500,0)"></path></g><g data-mml-node="mo" data-latex="." transform="translate(4439,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106 110 106 86 82 86 53 86 24 110 0 139 0 168 0 192 24 192 53Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(4883.7,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex="]" transform="translate(6895.6,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> ,所有元素设为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="4.783ex" height="1.557ex" role="img" focusable="false" viewBox="0 -677 2114 688"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{True}"><g data-mml-node="mtext" data-latex="\text{True}"><path data-c="54" d="M653 447 685 447 666 677 55 677 36 447 68 447C75 513 78 572 106 605 132 635 181 638 242 638 271 638 289 638 295 637 313 633 313 624 313 603L313 82C313 69 312 61 309 56 303 45 271 39 213 39L169 39 169 0C199 2 263 3 360 3 458 3 522 2 552 0L552 39 508 39C450 39 418 45 412 56 409 61 408 69 408 82L408 603C408 614 410 623 412 629 414 635 436 638 479 638 540 638 588 635 614 605 642 572 646 513 653 447Z"></path><path data-c="72" d="M364 378C364 417 327 442 288 442 237 442 198 412 172 351L172 442 28 431 28 393C63 393 84 390 92 384 100 378 104 365 104 342L104 79C104 60 101 48 94 44 87 40 65 38 28 38L28 0 143 3C185 4 228 3 271 0L271 38 247 38C214 38 193 41 186 46 179 51 176 63 176 81L176 232C176 275 184 314 199 347 219 390 248 412 287 413 277 403 272 391 272 377 272 346 287 331 318 331 345 331 364 352 364 378Z" transform="translate(722,0)"></path><path data-c="75" d="M267 18C198 18 185 47 185 112L185 442 32 431 32 393C71 393 94 389 100 382 106 375 109 350 109 306L109 159C109 120 112 90 119 67 134 15 189-11 262-11 316-11 357 14 385 65L385-11 535 0 535 38C499 38 478 40 470 46 462 52 458 66 458 89L458 442 306 431 306 393C341 393 362 390 370 384 378 378 382 365 382 342L382 167C382 88 340 18 267 18Z" transform="translate(1114,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(1670,0)"></path></g></g></g></svg></mjx-container></li><li>置<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="10.043ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4439 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{IsPrime}[0] = \text{IsPrime}[1] = \text{False}"><g data-mml-node="mtext" data-latex="\text{IsPrime}"><path data-c="49" d="M180 3C257 3 308 2 333 0L333 39 304 39C268 39 246 41 239 46 232 51 228 63 228 81L228 602C228 620 232 631 239 636 246 641 268 644 304 644L333 644 333 683C308 681 257 680 181 680 104 680 53 681 28 683L28 644 57 644C93 644 115 641 122 636 129 631 133 620 133 602L133 81C133 63 129 51 122 46 115 41 93 39 57 39L28 39 28 0C53 2 104 3 180 3Z"></path><path data-c="73" d="M360 130C360 206 308 254 205 274 158 283 128 294 112 305 96 316 88 332 88 351 88 398 123 421 193 421 261 421 298 383 303 306 304 298 309 294 319 294 330 294 336 303 336 321L336 420C336 439 331 448 321 448 310 448 295 430 285 422 260 439 229 448 193 448 104 448 33 408 33 323 33 289 47 260 76 237 111 208 144 202 207 191 272 178 305 149 305 104 305 47 270 18 199 18 130 18 86 64 67 155 64 168 59 175 50 175 39 175 33 165 33 146L33 17C33-2 38-11 48-11 51-11 56-8 64-1 82 15 74 12 92 30 121 3 157-11 199-11 294-11 360 38 360 130Z" transform="translate(361,0)"></path><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z" transform="translate(755,0)"></path><path data-c="72" d="M364 378C364 417 327 442 288 442 237 442 198 412 172 351L172 442 28 431 28 393C63 393 84 390 92 384 100 378 104 365 104 342L104 79C104 60 101 48 94 44 87 40 65 38 28 38L28 0 143 3C185 4 228 3 271 0L271 38 247 38C214 38 193 41 186 46 179 51 176 63 176 81L176 232C176 275 184 314 199 347 219 390 248 412 287 413 277 403 272 391 272 377 272 346 287 331 318 331 345 331 364 352 364 378Z" transform="translate(1436,0)"></path><path data-c="69" d="M194 601C194 631 169 657 139 657 109 657 83 631 83 601 83 571 108 544 138 544 169 544 194 570 194 601M143 3 247 0 247 39C214 39 194 41 188 45 182 49 180 60 180 78L180 445 37 433 37 395C70 395 91 392 98 387 105 382 108 368 108 345L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z" transform="translate(1828,0)"></path><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(2106,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(2939,0)"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(3383,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="0" transform="translate(3661,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(4161,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="12.432ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 5494.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{IsPrime}[0] = \text{IsPrime}[1] = \text{False}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mtext" data-latex="\text{IsPrime}" transform="translate(1055.8,0)"><path data-c="49" d="M180 3C257 3 308 2 333 0L333 39 304 39C268 39 246 41 239 46 232 51 228 63 228 81L228 602C228 620 232 631 239 636 246 641 268 644 304 644L333 644 333 683C308 681 257 680 181 680 104 680 53 681 28 683L28 644 57 644C93 644 115 641 122 636 129 631 133 620 133 602L133 81C133 63 129 51 122 46 115 41 93 39 57 39L28 39 28 0C53 2 104 3 180 3Z"></path><path data-c="73" d="M360 130C360 206 308 254 205 274 158 283 128 294 112 305 96 316 88 332 88 351 88 398 123 421 193 421 261 421 298 383 303 306 304 298 309 294 319 294 330 294 336 303 336 321L336 420C336 439 331 448 321 448 310 448 295 430 285 422 260 439 229 448 193 448 104 448 33 408 33 323 33 289 47 260 76 237 111 208 144 202 207 191 272 178 305 149 305 104 305 47 270 18 199 18 130 18 86 64 67 155 64 168 59 175 50 175 39 175 33 165 33 146L33 17C33-2 38-11 48-11 51-11 56-8 64-1 82 15 74 12 92 30 121 3 157-11 199-11 294-11 360 38 360 130Z" transform="translate(361,0)"></path><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z" transform="translate(755,0)"></path><path data-c="72" d="M364 378C364 417 327 442 288 442 237 442 198 412 172 351L172 442 28 431 28 393C63 393 84 390 92 384 100 378 104 365 104 342L104 79C104 60 101 48 94 44 87 40 65 38 28 38L28 0 143 3C185 4 228 3 271 0L271 38 247 38C214 38 193 41 186 46 179 51 176 63 176 81L176 232C176 275 184 314 199 347 219 390 248 412 287 413 277 403 272 391 272 377 272 346 287 331 318 331 345 331 364 352 364 378Z" transform="translate(1436,0)"></path><path data-c="69" d="M194 601C194 631 169 657 139 657 109 657 83 631 83 601 83 571 108 544 138 544 169 544 194 570 194 601M143 3 247 0 247 39C214 39 194 41 188 45 182 49 180 60 180 78L180 445 37 433 37 395C70 395 91 392 98 387 105 382 108 368 108 345L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z" transform="translate(1828,0)"></path><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(2106,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(2939,0)"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(4438.8,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(4716.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(5216.8,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.522ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3324.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{IsPrime}[0] = \text{IsPrime}[1] = \text{False}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mtext" data-latex="\text{False}" transform="translate(1055.8,0)"><path data-c="46" d="M275 641 393 641C464 641 510 626 533 597 565 558 569 521 578 450L611 450 582 680 33 680 33 641 61 641C96 641 117 639 124 634 131 629 135 617 135 599L135 81C135 63 131 51 124 46 117 41 96 39 61 39L33 39 33 0C59 2 110 3 187 3 274 3 330 2 357 0L357 39 320 39C267 39 238 44 233 55 231 60 230 69 230 82L230 321 311 321C354 321 382 313 394 298 406 283 412 253 412 206L444 206 444 475 412 475C412 429 406 398 394 383 382 368 354 360 311 360L230 360 230 606C230 642 236 641 275 641Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(653,0)"></path><path data-c="6C" d="M144 3 255 0 255 39C219 39 197 40 190 44 183 48 180 60 180 79L180 694 33 683 33 645C68 645 90 642 97 636 104 630 108 616 108 593L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z" transform="translate(1153,0)"></path><path data-c="73" d="M360 130C360 206 308 254 205 274 158 283 128 294 112 305 96 316 88 332 88 351 88 398 123 421 193 421 261 421 298 383 303 306 304 298 309 294 319 294 330 294 336 303 336 321L336 420C336 439 331 448 321 448 310 448 295 430 285 422 260 439 229 448 193 448 104 448 33 408 33 323 33 289 47 260 76 237 111 208 144 202 207 191 272 178 305 149 305 104 305 47 270 18 199 18 130 18 86 64 67 155 64 168 59 175 50 175 39 175 33 165 33 146L33 17C33-2 38-11 48-11 51-11 56-8 64-1 82 15 74 12 92 30 121 3 157-11 199-11 294-11 360 38 360 130Z" transform="translate(1431,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(1825,0)"></path></g></g></g></svg></mjx-container></li><li>对每个<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.781ex" height="1.52ex" role="img" focusable="false" viewBox="0 -661 345 672"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g></svg></mjx-container> 从 2 到<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.359ex" xmlns="http://www.w3.org/2000/svg" width="6.482ex" height="2.398ex" role="img" focusable="false" viewBox="0 -901.1 2864.9 1060"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\sqrt{S_{\text{max} } } "><g data-mml-node="msqrt" data-latex="\sqrt{S_{\text{max} } } "><g data-mml-node="mo" transform="translate(0,801.1)"><path data-c="221A" d="M847-2C851 7 853 13 853 16 853 32 845 40 829 40 820 40 813 36 809 27 666-259 595-403 595-405L595-406C595-413 527-558 390-843L217-461C212-450 207-445 201-445 198-445 192-448 184-454L86-528C77-535 73-540 73-545 73-555 78-560 87-560 90-560 95-557 103-551L151-516 345-943C350-954 357-960 367-960 379-960 387-955 392-946Z"></path></g><g transform="translate(853,0)"><g data-mml-node="msub" data-latex="S_{\text{max} } "><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g><rect width="2011.9" height="60" x="853" y="781.1"></rect></g></g></g></svg></mjx-container> ,若<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="9.692ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4284 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{IsPrime}[i] "><g data-mml-node="mtext" data-latex="\text{IsPrime}"><path data-c="49" d="M180 3C257 3 308 2 333 0L333 39 304 39C268 39 246 41 239 46 232 51 228 63 228 81L228 602C228 620 232 631 239 636 246 641 268 644 304 644L333 644 333 683C308 681 257 680 181 680 104 680 53 681 28 683L28 644 57 644C93 644 115 641 122 636 129 631 133 620 133 602L133 81C133 63 129 51 122 46 115 41 93 39 57 39L28 39 28 0C53 2 104 3 180 3Z"></path><path data-c="73" d="M360 130C360 206 308 254 205 274 158 283 128 294 112 305 96 316 88 332 88 351 88 398 123 421 193 421 261 421 298 383 303 306 304 298 309 294 319 294 330 294 336 303 336 321L336 420C336 439 331 448 321 448 310 448 295 430 285 422 260 439 229 448 193 448 104 448 33 408 33 323 33 289 47 260 76 237 111 208 144 202 207 191 272 178 305 149 305 104 305 47 270 18 199 18 130 18 86 64 67 155 64 168 59 175 50 175 39 175 33 165 33 146L33 17C33-2 38-11 48-11 51-11 56-8 64-1 82 15 74 12 92 30 121 3 157-11 199-11 294-11 360 38 360 130Z" transform="translate(361,0)"></path><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z" transform="translate(755,0)"></path><path data-c="72" d="M364 378C364 417 327 442 288 442 237 442 198 412 172 351L172 442 28 431 28 393C63 393 84 390 92 384 100 378 104 365 104 342L104 79C104 60 101 48 94 44 87 40 65 38 28 38L28 0 143 3C185 4 228 3 271 0L271 38 247 38C214 38 193 41 186 46 179 51 176 63 176 81L176 232C176 275 184 314 199 347 219 390 248 412 287 413 277 403 272 391 272 377 272 346 287 331 318 331 345 331 364 352 364 378Z" transform="translate(1436,0)"></path><path data-c="69" d="M194 601C194 631 169 657 139 657 109 657 83 631 83 601 83 571 108 544 138 544 169 544 194 570 194 601M143 3 247 0 247 39C214 39 194 41 188 45 182 49 180 60 180 78L180 445 37 433 37 395C70 395 91 392 98 387 105 382 108 368 108 345L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z" transform="translate(1828,0)"></path><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(2106,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(2939,0)"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(3383,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(3661,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(4006,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> 为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="4.783ex" height="1.557ex" role="img" focusable="false" viewBox="0 -677 2114 688"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{True}"><g data-mml-node="mtext" data-latex="\text{True}"><path data-c="54" d="M653 447 685 447 666 677 55 677 36 447 68 447C75 513 78 572 106 605 132 635 181 638 242 638 271 638 289 638 295 637 313 633 313 624 313 603L313 82C313 69 312 61 309 56 303 45 271 39 213 39L169 39 169 0C199 2 263 3 360 3 458 3 522 2 552 0L552 39 508 39C450 39 418 45 412 56 409 61 408 69 408 82L408 603C408 614 410 623 412 629 414 635 436 638 479 638 540 638 588 635 614 605 642 572 646 513 653 447Z"></path><path data-c="72" d="M364 378C364 417 327 442 288 442 237 442 198 412 172 351L172 442 28 431 28 393C63 393 84 390 92 384 100 378 104 365 104 342L104 79C104 60 101 48 94 44 87 40 65 38 28 38L28 0 143 3C185 4 228 3 271 0L271 38 247 38C214 38 193 41 186 46 179 51 176 63 176 81L176 232C176 275 184 314 199 347 219 390 248 412 287 413 277 403 272 391 272 377 272 346 287 331 318 331 345 331 364 352 364 378Z" transform="translate(722,0)"></path><path data-c="75" d="M267 18C198 18 185 47 185 112L185 442 32 431 32 393C71 393 94 389 100 382 106 375 109 350 109 306L109 159C109 120 112 90 119 67 134 15 189-11 262-11 316-11 357 14 385 65L385-11 535 0 535 38C499 38 478 40 470 46 462 52 458 66 458 89L458 442 306 431 306 393C341 393 362 390 370 384 378 378 382 365 382 342L382 167C382 88 340 18 267 18Z" transform="translate(1114,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(1670,0)"></path></g></g></g></svg></mjx-container> ,则标记所有倍数<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.215ex" height="2.452ex" role="img" focusable="false" viewBox="0 -833.9 2305.2 1083.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i^{2}, i(i+1), \dots"><g data-mml-node="msup" data-latex="i^{2}"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="TeXAtom" transform="translate(378,363) scale(0.707)" data-latex="{2}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(781.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1226.2,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(1571.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="i" transform="translate(1960.2,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.174ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3170.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i^{2}, i(i+1), \dots"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(1000.2,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(1500.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(1889.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mo" transform="translate(2333.9,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106 664 106 638 83 638 53 638 23 664 0 695 0 725 0 751 23 751 53M475 53C475 83 449 106 419 106 388 106 363 83 363 53 363 23 388 0 419 0 449 0 475 23 475 53M200 53C200 83 174 106 143 106 113 106 87 83 87 53 87 23 113 0 143 0 173 0 200 23 200 53Z"></path></g></g></g></svg></mjx-container> 为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="5.133ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 2269 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{False}"><g data-mml-node="mtext" data-latex="\text{False}"><path data-c="46" d="M275 641 393 641C464 641 510 626 533 597 565 558 569 521 578 450L611 450 582 680 33 680 33 641 61 641C96 641 117 639 124 634 131 629 135 617 135 599L135 81C135 63 131 51 124 46 117 41 96 39 61 39L33 39 33 0C59 2 110 3 187 3 274 3 330 2 357 0L357 39 320 39C267 39 238 44 233 55 231 60 230 69 230 82L230 321 311 321C354 321 382 313 394 298 406 283 412 253 412 206L444 206 444 475 412 475C412 429 406 398 394 383 382 368 354 360 311 360L230 360 230 606C230 642 236 641 275 641Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(653,0)"></path><path data-c="6C" d="M144 3 255 0 255 39C219 39 197 40 190 44 183 48 180 60 180 79L180 694 33 683 33 645C68 645 90 642 97 636 104 630 108 616 108 593L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z" transform="translate(1153,0)"></path><path data-c="73" d="M360 130C360 206 308 254 205 274 158 283 128 294 112 305 96 316 88 332 88 351 88 398 123 421 193 421 261 421 298 383 303 306 304 298 309 294 319 294 330 294 336 303 336 321L336 420C336 439 331 448 321 448 310 448 295 430 285 422 260 439 229 448 193 448 104 448 33 408 33 323 33 289 47 260 76 237 111 208 144 202 207 191 272 178 305 149 305 104 305 47 270 18 199 18 130 18 86 64 67 155 64 168 59 175 50 175 39 175 33 165 33 146L33 17C33-2 38-11 48-11 51-11 56-8 64-1 82 15 74 12 92 30 121 3 157-11 199-11 294-11 360 38 360 130Z" transform="translate(1431,0)"></path><path data-c="65" d="M415 251C415 366 348 448 236 448 176 448 126 425 85 378 47 334 28 281 28 220 28 157 49 104 91 58 133 12 185-11 247-11 304-11 348 9 378 48 403 81 415 105 415 121 415 131 409 136 398 136 390 136 385 131 382 120 360 54 317 21 253 21 208 21 173 42 146 85 127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389 193 409 215 419 236 419 281 419 311 396 326 349Z" transform="translate(1825,0)"></path></g></g></g></svg></mjx-container></li></ol><h4 id="动态规划与素数计数的融合"><a href="#动态规划与素数计数的融合" class="headerlink" title="动态规划与素数计数的融合"></a>动态规划与素数计数的融合</h4><p>在 DP 计算完成后,遍历所有素数<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.439ex" xmlns="http://www.w3.org/2000/svg" width="1.138ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 503 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g></g></g></svg></mjx-container> 并累加<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="7.962ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3519 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[N] [p] "><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="N" transform="translate(1301,0)"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(2182,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(2460,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(2738,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(3241,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> 。关键优化包括:</p><p>奇偶性剪枝 :除 2 外所有素数为奇数,因此仅需考虑和为奇数的子集(空集和为 0 需排除)</p><p>子集和对称性 :对于子集<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="1.593ex" height="1.532ex" role="img" focusable="false" viewBox="0 -677 704 677"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="T"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g></g></g></svg></mjx-container> 及其补集<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.459ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 645 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S \setminus T"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.381ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1494.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S \setminus T"><g data-mml-node="mo" data-latex="\setminus"><path data-c="2216" d="M488-103C504-103 512-95 512-79 512-74 511-70 508-66L100 592C94 599 87 603 80 603 64 603 56 595 56 579 56 574 57 570 60 566L468-92C474-99 481-103 488-103Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(790.2,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g></g></g></svg></mjx-container> ,有<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.602ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2034 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(T) + f(S \setminus T) = S_{\text{max} }"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705 400 705 357 665 334 586 329 568 318 517 302 433L237 433C215 433 204 432 204 411 204 400 214 395 235 395L295 395 222 8C211-49 201-91 192-119 180-156 163-175 141-175 126-175 114-171 103-164 135-159 151-140 151-108 151-82 138-69 111-69 77-69 53-99 53-133 53-177 94-205 141-205 166-205 189-195 208-174 240-141 265-94 283-31 294 8 304 46 311 84L369 395 451 395C474 395 484 396 484 419 484 428 474 433 454 433L377 433C383 474 411 625 420 644 430 665 444 675 462 675 477 675 490 671 501 664 470 657 454 639 454 608 454 582 467 569 494 569 528 569 552 599 552 633Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(941,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(1645,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.851ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2586.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(T) + f(S \setminus T) = S_{\text{max} }"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mi" data-latex="f" transform="translate(1000.2,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705 400 705 357 665 334 586 329 568 318 517 302 433L237 433C215 433 204 432 204 411 204 400 214 395 235 395L295 395 222 8C211-49 201-91 192-119 180-156 163-175 141-175 126-175 114-171 103-164 135-159 151-140 151-108 151-82 138-69 111-69 77-69 53-99 53-133 53-177 94-205 141-205 166-205 189-195 208-174 240-141 265-94 283-31 294 8 304 46 311 84L369 395 451 395C474 395 484 396 484 419 484 428 474 433 454 433L377 433C383 474 411 625 420 644 430 665 444 675 462 675 477 675 490 671 501 664 470 657 454 639 454 608 454 582 467 569 494 569 528 569 552 599 552 633Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(1552.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="S" transform="translate(1941.2,0)"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.261ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1883.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(T) + f(S \setminus T) = S_{\text{max} }"><g data-mml-node="mo" data-latex="\setminus"><path data-c="2216" d="M488-103C504-103 512-95 512-79 512-74 511-70 508-66L100 592C94 599 87 603 80 603 64 603 56 595 56 579 56 574 57 570 60 566L468-92C474-99 481-103 488-103Z"></path></g><g data-mml-node="mi" data-latex="T" transform="translate(790.2,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55 188 44 154 39 94 39 63 39 49 42 49 16 49 5 56 0 69 0 120 0 192 4 235 3L317 2C331 2 386 0 403 0 420 0 428 8 428 24 428 34 416 39 391 39 339 39 309 41 300 46 297 48 295 52 295 58L430 603C433 617 436 626 439 629 443 635 467 638 511 638 566 638 604 634 623 625 642 616 652 595 652 561 652 543 649 517 644 483 642 475 641 469 641 464 641 453 646 447 657 447 666 447 672 456 675 473L702 645C703 650 704 656 704 662 704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462 24 452 29 447 40 447 48 447 55 455 60 470 85 543 110 588 133 607 159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(1494.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.941ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3067.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(T) + f(S \setminus T) = S_{\text{max} }"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg></mjx-container> 。若<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.357ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="1.952ex" role="img" focusable="false" viewBox="0 -705 2011.9 862.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} }"><g data-mml-node="msub" data-latex="S_{\text{max} }"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg></mjx-container> 为偶数(此处<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.05ex" xmlns="http://www.w3.org/2000/svg" width="7.919ex" height="1.557ex" role="img" focusable="false" viewBox="0 -666 3500 688"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="2001000"><g data-mml-node="mn" data-latex="2001000"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(1500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(2000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(2500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(3000,0)"></path></g></g></g></svg></mjx-container> 是偶数),则素数<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.439ex" xmlns="http://www.w3.org/2000/svg" width="1.138ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 503 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g></g></g></svg></mjx-container> 与<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2011.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } - p"><g data-mml-node="msub" data-latex="S_{\text{max}}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.401ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1503.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } - p"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270 80 270C64 270 56 263 56 250 56 237 64 230 80 230L698 230C714 230 722 237 722 250 722 262 710 270 698 270Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(1000.2,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g></g></g></svg></mjx-container> 不可能同时为素数(除 2 与<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2011.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} }-2"><g data-mml-node="msub" data-latex="S_{\text{max}}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} }-2"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270 80 270C64 270 56 263 56 250 56 237 64 230 80 230L698 230C714 230 722 237 722 250 722 262 710 270 698 270Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(1000.2,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g></g></g></svg></mjx-container> 外),可减少一半计算量</p><h3 id="生成函数方法"><a href="#生成函数方法" class="headerlink" title="生成函数方法"></a>生成函数方法</h3><h4 id="生成函数的构造"><a href="#生成函数的构造" class="headerlink" title="生成函数的构造"></a>生成函数的构造</h4><p>子集和问题的生成函数为各元素生成函数的乘积:</p><p><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true" width="full" style="min-width:27.756ex"><svg style="vertical-align:-2.747ex;min-width:27.756ex" xmlns="http://www.w3.org/2000/svg" width="100%" height="6.626ex" role="img" focusable="false"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(0.0181,-0.0181) translate(0, -1714.3)"><g data-mml-node="math" data-latex="
F(x) = \prod_{i=1}^{N} (1 + x^{i})
"><g data-mml-node="mtable" data-latex="
F(x) = \prod_{i=1}^{N} (1 + x^{i})
" transform="translate(2078,0) translate(-2078,0)"><g transform="translate(0 1714.3) matrix(1 0 0 -1 0 0) scale(55.25)"><svg data-table="true" preserveAspectRatio="xMidYMid" viewBox="4056 -1714.3 1 2928.7"><g transform="matrix(1 0 0 -1 0 0)"><g data-mml-node="mlabeledtr" transform="translate(0,-18.6)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="F"><path data-c="1D439" d="M199 656C199 646 210 641 231 641 271 641 291 637 291 628 291 625 289 618 286 605L156 82C150 60 140 47 126 42 119 40 101 39 70 39 48 39 38 37 38 16 38 5 44 0 57 0L187 3 335 0C351 0 359 8 359 23 359 40 348 39 322 39 278 39 253 41 247 46 244 47 243 51 243 56L307 321 400 321C446 321 478 319 478 281 478 268 476 252 471 233 470 230 469 226 468 222 468 211 473 206 484 206 489 207 496 214 503 229L557 444C559 452 560 458 560 461 557 470 551 475 544 475 536 475 530 467 526 452 516 414 502 390 486 378 470 366 442 360 402 360L317 360 379 606C387 640 387 641 429 641L559 641C656 641 700 626 700 537 700 517 699 499 697 484 696 473 695 467 695 466 695 455 700 450 710 450 720 450 726 459 728 478L748 649C751 677 744 680 717 680L233 680C210 680 199 679 199 656Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(751,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="x" transform="translate(1140,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(1712,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g><g data-mml-node="mo" data-latex="=" transform="translate(2378.8,0)"><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="munderover" data-latex="\prod_{i=1}^{N}" transform="translate(3434.6,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450 1221-450 1221-388C1158-388 1115-379 1092-361 1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862 1115 880 1158 888 1221 888L1221 950 56 950 56 888C119 888 162 879 185 861 208 843 219 817 219 783L219-283C219-318 208-344 185-362 162-380 119-388 56-388L56-450 542-450 542-388C479-388 436-379 413-361 390-343 379-317 379-283L379 888 898 888 898-283C898-318 887-344 864-362 841-380 798-388 735-388Z"></path></g><g data-mml-node="TeXAtom" transform="translate(65.2,-1087.9) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g></g><g data-mml-node="TeXAtom" transform="translate(327.5,1150) scale(0.707)" data-latex="{N}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(4712.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(5101.6,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="+" transform="translate(5823.8,0)"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="msup" data-latex="x^{i}" transform="translate(6824,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g><g data-mml-node="TeXAtom" transform="translate(605,413) scale(0.707)" data-latex="{i}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661 216 661 188 633 188 605 188 578 202 565 229 565 257 565 284 593 284 621M259 138C237 59 205 19 164 19 151 19 144 28 144 47 144 64 173 150 232 306 240 329 244 347 244 360 244 409 210 445 161 445 118 445 84 420 59 369 39 328 29 301 29 288 29 279 34 275 45 275 58 275 60 281 64 295 87 375 118 415 158 415 171 415 178 406 178 387 178 373 175 357 168 338 145 275 121 208 101 155 86 115 78 88 78 74 78 25 114-11 162-11 205-11 239 14 264 64 283 103 293 130 293 145 293 154 288 159 277 159 274 159 259 150 259 138Z"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7723,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></g></svg><svg data-labels="true" preserveAspectRatio="xMaxYMid" viewBox="1278 -1714.3 1 2928.7"><g data-labels="true" transform="matrix(1 0 0 -1 0 0)"><g data-mml-node="mtd" id="mjx-eqn:2" transform="translate(0,729.4)"><text data-id-align="true"></text><g data-idbox="true" transform="translate(0,-748)"><g data-mml-node="mtext" data-latex="\text{(2)}"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z" transform="translate(389,0)"></path><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z" transform="translate(889,0)"></path></g></g></g></g></svg></g></g></g></g></svg></mjx-container></p><p>其中<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="2.315ex" height="1.956ex" role="img" focusable="false" viewBox="0 -853.7 1023.4 864.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x^{k}"><g data-mml-node="msup" data-latex="x^{k}"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g><g data-mml-node="TeXAtom" transform="translate(605,363) scale(0.707)" data-latex="{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314 485 314 508 345 508 379 508 418 476 445 437 445 392 445 344 415 291 356 250 311 217 282 190 269L291 679C289 688 287 694 274 694 242 694 166 685 154 684 139 682 132 675 132 660 132 650 141 645 159 645 178 645 204 646 204 632L59 43C56 32 55 25 55 21 55 0 66-11 87-11 104-11 117-3 124 12 129 21 147 92 179 226 231 221 286 196 286 146 286 131 279 101 279 91 279 34 316-11 373-11 431-11 470 41 490 145 490 154 485 159 475 159 466 159 460 152 457 138 435 59 408 19 375 19 357 19 348 33 348 61 348 77 360 131 360 147 360 204 314 239 221 253 244 269 270 292 298 322 326 352 346 371 359 382 386 404 412 415 435 415 445 415 453 413 459 409 432 404 409 379 409 353Z"></path></g></g></g></g></g></svg></mjx-container> 的系数即为和为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="1.179ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 521 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314 485 314 508 345 508 379 508 418 476 445 437 445 392 445 344 415 291 356 250 311 217 282 190 269L291 679C289 688 287 694 274 694 242 694 166 685 154 684 139 682 132 675 132 660 132 650 141 645 159 645 178 645 204 646 204 632L59 43C56 32 55 25 55 21 55 0 66-11 87-11 104-11 117-3 124 12 129 21 147 92 179 226 231 221 286 196 286 146 286 131 279 101 279 91 279 34 316-11 373-11 431-11 470 41 490 145 490 154 485 159 475 159 466 159 460 152 457 138 435 59 408 19 375 19 357 19 348 33 348 61 348 77 360 131 360 147 360 204 314 239 221 253 244 269 270 292 298 322 326 352 346 371 359 382 386 404 412 415 435 415 445 415 453 413 459 409 432 404 409 379 409 353Z"></path></g></g></g></svg></mjx-container> 的子集数量。因此 P-2000 问题的答案等于<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.561ex" xmlns="http://www.w3.org/2000/svg" width="4.753ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2101 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="F(x)"><g data-mml-node="mi" data-latex="F"><path data-c="1D439" d="M199 656C199 646 210 641 231 641 271 641 291 637 291 628 291 625 289 618 286 605L156 82C150 60 140 47 126 42 119 40 101 39 70 39 48 39 38 37 38 16 38 5 44 0 57 0L187 3 335 0C351 0 359 8 359 23 359 40 348 39 322 39 278 39 253 41 247 46 244 47 243 51 243 56L307 321 400 321C446 321 478 319 478 281 478 268 476 252 471 233 470 230 469 226 468 222 468 211 473 206 484 206 489 207 496 214 503 229L557 444C559 452 560 458 560 461 557 470 551 475 544 475 536 475 530 467 526 452 516 414 502 390 486 378 470 366 442 360 402 360L317 360 379 606C387 640 387 641 429 641L559 641C656 641 700 626 700 537 700 517 699 499 697 484 696 473 695 467 695 466 695 455 700 450 710 450 720 450 726 459 728 478L748 649C751 677 744 680 717 680L233 680C210 680 199 679 199 656Z"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(751,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="x" transform="translate(1140,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442 389 442 355 419 329 373 308 419 273 442 222 442 173 442 133 419 101 374 74 335 60 306 60 287 60 278 65 273 75 273 84 273 90 278 92 287 111 345 153 413 220 413 253 413 269 392 269 351 269 330 251 252 216 118 199 51 169 18 126 18 112 18 99 21 88 26 114 36 127 54 127 80 127 106 114 119 87 119 54 119 29 91 29 58 29 12 76-11 125-11 167-11 201 12 228 58 247 12 283-11 335-11 383-11 423 12 455 57 482 96 496 125 496 144 496 153 491 158 481 158 472 158 467 153 464 144 447 87 402 18 337 18 304 18 287 38 287 79 287 92 292 120 303 165L337 300C356 375 387 413 431 413 445 413 458 410 469 405 442 396 429 378 429 351 429 325 443 312 470 312 502 312 527 341 527 373Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(1712,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container> 中所有素数指数项的系数之和。</p><h4 id="多项式乘法实现"><a href="#多项式乘法实现" class="headerlink" title="多项式乘法实现"></a>多项式乘法实现</h4><p>通过快速傅里叶变换 (FFT) 可加速多项式乘法,但由于系数为整数且规模巨大(最高次数 2001000),实际计算中需采用数论变换 (NTT) 或分段乘法。然而,即使采用 FFT,<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.993ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 881 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N=2000"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.914ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3055.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N=2000"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="000" transform="translate(1055.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></svg></mjx-container> 时的多项式乘法复杂度仍为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.561ex" xmlns="http://www.w3.org/2000/svg" width="16.091ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 7112.2 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(S_{\text{max} } \log S_{\text{max} })"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1088,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mi" data-latex="\log" transform="translate(3266.6,0)"><path data-c="6C" d="M144 3 255 0 255 39C219 39 197 40 190 44 183 48 180 60 180 79L180 694 33 683 33 645C68 645 90 642 97 636 104 630 108 616 108 593L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z"></path><path data-c="6F" d="M249-11C311-11 363 11 406 55 449 99 471 152 471 214 471 277 450 332 408 378 366 424 313 448 250 448 187 448 135 424 92 378 49 332 28 277 28 214 28 152 49 99 92 55 135 11 188-11 249-11M250 21C202 21 166 42 141 85 125 113 117 159 117 222 117 283 125 327 140 355 164 398 200 419 249 419 296 419 332 398 357 357 374 329 382 284 382 222 382 106 348 21 250 21Z" transform="translate(278,0)"></path><path data-c="67" d="M431 453C393 453 358 438 326 408 296 431 262 442 223 442 137 442 59 378 59 294 59 252 74 218 104 192 85 168 75 141 75 110 75 72 88 43 113 24 71 10 28-26 28-77 28-120 56-154 111-178 153-197 199-206 249-206 300-206 347-197 389-178 444-154 471-120 471-75 471-22 449 17 405 42 359 67 308 70 234 70 190 70 166 70 161 71 133 75 113 102 113 133 113 148 117 162 126 174 154 155 186 145 223 145 309 145 386 209 386 293 386 332 373 364 347 389 372 412 399 423 428 423 423 418 420 410 420 400 420 378 431 367 453 367 474 367 485 378 485 401 485 432 461 453 431 453M223 411C277 411 304 372 304 294 304 215 277 175 223 175 168 175 141 214 141 293 141 372 168 411 223 411M164 4 222 4C274 4 316 1 348-6 391-15 412-39 412-77 412-109 392-134 352-153 321-168 287-175 250-175 214-175 180-168 148-153 107-134 87-109 87-77 87-35 123 4 164 4Z" transform="translate(778,0)"></path></g><g data-mml-node="mo" transform="translate(4544.6,0)"><path data-c="2061" d=""></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(4711.3,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6723.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container> ,与动态规划方法相当。</p></div><div class="story post-story"><h2 id="P-2000问题与子集和问题的归约关系"><a href="#P-2000问题与子集和问题的归约关系" class="headerlink" title="P-2000问题与子集和问题的归约关系"></a>P-2000 问题与子集和问题的归约关系</h2><h3 id="子集和问题到P-2000问题的归约"><a href="#子集和问题到P-2000问题的归约" class="headerlink" title="子集和问题到P-2000问题的归约"></a>子集和问题到 P-2000 问题的归约</h3><p><strong>定理</strong> :SUBSET - SUM ≤ₚ P-2000 问题,即子集和问题可多项式时间归约到 P-2000 问题。</p><p><strong>证明思路</strong> :</p><ol><li>给定 SUBSET - SUM 实例<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.28ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2333.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\langle A, t \rangle"><g data-mml-node="mo" data-latex="\langle"><path data-c="27E8" d="M313-250C328-250 336-242 336-226 336-223 336-220 335-218L158 250 335 717C336 719 336 722 336 726 336 742 328 750 313 750 302 750 295 745 291 735L111 259C110 257 110 254 110 250 110 247 110 244 111 242L291-235C295-245 302-250 313-250Z"></path></g><g data-mml-node="mi" data-latex="A" transform="translate(389,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(1139,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mi" data-latex="t" transform="translate(1583.7,0)"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g><g data-mml-node="mo" data-latex="\rangle" transform="translate(1944.7,0)"><path data-c="27E9" d="M278 242C279 244 279 247 279 250 279 253 279 256 278 258L98 735C94 745 87 750 76 750 61 750 53 742 53 726 53 723 53 720 54 718L231 250 54-217C53-219 53-222 53-226 53-242 61-250 76-250 87-250 94-245 98-235Z"></path></g></g></g></svg></mjx-container> (设<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.697ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 750 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A = \{a_{1}, \dots, a_{m}\}"><g data-mml-node="mi" data-latex="A"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="13.908ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6147.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A = \{a_{1}, \dots, a_{m}\}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mo" data-latex="\{" transform="translate(1055.8,0)"><path data-c="7B" d="M286-122 286 126C286 183 251 225 182 250 251 275 286 317 286 374L286 622C286 680 348 718 409 718 420 718 425 723 425 734 425 745 420 750 409 750 363 750 321 740 284 721 237 697 214 664 214 622L214 374C214 311 154 266 91 266 80 266 75 261 75 250 75 239 80 234 91 234 155 234 214 188 214 126L214-122C214-164 237-197 284-221 321-240 363-250 409-250 420-250 425-245 425-234 425-223 420-218 409-218 348-218 286-180 286-122Z"></path></g><g data-mml-node="msub" data-latex="a_{1}" transform="translate(1555.8,0)"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158 474 158 468 151 465 137 445 58 421 18 394 18 377 18 368 32 368 60 368 73 372 97 381 132L438 357C443 376 445 387 445 392 445 412 434 422 412 422 391 422 377 410 370 387 349 424 319 442 281 442 216 442 159 409 109 343 63 281 40 217 40 150 40 63 91-11 175-11 218-11 260 12 300 58 311 20 345-11 392-11 461-11 482 70 498 144M341 374C350 353 355 339 355 330 355 326 354 321 353 314L304 122C301 111 294 99 285 87 248 41 212 18 177 18 138 18 118 48 118 107 118 131 124 167 136 215 157 300 187 357 224 388 244 405 263 413 282 413 309 413 329 400 341 374Z"></path></g><g data-mml-node="TeXAtom" transform="translate(562,-150) scale(0.707)" data-latex="{1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2521.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mo" transform="translate(2966,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106 664 106 638 83 638 53 638 23 664 0 695 0 725 0 751 23 751 53M475 53C475 83 449 106 419 106 388 106 363 83 363 53 363 23 388 0 419 0 449 0 475 23 475 53M200 53C200 83 174 106 143 106 113 106 87 83 87 53 87 23 113 0 143 0 173 0 200 23 200 53Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(3969.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="msub" data-latex="a_{m}" transform="translate(4414.3,0)"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158 474 158 468 151 465 137 445 58 421 18 394 18 377 18 368 32 368 60 368 73 372 97 381 132L438 357C443 376 445 387 445 392 445 412 434 422 412 422 391 422 377 410 370 387 349 424 319 442 281 442 216 442 159 409 109 343 63 281 40 217 40 150 40 63 91-11 175-11 218-11 260 12 300 58 311 20 345-11 392-11 461-11 482 70 498 144M341 374C350 353 355 339 355 330 355 326 354 321 353 314L304 122C301 111 294 99 285 87 248 41 212 18 177 18 138 18 118 48 118 107 118 131 124 167 136 215 157 300 187 357 224 388 244 405 263 413 282 413 309 413 329 400 341 374Z"></path></g><g data-mml-node="TeXAtom" transform="translate(562,-150) scale(0.707)" data-latex="{m}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353 489 412 451 442 383 442 324 442 273 416 231 363 223 407 188 442 137 442 96 442 66 409 45 344 34 312 29 293 29 287 29 278 34 273 45 273 50 273 53 274 56 276 61 285 64 292 66 299 84 375 107 413 134 413 152 413 161 399 161 371 161 358 156 331 145 290L88 63C84 51 79 25 79 19 79-1 90-11 111-11 131-11 145-1 152 19 153 24 160 49 171 92L192 181 222 295C233 318 250 341 272 365 301 397 337 413 380 413 413 413 429 391 429 348 429 335 424 308 414 267L387 153C380 124 364 64 356 32 355 25 354 21 354 19 354-1 365-11 387-11 398-11 406-8 413-1 428 14 429 21 435 48L494 285C497 298 511 321 535 353 565 393 605 413 654 413 687 413 703 391 703 348 703 309 683 236 642 129 633 106 629 87 629 74 629 25 666-11 714-11 759-11 793 14 818 64 838 104 848 131 848 144 848 153 843 158 832 158 825 157 818 148 813 137 791 58 759 18 716 18 703 18 696 28 696 47 696 62 702 84 714 115 755 222 775 295 775 333 775 404 728 442 657 442Z"></path></g></g></g><g data-mml-node="mo" data-latex="\}" transform="translate(5647.2,0)"><path data-c="7D" d="M286 374 286 622C286 664 263 697 216 721 179 740 137 750 91 750 80 750 75 745 75 734 75 723 80 718 91 718 152 718 214 680 214 622L214 374C214 317 249 275 318 250 249 225 214 183 214 126L214-122C214-180 152-218 91-218 80-218 75-223 75-234 75-245 80-250 91-250 137-250 179-240 216-221 263-197 286-164 286-122L286 126C286 188 345 234 409 234 420 234 425 239 425 250 425 261 420 266 409 266 345 266 286 312 286 374Z"></path></g></g></g></svg></mjx-container> ),构造 P-2000 问题的特例集合<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.05ex" xmlns="http://www.w3.org/2000/svg" width="1.459ex" height="1.645ex" role="img" focusable="false" viewBox="0 -705 645 727"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg></mjx-container> :</li></ol><p>令<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="2.362ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1044 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="M = \max(t, \sum A) + 1"><g data-mml-node="mi" data-latex="M"><path data-c="1D440" d="M594 16C594 5 600 0 613 0L736 3C759 4 840 0 859 0 874 0 882 8 882 24 882 34 872 39 851 39 810 39 790 43 790 52 790 55 792 62 795 75L927 602C932 623 942 636 955 641 961 643 979 644 1008 644 1033 644 1044 645 1044 668 1044 678 1034 683 1013 683L882 683C853 683 853 681 840 662L484 108 408 657C404 682 402 683 373 683L237 683C215 683 204 682 204 660 204 649 215 644 236 644 256 644 297 647 297 631 297 629 296 623 293 613L167 110C158 72 135 49 100 42 75 39 42 43 42 16 42 5 48 0 60 0 78 0 141 3 159 3 178 3 242 0 261 0 276 0 283 8 283 24 283 33 276 38 261 39 219 39 198 52 198 78 198 82 199 89 202 100L332 621 415 26C418 9 424 0 434 0 442 0 450 7 459 20L848 627 712 82C706 60 696 47 681 42 675 40 656 39 625 39 604 39 594 37 594 16Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="14.645ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6473.1 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="M = \max(t, \sum A) + 1"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mo" data-latex="\max" transform="translate(1055.8,0)"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g><g data-mml-node="mo" data-latex="(" transform="translate(2916.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="t" transform="translate(3305.8,0)"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(3666.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mo" data-latex="\sum" transform="translate(4111.4,0)"><path data-c="2211" d="M56 713 417 216 67-217C60-225 57-231 57-235 57-245 67-250 88-250L913-250 1001 5 967 5C954-33 933-66 902-95 825-166 719-188 565-188L152-188 490 232C497 240 500 246 500 250 500 254 498 259 493 266L175 702 560 702C682 702 764 691 854 644 907 616 944 571 967 510L1001 510 913 750 88 750C57 750 56 746 56 713Z"></path></g><g data-mml-node="mi" data-latex="A" transform="translate(5334.1,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g><g data-mml-node="mo" data-latex=")" transform="translate(6084.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="M = \max(t, \sum A) + 1"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(1000.2,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g></g></g></svg></mjx-container> ,构造<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.459ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 645 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S = A \cup \{M, M + t\}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.085ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1805.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S = A \cup \{M, M + t\}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mi" data-latex="A" transform="translate(1055.8,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0 251 0 258 8 258 23 258 32 252 38 239 39 210 40 196 50 196 69 196 78 205 98 224 128 251 173 270 206 283 228L526 228C526 221 527 207 530 185 537 112 541 72 541 67 541 48 519 39 474 39 455 39 446 31 446 15 446 5 452 0 464 0 488 0 564 3 588 3 608 3 679 0 699 0 714 0 721 8 721 24 721 34 712 39 694 39 666 39 649 41 644 44 639 47 635 56 634 71L574 689C571 708 572 716 551 716 539 716 529 710 522 697L178 120C148 70 108 43 59 39 43 38 35 30 35 15 35 5 41 0 52 0 68 0 121 3 137 3M492 577 522 267 307 267Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="8.873ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3921.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S = A \cup \{M, M + t\}"><g data-mml-node="mo" data-latex="\cup"><path data-c="222A" d="M334-20C403-20 465-1 518 38 577 81 607 136 607 203L607 580C607 596 599 604 583 604 568 604 560 596 560 580L560 203C560 149 535 105 485 72 440 42 390 27 334 27 278 27 228 42 183 72 133 105 108 149 108 203L108 580C108 596 100 604 85 604 69 604 61 596 61 580L61 203C61 136 91 81 150 38 203-1 265-20 334-20Z"></path></g><g data-mml-node="mo" data-latex="\{" transform="translate(889.2,0)"><path data-c="7B" d="M286-122 286 126C286 183 251 225 182 250 251 275 286 317 286 374L286 622C286 680 348 718 409 718 420 718 425 723 425 734 425 745 420 750 409 750 363 750 321 740 284 721 237 697 214 664 214 622L214 374C214 311 154 266 91 266 80 266 75 261 75 250 75 239 80 234 91 234 155 234 214 188 214 126L214-122C214-164 237-197 284-221 321-240 363-250 409-250 420-250 425-245 425-234 425-223 420-218 409-218 348-218 286-180 286-122Z"></path></g><g data-mml-node="mi" data-latex="M" transform="translate(1389.2,0)"><path data-c="1D440" d="M594 16C594 5 600 0 613 0L736 3C759 4 840 0 859 0 874 0 882 8 882 24 882 34 872 39 851 39 810 39 790 43 790 52 790 55 792 62 795 75L927 602C932 623 942 636 955 641 961 643 979 644 1008 644 1033 644 1044 645 1044 668 1044 678 1034 683 1013 683L882 683C853 683 853 681 840 662L484 108 408 657C404 682 402 683 373 683L237 683C215 683 204 682 204 660 204 649 215 644 236 644 256 644 297 647 297 631 297 629 296 623 293 613L167 110C158 72 135 49 100 42 75 39 42 43 42 16 42 5 48 0 60 0 78 0 141 3 159 3 178 3 242 0 261 0 276 0 283 8 283 24 283 33 276 38 261 39 219 39 198 52 198 78 198 82 199 89 202 100L332 621 415 26C418 9 424 0 434 0 442 0 450 7 459 20L848 627 712 82C706 60 696 47 681 42 675 40 656 39 625 39 604 39 594 37 594 16Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(2433.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mi" data-latex="M" transform="translate(2877.9,0)"><path data-c="1D440" d="M594 16C594 5 600 0 613 0L736 3C759 4 840 0 859 0 874 0 882 8 882 24 882 34 872 39 851 39 810 39 790 43 790 52 790 55 792 62 795 75L927 602C932 623 942 636 955 641 961 643 979 644 1008 644 1033 644 1044 645 1044 668 1044 678 1034 683 1013 683L882 683C853 683 853 681 840 662L484 108 408 657C404 682 402 683 373 683L237 683C215 683 204 682 204 660 204 649 215 644 236 644 256 644 297 647 297 631 297 629 296 623 293 613L167 110C158 72 135 49 100 42 75 39 42 43 42 16 42 5 48 0 60 0 78 0 141 3 159 3 178 3 242 0 261 0 276 0 283 8 283 24 283 33 276 38 261 39 219 39 198 52 198 78 198 82 199 89 202 100L332 621 415 26C418 9 424 0 434 0 442 0 450 7 459 20L848 627 712 82C706 60 696 47 681 42 675 40 656 39 625 39 604 39 594 37 594 16Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.211ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1861.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S = A \cup \{M, M + t\}"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mi" data-latex="t" transform="translate(1000.2,0)"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g><g data-mml-node="mo" data-latex="\}" transform="translate(1361.2,0)"><path data-c="7D" d="M286 374 286 622C286 664 263 697 216 721 179 740 137 750 91 750 80 750 75 745 75 734 75 723 80 718 91 718 152 718 214 680 214 622L214 374C214 317 249 275 318 250 249 225 214 183 214 126L214-122C214-180 152-218 91-218 80-218 75-223 75-234 75-245 80-250 91-250 137-250 179-240 216-221 263-197 286-164 286-122L286 126C286 188 345 234 409 234 420 234 425 239 425 250 425 261 420 266 409 266 345 266 286 312 286 374Z"></path></g></g></g></svg></mjx-container></p><p>选择足够大的<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="1.993ex" height="1.545ex" role="img" focusable="false" viewBox="0 -683 881 683"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g></g></g></svg></mjx-container> 使得<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.459ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 645 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S \subseteq \{1, 2, \dots, N\}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="14.196ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6274.4 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S \subseteq \{1, 2, \dots, N\}"><g data-mml-node="mo" data-latex="\subseteq"><path data-c="2286" d="M669 87 378 87C309 87 252 110 204 158 156 206 132 264 132 333 132 402 156 460 204 508 252 556 309 579 378 579L669 579C685 579 693 587 693 603 693 619 685 627 669 627L378 627C296 627 227 599 170 542 113 485 85 415 85 333 85 251 113 181 170 124 227 67 296 39 378 39L669 39C685 39 693 47 693 63 693 76 682 87 669 87M669-80 130-80C115-80 107-88 107-103 107-119 115-127 130-127L669-127C685-127 693-119 693-103 693-91 682-80 669-80Z"></path></g><g data-mml-node="mo" data-latex="\{" transform="translate(1055.8,0)"><path data-c="7B" d="M286-122 286 126C286 183 251 225 182 250 251 275 286 317 286 374L286 622C286 680 348 718 409 718 420 718 425 723 425 734 425 745 420 750 409 750 363 750 321 740 284 721 237 697 214 664 214 622L214 374C214 311 154 266 91 266 80 266 75 261 75 250 75 239 80 234 91 234 155 234 214 188 214 126L214-122C214-164 237-197 284-221 321-240 363-250 409-250 420-250 425-245 425-234 425-223 420-218 409-218 348-218 286-180 286-122Z"></path></g><g data-mml-node="mn" data-latex="1" transform="translate(1555.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(2055.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(2500.4,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(3000.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mo" transform="translate(3445.1,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106 664 106 638 83 638 53 638 23 664 0 695 0 725 0 751 23 751 53M475 53C475 83 449 106 419 106 388 106 363 83 363 53 363 23 388 0 419 0 449 0 475 23 475 53M200 53C200 83 174 106 143 106 113 106 87 83 87 53 87 23 113 0 143 0 173 0 200 23 200 53Z"></path></g><g data-mml-node="mo" data-latex="," transform="translate(4448.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50 86 20 109-5 139-5 153-5 165-1 174 8L175 0C175-63 154-117 112-160 105-168 101-174 101-178 101-188 105-193 114-193 123-193 135-181 152-158 186-110 203-57 203 0 203 53 185 106 139 106Z"></path></g><g data-mml-node="mi" data-latex="N" transform="translate(4893.4,0)"><path data-c="1D441" d="M864 683C845 683 783 680 764 680 745 680 682 683 663 683 648 683 641 675 641 659 641 650 648 645 663 644 705 644 726 631 726 605 726 599 725 592 724 585L616 157 401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659 200 649 211 644 232 644 274 644 295 643 296 640L163 110C154 71 131 49 95 42 69 39 39 43 39 15 39 5 45 0 56 0 74 0 136 3 155 3 174 3 238 0 257 0 272 0 279 8 279 24 279 33 271 38 255 39 214 40 194 53 194 78 194 83 195 90 197 100L326 611 576 21C582 7 590 0 599 0 608 0 614 8 618 24L757 574C770 625 798 643 860 644 874 645 881 653 881 669 878 678 877 683 864 683Z"></path></g><g data-mml-node="mo" data-latex="\}" transform="translate(5774.4,0)"><path data-c="7D" d="M286 374 286 622C286 664 263 697 216 721 179 740 137 750 91 750 80 750 75 745 75 734 75 723 80 718 91 718 152 718 214 680 214 622L214 374C214 317 249 275 318 250 249 225 214 183 214 126L214-122C214-180 152-218 91-218 80-218 75-223 75-234 75-245 80-250 91-250 137-250 179-240 216-221 263-197 286-164 286-122L286 126C286 188 345 234 409 234 420 234 425 239 425 250 425 261 420 266 409 266 345 266 286 312 286 374Z"></path></g></g></g></svg></mjx-container></p><ol start="2"><li><p>此时,和为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> 的子集与和为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="2.362ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1044 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="M + t"><g data-mml-node="mi" data-latex="M"><path data-c="1D440" d="M594 16C594 5 600 0 613 0L736 3C759 4 840 0 859 0 874 0 882 8 882 24 882 34 872 39 851 39 810 39 790 43 790 52 790 55 792 62 795 75L927 602C932 623 942 636 955 641 961 643 979 644 1008 644 1033 644 1044 645 1044 668 1044 678 1034 683 1013 683L882 683C853 683 853 681 840 662L484 108 408 657C404 682 402 683 373 683L237 683C215 683 204 682 204 660 204 649 215 644 236 644 256 644 297 647 297 631 297 629 296 623 293 613L167 110C158 72 135 49 100 42 75 39 42 43 42 16 42 5 48 0 60 0 78 0 141 3 159 3 178 3 242 0 261 0 276 0 283 8 283 24 283 33 276 38 261 39 219 39 198 52 198 78 198 82 199 89 202 100L332 621 415 26C418 9 424 0 434 0 442 0 450 7 459 20L848 627 712 82C706 60 696 47 681 42 675 40 656 39 625 39 604 39 594 37 594 16Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.08ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1361.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="M + t"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="mi" data-latex="t" transform="translate(1000.2,0)"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> 的子集存在一一对应(通过添加元素<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:0" xmlns="http://www.w3.org/2000/svg" width="2.362ex" height="1.545ex" role="img" focusable="false" viewBox="0 -683 1044 683"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="M"><g data-mml-node="mi" data-latex="M"><path data-c="1D440" d="M594 16C594 5 600 0 613 0L736 3C759 4 840 0 859 0 874 0 882 8 882 24 882 34 872 39 851 39 810 39 790 43 790 52 790 55 792 62 795 75L927 602C932 623 942 636 955 641 961 643 979 644 1008 644 1033 644 1044 645 1044 668 1044 678 1034 683 1013 683L882 683C853 683 853 681 840 662L484 108 408 657C404 682 402 683 373 683L237 683C215 683 204 682 204 660 204 649 215 644 236 644 256 644 297 647 297 631 297 629 296 623 293 613L167 110C158 72 135 49 100 42 75 39 42 43 42 16 42 5 48 0 60 0 78 0 141 3 159 3 178 3 242 0 261 0 276 0 283 8 283 24 283 33 276 38 261 39 219 39 198 52 198 78 198 82 199 89 202 100L332 621 415 26C418 9 424 0 434 0 442 0 450 7 459 20L848 627 712 82C706 60 696 47 681 42 675 40 656 39 625 39 604 39 594 37 594 16Z"></path></g></g></g></svg></mjx-container> )</p></li><li><p>P-2000 问题对<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.05ex" xmlns="http://www.w3.org/2000/svg" width="1.459ex" height="1.645ex" role="img" focusable="false" viewBox="0 -705 645 727"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g></g></g></svg></mjx-container> 的计数结果中,若<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.025ex" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595 257 616 246 626 225 626 202 626 188 613 182 587L145 433 56 433C34 433 23 432 23 411 23 400 33 395 54 395L135 395C86 200 62 97 62 84 62 28 100-11 156-11 194-11 227 6 256 41 280 70 297 98 308 125 312 136 314 142 314 145 314 154 309 159 299 159 291 159 285 154 281 143 247 60 206 19 157 19 140 19 131 33 131 60 131 75 133 91 137 107L208 395 297 395C323 395 330 397 330 419Z"></path></g></g></g></svg></mjx-container> 为素数,则包含了原 SUBSET - SUM 问题的解信息</p></li></ol><p>这一归约过程可在多项式时间内完成,因为集合规模的扩展和素数判断均为多项式操作。该归约表明 P-2000 问题至少与 SUBSET - SUM 问题一样难,即 P-2000 问题是 NP 难的。</p><h3 id="P-2000问题到子集和问题的归约不可能性"><a href="#P-2000问题到子集和问题的归约不可能性" class="headerlink" title="P-2000问题到子集和问题的归约不可能性"></a>P-2000 问题到子集和问题的归约不可能性</h3><p>P-2000 问题本质是 #P 类问题(计数问题),而子集和问题是 NP 类(判定问题)。根据 Toda 定理,多项式层级<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.238ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1431 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{PH} \subseteq \text{P}^{\#\text{P} }"><g data-mml-node="mtext" data-latex="\text{PH}"><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z"></path><path data-c="48" d="M566 3C640 3 690 2 716 0L716 39 688 39C653 39 632 41 625 46 618 51 614 63 614 81L614 602C614 620 618 631 625 636 632 641 653 644 688 644L716 644 716 683C690 681 640 680 567 680 492 680 442 681 417 683L417 644 444 644C479 644 500 641 507 636 514 631 518 620 518 602L518 375 231 375 231 602C231 620 235 631 242 636 249 641 270 644 305 644L332 644 332 683C307 681 257 680 183 680 109 680 59 681 33 683L33 644 61 644C96 644 117 641 124 636 131 631 135 620 135 602L135 81C135 63 131 51 124 46 117 41 96 39 61 39L33 39 33 0C59 2 109 3 182 3 257 3 307 2 332 0L332 39 305 39C270 39 249 41 242 46 235 51 231 63 231 81L231 336 518 336 518 81C518 63 514 51 507 46 500 41 479 39 444 39L417 39 417 0C442 2 492 3 566 3Z" transform="translate(681,0)"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.539ex" height="2.604ex" role="img" focusable="false" viewBox="0 -900.8 2890.3 1150.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{PH} \subseteq \text{P}^{\#\text{P} }"><g data-mml-node="mo" data-latex="\subseteq"><path data-c="2286" d="M669 87 378 87C309 87 252 110 204 158 156 206 132 264 132 333 132 402 156 460 204 508 252 556 309 579 378 579L669 579C685 579 693 587 693 603 693 619 685 627 669 627L378 627C296 627 227 599 170 542 113 485 85 415 85 333 85 251 113 181 170 124 227 67 296 39 378 39L669 39C685 39 693 47 693 63 693 76 682 87 669 87M669-80 130-80C115-80 107-88 107-103 107-119 115-127 130-127L669-127C685-127 693-119 693-103 693-91 682-80 669-80Z"></path></g><g data-mml-node="msup" data-latex="\text{P}^{\#\text{P}}" transform="translate(1055.8,0)"><g data-mml-node="mtext" data-latex="\text{P}"><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z"></path></g><g data-mml-node="TeXAtom" transform="translate(714,410.1) scale(0.707)" data-latex="{\#\text{P}}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\#"><path data-c="23" d="M739 130C764 130 776 138 776 154 776 170 763 178 738 178L535 178 572 322 738 322C763 322 776 330 776 346 776 362 764 370 739 370L586 370 662 651C665 657 666 663 666 670 666 686 658 694 642 694 637 694 632 692 628 689 622 679 618 672 617 667L538 370 360 370 436 651C439 657 440 663 440 670 440 686 432 694 416 694 411 694 406 692 401 689 395 679 391 672 390 667L311 370 93 370C68 370 56 362 56 346 56 330 69 322 94 322L297 322 260 178 94 178C69 178 56 170 56 154 56 138 68 130 93 130L246 130 170-151C167-157 166-163 166-170 166-186 174-194 190-194 195-194 200-192 204-189 210-179 214-172 215-167L294 130 472 130 396-151C393-157 392-163 392-170 392-186 400-194 416-194 421-194 426-192 431-189 437-179 441-172 442-167L521 130M346 322 524 322 486 178 308 178Z"></path></g><g data-mml-node="mtext" data-latex="\text{P}" transform="translate(833,0)"><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z"></path></g></g></g></g></g></svg></mjx-container> ,即 #P 类问题至少与 PH 一样难。若 P-2000 问题可归约到子集和问题,则意味着<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.425ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1514 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\#\text{P} \subseteq \text{NP}"><g data-mml-node="mi" data-latex="\#"><path data-c="23" d="M739 130C764 130 776 138 776 154 776 170 763 178 738 178L535 178 572 322 738 322C763 322 776 330 776 346 776 362 764 370 739 370L586 370 662 651C665 657 666 663 666 670 666 686 658 694 642 694 637 694 632 692 628 689 622 679 618 672 617 667L538 370 360 370 436 651C439 657 440 663 440 670 440 686 432 694 416 694 411 694 406 692 401 689 395 679 391 672 390 667L311 370 93 370C68 370 56 362 56 346 56 330 69 322 94 322L297 322 260 178 94 178C69 178 56 170 56 154 56 138 68 130 93 130L246 130 170-151C167-157 166-163 166-170 166-186 174-194 190-194 195-194 200-192 204-189 210-179 214-172 215-167L294 130 472 130 396-151C393-157 392-163 392-170 392-186 400-194 416-194 421-194 426-192 431-189 437-179 441-172 442-167L521 130M346 322 524 322 486 178 308 178Z"></path></g><g data-mml-node="mtext" data-latex="\text{P}" transform="translate(833,0)"><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.626ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2486.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\#\text{P} \subseteq \text{NP}"><g data-mml-node="mo" data-latex="\subseteq"><path data-c="2286" d="M669 87 378 87C309 87 252 110 204 158 156 206 132 264 132 333 132 402 156 460 204 508 252 556 309 579 378 579L669 579C685 579 693 587 693 603 693 619 685 627 669 627L378 627C296 627 227 599 170 542 113 485 85 415 85 333 85 251 113 181 170 124 227 67 296 39 378 39L669 39C685 39 693 47 693 63 693 76 682 87 669 87M669-80 130-80C115-80 107-88 107-103 107-119 115-127 130-127L669-127C685-127 693-119 693-103 693-91 682-80 669-80Z"></path></g><g data-mml-node="mtext" data-latex="\text{NP}" transform="translate(1055.8,0)"><path data-c="4E" d="M576 15C586 1 589 0 596 0 613 0 614 7 614 30L614 575C614 592 618 606 626 619 637 636 667 644 716 644L716 683 596 680 477 683 477 644C526 644 556 636 567 619 575 606 579 592 579 575L579 166 237 668C230 678 220 683 205 683L33 683 33 644 66 644C106 644 128 642 133 638 134 637 135 632 135 624L135 108C135 91 131 77 123 64 112 47 82 39 33 39L33 0 152 3 272 0 272 39C223 39 193 47 182 64 174 77 170 91 170 108L170 611Z"></path><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z" transform="translate(750,0)"></path></g></g></g></svg></mjx-container> ,这将与现有复杂度理论矛盾(除非<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 681 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{P} = \text{NP} = \#\text{P}"><g data-mml-node="mtext" data-latex="\text{P}"><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.626ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2486.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{P} = \text{NP} = \#\text{P}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mtext" data-latex="\text{NP}" transform="translate(1055.8,0)"><path data-c="4E" d="M576 15C586 1 589 0 596 0 613 0 614 7 614 30L614 575C614 592 618 606 626 619 637 636 667 644 716 644L716 683 596 680 477 683 477 644C526 644 556 636 567 619 575 606 579 592 579 575L579 166 237 668C230 678 220 683 205 683L33 683 33 644 66 644C106 644 128 642 133 638 134 637 135 632 135 624L135 108C135 91 131 77 123 64 112 47 82 39 33 39L33 0 152 3 272 0 272 39C223 39 193 47 182 64 174 77 170 91 170 108L170 611Z"></path><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z" transform="translate(750,0)"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.814ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2569.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{P} = \text{NP} = \#\text{P}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mi" data-latex="\#" transform="translate(1055.8,0)"><path data-c="23" d="M739 130C764 130 776 138 776 154 776 170 763 178 738 178L535 178 572 322 738 322C763 322 776 330 776 346 776 362 764 370 739 370L586 370 662 651C665 657 666 663 666 670 666 686 658 694 642 694 637 694 632 692 628 689 622 679 618 672 617 667L538 370 360 370 436 651C439 657 440 663 440 670 440 686 432 694 416 694 411 694 406 692 401 689 395 679 391 672 390 667L311 370 93 370C68 370 56 362 56 346 56 330 69 322 94 322L297 322 260 178 94 178C69 178 56 170 56 154 56 138 68 130 93 130L246 130 170-151C167-157 166-163 166-170 166-186 174-194 190-194 195-194 200-192 204-189 210-179 214-172 215-167L294 130 472 130 396-151C393-157 392-163 392-170 392-186 400-194 416-194 421-194 426-192 431-189 437-179 441-172 442-167L521 130M346 322 524 322 486 178 308 178Z"></path></g><g data-mml-node="mtext" data-latex="\text{P}" transform="translate(1888.8,0)"><path data-c="50" d="M395 312C452 312 503 328 548 360 599 396 624 441 624 495 624 552 598 599 546 635 500 667 447 683 387 683L35 683 35 644 63 644C98 644 119 641 126 636 133 631 137 620 137 602L137 81C137 63 133 51 126 46 119 41 98 39 63 39L35 39 35 0C61 2 111 3 184 3 258 3 308 2 334 0L334 39 306 39C271 39 250 41 243 46 236 51 232 63 232 81L232 312M274 644 362 644C391 644 416 640 437 633 494 612 514 570 514 495 514 467 511 443 504 423 487 373 433 346 362 346L229 346 229 609C229 645 235 644 274 644Z"></path></g></g></g></svg></mjx-container> )。</p><p>从集合论角度看,根据 ZF 公理系统中的幂集公理,非确定型图灵机 (NTM) 的计算能力相当于确定型图灵机 (DTM) 的幂集。由于 P-2000 问题需要计数所有素数目标的子集数量(相当于枚举幂集中的特定元素),其复杂度严格高于仅需判定存在性的 SUBSET - SUM 问题。</p></div><div class="story post-story"><h2 id="实际计算与优化策略"><a href="#实际计算与优化策略" class="headerlink" title="实际计算与优化策略"></a>实际计算与优化策略</h2><h3 id="动态规划的优化实现"><a href="#动态规划的优化实现" class="headerlink" title="动态规划的优化实现"></a>动态规划的优化实现</h3><h4 id="空间压缩"><a href="#空间压缩" class="headerlink" title="空间压缩"></a>空间压缩</h4><p>采用一维数组<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.633ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2048 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="dp[s] "><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632 370 389C349 426 320 445 281 445 216 445 159 412 109 345 63 283 40 218 40 151 40 63 91-11 175-11 218-11 260 12 300 59 311 21 345-11 392-11 461-11 483 71 498 145 498 154 493 159 483 159 474 159 468 152 465 138 445 59 421 19 394 19 377 19 368 33 368 60 368 75 370 91 374 107L516 679 516 683C513 690 507 694 499 694 476 694 434 690 374 683 363 682 357 674 357 660 357 650 366 645 384 645 403 645 429 646 429 632M341 376C351 355 356 341 356 332 355 328 354 323 353 316L304 122C301 111 294 99 285 87 248 42 212 19 177 19 138 19 118 49 118 108 118 132 124 168 136 216 157 301 187 359 224 390 244 407 263 415 282 415 309 415 329 402 341 376Z"></path></g><g data-mml-node="mi" data-latex="p" transform="translate(520,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373 217 419 186 442 137 442 96 442 66 409 45 344 35 311 30 292 30 286 30 277 35 272 46 272 51 272 54 273 57 275 62 284 65 291 66 298 84 374 107 412 134 412 152 412 161 398 161 371 161 356 159 339 154 321L44-118C35-151 34-155-5-155-23-155-32-163-32-178-32-189-26-194-15-194 0-194 52-191 67-191 86-191 146-194 165-194 180-194 187-186 187-170 187-160 178-155 159-155 141-155 114-156 114-144 114-131 155 26 159 43 179 6 209-13 249-13 314-13 371 20 421 87 467 148 490 213 490 280 490 367 438 442 355 442M352 412C391 412 411 382 411 323 411 296 405 260 394 215 371 128 342 71 307 42 286 25 267 16 248 16 219 16 199 29 188 56 179 77 174 92 174 100L225 309C230 331 248 354 276 377 304 400 329 412 352 412Z"></path></g><g data-mml-node="mo" data-latex="[" transform="translate(1023,0)"><path data-c="5B" d="M233-202 159-202 159 702 233 702C248 702 256 710 256 726 256 742 248 750 233 750L114 750 114-250 233-250C248-250 256-242 256-226 256-214 245-202 233-202Z"></path></g><g data-mml-node="mi" data-latex="s" transform="translate(1301,0)"><path data-c="1D460" d="M420 354C420 411 362 442 300 442 237 442 192 423 165 385 142 352 130 322 130 295 130 242 165 208 234 193 263 188 285 181 302 173 323 164 333 147 333 123 333 105 325 85 308 62 287 33 250 18 197 18 143 18 108 33 92 62 124 61 151 87 151 119 151 144 138 157 111 157 75 157 52 124 52 88 52 22 124-11 196-11 271-11 325 11 357 56 384 93 397 126 397 156 397 199 376 231 335 252 304 263 280 270 265 273 230 282 194 285 194 328 194 381 244 413 300 413 342 413 369 400 382 375 360 371 337 352 337 327 337 306 348 295 371 295 402 295 420 323 420 354Z"></path></g><g data-mml-node="mo" data-latex="]" transform="translate(1770,0)"><path data-c="5D" d="M45-250 164-250 164 750 45 750C30 750 22 742 22 726 22 710 30 702 45 702L119 702 119-202 45-202C30-202 22-210 22-226 22-242 30-250 45-250Z"></path></g></g></g></svg></mjx-container> ,按从大到小顺序更新:</p><figure class="highlight cpp"><table><tbody><tr><td class="code"><pre><span class="line">dp = [<span class="number">0</span>] * (S_max + <span class="number">1</span>)</span><br><span class="line">dp[<span class="number">0</span>] = <span class="number">1</span></span><br><span class="line"><span class="keyword">for</span> i in <span class="built_in">range</span>(<span class="number">1</span>, N+<span class="number">1</span>):</span><br><span class="line"> <span class="keyword">for</span> s in <span class="built_in">range</span>(S_max, i<span class="number">-1</span>, <span class="number">-1</span>):</span><br><span class="line"> dp[s] += dp[s - i]</span><br><span class="line"> dp[s] %= MOD <span class="comment">// 如需模运算防止溢出</span></span><br></pre></td></tr></tbody></table></figure><p>这一实现与 01 背包问题的空间优化方法一致,将二维数组压缩为一维数组,空间复杂度从<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.819ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1688 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) "><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="n" transform="translate(1088,0)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18 427 18 420 28 420 47 420 61 426 84 438 115 478 224 498 296 498 333 498 403 451 442 381 442 322 442 271 416 230 363 222 407 187 442 136 442 80 442 58 390 44 345 34 313 29 294 29 287 29 278 34 273 45 273 50 273 53 274 56 276 61 285 64 292 65 299 83 375 106 413 133 413 151 413 160 399 160 371 160 358 155 331 144 290L87 63C84 50 78 24 78 19 78-1 89-11 111-11 130-11 144-1 151 19 153 24 159 49 170 92L191 181 221 295C232 318 249 341 270 365 299 397 335 413 378 413 411 413 427 391 427 348 427 310 406 234 363 120 356 102 353 87 353 74 353 25 390-11 438-11 482-11 517 14 542 64 561 104 571 131 571 144 571 153 566 158 555 158 552 158 537 149 537 137Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.564ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2901.1 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) "><g data-mml-node="mo" data-latex="\cdot"><path data-c="22C5" d="M192 250C192 279 168 303 139 303 110 303 86 279 86 250 86 221 110 197 139 197 168 197 192 221 192 250Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(500.2,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2512.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container> 降至<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.561ex" xmlns="http://www.w3.org/2000/svg" width="7.893ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 3488.9 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex=" \mathcal{O}(S_{\text{max} })"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1088,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3099.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container> 。</p><h4 id="素数判断优化"><a href="#素数判断优化" class="headerlink" title="素数判断优化"></a>素数判断优化</h4><p>使用 Miller-Rabin 素性测试代替厄拉多塞筛法,可处理更大范围内的素数判断,尤其当<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.357ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="1.952ex" role="img" focusable="false" viewBox="0 -705 2011.9 862.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} }"><g data-mml-node="msub" data-latex="S_{\text{max} }"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg></mjx-container> 超过<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.05ex" xmlns="http://www.w3.org/2000/svg" width="3.25ex" height="2.02ex" role="img" focusable="false" viewBox="0 -871.1 1436.6 893.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="10^{7}"><g data-mml-node="msup" data-latex="10^{7}"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{7}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="7"><path data-c="37" d="M475 604C482 613 485 626 485 644L243 644C174 644 135 648 128 657 125 660 122 667 120 676L89 676 55 464 88 464C98 520 106 550 112 555 115 558 146 560 205 560L401 560 295 410C214 295 174 171 174 36 174-3 190-22 223-22 256-22 272-3 272 36L272 87C272 239 296 349 343 416Z"></path></g></g></g></g></g></svg></mjx-container> 时更高效。对于<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="4.552ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2011.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } = 2001000"><g data-mml-node="msub" data-latex="S_{\text{max}}"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="10.307ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="S_{\text{max} } = 2001000"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="001000" transform="translate(1055.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(1500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(2000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(2500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(3000,0)"></path></g></g></g></svg></mjx-container> ,预先生成素数表仍是可行的,但需注意内存占用(约 2MB)。</p><h3 id="复杂度下界分析"><a href="#复杂度下界分析" class="headerlink" title="复杂度下界分析"></a>复杂度下界分析</h3><p>根据动态规划复杂度分析,P-2000 问题的时间复杂度为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.819ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1688 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="n" transform="translate(1088,0)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18 427 18 420 28 420 47 420 61 426 84 438 115 478 224 498 296 498 333 498 403 451 442 381 442 322 442 271 416 230 363 222 407 187 442 136 442 80 442 58 390 44 345 34 313 29 294 29 287 29 278 34 273 45 273 50 273 53 274 56 276 61 285 64 292 65 299 83 375 106 413 133 413 151 413 160 399 160 371 160 358 155 331 144 290L87 63C84 50 78 24 78 19 78-1 89-11 111-11 130-11 144-1 151 19 153 24 159 49 170 92L191 181 221 295C232 318 249 341 270 365 299 397 335 413 378 413 411 413 427 391 427 348 427 310 406 234 363 120 356 102 353 87 353 74 353 25 390-11 438-11 482-11 517 14 542 64 561 104 571 131 571 144 571 153 566 158 555 158 552 158 537 149 537 137Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.564ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2901.1 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="mo" data-latex="\cdot"><path data-c="22C5" d="M192 250C192 279 168 303 139 303 110 303 86 279 86 250 86 221 110 197 139 197 168 197 192 221 192 250Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(500.2,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2512.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="9.375ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4143.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1754.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mn" data-latex="000" transform="translate(2143.8,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1000,0)"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(1500,0)"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="mn" data-latex="2" transform="translate(1000.2,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612 69 576 50 534 50 483 50 449 75 424 106 424 136 424 161 450 161 480 161 513 137 536 105 536 102 536 100 536 98 535 117 584 161 627 224 627 306 627 352 556 352 470 352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0 450 180 417 180C409 129 402 100 396 91 391 86 361 84 306 84L139 84 236 179C304 243 390 312 419 365 439 400 449 435 449 470 449 588 357 666 237 666Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="6.393ex" height="2.52ex" role="img" focusable="false" viewBox="0 -864 2825.8 1114"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="msup" data-latex="0^{6}" transform="translate(1000.2,0)"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{6}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="6"><path data-c="36" d="M383 504C416 504 432 521 432 555 432 627 378 666 304 666 221 666 155 627 106 548 63 480 42 403 42 316 42 189 65 100 112 47 152 1 198-22 251-22 312-22 362 1 401 47 438 91 457 144 457 205 457 266 439 318 403 361 365 407 316 431 257 431 205 431 165 402 138 346L138 352C138 465 166 561 226 605 252 624 279 633 306 633 342 633 368 623 385 602 351 602 334 583 334 553 334 525 355 504 383 504M344 340C355 317 361 272 361 206 361 141 356 98 345 76 325 35 294 14 251 14 222 14 200 24 184 44 171 60 162 74 158 85 146 116 140 163 140 227 140 255 144 282 151 308 164 355 201 399 256 399 295 399 325 379 344 340Z"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2436.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg><mjx-break size="4"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367 80 367C64 367 56 359 56 344 56 329 64 321 80 321L698 321C714 321 722 329 722 344 722 356 711 367 698 367M698 179 80 179C64 179 56 171 56 156 56 141 64 133 80 133L698 133C714 133 722 141 722 156 722 169 711 179 698 179Z"></path></g><g data-mml-node="mn" data-latex="4" transform="translate(1055.8,0)"><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199 28 163 289 163 289 81C289 63 285 51 278 46 271 41 252 39 219 39L194 39 194 0C223 2 269 3 331 3 393 3 439 2 468 0L468 39 443 39C410 39 391 41 384 46 377 51 373 63 373 81L373 163 471 163 471 202 373 202 373 660C373 670 366 677 353 677M295 553 295 202 67 202Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.513ex" height="2.52ex" role="img" focusable="false" viewBox="0 -864 2436.8 1114"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} }) = \mathcal{O}(2000 \times 2 \times 10^{6}) = 4 \times 10^{9}"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250 623 451C628 456 630 461 630 468 630 481 620 491 607 491 600 491 595 489 590 484L389 283 188 484C183 489 178 491 171 491 158 491 148 481 148 468 148 461 150 456 155 451L356 250 155 49C150 44 148 39 148 32 148 19 158 9 171 9 178 9 183 11 188 16L389 217 590 16C595 11 600 9 607 9 620 9 630 19 630 32Z"></path></g><g data-mml-node="msup" data-latex="0^{9}" transform="translate(1000.2,0)"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{9}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="9"><path data-c="39" d="M116 140C83 140 67 123 67 89 67 14 128-22 207-22 287-22 351 18 398 99 437 166 457 243 457 329 457 456 434 546 388 599 349 644 304 666 253 666 194 666 145 645 106 602 63 557 42 503 42 440 42 379 60 327 96 284 134 238 183 215 242 215 294 215 334 243 361 299L361 286C361 177 342 103 303 63 272 30 239 14 206 14 166 14 137 23 118 42 149 42 165 60 165 91 165 119 144 140 116 140M243 246C204 246 175 266 155 306 144 329 138 374 138 439 138 504 145 548 158 573 180 613 212 633 253 633 294 633 324 608 343 558 354 531 361 485 361 420 361 333 322 246 243 246Z"></path></g></g></g></g></g></svg></mjx-container> 操作,这超出了现代计算机的常规处理能力(约<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.05ex" xmlns="http://www.w3.org/2000/svg" width="3.25ex" height="2.005ex" role="img" focusable="false" viewBox="0 -864 1436.6 886"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="10^{8}"><g data-mml-node="msup" data-latex="10^{8}"><g data-mml-node="mn" data-latex="0"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47 195 42 170 39 130 39L95 39 95 0C120 2 174 3 257 3 340 3 394 2 419 0L419 39 384 39C343 39 318 42 310 47 302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"></path><path data-c="30" d="M249-22C390-22 460 92 460 320 460 473 428 575 365 625 330 652 291 666 250 666 109 666 39 551 39 320 39 136 88-22 249-22M361 524C368 489 371 425 371 332 371 240 367 172 360 128 347 48 310 8 249 8 226 8 203 17 182 34 155 57 139 104 132 176 129 201 128 253 128 332 128 419 131 480 136 513 145 568 163 603 191 618 213 630 232 636 249 636 314 636 350 583 361 524Z" transform="translate(500,0)"></path></g><g data-mml-node="TeXAtom" transform="translate(1033,393.1) scale(0.707)" data-latex="{8}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="8"><path data-c="38" d="M250 666C201 666 158 650 122 618 86 586 68 546 68 497 68 456 83 419 113 386 120 378 142 361 179 335 88 288 42 227 42 153 42 100 64 57 107 24 147-7 194-22 249-22 305-22 354-4 395 32 436 68 457 115 457 170 457 216 441 257 408 294 396 307 365 330 316 361 393 402 431 454 431 515 431 606 344 666 250 666M379 515C379 463 348 418 286 381L167 459C136 479 120 505 120 536 120 596 185 633 249 633 318 633 379 584 379 515M250 14C168 14 99 73 99 153 99 220 136 274 210 315L328 240C376 209 400 174 400 134 400 62 325 14 250 14Z"></path></g></g></g></g></g></svg></mjx-container> 操作 / 秒)。因此,实际求解需结合启发式方法,如:</p><p>分段计算 :将集合分为多个子集,分别计算子集和分布,再通过卷积合并</p><p>蒙特卡洛采样 :随机抽取部分子集估计素数和的比例</p><p>数学近似 :利用素数定理估计区间内素数密度,结合中心极限定理近似子集和分布</p></div><div class="story post-story"><h2 id="结论"><a href="#结论" class="headerlink" title="结论"></a>结论</h2><p>P-2000 问题作为子集和理论与素数分布的交叉课题,展现了组合计数问题的深刻复杂性。通过动态规划与素数筛选的结合,我们建立了问题的求解框架,其时间复杂度为<mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="3.819ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1688 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } + S_{\text{max} } \log \log S_{\text{max} })"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194 429 83 352 28 258 28 211 28 174 46 147 83 129 108 120 144 120 193 120 238 127 290 142 349 172 472 233 570 324 643L308 660C283 647 264 634 249 622 154 545 90 442 57 312 46 270 41 230 41 192 41 134 53 88 78 55 115 6 163-18 223-18 372-18 485 51 562 190 605 268 663 421 659 530 656 621 605 686 514 686 402 686 321 596 299 505 290 472 292 448 304 432 311 421 322 415 338 415 365 415 382 427 389 451 394 467 394 480 387 489 372 508 365 526 365 542 365 570 380 595 411 616 439 635 468 645 497 645 558 645 583 584 583 525Z"></path></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234 332-231 330-227 327-223 275-183 233-117 202-26 175 53 161 131 161 208L161 292C161 369 175 447 202 526 233 617 275 683 327 723 330 726 332 730 332 734 332 743 327 748 318 748 317 748 314 747 311 745 251 699 201 631 160 540 121 453 101 371 101 292L101 208C101 129 121 47 160-40 201-131 251-199 311-245 314-247 317-248 318-248Z"></path></g><g data-mml-node="mi" data-latex="n" transform="translate(1088,0)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18 427 18 420 28 420 47 420 61 426 84 438 115 478 224 498 296 498 333 498 403 451 442 381 442 322 442 271 416 230 363 222 407 187 442 136 442 80 442 58 390 44 345 34 313 29 294 29 287 29 278 34 273 45 273 50 273 53 274 56 276 61 285 64 292 65 299 83 375 106 413 133 413 151 413 160 399 160 371 160 358 155 331 144 290L87 63C84 50 78 24 78 19 78-1 89-11 111-11 130-11 144-1 151 19 153 24 159 49 170 92L191 181 221 295C232 318 249 341 270 365 299 397 335 413 378 413 411 413 427 391 427 348 427 310 406 234 363 120 356 102 353 87 353 74 353 25 390-11 438-11 482-11 517 14 542 64 561 104 571 131 571 144 571 153 566 158 555 158 552 158 537 149 537 137Z"></path></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="5.684ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2512.1 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } + S_{\text{max} } \log \log S_{\text{max} })"><g data-mml-node="mo" data-latex="\cdot"><path data-c="22C5" d="M192 250C192 279 168 303 139 303 110 303 86 279 86 250 86 221 110 197 139 197 168 197 192 221 192 250Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(500.2,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g></g></g></svg><mjx-break size="3"></mjx-break><svg style="vertical-align:-.566ex" xmlns="http://www.w3.org/2000/svg" width="19.161ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 8469.1 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n \cdot S_{\text{max} } + S_{\text{max} } \log \log S_{\text{max} })"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274 413 274 413 559C413 575 405 583 389 583 373 583 365 575 365 559L365 274 80 274C64 274 56 266 56 250 56 234 64 226 80 226L365 226 365-59C365-75 373-83 389-83 405-83 413-75 413-59L413 226 698 226C714 226 722 234 722 250 722 263 711 274 698 274Z"></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mi" data-latex="\log" transform="translate(3178.8,0)"><path data-c="6C" d="M144 3 255 0 255 39C219 39 197 40 190 44 183 48 180 60 180 79L180 694 33 683 33 645C68 645 90 642 97 636 104 630 108 616 108 593L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z"></path><path data-c="6F" d="M249-11C311-11 363 11 406 55 449 99 471 152 471 214 471 277 450 332 408 378 366 424 313 448 250 448 187 448 135 424 92 378 49 332 28 277 28 214 28 152 49 99 92 55 135 11 188-11 249-11M250 21C202 21 166 42 141 85 125 113 117 159 117 222 117 283 125 327 140 355 164 398 200 419 249 419 296 419 332 398 357 357 374 329 382 284 382 222 382 106 348 21 250 21Z" transform="translate(278,0)"></path><path data-c="67" d="M431 453C393 453 358 438 326 408 296 431 262 442 223 442 137 442 59 378 59 294 59 252 74 218 104 192 85 168 75 141 75 110 75 72 88 43 113 24 71 10 28-26 28-77 28-120 56-154 111-178 153-197 199-206 249-206 300-206 347-197 389-178 444-154 471-120 471-75 471-22 449 17 405 42 359 67 308 70 234 70 190 70 166 70 161 71 133 75 113 102 113 133 113 148 117 162 126 174 154 155 186 145 223 145 309 145 386 209 386 293 386 332 373 364 347 389 372 412 399 423 428 423 423 418 420 410 420 400 420 378 431 367 453 367 474 367 485 378 485 401 485 432 461 453 431 453M223 411C277 411 304 372 304 294 304 215 277 175 223 175 168 175 141 214 141 293 141 372 168 411 223 411M164 4 222 4C274 4 316 1 348-6 391-15 412-39 412-77 412-109 392-134 352-153 321-168 287-175 250-175 214-175 180-168 148-153 107-134 87-109 87-77 87-35 123 4 164 4Z" transform="translate(778,0)"></path></g><g data-mml-node="mo" transform="translate(4456.8,0)"><path data-c="2061" d=""></path></g><g data-mml-node="mi" data-latex="\log" transform="translate(4623.5,0)"><path data-c="6C" d="M144 3 255 0 255 39C219 39 197 40 190 44 183 48 180 60 180 79L180 694 33 683 33 645C68 645 90 642 97 636 104 630 108 616 108 593L108 79C108 60 105 48 98 44 91 40 69 39 33 39L33 0Z"></path><path data-c="6F" d="M249-11C311-11 363 11 406 55 449 99 471 152 471 214 471 277 450 332 408 378 366 424 313 448 250 448 187 448 135 424 92 378 49 332 28 277 28 214 28 152 49 99 92 55 135 11 188-11 249-11M250 21C202 21 166 42 141 85 125 113 117 159 117 222 117 283 125 327 140 355 164 398 200 419 249 419 296 419 332 398 357 357 374 329 382 284 382 222 382 106 348 21 250 21Z" transform="translate(278,0)"></path><path data-c="67" d="M431 453C393 453 358 438 326 408 296 431 262 442 223 442 137 442 59 378 59 294 59 252 74 218 104 192 85 168 75 141 75 110 75 72 88 43 113 24 71 10 28-26 28-77 28-120 56-154 111-178 153-197 199-206 249-206 300-206 347-197 389-178 444-154 471-120 471-75 471-22 449 17 405 42 359 67 308 70 234 70 190 70 166 70 161 71 133 75 113 102 113 133 113 148 117 162 126 174 154 155 186 145 223 145 309 145 386 209 386 293 386 332 373 364 347 389 372 412 399 423 428 423 423 418 420 410 420 400 420 378 431 367 453 367 474 367 485 378 485 401 485 432 461 453 431 453M223 411C277 411 304 372 304 294 304 215 277 175 223 175 168 175 141 214 141 293 141 372 168 411 223 411M164 4 222 4C274 4 316 1 348-6 391-15 412-39 412-77 412-109 392-134 352-153 321-168 287-175 250-175 214-175 180-168 148-153 107-134 87-109 87-77 87-35 123 4 164 4Z" transform="translate(778,0)"></path></g><g data-mml-node="mo" transform="translate(5901.5,0)"><path data-c="2061" d=""></path></g><g data-mml-node="msub" data-latex="S_{\text{max}}" transform="translate(6068.1,0)"><g data-mml-node="mi" data-latex="S"><path data-c="1D446" d="M133 157C133 181 136 201 141 217 141 227 136 232 125 232 120 232 116 230 114 228 109 223 52 8 52-8 52-17 57-22 67-22 72-22 79-17 88-6L133 47C168 1 224-22 300-22 366-22 424 5 476 58 528 111 554 170 554 236 554 283 538 323 505 355 490 368 470 379 445 388 422 393 400 399 378 405L312 423C279 432 254 469 254 509 254 552 271 589 306 621 341 653 380 669 423 669 515 669 561 619 561 520 561 502 557 482 557 465L557 462C560 455 565 451 573 451 582 451 588 459 592 474L645 691C645 700 640 705 630 705 625 705 618 700 609 689L566 637C538 682 491 705 424 705 361 705 304 681 254 634 202 586 176 531 176 468 176 396 223 339 282 323L387 296C441 281 475 262 475 195 475 149 457 108 422 72 387 36 347 17 302 17 204 17 133 60 133 157Z"></path></g><g data-mml-node="TeXAtom" transform="translate(646,-150) scale(0.707)" data-latex="{\text{max}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{max}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44 367 40 344 38 307 38L307 0 423 3 538 0 538 38C501 38 479 40 472 44 465 48 461 60 461 79L461 259C461 339 513 413 590 413 637 413 660 378 660 307L660 79C660 60 656 48 649 44 642 40 619 38 582 38L582 0 698 3 813 0 813 38C781 38 760 39 750 42 740 45 736 52 736 64L736 251C736 298 734 331 731 350 721 411 676 442 597 442 534 442 487 413 455 354 441 413 397 442 322 442 259 442 211 412 179 352L179 442 32 431 32 393C68 393 90 390 98 384 106 378 109 365 109 342L109 79C109 60 105 48 98 44 91 40 69 38 32 38L32 0 148 3 263 0 263 38C226 38 203 40 196 44 189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"></path><path data-c="61" d="M483 91 483 150 451 150 451 91C451 52 440 32 419 32 399 32 387 57 387 77L387 274C387 309 383 335 376 353 352 412 283 448 213 448 136 448 60 405 60 333 60 300 77 283 110 283 143 283 159 299 159 332 159 361 144 378 113 381 135 406 168 419 211 419 273 419 311 362 311 297L311 264C233 259 174 247 133 228 66 197 32 154 32 97 32 71 42 49 61 32 93 3 137-11 193-11 252-11 294 14 320 65 327 27 355-6 398-6 451-6 483 36 483 91M200 18C154 18 116 52 116 98 116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(833,0)"></path><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343 408 375 447 392 498 393L498 431C470 429 442 428 414 428 377 428 344 429 315 431L315 393C334 391 344 382 344 366 344 357 339 346 330 334L272 262 198 357C193 364 190 369 190 372 190 385 202 392 225 393L225 431 114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385 96 380 112 363 134 334L229 210C180 147 150 109 139 96 107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0 195 38C176 41 167 50 167 65 167 69 168 74 170 79 176 92 203 126 251 183L323 89C334 75 340 65 343 59 343 46 331 39 307 38L307 0Z" transform="translate(1333,0)"></path></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(8080.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40 268 47 288 129 288 208L288 292C288 371 268 453 229 540 188 631 138 699 78 745 75 747 72 748 71 748 62 748 57 743 57 734 57 730 59 726 62 723 114 683 156 617 187 526 214 447 228 369 228 292L228 208C228 131 214 53 187-26 156-117 114-183 62-223 59-227 57-231 57-234 57-243 62-248 71-248 72-248 75-247 78-245Z"></path></g></g></g></svg></mjx-container> 。复杂性分析表明,经典子集和问题可多项式归约到 P-2000 问题,但反之不成立,这一结果强化了 #P 类问题与 NP 类问题的难度分野。</p></div></div><div class="footer"></div><div class="article-meta" id="bottom"><div class="new-meta-box"></div></div><div class="prev-next"><a class="prev" href="/notes/P-2000/6"><p class="title"><i class="fa-solid fa-chevron-left" aria-hidden="true"></i>P-n问题与计数版本子集和问题的归约关系 P-n问题的#P完全性证明:与计数子集和问题的归约关系</p><p class="content">P-2000问题要求计算集合{1,2,…,2000}中所有元素之和为素数的子集数量,属于计算复杂性理论中的#P类问题,其难度远超NP问题。该问题可视为计数版本子集和问题(#Subset Sum)的扩展,需对所有素数p计算和为p的子集数量之和,核心困难在于子集和的计数本身及数论复杂性(素性判断)。通过多项式时间归约证明,P-n问题与#Subset Sum可相互转换,因此是#P完全的,这意味着除非#P=FP,否则不存在高效求解算法。</p></a><a class="next" href="/notes/P-2000/8"><p class="title">P-2000问题规模分析:子集组合与素数数量估算<i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p><p class="content">该文档聚焦P-2000问题的规模量化,首先指出暴力破解需处理2^2000个子集,计算其元素总和达2001000。基于素数定理,通过素数计数函数、对数积分函数和x/ln x三种方法估算小于2001000的素数数量,最终确定精确值为149002个。这一分析为理解P-2000问题的复杂度提供了关键数值基础。</p></a></div><div class="recommended-article"><div class="recommended-article-header"><i class="fa-solid fa-bookmark fa-fw" aria-hidden="true"></i> <span>推荐阅读</span></div><div class="recommended-article-group"> <a class="recommended-article-item" href="/notes/P-2000/5.html" title="P-2000问题的#P完全性证明与复杂性分析" rel="bookmark"><img src="https://static.mhuig.top/npm/imbox@0.0.15/c/60.webp" class="lazyload" data-srcset="https://static.mhuig.top/npm/imbox@0.0.15/c/60.webp" srcset="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="P-2000问题的#P完全性证明与复杂性分析"> <span class="title">P-2000问题的#P完全性证明与复杂性分析</span></a> <a class="recommended-article-item" href="/notes/P-2000/6.html" title="P-n问题与计数版本子集和问题的归约关系 P-n问题的#P完全性证明:与计数子集和问题的归约关系" rel="bookmark"><img src="https://static.mhuig.top/npm/imbox@0.0.15/c/3.webp" class="lazyload" data-srcset="https://static.mhuig.top/npm/imbox@0.0.15/c/3.webp" srcset="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="P-n问题与计数版本子集和问题的归约关系 P-n问题的#P完全性证明:与计数子集和问题的归约关系"> <span class="title">P-n问题与计数版本子集和问题的归约关系 P-n问题的#P完全性证明:与计数子集和问题的归约关系</span></a> <a class="recommended-article-item" href="/notes/P-2000/9.html" title="暴力穷举:一个简单的P-5问题示例 暴力穷举法求解P-5问题:子集和为素数的案例分析" rel="bookmark"><img src="https://static.mhuig.top/npm/imbox@0.0.15/c/43.webp" class="lazyload" data-srcset="https://static.mhuig.top/npm/imbox@0.0.15/c/43.webp" srcset="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="暴力穷举:一个简单的P-5问题示例 暴力穷举法求解P-5问题:子集和为素数的案例分析"> <span class="title">暴力穷举:一个简单的P-5问题示例 暴力穷举法求解P-5问题:子集和为素数的案例分析</span></a> <a class="recommended-article-item" href="/notes/P-2000/8.html" title="P-2000问题规模分析:子集组合与素数数量估算" rel="bookmark"><img src="https://static.mhuig.top/npm/imbox@0.0.15/c/76.webp" class="lazyload" data-srcset="https://static.mhuig.top/npm/imbox@0.0.15/c/76.webp" srcset="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="P-2000问题规模分析:子集组合与素数数量估算"> <span class="title">P-2000问题规模分析:子集组合与素数数量估算</span></a> <a class="recommended-article-item" href="/notes/P-2000/4.html" title="P-∞ Problem" rel="bookmark"><img src="https://static.mhuig.top/npm/imbox@0.0.15/c/89.webp" class="lazyload" data-srcset="https://static.mhuig.top/npm/imbox@0.0.15/c/89.webp" srcset="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="P-∞ Problem"> <span class="title">P-∞ Problem</span></a> <a class="recommended-article-item" href="/notes/Zeta/88.html" title="问题的归约:连接P与NP世界的逻辑桥梁" rel="bookmark"><img src="https://static.mhuig.top/npm/imbox@0.0.15/c/92.webp" class="lazyload" data-srcset="https://static.mhuig.top/npm/imbox@0.0.15/c/92.webp" srcset="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="问题的归约:连接P与NP世界的逻辑桥梁"> <span class="title">问题的归约:连接P与NP世界的逻辑桥梁</span></a></div></div></article><article class="post white-box shadow floatable blur" id="comments"><span hidden=""><meta itemprop="discussionUrl" content="/notes/P-2000/7#comments"></span><p ct=""><i class="fa-duotone fa-comments"></i> 留言区</p><div id="layoutHelper-comments"></div></article></div><aside id="l_side" itemscope="" itemtype="http://schema.org/WPSideBar"><section class="widget text desktop mobile pjax"><header><a href="/notes/"><i class="fa-duotone fa-book fa-fw" aria-hidden="true"></i> <span class="name">Notes</span></a></header><div class="content"></div></section><section class="widget list group desktop mobile pjax"><header><i class="fa-duotone fa-p fa-fw" aria-hidden="true"></i> <span class="name">P-2000 Problem</span></header><div class="content"><ul class="list entry navigation"><li><a class="flat-box" title="/notes/P-2000/" href="/notes/P-2000/" active-action="action-notesP-2000"><div class="name"> Welcome</div></a></li><li><a class="flat-box" title="/notes/P-2000/1" href="/notes/P-2000/1" active-action="action-notesP-20001"><div class="name"> D2-2000 Problem</div></a></li><li><a class="flat-box" title="/notes/P-2000/2" href="/notes/P-2000/2" active-action="action-notesP-20002"><div class="name"> D5-2000 Problem</div></a></li><li><a class="flat-box" title="/notes/P-2000/3" href="/notes/P-2000/3" active-action="action-notesP-20003"><div class="name"> P-2000 Problem</div></a></li><li><a class="flat-box" title="/notes/P-2000/4" href="/notes/P-2000/4" active-action="action-notesP-20004"><div class="name"> P-∞ Problem</div></a></li><li><a class="flat-box" title="/notes/P-2000/5" href="/notes/P-2000/5" active-action="action-notesP-20005"><div class="name"> P-2000问题是#P完全问题</div></a></li><li><a class="flat-box" title="/notes/P-2000/6" href="/notes/P-2000/6" active-action="action-notesP-20006"><div class="name"> P-n问题与计数版本子集和问题的归约关系</div></a></li><li><a class="flat-box" title="/notes/P-2000/7" href="/notes/P-2000/7" active-action="action-notesP-20007"><div class="name"> P-2000问题与子集和问题的计算复杂性关联分析</div></a></li><li><a class="flat-box" title="/notes/P-2000/8" href="/notes/P-2000/8" active-action="action-notesP-20008"><div class="name"> 暴力破解:确定P-2000问题的规模</div></a></li><li><a class="flat-box" title="/notes/P-2000/9" href="/notes/P-2000/9" active-action="action-notesP-20009"><div class="name"> 暴力穷举:一个简单的P-5问题示例</div></a></li><li><a class="flat-box" title="/notes/P-2000/10" href="/notes/P-2000/10" active-action="action-notesP-200010"><div class="name"> 开关灯问题</div></a></li></ul></div></section><div class="widget-sticky pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div><div class="pjax"></div></aside><pjax><script>window.pdata={},pdata.ispage=!1,pdata.commentPath="",pdata.commentPlaceholder="",pdata.commentConfig={};var l_header=document.getElementById("l_header");l_header.classList.add("show");var cover_wrapper=document.querySelector("#l_cover .cover-wrapper"),scroll_down=document.getElementById("scroll-down");cover_wrapper.id="none",cover_wrapper.style.display="none",scroll_down.style.display="none"</script></pjax></div><footer class="footer clearfix" itemscope="" itemtype="http://schema.org/WPFooter"><br><br><div class="aplayer-container"><div class="aplayer-local"></div></div><br><div class="social-wrapper" itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/atom.xml" class="social fa-duotone fa-rss flat-btn" target="_blank" rel="external nofollow noopener noreferrer" itemprop="url"></a><a href="https://mhuig.top/contact/" class="social fa-duotone fa-envelope flat-btn" target="_blank" rel="external nofollow noopener noreferrer" itemprop="url"></a><a href="https://github.com/MHuiG" class="social fa-brands fa-github flat-btn" target="_blank" rel="external nofollow noopener noreferrer" itemprop="url"></a><a href="https://t.me/MHuiG" class="social fa-brands fa-telegram flat-btn" target="_blank" rel="external nofollow noopener noreferrer" itemprop="url"></a></div><div><p>博客内容遵循 <a target="_blank" rel="external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-hans">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</a></p></div><div class="copyright"><p><a href="https://icp.gov.moe" target="_blank" rel="external nofollow noopener noreferrer">萌ICP备</a> <a href="https://icp.gov.moe/?keyword=2020012138" target="_blank" rel="external nofollow noopener noreferrer">2020012138号</a><br><a target="_blank" rel="noopener" href="https://mhuig.top/">Copyright © Since 2018 MHuiG</a></p></div></footer><a id="s-top" class="fa-solid fa-arrow-up fa-fw" title="top"></a></div></div><div><script>volantis.dom.bodyAnchor=volantis.dom.$(document.getElementById("safearea")),volantis.dom.topBtn=volantis.dom.$(document.getElementById("s-top")),volantis.dom.wrapper=volantis.dom.$(document.getElementById("wrapper")),volantis.dom.coverAnchor=volantis.dom.$(document.querySelector("#l_cover .cover-wrapper")),volantis.dom.switcher=volantis.dom.$(document.querySelector("#l_header .switcher .s-search")),volantis.dom.header=volantis.dom.$(document.getElementById("l_header")),volantis.dom.search=volantis.dom.$(document.querySelector("#l_header .m_search")),volantis.dom.mPhoneList=volantis.dom.$(document.querySelectorAll("#l_header .m-phone .list-v"))</script><script>volantis.css("https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/libs/@fortawesome/fontawesome-pro/css/all.min.css")</script><script src="/js/app.js"></script><script>const rootElement=document.documentElement,darkModeStorageKey="color-scheme",rootElementDarkModeAttributeName="color-scheme",setLS=(e,t)=>{localStorage.setItem(e,t)},removeLS=e=>{localStorage.removeItem(e)},getLS=e=>localStorage.getItem(e),getModeFromCSSMediaQuery=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",resetRootDarkModeAttributeAndLS=()=>{rootElement.removeAttribute("color-scheme"),removeLS("color-scheme")},validColorModeKeys={dark:!0,light:!0},applyCustomDarkModeSettings=e=>{const t=e||getLS("color-scheme");getCustomDarkMode(),t===getModeFromCSSMediaQuery()?resetRootDarkModeAttributeAndLS():validColorModeKeys[t]?rootElement.setAttribute("color-scheme",t):resetRootDarkModeAttributeAndLS()},invertDarkModeObj={dark:"light",light:"dark"},getCustomDarkMode=()=>{let e=getLS("color-scheme");if(validColorModeKeys[e])e=invertDarkModeObj[e];else{if(null!==e)return;e=invertDarkModeObj[getModeFromCSSMediaQuery()]}volantis.dark.mode="dark"==e?"light":"dark"},toggleCustomDarkMode=()=>{let e=getLS("color-scheme");if(validColorModeKeys[e])e=invertDarkModeObj[e];else{if(null!==e)return;e=invertDarkModeObj[getModeFromCSSMediaQuery()]}return setLS("color-scheme",e),e};function bindToggleButton(){document.querySelectorAll("#wrapper .toggle-mode-btn,#rightmenu-wrapper .toggle-mode-btn").forEach((function(e){volantis.dom.$(e).on("click",volantis.dark.toggle)}))}volantis.dark.toggle=()=>{const e=toggleCustomDarkMode();applyCustomDarkModeSettings(e),volantis.dark.method.toggle.start()},applyCustomDarkModeSettings(),document.addEventListener("DOMContentLoaded",(()=>{volantis.requestAnimationFrame(bindToggleButton)})),volantis.pjax.push(bindToggleButton);const darkModelListeners={dark:e=>{e.matches&&(volantis.dark.mode="dark"),volantis.dark.method.toggle.start()},light:e=>{e.matches&&(volantis.dark.mode="light"),volantis.dark.method.toggle.start()}};window.matchMedia("(prefers-color-scheme: dark)").addListener(darkModelListeners.dark),window.matchMedia("(prefers-color-scheme: light)").addListener(darkModelListeners.light)</script><script>function loadIssuesJS(){null!=document.getElementById("sites-api")&&"undefined"==typeof SitesJS&&volantis.js("/js/plugins/tags/sites.js");null!=document.getElementById("friends-api")&&"undefined"==typeof FriendsJS&&volantis.js("/js/plugins/tags/friends.js");null!=document.getElementById("contributors-api")&&"undefined"==typeof ContributorsJS&&volantis.js("/js/plugins/tags/contributors.js")}loadIssuesJS(),volantis.pjax.push((()=>{loadIssuesJS()}))</script><script defer="" src="https://cdn.bootcdn.net/ajax/libs/vanilla-lazyload/17.1.0/lazyload.min.js"></script><script>window.lazyLoadOptions={elements_selector:".lazyload",threshold:0},window.addEventListener("LazyLoad::Initialized",(function(n){window.lazyLoadInstance=n.detail.instance}),!1),document.addEventListener("DOMContentLoaded",(function(){lazyLoadInstance.update()})),document.addEventListener("pjax:complete",(function(){lazyLoadInstance.update()}))</script><script>window.FPConfig={delay:0,ignoreKeywords:["#"],maxRPS:6,hoverDelay:0}</script><script defer="" src="https://static.mhuig.top/npm/volantis-static@0.0.1660614606622/libs/flying-pages/flying-pages.min.js"></script><script>volantis.css("https://cdn.bootcdn.net/ajax/libs/aplayer/1.10.1/APlayer.min.css"),volantis.js("https://cdn.bootcdn.net/ajax/libs/aplayer/1.10.1/APlayer.min.js").then((()=>{function e(){document.querySelector(".aplayer-local-min")&&document.querySelectorAll(".aplayer-local-min").forEach((e=>{new APlayer(Object.assign({container:e,mini:!0,order:"list",volume:"0.7",autoplay:!1,loop:"all",theme:"#1BCDFC",listMaxHeight:"320px",listFolded:"true",preload:"auto",lrcType:3,audio:[{name:"虹之间",artist:"钢琴版伴奏",url:"https://blog.mhuig.top/music-Archive/BetweenTheRainbow.mp3",lrc:"https://blog.mhuig.top/music-Archive/BetweenTheRainbow.lrc",cover:"https://blog.mhuig.top/music-Archive/BetweenTheRainbow.jpg"},{name:"Avem",artist:"Alan Walker",url:"https://blog.mhuig.top/music-Archive/Avem.mp3",lrc:"https://blog.mhuig.top/music-Archive/Avem.lrc",cover:"https://blog.mhuig.top/music-Archive/Avem.jpg"},{name:"Fly",artist:"Marshmello / Leau Culver",url:"https://blog.mhuig.top/music-Archive/fly.mp3",lrc:"https://blog.mhuig.top/music-Archive/fly.lrc",cover:"https://blog.mhuig.top/music-Archive/fly.jpg"},{name:"Alone",artist:"Marshmello",url:"https://blog.mhuig.top/music-Archive/alone.mp3",lrc:"https://blog.mhuig.top/music-Archive/alone.lrc",cover:"https://blog.mhuig.top/music-Archive/alone.jpg"}]},JSON.parse(e.querySelector(".aplayer-local-min-conf").innerText)))}))}document.querySelectorAll(".aplayer-local").forEach((e=>{new APlayer({container:e,fixed:!1,order:"list",volume:"0.7",autoplay:!1,loop:"all",theme:"#1BCDFC",listMaxHeight:"320px",listFolded:"true",preload:"auto",lrcType:3,audio:[{name:"虹之间",artist:"钢琴版伴奏",url:"https://blog.mhuig.top/music-Archive/BetweenTheRainbow.mp3",lrc:"https://blog.mhuig.top/music-Archive/BetweenTheRainbow.lrc",cover:"https://blog.mhuig.top/music-Archive/BetweenTheRainbow.jpg"},{name:"Avem",artist:"Alan Walker",url:"https://blog.mhuig.top/music-Archive/Avem.mp3",lrc:"https://blog.mhuig.top/music-Archive/Avem.lrc",cover:"https://blog.mhuig.top/music-Archive/Avem.jpg"},{name:"Fly",artist:"Marshmello / Leau Culver",url:"https://blog.mhuig.top/music-Archive/fly.mp3",lrc:"https://blog.mhuig.top/music-Archive/fly.lrc",cover:"https://blog.mhuig.top/music-Archive/fly.jpg"},{name:"Alone",artist:"Marshmello",url:"https://blog.mhuig.top/music-Archive/alone.mp3",lrc:"https://blog.mhuig.top/music-Archive/alone.lrc",cover:"https://blog.mhuig.top/music-Archive/alone.jpg"}]})})),e(),volantis.pjax.push(e,"aplayerMin")}))</script><script>function check_giscus(){return"dark"===volantis.dark.mode?volantis.giscus.Theme="dark":volantis.giscus.Theme="light",document.getElementById("giscus_container")}function pjax_giscus(){const t=check_giscus();if(!t)return;let s=Object.assign({theme:{light:"light",dark:"dark"},repo:"MHuiG/talk","repo-id":"MDEwOlJlcG9zaXRvcnkyODQ4NDg1NTg=",category:"Giscus","category-id":"DIC_kwDOEPpxrs4B_X67",mapping:"pathname","reactions-enabled":"1","emit-metadata":"1",lang:"zh-CN","input-position":"top"},pdata.commentConfig);const e=document.createElement("script");e.setAttribute("src","https://giscus.app/client.js"),Object.keys(s).forEach((t=>{"theme"!=t&&e.setAttribute("data-"+t,s[t])})),e.setAttribute("data-theme",volantis.giscus.Theme),e.setAttribute("crossorigin","anonymous"),t.appendChild(e)}function dark_giscus(){if(!check_giscus())return;const t={setConfig:{theme:volantis.giscus.Theme}};document.querySelector("iframe.giscus-frame").contentWindow.postMessage({giscus:t},"https://giscus.app")}volantis.layoutHelper("comments",'<div id="giscus_container"></div>'),volantis.giscus={},pjax_giscus(),volantis.pjax.push(pjax_giscus),volantis.dark.push(dark_giscus)</script><script>async function loadSearchScript(){return volantis.js("/js/search/hexo.js")}function loadSearchService(){loadSearchScript(),document.querySelectorAll(".input.u-search-input").forEach((e=>{e.removeEventListener("focus",loadSearchService,!1)})),document.querySelectorAll(".u-search-form").forEach((e=>{e.addEventListener("submit",(e=>{e.preventDefault()}),!1)}))}function OpenSearch(e){"undefined"==typeof SearchService?loadSearchScript().then((()=>{SearchService.setQueryText(e),SearchService.search()})):(SearchService.setQueryText(e),SearchService.search())}if(window.location.search&&/^\?s=/g.test(window.location.search)){OpenSearch(decodeURI(window.location.search).replace(/\ /g,"-").replace(/^\?s=/g,""))}document.querySelectorAll(".input.u-search-input").forEach((e=>{e.addEventListener("focus",loadSearchService,!1)}))</script><script>function pjax_highlightjs_copyCode(){(document.querySelector(".highlight .code pre")||document.querySelector(".article pre code"))&&VolantisApp.utilCopyCode(".highlight .code pre, .article pre code")}volantis.requestAnimationFrame(pjax_highlightjs_copyCode),volantis.pjax.push(pjax_highlightjs_copyCode)</script><script>function load_swiper(){document.querySelectorAll(".swiper-container")[0]&&(volantis.css("https://cdn.bootcdn.net/ajax/libs/Swiper/8.3.2/swiper-bundle.min.css"),volantis.js("https://cdn.bootcdn.net/ajax/libs/Swiper/8.3.2/swiper-bundle.min.js").then((()=>{pjax_swiper()})))}function pjax_swiper(){volantis.swiper=new Swiper(".swiper-container",{slidesPerView:"auto",spaceBetween:8,centeredSlides:!0,loop:!0,pagination:{el:".swiper-pagination",clickable:!0},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})}load_swiper(),volantis.pjax.push((()=>{document.querySelectorAll(".swiper-container")[0]&&(void 0===volantis.swiper?load_swiper():pjax_swiper())}))</script><script>volantis.css("https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/themes/blue/pace-theme-minimal.min.css"),volantis.js("https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/pace.min.js").then((()=>{Pace.options.restartOnPushState=!1,volantis.pjax.send(Pace.restart,"Pace.restart"),volantis.scroll.push(volantis.debounce((()=>{Pace.stop(),Pace.trigger("start"),Pace.bar.update(100*volantis.scroll.progress()),document.body.className=document.body.className.replaceAll("pace-running ","")})),"阅读进度")}))</script><pjax></pjax><script>function listenSidebarTOC(){const t=document.querySelectorAll(".toc li");if(!t.length)return;const e=[];Array.from(t).forEach((t=>{const n=t.querySelector(".toc-link"),i=document.getElementById(n.getAttribute("href")?decodeURI(n.getAttribute("href")).replace("#",""):n.getAttribute("toc-action").split("toc-")[1]);return e.push(i),n.getAttribute("href")&&(n.setAttribute("toc-action","toc-"+decodeURI(n.getAttribute("href")).replace("#","")),n.removeAttribute("href")),i&&i.id&&n.addEventListener("click",(t=>{t.preventDefault(),volantis.scroll.to(i,{addTop:5,observer:!0}),history.pushState(null,document.title,"#"+i.id)})),i}));function n(t){if(t.classList.contains("active-current"))return;document.querySelectorAll(".toc .active").forEach((t=>{t.classList.remove("active","active-current")})),t.classList.add("active","active-current");let e=t.parentNode;for(;!e.matches(".toc");)e.matches("li")&&e.classList.add("active"),e=e.parentNode}volantis.activateNavIndex=0,n(t[volantis.activateNavIndex]),e[0]&&volantis.scroll.push(volantis.debounce((()=>{if(e[0].getBoundingClientRect().top>=0)volantis.activateNavIndex=0;else if(e[e.length-1].getBoundingClientRect().top<0)volantis.activateNavIndex=e.length-1;else for(let t=0;t<e.length;t++){const n=e[t],i=e[(t+1)%e.length];if(n.getBoundingClientRect().top<0&&i.getBoundingClientRect().top>=0){volantis.activateNavIndex=t;break}}n(t[volantis.activateNavIndex])})),"sidebar-toc")}document.addEventListener("DOMContentLoaded",(()=>{volantis.requestAnimationFrame(listenSidebarTOC)})),volantis.pjax.push(listenSidebarTOC,"listenSidebarTOC")</script><script>try{let e=(e,t,n=2)=>Math.abs(e-t)<=n,t=(t,n)=>!e(t.width,n.width)||!e(t.height,n.height),n=new WeakMap,i=(e,i=e.getClientBoundingRect())=>{let o=n.get(e);o&&!t(o,i)||(n.set(e,i),e.style["contain-intrinsic-size"]=`${i.width}px ${i.height}px`)},o=new IntersectionObserver(((e,t)=>{e.forEach((e=>{i(e.target,e.boundingClientRect)}))}),{rootMargin:"500px 0px 500px 0px"}),r=new ResizeObserver(((e,t)=>{e.forEach((e=>{i(e.target,e.contentRect)}))})),s=e=>{let t=document.querySelectorAll(e);t.length&&(t.forEach((e=>{o.observe(e),r.observe(e)})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{t[0].style["content-visibility"]="auto"}))})))},a=()=>{"content-visibility"in document.documentElement.style&&s(".post-story")};a(),volantis.pjax.push(a)}catch(e){console.log(e)}</script><script>document.onreadystatechange=function(){if("complete"==document.readyState){const{saveData:e,effectiveType:t}=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{};("none"==getComputedStyle(document.querySelector("#safearea"),null).display||e||/2g/.test(t))&&(document.querySelectorAll(".reveal").forEach((function(e){e.style.opacity="1"})),document.querySelector("#safearea").style.display="block")}}</script><script src="https://cdn.bootcdn.net/ajax/libs/pjax/0.2.8/pjax.min.js"></script><script>const performanceMonitor={slowThreshold:800,slowCount:0,maxSlowAllowed:1,requestStartTime:0,start(){this.requestStartTime=Date.now()},check(){Date.now()-this.requestStartTime>this.slowThreshold?this.slowCount++:this.slowCount=0},res(){return this.slowCount>=this.maxSlowAllowed}};var pjax;document.addEventListener("DOMContentLoaded",(function(){pjax=new Pjax({elements:'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([pjax-fancybox]):not([onclick="return false;"]):not([onclick="return!1"]):not([target="_blank"]):not([target="view_window"]):not([href$=".xml"])',selectors:["head title","head meta[name=keywords]","head meta[name=description]","#l_main","#pjax-header-nav-list",".pjax","pjax","meta[name=robots]","link[rel=canonical]","meta[property='og:title']","meta[property='og:description']","meta[property='og:url']","meta[property='og:image']","script[type='application/ld+json']"],cacheBust:!1,timeout:900})})),document.addEventListener("pjax:send",(function(e){window.stop(),performanceMonitor.start();try{var t=window.location.pathname,o=e.triggerElement.href,n=[""];""!=n[0]&&n.forEach((e=>{-1==t.indexOf(e)&&-1==o.indexOf(e)||(window.location.href=o)})),performanceMonitor.res()&&(window.location.href=o)}catch(e){}volantis.pjax.method.send.start()})),document.addEventListener("pjax:complete",(function(){performanceMonitor.check(),document.querySelectorAll("script[data-pjax], .pjax-reload script").forEach((e=>{const t=e.text||e.textContent||e.innerHTML||"",o=document.createElement("script");Object.keys(e.attributes).forEach((t=>{o.setAttribute(e.attributes[t].nodeName,e.attributes[t].nodeValue)})),t&&o.appendChild(document.createTextNode(t)),e.parentNode.replaceChild(o,e)})),volantis.pjax.method.complete.start()})),document.addEventListener("pjax:error",(function(e){"pjax"===volantis.debug?(console.error(e),console.log("pjax error: \n"+JSON.stringify(e))):(volantis.pjax.method.error.start(),window.location.href=e.triggerElement.href)}))</script></div><pjax> <a style="display:none" target="_blank" rel="external nofollow noopener noreferrer" href="https://bot-trap.mhuig.top/">Are You A Robot?</a></pjax><script>(()=>{function t(){if("localhost:4000"!=window.location.host&&!/blog\.mhuig\.top/.test(window.location.host)){const t=document.createElement("meta");t.name="robots",t.content=atob("bm9pbmRleCwgbm9mb2xsb3csIG5vYXJjaGl2ZQ=="),document.head.appendChild(t)}}function o(){document.querySelector("figcaption")&&document.querySelectorAll("figcaption").forEach((t=>{volantis.dom.$(t).on("click",(function(){const t=!window.CodeBlockFullscreen;window.CodeBlockFullscreen=t;const o=document.getElementById("post")||document.getElementById("docs")||document.getElementById("page");if(!o)return;const e=this.parentElement,n=e.parentElement,l=document.documentElement,c=document.querySelectorAll(".highlight > table .gutter");o.classList.toggle("code-block-fullscreen",t),e.classList.toggle("code-block-fullscreen",t),n.classList.toggle("code-block-fullscreen",t),e.classList.toggle("code-block-fullscreen-overflow-auto",t),l.classList.toggle("code-block-fullscreen-html-scroll",t),c.forEach((o=>{o.classList.toggle("code-block-fullscreen-gutter",t)}))}))}))}t(),volantis.pjax.push(t),top.location!=self.location&&(top.location=self.location),"mhuig.github.io"==window.location.host||"localhost:4000"==window.location.host||/mhuig\.top$/.test(window.location.host)||/kix\.moe$/.test(window.location.host)||/mhuig/.test(window.location.host)||/ipfs/.test(window.location.host)||(window.location.href=atob("aHR0cHM6Ly9ibG9nLm1odWlnLnRvcC8=")),o(),volantis.pjax.push(o);const e=[{month:12,day:13},function(){const t=(new Date).getFullYear(),o=t%100,e=t>=2e3?4.81:5.59,n=Math.floor(o/4),l=Math.floor(.2422*o+e)-n;return{month:4,day:Math.max(4,l)}}(),{month:7,day:7},{month:9,day:18},{month:9,day:30}];function n(){document.documentElement.classList.remove("mourning-mode");if(!["/","/index.html","/index.htm","/index"].includes(window.location.pathname))return;const t=new Date,o=t.getMonth()+1,n=t.getDate();e.some((t=>t.month===o&&t.day===n))&&document.documentElement.classList.add("mourning-mode")}const l=document.createElement("style");l.textContent="\n html.mourning-mode {\n filter: grayscale(100%);\n -webkit-filter: grayscale(100%);\n transition: filter 0.5s ease;\n }\n ",document.head.appendChild(l),n(),document.addEventListener("pjax:complete",n)})()</script></body></html>