{"id":396422,"date":"2024-06-29T12:49:51","date_gmt":"2024-06-29T12:49:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=396422"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T12:49:51","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=396422","title":{"rendered":"<span>\u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u2014 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prime_number\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/a> \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pocklington_primality_test\" rel=\"noopener noreferrer nofollow\"><em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em><\/a>.<br \/>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0434\u0432\u0430\u0438\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<p>\u041e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prime_number#Other_applications\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.<\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/h2>\n<p>\u0418 \u0442\u0430\u043a \u043f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1b\/542\/943\/e1b542943242af25620c1a19a06ab53d.svg\"\/>\u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"10^{35}\" alt=\"10^{35}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a5f\/46d\/593\/a5f46d593599accdcc2190a4619f6fc9.svg\"\/>, \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img class=\"formula inline\" source=\"p:p>=N&#187; alt=&#187;p:p>=N&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c2\/a7f\/b9e\/2c2a7fb9ecfa1240c44429a04a9fc567.svg&#187;\/>.<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0435\u0448\u0435\u0442\u043e-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e <img decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/221\/9b2\/a85\/2219b2a855500a914237c21f60d8d002.svg\"\/>&#8212; \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430, \u0410\u0442\u043a\u0438\u043d\u0430, \u0421\u0443\u043d\u0434\u0430\u0440\u0430\u043c\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u044d\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0445 \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/75f\/a9e\/cbb\/75fa9ecbbd77700aae307559a2412a8b.svg\"\/> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0435 \u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b &#8212; \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Primality_test\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u044d\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0432\u044b\u0448\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432;<\/p>\n<\/li>\n<\/ol>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0437 3 \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u0442 <em>\u0440\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430<\/em> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442<em> \u043c\u0430\u043b\u0443\u044e \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0424\u0435\u0440\u043c\u0430<\/em>, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430. \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb6\/01c\/49f\/cb601c49fbad4bb07ba42982d4281cbb.svg\"\/>\u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e <img decoding=\"async\" class=\"formula inline\" source=\"s\" alt=\"s\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/726\/8b2\/2cf\/7268b22cf9fa36d46850b294bb7d09c3.svg\"\/>.<\/p>\n<ol>\n<li>\n<p>\u0421\u0442\u0440\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430 \u0434\u043e <img decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dcb\/0a8\/900\/dcb0a8900ab87aed302bd1ac4b436823.svg\"\/>, \u0433\u0434\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/da7\/1c7\/bf4\/da71c7bf4088c861feabfa054706e36c.svg\"\/> \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 &#8212; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <img decoding=\"async\" class=\"formula inline\" source=\"10^3\" alt=\"10^3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/02e\/367\/b2a\/02e367b2a2fa938164144702045cd297.svg\"\/>. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" class=\"formula inline\" source=\"s\" alt=\"s\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b16\/f40\/251\/b16f40251baf2595aae71c3f0f09d75c.svg\"\/>&#8212; \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043b\u0438\u0431\u043e \u0438\u0437 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u0442\u0430. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 2.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" class=\"formula inline\" source=\"s\" alt=\"s\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/03d\/b7d\/52f\/03db7d52f4f630c3c6a05c602c6329fc.svg\"\/>&#8212; \u0435\u0441\u043b\u0438 <img class=\"formula inline\" source=\"s>N&#187; alt=&#187;s>N&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a5d\/07f\/fe6\/a5d07ffe62c8f0dcd030aefa95f0373b.svg&#187;\/>, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u044d\u0442\u043e <img decoding=\"async\" class=\"formula inline\" source=\"p:p=s\" alt=\"p:p=s\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/843\/26c\/e25\/84326ce255fb2894c135fcaee95caf36.svg\"\/>, \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img class=\"formula inline\" source=\"n:n>s&#187; alt=&#187;n:n>s&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/937\/f83\/ec4\/937f83ec402fe0a28178fa392a116c80.svg&#187;\/> &#8212; \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 3.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0447\u0451\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<img decoding=\"async\" class=\"formula inline\" source=\"r : s &lt;= r &lt;= 2 * (2 * s + 1) \" alt=\"r : s &lt;= r &lt;= 2 * (2 * s + 1) \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7c3\/1d9\/e0b\/7c31d9e0bd4612fa44c792bec34d6cfa.svg\"\/>\u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 <img decoding=\"async\" class=\"formula inline\" source=\"n=s*r+1\" alt=\"n=s*r+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a22\/c38\/86b\/a22c3886b7121249348448156adce07d.svg\"\/>.  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 4.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/055\/688\/a49\/055688a49944343e42e66371d89f9965.svg\"\/> \u043d\u0430 \u0434\u0435\u043b\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0448\u0430\u0433\u0435 1 &#8212; \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445, \u0442\u043e \u043e\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/45e\/cd6\/86c\/45ecd686c2f35d84a8adffa6d42f1a3e.svg\"\/>, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 2. \u0418\u043d\u0430\u0447\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 5.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" class=\"formula inline\" source=\"a:1&lt;a&lt;n\" alt=\"a:1&lt;a&lt;n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ff3\/bee\/0bd\/ff3bee0bd94f27b371bd09796a40a53e.svg\"\/> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7d0\/078\/f70\/7d0078f705fd199600b9c1ce3d4d998e.svg\"\/>\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0434\u0432\u0443\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 <img decoding=\"async\" class=\"formula inline\" source=\"a^{n-1} \\equiv 1\\:(mod\\:n)\" alt=\"a^{n-1} \\equiv 1\\:(mod\\:n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d9d\/942\/c2b\/d9d942c2bce1d768cbb5ee946c724ad4.svg\"\/>\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"gcd(a^r-1,n)==1\" alt=\"gcd(a^r-1,n)==1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/734\/4f5\/50d\/7344f550d182a4f7f44de2eb56abe5a1.svg\"\/>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0442\u043e \u043f\u043e <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em> \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca6\/b07\/060\/ca6b0706079c76cbdb09eb39e0ba2bdb.svg\"\/> \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c <img decoding=\"async\" class=\"formula inline\" source=\"s:=n\" alt=\"s:=n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b6\/9cb\/d61\/0b69cbd619043dd4852b475eed7d09ce.svg\"\/> \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u0438\u0441\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 2.<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#8212; <img decoding=\"async\" class=\"formula inline\" source=\"a^{n-1}\\equiv1\\:(mod\\:n)\" alt=\"a^{n-1}\\equiv1\\:(mod\\:n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/755\/9d2\/c07\/7559d2c0737a26fd4b6a311c3fd63ce0.svg\"\/>, \u0442\u043e \u043f\u043e <em>\u043c\u0430\u043b\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0424\u0435\u0440\u043c\u0430<\/em> \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0c7\/e37\/1a8\/0c7e371a89b38e061bfdcdb5f26baa17.svg\"\/> \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 3.<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 &#8212; \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c <img decoding=\"async\" class=\"formula inline\" source=\"d:1&lt;d&lt;=n\" alt=\"d:1&lt;d&lt;=n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/304\/fe5\/583\/304fe5583f3ca0109e04373a6e56aa4e.svg\"\/>\u0434\u043b\u044f \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/123\/35a\/096\/12335a096ed7bbf150107c2ee8c286c5.svg\"\/>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443<img decoding=\"async\" class=\"formula inline\" source=\"gcd(a^r-1,n)==d\" alt=\"gcd(a^r-1,n)==d\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f3d\/43d\/791\/f3d43d7919dc81a155dce75a40c77b66.svg\"\/>. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e <img decoding=\"async\" class=\"formula inline\" source=\"d \u2260n\" alt=\"d \u2260n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c16\/42e\/dc7\/c1642edc7c30ac78a58feaa2015d407e.svg\"\/>, \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043d\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b9\/175\/03c\/1b917503c0fb3598573ff8e797e5f33f.svg\"\/>\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0443, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 3.<\/p>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"d==n\" alt=\"d==n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b51\/76f\/419\/b5176f41934ffabbbd495ba9fe38d0fd.svg\"\/>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <img decoding=\"async\" class=\"formula inline\" source=\"a^r\\equiv1\\:(mod\\:n)\" alt=\"a^r\\equiv1\\:(mod\\:n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/be8\/f97\/181\/be8f971812a0d82042663cab3ab26ed1.svg\"\/>, \u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0439 \u043a\u043e\u043d\u0433\u0440\u0443\u044d\u043d\u0446\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"r\" alt=\"r\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e18\/cd4\/e8a\/e18cd4e8a450d1171929ab3889e9b727.svg\"\/>. \u041e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u044d\u0442\u043e <img decoding=\"async\" class=\"formula inline\" source=\"a==1\" alt=\"a==1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/232\/a62\/113\/232a621130edfa52b3d5961ae94ec4e5.svg\"\/>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"1&lt;a&lt;n\" alt=\"1&lt;a&lt;n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cf5\/148\/d47\/cf5148d472dab77ca2db5c8de26fb33e.svg\"\/>\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435<img decoding=\"async\" class=\"formula inline\" source=\"r-1\" alt=\"r-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/78d\/b99\/ee8\/78db99ee82dedf0bde205e803318168a.svg\"\/>\u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c <img decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/09c\/5c7\/e0d\/09c5c7e0d22d3ba56a47dded91d5e617.svg\"\/> \u043c\u044b \u043d\u0430\u0439\u0434\u0451\u043c (\u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <img decoding=\"async\" class=\"formula inline\" source=\"1-O(s^{-1})\" alt=\"1-O(s^{-1})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6ae\/35f\/e48\/6ae35fe480cd109af36c14a110e80a89.svg\"\/>) \u0442\u0430\u043a\u043e\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"a\" alt=\"a\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7bc\/762\/bcc\/7bc762bcc657cc794db7ff75e84e5bfb.svg\"\/>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u043b\u043e <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 5 \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"a\" alt=\"a\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/546\/c73\/021\/546c7302154e1a00f71a4987f49b430d.svg\"\/>.<\/p>\n<\/li>\n<\/ol>\n<h2>\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043c\u0435\u0442\u044c \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0446\u0438\u0444\u0440 &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u0448\u0430\u0433\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043c\u044b \u0434\u043e\u0439\u0434\u0451\u043c \u043a \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/531\/5c1\/f06\/5315c1f0671ba2608c5c3af6a7086692.svg\"\/>. \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435<img class=\"formula inline\" source=\"p:p>N&#187; alt=&#187;p:p>N&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ee\/757\/42d\/3ee75742dee6ce3dc1facd1060adafe2.svg&#187;\/>\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u044b\u0431\u043e\u0440\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0434\u043b\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c <img decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/521\/576\/0a1\/5215760a1bbba8fee14888c5fab323c6.svg\"\/>\u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/327\/f0e\/650\/327f0e6507716504b23ecb928b5dc372.svg\"\/>, \u0442\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c.<\/p>\n<p>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0431\u044b\u0442\u044c \u0438\u0437-\u0437\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dirichlet%27s_theorem_on_arithmetic_progressions\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0414\u0438\u0440\u0438\u0445\u043b\u0435<\/a> \u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u043b\u0430\u0445 \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u044f\u0445, \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u041b\u044e\u0441\u0442\u0435\u0440\u043d\u0438\u043a\u0430 \u043e \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prime_gap\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u041a\u0440\u0430\u043c\u0435\u0440\u0430<\/a> \u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>\n<h2>\u041a\u043e\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 Python<\/h2>\n<pre><code>def generatePrime(n : int, primes = None, s = None):     \"\"\"Generates prime number with at least n digits:      : param n: number of 10-based digits in the generate prime is at least n;     : param primes: an iterable object of numbers that are used as small factors     for pre-prime verification. If None, is computed using getSieve(1000);     : param s: initial prime number - if None, last from primes is used;     \"\"\"      # Any prime number higher than the up_limit suffices the result.     up_limit = 10**n      # Get the list of small primes which are used as small divisors     # to reject the n candidate before the Pocklington test.     if not primes: primes = getSieve(1000)      if not s: s = primes[-1] # initial prime     while s &lt; up_limit:         lo, hi = (s + 1) >> 1, (s &lt;&lt; 1) + 1          # Proceed with finding new prime n         while True:             r = random.randint(lo, hi) &lt;&lt; 1 # get random even r from [s, 4*s + 2]             n = s*r + 1 # n is prime candidate, s^2 + 1 &lt;= n &lt;= 4s^2 + 2s + 1              # reject n if n divides some number in primes list             if not is_probably_prime(n, primes): continue              # Here n is probably prime - apply Pocklington criterion to verify it             while True:                 a = random.randint(2, n-1)                  # Fermat\u2019s little theorem isn't satisfied - choose another n                 if pow(a, n-1, n) != 1: break                  d = math.gcd((pow(a, r, n) - 1) % n, n)                 if d != n:                     if d == 1: s = n # n is prime, replace s with n                     else: pass # n isn't prime, choose another n                     break                 else: pass # a^r mod n == 1, choose another a             if s == n: break     return s<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c <code>n<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 5 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b:<\/p>\n<pre><code>1)P1 = 222479360228659844149346639882089160021, D1 = 39 2)P2 = 327235960958148645696052834806967763219, D2 = 39 3)P3 = 1703805325300022851813841485118972214405495022945891, D3 = 52 4)P4 = 848995467487101811203366361379372085728608261197707959, D4 = 54 5)P5 = 1041875824682281112078115198781702612619843793759431, D5 = 52<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 <code>sympy.ntheory.primetest.isprime<\/code>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0426\u0435\u043b\u044c\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043d\u0430 \u0447\u0438\u0441\u043b\u0430\u0445 &#8212; <em>\u0440\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430<\/em>, <em>\u0432\u043e\u0437\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e<\/em>, <em>\u043c\u0430\u043b\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0424\u0435\u0440\u043c\u0430<\/em>, <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em>.<\/p>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u044f \u043d\u0435 \u043d\u0430\u0448\u0451\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u0435\u0442. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/Pilipets\/AdvancedAlgorithms\/blob\/main\/LargePrimeGenerator.py\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/594135\/\"> https:\/\/habr.com\/ru\/articles\/594135\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prime_number\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/a> \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pocklington_primality_test\" rel=\"noopener noreferrer nofollow\"><em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em><\/a>.<br \/>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0434\u0432\u0430\u0438\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<p>\u041e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prime_number#Other_applications\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.<\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/h2>\n<p>\u0418 \u0442\u0430\u043a \u043f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 , \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e =N&#187; alt=&#187;p:p>=N&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c2\/a7f\/b9e\/2c2a7fb9ecfa1240c44429a04a9fc567.svg&#187;\/>.<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0435\u0448\u0435\u0442\u043e-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e &#8212; \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430, \u0410\u0442\u043a\u0438\u043d\u0430, \u0421\u0443\u043d\u0434\u0430\u0440\u0430\u043c\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u044d\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0445 \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0435  \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0435 \u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b &#8212; \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Primality_test\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u044d\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0432\u044b\u0448\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432;<\/p>\n<\/li>\n<\/ol>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0437 3 \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u0442 <em>\u0440\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430<\/em> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442<em> \u043c\u0430\u043b\u0443\u044e \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0424\u0435\u0440\u043c\u0430<\/em>, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430. \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e .<\/p>\n<ol>\n<li>\n<p>\u0421\u0442\u0440\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430 \u0434\u043e , \u0433\u0434\u0435  \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 &#8212; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 . \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e &#8212; \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043b\u0438\u0431\u043e \u0438\u0437 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u0442\u0430. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 2.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e &#8212; \u0435\u0441\u043b\u0438 N&#187; alt=&#187;s>N&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a5d\/07f\/fe6\/a5d07ffe62c8f0dcd030aefa95f0373b.svg&#187;\/>, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u044d\u0442\u043e , \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e s&#187; alt=&#187;n:n>s&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/937\/f83\/ec4\/937f83ec402fe0a28178fa392a116c80.svg&#187;\/> &#8212; \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 3.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0447\u0451\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 .  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 4.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c  \u043d\u0430 \u0434\u0435\u043b\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0448\u0430\u0433\u0435 1 &#8212; \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445, \u0442\u043e \u043e\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 , \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 2. \u0418\u043d\u0430\u0447\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 5.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0447\u0438\u0441\u043b\u043e  \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0434\u0432\u0443\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438 .<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0442\u043e \u043f\u043e <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em> \u0447\u0438\u0441\u043b\u043e  \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c  \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u0438\u0441\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 2.<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#8212; , \u0442\u043e \u043f\u043e <em>\u043c\u0430\u043b\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0424\u0435\u0440\u043c\u0430<\/em> \u0447\u0438\u0441\u043b\u043e  \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 3.<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 &#8212; \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 , \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e , \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043d\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0443, \u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u0433\u0443 3.<\/p>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 , \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 , \u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0439 \u043a\u043e\u043d\u0433\u0440\u0443\u044d\u043d\u0446\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 . \u041e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u044d\u0442\u043e , \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435\u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c  \u043c\u044b \u043d\u0430\u0439\u0434\u0451\u043c (\u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e ) \u0442\u0430\u043a\u043e\u0435 , \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u043b\u043e <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 5 \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 .<\/p>\n<\/li>\n<\/ol>\n<h2>\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043c\u0435\u0442\u044c \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0446\u0438\u0444\u0440 &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u0448\u0430\u0433\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043c\u044b \u0434\u043e\u0439\u0434\u0451\u043c \u043a \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 . \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435N&#187; alt=&#187;p:p>N&#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ee\/757\/42d\/3ee75742dee6ce3dc1facd1060adafe2.svg&#187;\/>\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u044b\u0431\u043e\u0440\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0434\u043b\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043a\u0430 , \u0442\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c.<\/p>\n<p>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0431\u044b\u0442\u044c \u0438\u0437-\u0437\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dirichlet%27s_theorem_on_arithmetic_progressions\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0414\u0438\u0440\u0438\u0445\u043b\u0435<\/a> \u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u043b\u0430\u0445 \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u044f\u0445, \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u041b\u044e\u0441\u0442\u0435\u0440\u043d\u0438\u043a\u0430 \u043e \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prime_gap\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u041a\u0440\u0430\u043c\u0435\u0440\u0430<\/a> \u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>\n<h2>\u041a\u043e\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 Python<\/h2>\n<pre><code>def generatePrime(n : int, primes = None, s = None):     \"\"\"Generates prime number with at least n digits:      : param n: number of 10-based digits in the generate prime is at least n;     : param primes: an iterable object of numbers that are used as small factors     for pre-prime verification. If None, is computed using getSieve(1000);     : param s: initial prime number - if None, last from primes is used;     \"\"\"      # Any prime number higher than the up_limit suffices the result.     up_limit = 10**n      # Get the list of small primes which are used as small divisors     # to reject the n candidate before the Pocklington test.     if not primes: primes = getSieve(1000)      if not s: s = primes[-1] # initial prime     while s &lt; up_limit:         lo, hi = (s + 1) >> 1, (s &lt;&lt; 1) + 1          # Proceed with finding new prime n         while True:             r = random.randint(lo, hi) &lt;&lt; 1 # get random even r from [s, 4*s + 2]             n = s*r + 1 # n is prime candidate, s^2 + 1 &lt;= n &lt;= 4s^2 + 2s + 1              # reject n if n divides some number in primes list             if not is_probably_prime(n, primes): continue              # Here n is probably prime - apply Pocklington criterion to verify it             while True:                 a = random.randint(2, n-1)                  # Fermat\u2019s little theorem isn't satisfied - choose another n                 if pow(a, n-1, n) != 1: break                  d = math.gcd((pow(a, r, n) - 1) % n, n)                 if d != n:                     if d == 1: s = n # n is prime, replace s with n                     else: pass # n isn't prime, choose another n                     break                 else: pass # a^r mod n == 1, choose another a             if s == n: break     return s<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c <code>n<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 5 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b:<\/p>\n<pre><code>1)P1 = 222479360228659844149346639882089160021, D1 = 39 2)P2 = 327235960958148645696052834806967763219, D2 = 39 3)P3 = 1703805325300022851813841485118972214405495022945891, D3 = 52 4)P4 = 848995467487101811203366361379372085728608261197707959, D4 = 54 5)P5 = 1041875824682281112078115198781702612619843793759431, D5 = 52<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 <code>sympy.ntheory.primetest.isprime<\/code>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0426\u0435\u043b\u044c\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043d\u0430 \u0447\u0438\u0441\u043b\u0430\u0445 &#8212; <em>\u0440\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430<\/em>, <em>\u0432\u043e\u0437\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e<\/em>, <em>\u043c\u0430\u043b\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0424\u0435\u0440\u043c\u0430<\/em>, <em>\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u041f\u043e\u043a\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0430<\/em>.<\/p>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u044f \u043d\u0435 \u043d\u0430\u0448\u0451\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u0435\u0442. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/Pilipets\/AdvancedAlgorithms\/blob\/main\/LargePrimeGenerator.py\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/594135\/\"> https:\/\/habr.com\/ru\/articles\/594135\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-396422","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=396422"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396422\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}