{"id":346240,"date":"2023-03-03T15:03:48","date_gmt":"2023-03-03T15:03:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346240"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346240","title":{"rendered":"<span>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b: \u043e\u0442 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0430 \u0434\u043e \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/76f\/a2b\/92a\/76fa2b92afd9b5aec142ddbfb900eba7.png\" width=\"612\" height=\"376\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/76f\/a2b\/92a\/76fa2b92afd9b5aec142ddbfb900eba7.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043c\u044b \u0440\u0435\u0434\u043a\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0442\u0435 \u0438\u043b\u0438\u00a0\u0438\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c. \u0420\u0430\u0434\u0438 \u044d\u0442\u043e\u0433\u043e \u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043a\u0430\u0441\u043a\u0430\u0434 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439: \u043d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u043c \u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u00a0\u0433\u043e\u043b\u043e\u0432\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u0441\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u00a0\u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0418 \u0443\u0436 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 a * b \u043c\u044b \u043d\u0435\u00a0\u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u0435\u043b a \u0438 b \u0432\u00a0\u043d\u0430\u0448\u0435\u043c \u044f\u0437\u044b\u043a\u0435. \u041a\u0430\u043a\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0435\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f? \u042d\u0442\u043e \u043a\u0430\u043a\u0430\u044f\u2011\u0442\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430?<\/p>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u0441\u00a0\u043d\u0443\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432\u00a0\u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u00a0\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u0438\u0451\u043c\u0430\u043c\u0438, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438.<\/p>\n<h3>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h3>\n<ol>\n<li>\n<p><a href=\"#table\" rel=\"noopener noreferrer nofollow\">\u0415\u0433\u043e \u0432\u0435\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0438\u043a<\/a><br \/>    \u2022 <a href=\"#o-notation\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u041e-\u043d\u043e\u0442\u0430\u0446\u0438\u044e<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#karatsuba\" rel=\"noopener noreferrer nofollow\">\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0439 \u0438 \u0432\u043b\u0430\u0441\u0442\u0432\u0443\u0439: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#schonhage-strassen\" rel=\"noopener noreferrer nofollow\">\u041c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b vs \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/a><br \/>    \u2022 <a href=\"#fourier-transform\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#schonhage-strassen-2\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/a><br \/>    \u2022 <a href=\"#modular-arithmetic\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u0447\u0438\u0441\u0435\u043b<\/a><br \/>    \u2022 <a href=\"#polynomial-modular-arithmetic\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u0417\u0430\u0447\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430?<\/h2>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u0430. \u041f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f 32-\u0431\u0438\u0442\u043d\u044b\u0445, 64-\u0431\u0438\u0442\u043d\u044b\u0445, \u0430\u00a0\u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432\u00a0\u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u043e\u2011\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<u> <\/u>\u043c\u0438\u043a\u0440\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432; \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043f\u0435\u0439 \u0434\u043b\u044f\u00a0\u043a\u0440\u0435\u043c\u043d\u0438\u044f\u00a0\u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u0430\u044f \u043d\u0430\u0443\u043a\u0430. \u041d\u043e\u00a0\u043d\u0435\u00a0\u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0445\u0432\u0430\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f\u00a0\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b (\u0432\u0440\u043e\u0434\u0435 \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/RSA\" rel=\"noopener noreferrer nofollow\"><u>RSA<\/u><\/a>) \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0434\u043b\u0438\u043d\u043e\u0439 \u0432\u00a0\u0442\u044b\u0441\u044f\u0447\u0438 \u0431\u0438\u0442. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0432\u043e\u0434\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 4096-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043a\u00a0\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u043d\u0430\u0434 64-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u00a0\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d21\/e59\/ff3\/d21e59ff3ad18cb3da07069154e41eb3.svg\" width=\"27\" height=\"21\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\\log N\" alt=\"N\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9f8\/ef8\/a00\/9f8ef8a007e77772b6d4a8445cadda4c.svg\" width=\"66\" height=\"21\"\/> \u0443\u0436\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u044c \u0440\u0430\u0437!<\/p>\n<p>\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 <a href=\"https:\/\/blog.segger.com\/algorithms-for-division-part-3-using-multiplication\/\" rel=\"noopener noreferrer nofollow\"><u>\u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u00a0\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044e<\/u><\/a>; \u0432\u00a0\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f\u00a0\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f. <\/p>\n<p><a class=\"anchor\" name=\"table\" id=\"table\"><\/a><\/p>\n<p>\u041d\u043e\u00a0\u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c: \u043d\u0435\u00a0\u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b\u00a0\u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b \u0434\u043b\u044f\u00a0\u0448\u0438\u0440\u043e\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u00a0\u2014 \u043f\u043e\u00a0\u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043d\u0430\u00a0\u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c. \u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u0434\u0435\u0441\u044c \u0441\u0438\u043b\u0451\u043d \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441. \u041a\u0430\u043a\u00a0\u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f? \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e\u00a0\u0431\u044b\u0441\u0442\u0440\u043e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u041c\u043e\u0436\u0435\u043c\u00a0\u043b\u0438 \u043c\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438 \u0447\u0435\u043c\u0443 \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0432\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0438\u0441\u043a\u0430?<\/p>\n<h2>\u0415\u0433\u043e \u0432\u0435\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0438\u043a<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430-\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0432\u043d\u043e \u043c\u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u043b\u0430\u0437\u0430 <a href=\"https:\/\/www.youtube.com\/watch?v=VJf8XAhC550\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0438\u0434\u0435\u043e<\/u><\/a> \u0441 \u043a\u0440\u0438\u0447\u0430\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;How to Multiply&#187;, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u044f\u043f\u043e\u043d\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. \u0427\u0442\u043e \u043c\u0435\u043d\u044f \u0443\u0434\u0438\u0432\u0438\u043b\u043e \u2014 \u0442\u0430\u043a \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u0430\u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a, \u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043b\u0438\u0441\u0442\u0430 \u0431\u0443\u043c\u0430\u0433\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/737\/9b0\/420\/7379b0420c926ed91a9002b59f19959a.png\" width=\"1600\" height=\"898\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/737\/9b0\/420\/7379b0420c926ed91a9002b59f19959a.png\"\/><\/figure>\n<p>\u0414\u0430-\u0434\u0430, \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c. \u041c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0451 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u043e\u0439:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/16d\/c27\/301\/16dc27301e1549e5ef05c712705e958c.png\" width=\"53\" height=\"103\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/16d\/c27\/301\/16dc27301e1549e5ef05c712705e958c.png\"\/><\/figure>\n<p>92 \u2014 \u044d\u0442\u043e \u0434\u0432\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043d\u0438\u0436\u043d\u0435-\u043f\u0440\u0430\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438. 23 \u2014 \u0434\u0432\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430 \u0432\u0435\u0440\u0445\u043d\u0435-\u043b\u0435\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0435, \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u044b, \u043f\u043e\u0442\u043e\u043c \u0441\u043b\u043e\u0436\u0438\u0442\u044c, \u0438 \u043f\u043e\u0442\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u2014 \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435 \u0438 <em>\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/em> \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439 \u0432 \u0441\u0435\u0431\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0435 \u0434\u043e XX \u0432\u0435\u043a\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0437\u0430 \u0440\u0435\u0434\u043a\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u043e\u0434\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%95%D0%B3%D0%B8%D0%BF%D0%B5%D1%82%D1%81%D0%BA%D0%B8%D0%B5_%D0%B4%D1%80%D0%BE%D0%B1%D0%B8\" rel=\"noopener noreferrer nofollow\"><u>\u0435\u0433\u0438\u043f\u0435\u0442\u0441\u043a\u0438\u0445 \u0434\u0440\u043e\u0431\u0435\u0439<\/u><\/a>.<\/p>\n<p>\u0410\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0432 \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(M\\cdot N)\" alt=\"O(M\\cdot N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/88b\/b0a\/c14\/88bb0ac14d521c4d0a6ae9bf6067d36f.svg\" width=\"82\" height=\"22\"\/> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0433\u0434\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"M\" alt=\"M\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e3c\/586\/801\/e3c586801a84ebc97f03393273a92db3.svg\" width=\"21\" height=\"17\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9cf\/9f8\/713\/9cf9f87133e4f3bb4d5aceb58967276b.svg\" width=\"17\" height=\"17\"\/> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0432 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"M\" alt=\"M\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/094\/882\/a30\/094882a306f0c45fd192addeb6e418bc.svg\" width=\"21\" height=\"17\"\/> \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1fe\/b58\/63a\/1feb5863a2cfa6194016b1a19b22ec08.svg\" width=\"17\" height=\"17\"\/> \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0435\u0441\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"MN\" alt=\"MN\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/634\/14d\/4f2\/63414d4f2758c1fbe23a6bc4b9d7095d.svg\" width=\"38\" height=\"17\"\/> \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0447\u0438\u0441\u0435\u043b (\u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432) \u0441\u043b\u043e\u0436\u0438\u0442\u044c.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0443 \u0447\u0438\u0441\u0435\u043b \u0440\u0430\u0437\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432, \u044d\u0442\u043e \u0432\u0435\u0440\u043d\u043e. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0432 \u0447\u0438\u0441\u043b\u0435 x \u0440\u0430\u0432\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\lceil\\log_{10}x\\rceil\" alt=\"\\lceil\\log_{10}x\\rceil\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ac\/cde\/5d0\/8accde5d0a89307e9f274efdf148d407.svg\" width=\"73\" height=\"23\"\/>\u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u2014 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\lceil\\log_{2}x\\rceil\" alt=\"\\lceil\\log_{2}x\\rceil\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a38\/d73\/6cd\/a38d736cd6a39943914c5d62351ef89f.svg\" width=\"66\" height=\"22\"\/> (\u0441\u043a\u043e\u0431\u043a\u0438-\u0443\u0433\u043e\u043b\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0432\u0432\u0435\u0440\u0445). \u041d\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u044b \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u043c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u043c:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\log_{10}x=\\log_{10}2\\cdot\\log_{2}x\" alt=\"\\log_{10}x=\\log_{10}2\\cdot\\log_{2}x\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b4d\/2f2\/069\/b4d2f2069746884ac36fb3873821463c.svg\" width=\"198\" height=\"22\"\/><\/p>\n<p>\u0410 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0438.<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"o-notation\" id=\"o-notation\"><\/a><\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"M\" alt=\"M\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d7d\/63e\/dc3\/d7d63edc393d0ef50d70d5bbcd6a30d2.svg\" width=\"21\" height=\"17\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fa\/49b\/095\/3fa49b095d284ca28d608473b0dd29b7.svg\" width=\"17\" height=\"17\"\/> \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <em>\u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0445<\/em> \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432, \u0430 \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u044b; \u0442\u043e\u0433\u0434\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f \u0434\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b21\/3d7\/e39\/b213d7e393e2833cabc3243c531646e7.svg\" width=\"57\" height=\"25\"\/>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c O(N\u00b2)?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u041e-\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0443\u0447\u0438\u0442 \u0443\u043b\u0438\u0446\u0430 \u2014 \u043e\u043d\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u0439 \u0441\u0440\u0430\u0437\u0443 \u0432 \u043e\u0446\u0435\u043d\u043a\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u043e \u041e-\u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0438 \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0441\u043c\u044b\u0441\u043b, \u043f\u0440\u0438\u0447\u0451\u043c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N)\" alt=\"f(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/056\/2c4\/153\/0562c4153b301b16b7f36cdf45eab4de.svg\" width=\"43\" height=\"22\"\/> \u2014 \u0432 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u044d\u0442\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e6\/9b8\/0e0\/6e69b80e0620e2efd9f65a1280c39690.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442 \u2014 \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = O(N^2)\" alt=\"f(N) = O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d90\/893\/7e5\/d908937e5d83669bf3ee8f88e2d0e7fa.svg\" width=\"126\" height=\"25\"\/> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 C \u0442\u0430\u043a\u0430\u044f, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/812\/677\/475\/81267747526adeb6be405945a8692ce0.svg\" width=\"17\" height=\"17\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(N) \\le C\\cdot N^2\" alt=\"f(N) \\le C\\cdot N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/338\/815\/42b\/33881542b5e72ea5de9ebb6c8d4e16e7.svg\" width=\"125\" height=\"25\"\/><\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/em>, \u0447\u0435\u043c N^2.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u0430 \u0437\u0430\u043f\u0438\u0441\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b12\/d6c\/96c\/b12d6c96c7e2fdd65e0a3ca0023643ab.svg\" width=\"57\" height=\"25\"\/> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <em>\u043a\u043b\u0430\u0441\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/em>, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435. \u0412 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u043a\u043e-\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N)\\in O(N^2)\" alt=\"f(N)\\in O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/817\/338\/5ea\/8173385eaa91f7ffbd28cecbf7e00c86.svg\" width=\"124\" height=\"25\"\/> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0445\u043e\u0434\u0438\u0442 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0440\u0430\u0441\u0442\u0443\u0449\u0438\u0445 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u0433\u043e-\u0442\u043e \u0442\u0430\u043c.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u0442\u043e\u043c, \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0438 <em>\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435<\/em>, \u0447\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6df\/b5a\/972\/6dfb5a97226e4f8d8566056e9eb27c5f.svg\" width=\"27\" height=\"21\"\/>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0431\u0435\u0437 \u0437\u0430\u0437\u0440\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = O(N^3)\" alt=\"f(N) = O(N^3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ce1\/1e1\/93f\/ce11e193fc0ecccb50d0bcaed02fc56d.svg\" width=\"126\" height=\"25\"\/> \u2014 \u0438 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0431\u044b\u043b\u0438 \u0431\u044b \u043f\u0440\u0430\u0432\u044b. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^3\" alt=\"N^3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4f8\/47f\/866\/4f847f8669b3799ce35529e7036277a0.svg\" width=\"27\" height=\"21\"\/>. \u041f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043b\u0438 \u044d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f? \u041d\u0435 \u043e\u0447\u0435\u043d\u044c.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u00ab\u0440\u0430\u0432\u043d\u0430\u00bb \u0440\u0430\u0437\u043d\u044b\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\ldots)\" alt=\"O(\\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c0\/772\/bee\/2c0772beeb1dbc4a6e90fa9d315a993b.svg\" width=\"53\" height=\"22\"\/>; \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u043e\u043c \u044d\u0442\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\ldots)\" alt=\"O(\\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/225\/0d3\/487\/2250d3487aee78837b27b6fe663dbf85.svg\" width=\"53\" height=\"22\"\/> \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(N) = O(N^2),\\ f(N) = O(N^3)\\ \\ \\not{\\!\\!\\!\\Longrightarrow}\\ \\ O(N^2) = O(N^3)\" alt=\"f(N) = O(N^2),\\ f(N) = O(N^3)\\ \\ \\not{\\!\\!\\!\\Longrightarrow}\\ \\ O(N^2) = O(N^3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/98b\/24c\/6b1\/98b24c6b195cb1e1a4d5450007e2a88f.svg\" width=\"459\" height=\"25\"\/><\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\ldots)\" alt=\"O(\\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/400\/59f\/8a3\/40059f8a38246649884cf5add2b9d3ae.svg\" width=\"53\" height=\"22\"\/>\u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\ldots)\" alt=\"O(\\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae1\/79c\/26c\/ae179c26c40720014eae5d28c5a78051.svg\" width=\"53\" height=\"22\"\/>\u2014 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u2014 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e. <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = o(N^2)\" alt=\"f(N) = o(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eb6\/410\/932\/eb641093200a3847e90b28e37b9cca64.svg\" width=\"121\" height=\"25\"\/> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u043c\u0435\u0434\u043b\u0435\u043d\u0435\u0435<\/em>, \u0447\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/24c\/8df\/e62\/24c8dfe62bccc17ceee3c952d5fc5b02.svg\" width=\"27\" height=\"21\"\/>; \u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0430 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0438\u0445 \u0447\u0430\u0441\u0442\u043d\u043e\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441 \u0440\u043e\u0441\u0442\u043e\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a35\/e65\/e38\/a35e65e38ec8fe2df77950742548b029.svg\" width=\"17\" height=\"17\"\/> \u0432\u0441\u0451 \u0431\u043b\u0438\u0436\u0435 \u0438 \u0431\u043b\u0438\u0436\u0435 \u043a \u043d\u0443\u043b\u044e:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\frac{f(N)}{N^2} \\rightarrow 0 \\mbox{ \u043f\u0440\u0438 } N\\rightarrow\\infty\" alt=\"\\frac{f(N)}{N^2} \\rightarrow 0 \\mbox{ \u043f\u0440\u0438 } N\\rightarrow\\infty\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9a3\/7cc\/b1d\/9a37ccb1d256f5eb3b3d2bcacc32d54a.svg\" width=\"193\" height=\"46\"\/><\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043c\u0430\u0442\u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0437\u0430\u043f\u0438\u0441\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o(1)\" alt=\"o(1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8e9\/47e\/d48\/8e947ed48745d4b4441a5f47b45abc03.svg\" width=\"35\" height=\"22\"\/>, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u0441\u0442\u0440\u0435\u043c\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u043d\u0443\u043b\u044e. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 \u0442\u0430\u043c \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430; \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o(69)\" alt=\"o(69)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bae\/bb5\/9ec\/baebb59ecd0a3c5948e69acf325403b2.svg\" width=\"44\" height=\"22\"\/> \u0438 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0440\u043d\u043e. \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0432\u0430\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e. \u0422\u043e\u0433\u0434\u0430 \u043f\u0438\u0448\u0443\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o(1\/\\sqrt{N})\" alt=\"o(1\/\\sqrt{N})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/35c\/181\/d7f\/35c181d7f9b79b9365bcf9f66ad8712c.svg\" width=\"78\" height=\"25\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o(1\/N)\" alt=\"o(1\/N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/85a\/0f4\/a66\/85a0f4a66c1b930fb581e3a2e23db135.svg\" width=\"62\" height=\"22\"\/> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. <\/p>\n<p>\u0414\u0440\u0443\u0433\u0430\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = \\Theta(N^2)\" alt=\"f(N) = \\Theta(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b8b\/436\/34f\/b8b43634f157353c4a947298b5d66a47.svg\" width=\"127\" height=\"25\"\/> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u0442\u043e\u0447\u043d\u043e<\/em> \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/481\/29e\/21d\/48129e21d5f797b2436a58db87b3edae.svg\" width=\"27\" height=\"21\"\/>, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"C_1\" alt=\"C_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/050\/001\/f4b\/050001f4b21986942c6f051469f075a8.svg\" width=\"23\" height=\"19\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"C_2\" alt=\"C_2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b9b\/83c\/675\/b9b83c675600e606f0ac09779312b6b7.svg\" width=\"23\" height=\"19\"\/> \u0442\u0430\u043a\u0438\u0435, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53f\/3a2\/8d6\/53f3a28d6c6ed3f2f190050815082346.svg\" width=\"17\" height=\"17\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C_1\\cdot N^2 \\le f(N) \\le C_2\\cdot N^2\" alt=\"C_1\\cdot N^2 \\le f(N) \\le C_2\\cdot N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cdc\/3eb\/216\/cdc3eb2167284ebbac9851536d231cc4.svg\" width=\"223\" height=\"25\"\/><\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0432\u044b\u0448\u0435, \u043a\u043b\u0430\u0441\u0441\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0438\u0441\u044c <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(N) = N^2 + o(1)\" alt=\"f(N) = N^2 + o(1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a92\/a0e\/80b\/a92a0e80b29ca2dc40b8b0b4ca862ca9.svg\" width=\"155\" height=\"25\"\/><\/p>\n<p>\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0432\u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/790\/9d6\/413\/7909d6413eb477756af95275133cac2a.svg\" width=\"27\" height=\"21\"\/> \u043f\u043b\u044e\u0441 \u043d\u0435\u0447\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435, \u0441\u0442\u0440\u0435\u043c\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u043d\u0443\u043b\u044e \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/002\/442\/497\/002442497747db08d715ce1d4d671650.svg\" width=\"17\" height=\"17\"\/>. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = O(N^2)\" alt=\"f(N) = O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cc8\/895\/e4e\/cc8895e4ed5f78e406a843c4c0ab691f.svg\" width=\"126\" height=\"25\"\/> \u0438\u043b\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = \\Theta(N^2)\" alt=\"f(N) = \\Theta(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d9\/c0b\/857\/3d9c0b857a9b570088245b7785f5fd2c.svg\" width=\"127\" height=\"25\"\/>, \u044d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/158\/a30\/d38\/158a30d383cf2190489ae06c4e739d8d.svg\" width=\"27\" height=\"21\"\/> \u2014 \u0440\u043e\u0432\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^2\" alt=\"N^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b0c\/881\/385\/b0c881385ec00373cf85affa31a9c800.svg\" width=\"27\" height=\"21\"\/> \u0438 \u0432\u0441\u0451 \u0442\u0443\u0442.<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u043f\u0440\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445) \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0432 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430\u0445. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(N) = O(N^3)\" alt=\"f(N) = O(N^3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c1d\/eb8\/2d4\/c1deb82d4a2357360f1adeacb9b3d120.svg\" width=\"126\" height=\"25\"\/>, \u043e\u0431\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\frac{f(N)}{2} = \\frac{O(N^3)}{2} = O(N^3)\" alt=\"\\frac{f(N)}{2} = \\frac{O(N^3)}{2} = O(N^3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/efd\/981\/c4c\/efd981c4c16e3173b54b9cf466ec80da.svg\" width=\"224\" height=\"47\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\ldots)\" alt=\"O(\\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/069\/b0c\/f0d\/069b0cf0de89e6fe152707651368e701.svg\" width=\"53\" height=\"22\"\/> \u0441\u044a\u0435\u0434\u0430\u0435\u0442 \u043b\u044e\u0431\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c. \u0410 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c40\/4e1\/80b\/c404e180b0003cba052c3403ab337082.svg\" width=\"17\" height=\"17\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\frac{f(N)}{N} = \\frac{O(N^3)}{N} = O(N^2)\" alt=\"\\frac{f(N)}{N} = \\frac{O(N^3)}{N} = O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4d7\/4fd\/2a4\/4d74fd2a4248f6e9026a352ef9285ce7.svg\" width=\"224\" height=\"47\"\/><\/p>\n<p>\u041d\u0435-\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0443\u0448\u043b\u0430 \u0432\u043d\u0443\u0442\u0440\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\ldots)\" alt=\"O(\\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b72\/e0a\/856\/b72e0a856ff341786d5854bcb99ae095.svg\" width=\"53\" height=\"22\"\/> \u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e.<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"karatsuba\" id=\"karatsuba\"><\/a><\/p>\n<h2>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0439 \u0438 \u0432\u043b\u0430\u0441\u0442\u0432\u0443\u0439: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u044b<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043d\u0430 \u043f\u0443\u0442\u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u0432 1960-\u043c \u0433\u043e\u0434\u0443 \u0441\u043e\u0432\u0435\u0442\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a \u0410\u043d\u0430\u0442\u043e\u043b\u0438\u0439 \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u0430. \u041e\u043d \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"{\\color{Red}{235739}}\\,{\\color{DarkBlue}{098113}}\\ \\times\\ {\\color{DarkOrange}{187129}}\\,{\\color{Magenta}{102983}} \\\\[4mm] \\left({\\color{Red}{a_1}}\\cdot 10^6 + {\\color{DarkBlue}{a_0}}\\right)\\ \\times\\ \\left({\\color{DarkOrange}{b_1}}\\cdot 10^6 + {\\color{Magenta}{b_0}}\\right) \\\\[4mm] {\\color{Red}{a_1}}\\cdot{\\color{DarkOrange}{b_1}}\\cdot 10^{12} + ({\\color{Red}{a_1}}\\cdot {\\color{Magenta}{b_0}} + {\\color{DarkBlue}{a_0}}\\cdot {\\color{DarkOrange}{b_1}})\\cdot 10^6 + {\\color{DarkBlue}{a_0}}\\cdot {\\color{Magenta}{b_0}}\" alt=\"{\\color{Red}{235739}}\\,{\\color{DarkBlue}{098113}}\\ \\times\\ {\\color{DarkOrange}{187129}}\\,{\\color{Magenta}{102983}} \\\\[4mm] \\left({\\color{Red}{a_1}}\\cdot 10^6 + {\\color{DarkBlue}{a_0}}\\right)\\ \\times\\ \\left({\\color{DarkOrange}{b_1}}\\cdot 10^6 + {\\color{Magenta}{b_0}}\\right) \\\\[4mm] {\\color{Red}{a_1}}\\cdot{\\color{DarkOrange}{b_1}}\\cdot 10^{12} + ({\\color{Red}{a_1}}\\cdot {\\color{Magenta}{b_0}} + {\\color{DarkBlue}{a_0}}\\cdot {\\color{DarkOrange}{b_1}})\\cdot 10^6 + {\\color{DarkBlue}{a_0}}\\cdot {\\color{Magenta}{b_0}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eff\/ef8\/c2b\/effef8c2b0583506eed77d7aa6ee1a3d.svg\" width=\"697\" height=\"103\"\/><\/p>\n<p>\u0422\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c <em>\u0442\u0440\u0435\u043c\u044f<\/em> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u044d\u0442\u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430, \u0430 \u043d\u0435 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c. \u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"{\\color{Red}{a_1}}\\cdot {\\color{Magenta}{b_0}} + {\\color{DarkBlue}{a_0}}\\cdot{\\color{DarkOrange}{b_1}}\" alt=\"{\\color{Red}{a_1}}\\cdot {\\color{Magenta}{b_0}} + {\\color{DarkBlue}{a_0}}\\cdot{\\color{DarkOrange}{b_1}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/49f\/80e\/e0c\/49f80ee0c58a0ee7dd8e8bba1a472094.svg\" width=\"125\" height=\"20\"\/>, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\left({\\color{Red}{a_1}} + {\\color{DarkBlue}{a_0}}\\right) \\times \\left({\\color{DarkOrange}{b_1}} + {\\color{Magenta}{b_0}}\\right)\" alt=\"\\left({\\color{Red}{a_1}} + {\\color{DarkBlue}{a_0}}\\right) \\times \\left({\\color{DarkOrange}{b_1}} + {\\color{Magenta}{b_0}}\\right)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e4f\/42b\/4c3\/e4f42b4c3fa3b4d72d9f2550411202d9.svg\" width=\"175\" height=\"22\"\/> \u0438 \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0447\u0438\u0441\u043b\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"{\\color{Red}{a_1}}\\cdot{\\color{DarkOrange}{b_1}}\" alt=\"{\\color{Red}{a_1}}\\cdot{\\color{DarkOrange}{b_1}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/27e\/66d\/be7\/27e66dbe7e2f901b200b3b2b91653eab.svg\" width=\"51\" height=\"19\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"{\\color{DarkBlue}{a_0}}\\cdot {\\color{Magenta}{b_0}}\" alt=\"{\\color{DarkBlue}{a_0}}\\cdot {\\color{Magenta}{b_0}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a20\/361\/5d6\/a203615d605cfdc910d5709754ff062d.svg\" width=\"51\" height=\"20\"\/>, \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0438 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u043c \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{array}{c@{\\quad=\\quad}rrrr} {\\color{DarkBlue}{a_0}}\\cdot {\\color{Magenta}{b_0}} &amp; &amp;&amp;\\!\\!\\!\\!\\!\\!10103&amp;\\!\\!\\!\\!\\!\\!9710\\overset{\\displaystyle\\leftarrow}{79} \\\\ {\\color{Red}{a_1}}\\cdot {\\color{Magenta}{b_0}} + {\\color{DarkBlue}{a_0}}\\cdot {\\color{DarkOrange}{b_1}} &amp; &amp;\\!\\!\\!\\!\\!\\!42636&amp;\\!\\!\\!\\!\\!\\!897014&amp; \\\\  {\\color{Red}{a_1}}\\cdot{\\color{DarkOrange}{b_1}} &amp; 44113&amp;\\!\\!\\!\\!\\!\\!603331&amp;&amp; \\\\ \\hline a \\cdot b &amp; 44113&amp;\\!\\!\\!\\!\\!\\!645967&amp;\\!\\!\\!\\!\\!\\!907117&amp;\\!\\!\\!\\!\\!\\!971079 \\end{array}\" alt=\"\\begin{array}{c@{\\quad=\\quad}rrrr} {\\color{DarkBlue}{a_0}}\\cdot {\\color{Magenta}{b_0}} &amp; &amp;&amp;\\!\\!\\!\\!\\!\\!10103&amp;\\!\\!\\!\\!\\!\\!9710\\overset{\\displaystyle\\leftarrow}{79} \\\\ {\\color{Red}{a_1}}\\cdot {\\color{Magenta}{b_0}} + {\\color{DarkBlue}{a_0}}\\cdot {\\color{DarkOrange}{b_1}} &amp; &amp;\\!\\!\\!\\!\\!\\!42636&amp;\\!\\!\\!\\!\\!\\!897014&amp; \\\\  {\\color{Red}{a_1}}\\cdot{\\color{DarkOrange}{b_1}} &amp; 44113&amp;\\!\\!\\!\\!\\!\\!603331&amp;&amp; \\\\ \\hline a \\cdot b &amp; 44113&amp;\\!\\!\\!\\!\\!\\!645967&amp;\\!\\!\\!\\!\\!\\!907117&amp;\\!\\!\\!\\!\\!\\!971079 \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e1\/39f\/3fe\/3e139f3fe711c7d1512378f717bd9058.svg\" width=\"392\" height=\"122\"\/><\/p>\n<p>\u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043d\u0435 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u2014 \u043a\u0430\u043a \u0438 \u0434\u0432\u0430 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443. \u041f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u0447\u0438\u0441\u0435\u043b \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0439\u0434\u0451\u043c \u0434\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0438\u043b\u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0435\u0440\u0435\u0437 lookup table.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0434\u0435\u043b\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0442\u0440\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 (\u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0431\u0438\u0442) \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^k\" alt=\"2^k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/637\/6a7\/b7a\/6376a7b7a43d31489381672df255fb77.svg\" width=\"19\" height=\"21\"\/> \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ea5\/67e\/518\/ea567e5181280cf954d226733f0d7c64.svg\" width=\"10\" height=\"17\"\/> \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"3^k\" alt=\"3^k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/581\/994\/59e\/58199459ed3e53a1df05480e8819a198.svg\" width=\"19\" height=\"21\"\/> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u0447\u0438\u0441\u0435\u043b \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0434\u043b\u0438\u043d\u044b; \u043e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^{\\log_2 3}) \\approx O(N^{1.58}).\" alt=\"O(N^{\\log_2 3}) \\approx O(N^{1.58}).\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b92\/9be\/c8c\/b929bec8c588c8bfd759ae2d1f5106a6.svg\" width=\"190\" height=\"25\"\/><\/p>\n<blockquote>\n<p>\u0417\u0430\u043d\u044f\u0442\u043d\u044b\u0439 \u0444\u0430\u043a\u0442 \u2014 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u043a\u0443\u0441\u044b \u0441 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0435\u0439 \u0437\u0430 \u0441\u0447\u0451\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0435\u0449\u0451 \u0432 \u0440\u044f\u0434\u0435 \u043c\u0435\u0441\u0442. \u0422\u0430\u043a, \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"a+bi\" alt=\"a+bi\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/427\/fa7\/3f8\/427fa73f82ab585494e714b63a2d8804.svg\" width=\"49\" height=\"18\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"c+di\" alt=\"c+di\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8e7\/fda\/e00\/8e7fdae000a629877229fb7c47903592.svg\" width=\"49\" height=\"18\"\/> \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0437\u0430 \u0442\u0440\u0438 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0451\u0445, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"ac\" alt=\"ac\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bb4\/534\/b1f\/bb4534b1f4decde1d9201db5a3ff83ab.svg\" width=\"19\" height=\"12\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"bd\" alt=\"bd\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fc9\/93a\/51d\/fc993a51df9830a747fdf100f4c5de32.svg\" width=\"19\" height=\"17\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(a+b)\\cdot(c+d)\" alt=\"(a+b)\\cdot(c+d)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/744\/c25\/0a9\/744c250a98a74eeb0e7b932a59fc0edd.svg\" width=\"130\" height=\"22\"\/>. \u0410 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041f\u0430\u043d\u0430 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043f\u0430\u0440 \u043c\u0430\u0442\u0440\u0438\u0446 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"XY\" alt=\"XY\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8af\/977\/9d8\/8af9779d8e610482c7517269d92944b0.svg\" width=\"32\" height=\"17\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"UV\" alt=\"UV\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6d5\/bf9\/a67\/6d5bf9a67a815d639e4aeeec20eb8881.svg\" width=\"30\" height=\"17\"\/> \u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, \u0447\u0435\u043c \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 [1, 2]. \u041d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^3)\" alt=\"O(N^3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/75a\/860\/19c\/75a86019c5eee772418d4aa12311421d.svg\" width=\"57\" height=\"25\"\/> \u2014 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/046\/d8a\/6f7\/046d8a6f7d684d29ec85eb5866cd7568.svg\" width=\"17\" height=\"17\"\/> \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432.<\/p>\n<\/blockquote>\n<p><a class=\"anchor\" name=\"toom\" id=\"toom\"><\/a><\/p>\n<h2>\u0427\u0438\u0441\u043b\u0430 vs \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0422\u043e\u043e\u043c\u0430-\u041a\u0443\u043a\u0430<\/h2>\n<p>\u041f\u0440\u0438 \u0432\u0438\u0434\u0435 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u0430\u043a-\u0442\u043e \u0441\u0430\u043c \u0441\u043e\u0431\u043e\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438 \u043d\u0430 \u0431\u00f3\u043b\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0447\u0430\u0441\u0442\u0435\u0439 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u00f3\u043b\u044c\u0448\u0443\u044e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044e?<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u2014 \u0434\u0430; \u0438 \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u044b \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u041d\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0444\u043e\u043a\u0443\u0441.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0442\u0440\u0438 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"{\\color{Red}{2357}}\\,{\\color{DarkBlue}{3909}}\\,{\\color{DarkGreen}{8113}}\\ \\times\\ {\\color{DarkOrange}{1871}}\\,{\\color{Magenta}{2910}}\\,{\\color{Golden}{2983}} \\\\[5mm] \\left({\\color{Red}{a_2}}\\cdot 10^8 + {\\color{DarkBlue}{a_1}}\\cdot 10^4 + {\\color{DarkGreen}{a_0}}\\right)\\ \\times\\ \\left({\\color{DarkOrange}{b_2}}\\cdot 10^8 + {\\color{Magenta}{b_1}}\\cdot 10^4 + {\\color{Golden}{b_0}}\\right)\" alt=\"{\\color{Red}{2357}}\\,{\\color{DarkBlue}{3909}}\\,{\\color{DarkGreen}{8113}}\\ \\times\\ {\\color{DarkOrange}{1871}}\\,{\\color{Magenta}{2910}}\\,{\\color{Golden}{2983}} \\\\[5mm] \\left({\\color{Red}{a_2}}\\cdot 10^8 + {\\color{DarkBlue}{a_1}}\\cdot 10^4 + {\\color{DarkGreen}{a_0}}\\right)\\ \\times\\ \\left({\\color{DarkOrange}{b_2}}\\cdot 10^8 + {\\color{Magenta}{b_1}}\\cdot 10^4 + {\\color{Golden}{b_0}}\\right)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f07\/312\/e33\/f07312e3361038541006e3d749c5750a.svg\" width=\"697\" height=\"68\"\/><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0441\u043a\u043e\u0431\u043e\u043a:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{array}{r} {\\color{Teal}{a_0\\cdot b_0}} \\\\  {\\color{Violet}{a_1\\cdot b_0 + a_0\\cdot b_1}} \\quad\\quad \\\\ {\\color{Orchid}{a_2\\cdot b_0 + a_1\\cdot b_1 + a_0\\cdot b_2}} \\quad\\quad\\quad\\quad \\\\ {\\color{Gray}{a_2\\cdot b_1 + a_1\\cdot b_2}}\\quad\\quad\\quad\\quad\\quad\\quad \\\\ {\\color{DarkRed}{a_2\\cdot b_2}}\\quad\\quad\\quad\\quad\\quad\\quad\\quad\\quad \\\\ \\hline a\\cdot b \\end{array}\" alt=\"\\begin{array}{r} {\\color{Teal}{a_0\\cdot b_0}} \\\\  {\\color{Violet}{a_1\\cdot b_0 + a_0\\cdot b_1}} \\quad\\quad \\\\ {\\color{Orchid}{a_2\\cdot b_0 + a_1\\cdot b_1 + a_0\\cdot b_2}} \\quad\\quad\\quad\\quad \\\\ {\\color{Gray}{a_2\\cdot b_1 + a_1\\cdot b_2}}\\quad\\quad\\quad\\quad\\quad\\quad \\\\ {\\color{DarkRed}{a_2\\cdot b_2}}\\quad\\quad\\quad\\quad\\quad\\quad\\quad\\quad \\\\ \\hline a\\cdot b \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/805\/c03\/dd8\/805c03dd86831318a48084039f58bb3f.svg\" width=\"300\" height=\"168\"\/><\/p>\n<p>\u0422\u043e (\u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043e\u043f\u044b\u0442\u0430 \u0432 \u0430\u043b\u0433\u0435\u0431\u0440\u0435) \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u043c\u044b \u0442\u0430\u043a\u043e\u0435 \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432! <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b a \u0438 b \u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(x)\" alt=\"f(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ab\/7e7\/5ce\/0ab7e75ce971506f16213bc725bad686.svg\" width=\"37\" height=\"22\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"g(x)\" alt=\"g(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e53\/889\/d3d\/e53889d3d7fcccadc373a6380c5305e5.svg\" width=\"36\" height=\"22\"\/> \u043f\u0440\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u0445, \u0447\u0438\u0441\u043b\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u044b\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0447\u0435\u043c \u0438\u043d\u044b\u043c, \u043a\u0430\u043a \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(x) \\cdot g(x)\" alt=\"f(x) \\cdot g(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aac\/4e2\/b90\/aac4e2b90916f259d9ce35a0fd98a438.svg\" width=\"87\" height=\"22\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{array}{l}  f(x) \\cdot g(x) = \\\\[2mm] \\quad\\quad = (a_0 + a_1x + \\ldots)\\ \\times\\ (b_0 + b_1x + \\ldots) = \\quad\\quad\\quad\\quad \\\\[2mm] \\qquad\\qquad\\begin{array}{r@{\\ }l}  = &amp; ({\\color{Teal}{a_0\\cdot b_0}})  \\\\  + &amp; ({\\color{Violet}{a_1\\cdot b_0 + a_0\\cdot b_1}})\\cdot x \\\\  + &amp; ({\\color{Orchid}{a_2\\cdot b_0 + a_1\\cdot b_1 + a_0\\cdot b_2}})\\cdot x^2 \\\\  + &amp; ({\\color{Gray}{a_3\\cdot b_0 + a_2\\cdot b_1 + a_1\\cdot b_2 + a_0\\cdot b_3}})\\cdot x^3 \\\\   + &amp; \\ldots \\end{array} \\end{array}\" alt=\"\\begin{array}{l}  f(x) \\cdot g(x) = \\\\[2mm] \\quad\\quad = (a_0 + a_1x + \\ldots)\\ \\times\\ (b_0 + b_1x + \\ldots) = \\quad\\quad\\quad\\quad \\\\[2mm] \\qquad\\qquad\\begin{array}{r@{\\ }l}  = &amp; ({\\color{Teal}{a_0\\cdot b_0}})  \\\\  + &amp; ({\\color{Violet}{a_1\\cdot b_0 + a_0\\cdot b_1}})\\cdot x \\\\  + &amp; ({\\color{Orchid}{a_2\\cdot b_0 + a_1\\cdot b_1 + a_0\\cdot b_2}})\\cdot x^2 \\\\  + &amp; ({\\color{Gray}{a_3\\cdot b_0 + a_2\\cdot b_1 + a_1\\cdot b_2 + a_0\\cdot b_3}})\\cdot x^3 \\\\   + &amp; \\ldots \\end{array} \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aed\/e22\/90a\/aede2290a3fecfb26994a7ba32c01d76.svg\" width=\"466\" height=\"216\"\/><\/p>\n<p>\u0421\u0430\u043c\u0438 \u0436\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043f\u0443\u0442\u0451\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u041a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"a = {\\color{Red}{a_2}}\\cdot 10^8 + {\\color{DarkBlue}{a_1}}\\cdot 10^4 + {\\color{DarkGreen}{a_0}} = f(10^4)\" alt=\"a = {\\color{Red}{a_2}}\\cdot 10^8 + {\\color{DarkBlue}{a_1}}\\cdot 10^4 + {\\color{DarkGreen}{a_0}} = f(10^4)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/78f\/95e\/75d\/78f95e75d77bd18b4bc221e2a36c7b39.svg\" width=\"308\" height=\"25\"\/><\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0441\u0432\u0435\u043b\u0438 \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a \u0434\u0440\u0443\u0433\u043e\u0439. \u0412 \u0447\u0451\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432? \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 <em>\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/em>; \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(x) \\cdot g(x)\" alt=\"f(x) \\cdot g(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6f1\/c0a\/648\/6f1c0a648977ca38b0d37c8bfcc5bea9.svg\" width=\"87\" height=\"22\"\/> \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043e\u0431\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0438\u0445. \u0415\u0441\u043b\u0438 \u0431\u044b \u044f \u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b, \u044f \u0431\u044b \u0438 \u0432\u043e\u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u0435\u043d\u0438\u0432\u044b\u043c.<\/p>\n<p>\u041d\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0442\u043e\u0447\u043a\u0435. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b. \u0410 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u0432 \u0442\u043e\u0447\u043a\u0430\u0445, \u0440\u0435\u0448\u0438\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\left\\{\\begin{matrix} c0 + c_1\\cdot x_1 + \\ldots  = f(x_1)\\cdot g(x_1) \\\\  c0 + c_1\\cdot x_2 + \\ldots  = f(x_2)\\cdot g(x_2) \\\\  \\vdots \\end{matrix}\\right.\" alt=\"\\left\\{\\begin{matrix} c0 + c_1\\cdot x_1 + \\ldots  = f(x_1)\\cdot g(x_1) \\\\  c0 + c_1\\cdot x_2 + \\ldots  = f(x_2)\\cdot g(x_2) \\\\  \\vdots \\end{matrix}\\right.\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c26\/ef6\/9bd\/c26ef69bd492c168fcdca5651e24c5ed.svg\" width=\"295\" height=\"89\"\/><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_i\" alt=\"x_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c8c\/537\/7d7\/c8c5377d78aaf99377299d199effab6b.svg\" width=\"18\" height=\"15\"\/> \u2014 \u044d\u0442\u043e \u0442\u043e\u0447\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430, \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u0441\u0430\u043c\u0438 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"c_i\" alt=\"c_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/74b\/bbb\/d07\/74bbbbd07eaa38732b881cc91b7f7017.svg\" width=\"15\" height=\"15\"\/> \u2014 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043d\u0430\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 + 1; \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c, \u043d\u0443\u0436\u043d\u043e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u043d\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u043a\u043e\u043c \u0436\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u0447\u0435\u043a. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e \u043f\u044f\u0442\u044c \u0442\u043e\u0447\u0435\u043a, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c 4:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(x) \\cdot g(x) = {\\color{DarkRed}{a_2\\cdot b_2}}\\,\\cdot x^4 + \\ldots\" alt=\"f(x) \\cdot g(x) = {\\color{DarkRed}{a_2\\cdot b_2}}\\,\\cdot x^4 + \\ldots\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dcb\/fc2\/46d\/dcbfc246d15071ecff28f74ff72396fe.svg\" width=\"248\" height=\"25\"\/><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u043c <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{bmatrix} 1 &amp; x_1 &amp; x_1^2 &amp; x_1^3 &amp; \\cdots \\\\[1mm] 1 &amp; x_2 &amp; x_2^2 &amp; x_2^3 &amp; \\cdots \\\\[1mm] 1 &amp; x_3 &amp; x_3^2 &amp; x_3^3 &amp; \\cdots \\\\ \\vdots &amp; \\vdots &amp; \\vdots &amp; \\vdots &amp; \\ddots \\end{bmatrix} \\times \\begin{bmatrix} c_0 \\\\[1mm] c_1 \\\\[1mm]  c_2 \\\\ \\vdots \\end{bmatrix} = \\begin{bmatrix} f(x_1)\\cdot g(x_1) \\\\[1mm] f(x_2)\\cdot g(x_2) \\\\[1mm] f(x_3)\\cdot g(x_3) \\\\ \\vdots \\end{bmatrix}\" alt=\"\\begin{bmatrix} 1 &amp; x_1 &amp; x_1^2 &amp; x_1^3 &amp; \\cdots \\\\[1mm] 1 &amp; x_2 &amp; x_2^2 &amp; x_2^3 &amp; \\cdots \\\\[1mm] 1 &amp; x_3 &amp; x_3^2 &amp; x_3^3 &amp; \\cdots \\\\ \\vdots &amp; \\vdots &amp; \\vdots &amp; \\vdots &amp; \\ddots \\end{bmatrix} \\times \\begin{bmatrix} c_0 \\\\[1mm] c_1 \\\\[1mm]  c_2 \\\\ \\vdots \\end{bmatrix} = \\begin{bmatrix} f(x_1)\\cdot g(x_1) \\\\[1mm] f(x_2)\\cdot g(x_2) \\\\[1mm] f(x_3)\\cdot g(x_3) \\\\ \\vdots \\end{bmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/663\/ed6\/9a5\/663ed69a583b76060773dab4131aab79.svg\" width=\"443\" height=\"138\"\/><\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0435\u0439 \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430 (\u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0440\u0430\u0437\u0431\u0438\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"a\" alt=\"a\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/922\/32a\/119\/92232a11966906cfe26ac27ec9393d29.svg\" width=\"10\" height=\"12\"\/>\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"b\" alt=\"b\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b3\/ae9\/45a\/0b3ae945ab4cd8fcad3028e919a32178.svg\" width=\"8\" height=\"17\"\/>\u043d\u0430 \u0440\u0430\u0437\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0435\u0439);<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_i\" alt=\"x_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b69\/14b\/229\/b6914b229031d95111117ad598c460a4.svg\" width=\"18\" height=\"15\"\/>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e \u043d\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0435\u0451 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 (\u043f\u043e \u0440\u0430\u0437\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c), \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0438 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0434\u043b\u044f \u0442\u043e\u0447\u0435\u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"0, 1, -1, 2, -2\" alt=\"0, 1, -1, 2, -2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/74a\/80d\/4db\/74a80d4db156c0ce11fe94a82d2b032a.svg\" width=\"114\" height=\"20\"\/>:<\/p>\n<pre><code class=\"python\">from sympy import Rational from sympy.matrices import Matrix  # \u0422\u043e\u0447\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432: x = [0, 1, -1, 2, -2]  # \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043f\u043e \u044d\u0442\u0438\u043c \u0442\u043e\u0447\u043a\u0430\u043c: v = Matrix([     [         Rational(x_i ** j )         for j, _ in enumerate(x)     ] for x_i in x ])<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\left[\\begin{matrix}1 &amp; 0 &amp; 0 &amp; {\\color{Gray}{0}} &amp; {\\color{Gray}{0}}\\\\1 &amp; 1 &amp; 1 &amp; {\\color{Gray}{1}} &amp; {\\color{Gray}{1}}\\\\1 &amp; -1 &amp; 1 &amp; {\\color{Gray}{-1}} &amp; {\\color{Gray}{1}}\\\\1 &amp; 2 &amp; 4 &amp; {\\color{Gray}{8}} &amp; {\\color{Gray}{16}}\\\\1 &amp; -2 &amp; 4 &amp; {\\color{Gray}{-8}} &amp; {\\color{Gray}{16}}\\end{matrix}\\right]\" alt=\"\\left[\\begin{matrix}1 &amp; 0 &amp; 0 &amp; {\\color{Gray}{0}} &amp; {\\color{Gray}{0}}\\\\1 &amp; 1 &amp; 1 &amp; {\\color{Gray}{1}} &amp; {\\color{Gray}{1}}\\\\1 &amp; -1 &amp; 1 &amp; {\\color{Gray}{-1}} &amp; {\\color{Gray}{1}}\\\\1 &amp; 2 &amp; 4 &amp; {\\color{Gray}{8}} &amp; {\\color{Gray}{16}}\\\\1 &amp; -2 &amp; 4 &amp; {\\color{Gray}{-8}} &amp; {\\color{Gray}{16}}\\end{matrix}\\right]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2d3\/233\/068\/2d32330683855f155365a4ec75885af3.svg\" width=\"200\" height=\"132\"\/><\/p>\n<p>(\u0421\u0435\u0440\u044b\u043c \u044f \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0447\u0438\u0441\u043b\u0430, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430\u0445-\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f\u0445 \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e.)<\/p>\n<p>\u0418 \u043d\u0430 \u0435\u0451 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\frac{1}{24}\\times\\left[\\begin{matrix}24 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\\\0 &amp; 16 &amp; -16 &amp; -2 &amp; 2\\\\-30 &amp; 16 &amp; 16 &amp; -1 &amp; -1\\\\0 &amp; -4 &amp; 4 &amp; 2 &amp; -2\\\\6 &amp; -4 &amp; -4 &amp; 1 &amp; 1\\end{matrix}\\right]\" alt=\"\\frac{1}{24}\\times\\left[\\begin{matrix}24 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\\\0 &amp; 16 &amp; -16 &amp; -2 &amp; 2\\\\-30 &amp; 16 &amp; 16 &amp; -1 &amp; -1\\\\0 &amp; -4 &amp; 4 &amp; 2 &amp; -2\\\\6 &amp; -4 &amp; -4 &amp; 1 &amp; 1\\end{matrix}\\right]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/911\/690\/b81\/911690b8100bd19cf2e6a6c8a80cdb4f.svg\" width=\"306\" height=\"132\"\/><\/p>\n<p>\u0417\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0430 3, \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u0434\u0432\u0438\u0433\u0430\u043c\u0438, \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f\u043c\u0438 \u00ab\u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445\u00bb \u0447\u0438\u0441\u0435\u043b, \u0430 \u044d\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u00ab\u043f\u0440\u043e\u0441\u0442\u044b\u0435\u00bb \u2014 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u041a\u0430\u043a \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0442\u043e\u0433\u043e\u0432\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"C(N)\" alt=\"C(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/545\/693\/781\/5456937819f4f78505668d99bc6beea0.svg\" width=\"47\" height=\"22\"\/>, \u0433\u0434\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/05f\/a2a\/8cb\/05fa2a8cbda22a3791003780eee87fa8.svg\" width=\"17\" height=\"17\"\/> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442 \u0432 \u043d\u0430\u0448\u0438\u0445 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f\u0445, \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443\u043b\u0443:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) = 5\\cdot C\\left(\\frac{N}{3}\\right) + \\mathrm{const}\\cdot \\frac{N}{3} \" alt=\"C(N) = 5\\cdot C\\left(\\frac{N}{3}\\right) + \\mathrm{const}\\cdot \\frac{N}{3} \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/12e\/286\/218\/12e28621885a8b779f980448c2d4bc97.svg\" width=\"276\" height=\"50\"\/><\/p>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e: \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u0438\u043d\u043e\u0439 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e53\/e44\/ebf\/e53e44ebfe129aa2a8579aab6635adf9.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442 \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0441\u0432\u043e\u0434\u0438\u0442\u044c \u043a 5 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u0438\u043d\u043e\u0439 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/3\" alt=\"N\/3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/acb\/267\/290\/acb267290c252362e6a3e046aa22ba20.svg\" width=\"37\" height=\"22\"\/> \u0431\u0438\u0442 \u0438 \u0435\u0449\u0451 \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0434\u043b\u0438\u043d\u043e\u0439 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/3\" alt=\"N\/3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b0b\/340\/ce7\/b0b340ce7a5a6f8170725bddf536565f.svg\" width=\"37\" height=\"22\"\/> \u0431\u0438\u0442. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9E%D1%81%D0%BD%D0%BE%D0%B2%D0%BD%D0%B0%D1%8F_%D1%82%D0%B5%D0%BE%D1%80%D0%B5%D0%BC%D0%B0_%D0%BE_%D1%80%D0%B5%D0%BA%D1%83%D1%80%D1%80%D0%B5%D0%BD%D1%82%D0%BD%D1%8B%D1%85_%D1%81%D0%BE%D0%BE%D1%82%D0%BD%D0%BE%D1%88%D0%B5%D0%BD%D0%B8%D1%8F%D1%85\" rel=\"noopener noreferrer nofollow\"><u>\u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u043e \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u0445<\/u><\/a> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) = O(N^{\\log_3 5}) \\approx O(N^{1.46})\" alt=\"C(N) = O(N^{\\log_3 5}) \\approx O(N^{1.46})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/29b\/24c\/59d\/29b24c59d626e4e69d621880d4f3a950.svg\" width=\"258\" height=\"25\"\/><\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^{1.58})\" alt=\"O(N^{1.58})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3cd\/0b1\/8b7\/3cd0b18b7354f192721af1b3017370b3.svg\" width=\"75\" height=\"25\"\/> \u0434\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^{1.46})\" alt=\"O(N^{1.46})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d57\/f88\/f3c\/d57f88f3cc4bc85eea5e5970e343d4ca.svg\" width=\"75\" height=\"25\"\/>.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <strong>\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0422\u043e\u043e\u043c\u0430-\u041a\u0443\u043a\u0430<\/strong>. \u041e\u043d\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435; \u0432 \u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 GMP \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u043e <a href=\"https:\/\/github.com\/ryepdx\/gmp\/blob\/090b098806bc1a8f3af777b862369f58be465dd9\/mpn\/generic\/mul.c\" rel=\"noopener noreferrer nofollow\"><u>13 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b<\/u><\/a>. <\/p>\n<p>\u0417\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435? \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0431\u044c\u0451\u0442\u0441\u044f \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"M\" alt=\"M\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7fb\/1a8\/f66\/7fb1a8f663acd491fe7ec7b662d757e0.svg\" width=\"21\" height=\"17\"\/> \u0447\u0430\u0441\u0442\u0435\u0439, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) = O\\left(N^{{\\color{DarkBlue}{\\log_M (2M+1)}}}\\right)\" alt=\"C(N) = O\\left(N^{{\\color{DarkBlue}{\\log_M (2M+1)}}}\\right)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/399\/593\/ff9\/399593ff913fd2c32ed13d3af2f31864.svg\" width=\"214\" height=\"38\"\/><\/p>\n<p>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"M\" alt=\"M\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b4a\/14b\/019\/b4a14b0197dcd0570b8cfb838fb5a209.svg\" width=\"21\" height=\"17\"\/> \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"{\\color{DarkBlue}{\\log_M (2M+1)}} \\approx \\log_M (2M) = \\frac{\\log_2{2} + \\log_2 M}{\\log_2 M} = 1 + \\frac{1}{\\log_2 M} \\rightarrow 1\" alt=\"{\\color{DarkBlue}{\\log_M (2M+1)}} \\approx \\log_M (2M) = \\frac{\\log_2{2} + \\log_2 M}{\\log_2 M} = 1 + \\frac{1}{\\log_2 M} \\rightarrow 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/34d\/c2d\/8f1\/34dc2d8f149af29b9790b49dd2d23965.svg\" width=\"561\" height=\"49\"\/><\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e \u0441\u043a\u043e\u043b\u044c \u0443\u0433\u043e\u0434\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u043e\u0439 \u043a 1 \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/211\/774\/7c6\/2117747c63b0fb455ee2f009562238ff.svg\" width=\"17\" height=\"17\"\/> \u0432 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0435? \u0423\u0432\u044b, \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e. \u041b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e; \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0430\u0434\u0430\u0442\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0441\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u0435\u0435.<\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u044d\u0442\u043e <em>\u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e<\/em>. \u0414\u0430-\u0434\u0430! \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0445 <em>\u043b\u0443\u0447\u0448\u0435<\/em><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^{1+\\varepsilon})\" alt=\"O(N^{1+\\varepsilon})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/432\/31a\/a28\/43231aa28e9947616c984895548bf272.svg\" width=\"74\" height=\"25\"\/>, \u043a\u0430\u043a\u0438\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c \u0431\u044b \u043d\u0438 \u0431\u044b\u043b\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\varepsilon\" alt=\"\\varepsilon\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/07c\/5a6\/19b\/07c5a619b93f9913a519bb2ef40fa963.svg\" width=\"9\" height=\"12\"\/>.<\/p>\n<blockquote>\n<p>\u0417\u0430\u043d\u044f\u0442\u043d\u044b\u0439 \u0444\u0430\u043a\u0442 \u2014 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u0443 \u0422\u043e\u043e\u043c\u0430-\u041a\u0443\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432; \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435\u0442 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^{2+\\varepsilon})\" alt=\"O(N^{2+\\varepsilon})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/665\/aea\/076\/665aea0767de2b359f50db41130432d7.svg\" width=\"74\" height=\"25\"\/> \u0434\u043b\u044f \u0441\u043a\u043e\u043b\u044c \u0443\u0433\u043e\u0434\u043d\u043e \u043c\u0430\u043b\u043e\u0433\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\varepsilon\" alt=\"\\varepsilon\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/672\/d7a\/1d4\/672d7a1d48858390fbb338bf5feaa557.svg\" width=\"9\" height=\"12\"\/>. \u041b\u0443\u0447\u0448\u0430\u044f \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^{2.37})\" alt=\"O(N^{2.37})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/04b\/c77\/355\/04bc773556ce7799209a854c7432fb18.svg\" width=\"75\" height=\"25\"\/>.<\/p>\n<\/blockquote>\n<p><a class=\"anchor\" name=\"schonhage-strassen\" id=\"schonhage-strassen\"><\/a><\/p>\n<h2>\u041c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b vs \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/h2>\n<p>\u0420\u0430\u0437 \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0435\u0439 \u043d\u0430\u043c \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433. \u0427\u0442\u043e, \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u043d\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0435\u0439, \u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b?\u00a0<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u044b. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2N-1\" alt=\"2N-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/45b\/bed\/d66\/45bbedd66184490d63471c313df7b6f5.svg\" width=\"61\" height=\"18\"\/> \u0442\u043e\u0447\u0435\u043a \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/331\/78e\/770\/33178e770bce9d7c885e58a83593689f.svg\" width=\"17\" height=\"17\"\/>-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430; \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439, \u0447\u0442\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435. \u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0437\u044c\u043c\u0451\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_i = i\" alt=\"x_i = i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c1\/be8\/cdb\/6c1be8cdbe210d9cc4bca40288abaae8.svg\" width=\"51\" height=\"19\"\/> \u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<pre><code class=\"python\">import math import numpy as np  # \u0427\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c: a = 235739098113 b = 187129102983 m = len(str(a))  # \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435  # \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d  # \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 2*m-1, \u0434\u043e\u0431\u0438\u0432\u0430\u0435\u043c \u043d\u0443\u043b\u044f\u043c\u0438 \u0434\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b: a_coefs = [int(a_i) for a_i in str(a)[::-1]] + [0] * (m - 1) b_coefs = [int(b_i) for b_i in str(b)[::-1]] + [0] * (m - 1) n = len(a_coefs)  # \u0422\u043e\u0447\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432: x = np.arange(n)  # \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043f\u043e \u044d\u0442\u0438\u043c \u0442\u043e\u0447\u043a\u0430\u043c: v = np.vander(x, increasing=True)  # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 \u2014 \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a # \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432: a_y = v @ a_coefs b_y = v @ b_coefs  # \u041f\u043e\u0442\u043e\u0447\u0435\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c  # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f: c_y = a_y * b_y  # \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f: c_coefs = np.linalg.solve(v, c_y)  # \u0414\u043b\u044f \u0441\u0432\u0435\u0440\u043a\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \"\u0432 \u043b\u043e\u0431\": actual_c_coefs = [     sum(a_coefs[j] * b_coefs[i-j] for j in range(i+1))      for i in range(n) ]  # \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430-\u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0435\u043b\u0438\u043c \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e, # \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c: print(np.linalg.norm(c_coefs - actual_c_coefs) \/     np.linalg.norm(actual_c_coefs))<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438\u2026<\/p>\n<pre><code>2.777342817120168e+17<\/code><\/pre>\n<p>\u0425\u043e-\u0445\u043e, \u0434\u0430 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0438\u043c\u043e, \u044d\u0442\u043e <em>\u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/em> \u043c\u0438\u043c\u043e! \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443?\u00a0<\/p>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f [3], \u0443 \u043c\u0430\u0442\u0440\u0438\u0446 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2014 \u0440\u0435\u0448\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u043d\u0438\u043c\u0438 \u0432 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u0430\u044f \u0438\u0434\u0435\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e<\/em> \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u041c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432\u0437\u044f\u0432 \u0432\u043c\u0435\u0441\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_i = i\" alt=\"x_i = i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/159\/b95\/ac7\/159b95ac7c988f0e185baa22c3afa50b.svg\" width=\"51\" height=\"19\"\/> \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"python\">x = np.exp(1j * np.random.uniform(0, math.pi, size=n))  ...  0.00015636299542432733<\/code><\/pre>\n<p>\u041d\u043e \u043b\u0443\u0447\u0448\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0437\u044f\u0442\u044c \u0442\u043e\u0447\u043a\u0438, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043a\u043e\u0440\u043d\u044f\u043c\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f10\/fcd\/d51\/f10fcdd515599d3bfd17dd0aa589ab3c.svg\" width=\"17\" height=\"17\"\/>.<\/p>\n<pre><code class=\"python\">x = np.exp(-1j * np.linspace(0, 2*math.pi, n, endpoint=False))<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0435\u0449\u0451 \u0437\u0430 \u043a\u043e\u0440\u043d\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0425\u043e\u0442\u044f \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u043d\u0430\u043c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^n = 1\" alt=\"x^n = 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/843\/32b\/5b5\/84332b5b5f95b95e774069673ac37344.svg\" width=\"57\" height=\"18\"\/> \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x = \\pm 1\" alt=\"x = \\pm 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/634\/96a\/c4c\/63496ac4cfd2675f8fff6409e863dd32.svg\" width=\"62\" height=\"17\"\/>, \u043d\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0432\u0441\u0451 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0432\u0435\u0441\u0435\u043b\u0435\u0435. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img class=\"formula inline\" source=\"n > 0&#8243; alt=&#187;n > 0&#8243; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dc1\/5ea\/30a\/dc15ea30ae885d573f2cf292f838fb48.svg&#187; width=&#187;48&#8243; height=&#187;17&#8243;\/> \u0435\u0441\u0442\u044c \u0440\u043e\u0432\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f0a\/a7b\/5d4\/f0aa7b5d4f22f0dff1ea0b5b08402426.svg\" width=\"12\" height=\"12\"\/> \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u043a\u043e\u0440\u043d\u0435\u0439, \u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^n - 1\" alt=\"x^n - 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d92\/8e5\/a02\/d928e5a0278d00398cdf7dca16e0fe64.svg\" width=\"55\" height=\"19\"\/> \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e (\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u043a\u0430\u043a <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9E%D1%81%D0%BD%D0%BE%D0%B2%D0%BD%D0%B0%D1%8F_%D1%82%D0%B5%D0%BE%D1%80%D0%B5%D0%BC%D0%B0_%D0%B0%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D1%8B\" rel=\"noopener noreferrer nofollow\"><u>\u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0430\u043b\u0433\u0435\u0431\u0440\u044b<\/u><\/a>) \u0442\u043e\u0436\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041a\u043e\u0440\u043d\u044f\u043c\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2fe\/295\/348\/2fe295348aef79b071bbe488572ffe36.svg\" width=\"12\" height=\"12\"\/> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e70\/3f2\/54f\/e703f254ff2339a8cac2c8de86e63981.svg\" width=\"12\" height=\"12\"\/>-\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u0432\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u044c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eba\/1b6\/178\/eba1b617838ee0e67872a5f2f18564db.png\" alt=\"\" title=\"\" width=\"360\" height=\"351\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eba\/1b6\/178\/eba1b617838ee0e67872a5f2f18564db.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u044e\u0442\u0441\u044f (\u0430 \u0443 \u0432\u0441\u0435\u0445 \u043a\u043e\u0440\u043d\u0435\u0439 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u0430\u0432\u0435\u043d \u0435\u0434\u0438\u043d\u0438\u0446\u0435 \u2014 \u043e\u043d\u0438 \u0436\u0435 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438), \u0430 \u0444\u0430\u0437\u044b \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0447\u0438\u0441\u043b\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\omega\" alt=\"\\omega\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/81b\/36c\/0f0\/81b36c0f072237f1ccf086b6202bef28.svg\" width=\"0\" height=\"0\"\/> \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432\u0441\u0435 \u043a\u043e\u0440\u043d\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u0417\u0430 \u044d\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\omega\" alt=\"\\omega\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d46\/59a\/4b2\/d4659a4b20386f983bd91aeffc685376.svg\" width=\"0\" height=\"0\"\/> \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u043f\u0435\u0440\u0432\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u0440\u043d\u0435\u043c \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b<\/strong>.<\/p>\n<\/div>\n<\/details>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u00a0<\/p>\n<pre><code>1.5964929527133826e-15<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041c\u044b \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><a class=\"anchor\" name=\"fourier-transform\" id=\"fourier-transform\"><\/a><\/p>\n<p>\u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u2014 \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u0435 \u0438\u043a\u0441\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%94%D0%B8%D1%81%D0%BA%D1%80%D0%B5%D1%82%D0%BD%D0%BE%D0%B5_%D0%BF%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_%D0%A4%D1%83%D1%80%D1%8C%D0%B5\" rel=\"noopener noreferrer nofollow\"><u>\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435<\/u><\/a>! \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u043d\u0430 \u044d\u0442\u0443 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0441 \u043d\u0435\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%91%D1%8B%D1%81%D1%82%D1%80%D0%BE%D0%B5_%D0%BF%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_%D0%A4%D1%83%D1%80%D1%8C%D0%B5\" rel=\"noopener noreferrer nofollow\"><u>\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435<\/u><\/a> \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N \\log N)\" alt=\"O(N \\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a05\/02f\/75f\/a0502f75fe348db295ad23dd6e3676fa.svg\" width=\"96\" height=\"22\"\/> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/343\/a91\/311\/343a91311db735e865a1fbc17b0b2fd8.svg\" width=\"57\" height=\"25\"\/>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435?<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/strong> \u0434\u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043c \u0438\u0437 \u0432\u044b\u0441\u0448\u0435\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u0432\u043e\u043b\u043d\u043e\u0432\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0438. \u0412 \u0444\u0438\u0437\u0438\u043a\u0435 \u043e\u043d\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043a\u0430\u043a \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0443\u0434\u0438\u043e) \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/564\/981\/401\/56498140124e64f6049938219116868f.png\" width=\"489\" height=\"274\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/564\/981\/401\/56498140124e64f6049938219116868f.png\"\/><\/figure>\n<p>\u043d\u0430 \u0441\u0443\u043c\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u2014 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a \u0441 \u0434\u043b\u0438\u043d\u043e\u0439 \u0432\u043e\u043b\u043d\u044b, \u043a\u0440\u0430\u0442\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u0430:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b01\/2a8\/9fd\/b012a89fd6b9af5f872cd21fa098e78f.png\" width=\"489\" height=\"274\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b01\/2a8\/9fd\/b012a89fd6b9af5f872cd21fa098e78f.png\"\/><\/figure>\n<p>\u041e\u0434\u043d\u0430 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c\u0443 \u0437\u0432\u0443\u043a\u0443 \u043d\u0435\u043a\u043e\u0439 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0438 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438; \u0441\u0443\u043c\u043c\u0430 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043c\u0435\u043b\u043e\u0434\u0438\u044e. \u0421\u043a\u043e\u043b\u044c \u0443\u0433\u043e\u0434\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0438, \u0435\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u0421\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a (\u0447\u0430\u0441\u0442\u043e\u0442\u044b + \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u044b) \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u0441\u043f\u0435\u043a\u0442\u0440\u043e\u043c<\/strong> \u0441\u0438\u0433\u043d\u0430\u043b\u0430.<\/p>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u2014 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435; \u0416\u043e\u0437\u0435\u0444 \u0424\u0443\u0440\u044c\u0435 \u043e\u0442\u043a\u0440\u044b\u043b \u0435\u0433\u043e \u0437\u0430\u0434\u043e\u043b\u0433\u043e \u0434\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438 \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438; \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <em>\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438<\/em>, \u0437\u0430\u043c\u0435\u0440\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0448\u0430\u0433\u043e\u043c \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e3\/509\/218\/5e3509218990f4744a41c84a2a994c3c.png\" width=\"489\" height=\"274\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5e3\/509\/218\/5e3509218990f4744a41c84a2a994c3c.png\"\/><\/figure>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A2%D0%B5%D0%BE%D1%80%D0%B5%D0%BC%D0%B0_%D0%9A%D0%BE%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%B8%D0%BA%D0%BE%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\"><u>\u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u041a\u043e\u0442\u0435\u043b\u044c\u043d\u0438\u043a\u043e\u0432\u0430-\u041d\u0430\u0439\u043a\u0432\u0438\u0441\u0442\u0430-\u0428\u0435\u043d\u043d\u043e\u043d\u0430<\/u><\/a> \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u044b \u0432\u0441\u0451 \u0435\u0449\u0451 \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0438 (\u0430 \u0441 \u043d\u0438\u043c\u0438 \u2014 \u0438 \u0432\u0435\u0441\u044c \u0441\u0438\u0433\u043d\u0430\u043b), \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0438\u0433\u043d\u0430\u043b \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c (\u0432 \u043d\u0451\u043c \u043d\u0435 \u0431\u044b\u043b\u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0441\u0432\u0435\u0440\u0445\u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u043e\u0442). \u042d\u0442\u0438\u043c \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f <strong>\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/strong> \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u0441 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0430\u043c\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0440\u0430\u0437\u043d\u044b\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a. <\/p>\n<p>\u0422\u0430\u043a, \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0432\u044b\u0448\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0430\u0441\u0442\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0430\u043c\u0443\u044e \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/979\/335\/a8a\/979335a8a93682157c91c8f3b03dcadf.png\" width=\"489\" height=\"274\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/979\/335\/a8a\/979335a8a93682157c91c8f3b03dcadf.png\"\/><\/figure>\n<p>\u0410 \u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u0430\u044f, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0430\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0442\u0435\u043e\u0440\u0435\u043c\u044b \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cd1\/58d\/fac\/cd158dfacde7475bab5794689a1e3054.png\" width=\"489\" height=\"274\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cd1\/58d\/fac\/cd158dfacde7475bab5794689a1e3054.png\"\/><\/figure>\n<p>\u041f\u043e \u0440\u043e\u043a\u043e\u0432\u043e\u043c\u0443 \u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044e \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043e \u043a\u043e\u0440\u043d\u044f\u043c \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b.<\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0430\u043d\u0430\u043b\u0438\u0437 \u0424\u0443\u0440\u044c\u0435 \u2014 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0432\u043e\u0435\u0434\u0438\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0437\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439. \u0415\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0430\u043b\u0435\u043a\u043e \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0441\u0442\u0430\u0442\u044c\u0438; \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/post\/196374\/\" rel=\"noopener noreferrer nofollow\"><u>\u041f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0424\u0443\u0440\u044c\u0435<\/u><\/a>\u00bb \u0438 \u00ab<a href=\"https:\/\/habr.com\/ru\/post\/247385\/\" rel=\"noopener noreferrer nofollow\"><u>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438: \u0442\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0442<\/u><\/a>\u00bb.<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0448\u0443\u043c\u043e\u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f), \u0447\u0430\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e \u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u041c\u0420\u0422-\u0441\u043a\u0430\u043d\u0435\u0440\u0430\u0445\u00a0[4]). \u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u00ab\u0432 \u043b\u043e\u0431\u00bb \u0441\u0442\u043e\u0438\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f93\/eeb\/a31\/f93eeba314897cdd6976dae164099fa7.svg\" width=\"57\" height=\"25\"\/> \u2014 \u044d\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445. <strong>\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/strong> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u044e\u0449\u0438\u0445 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N)\" alt=\"O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c8\/6ab\/169\/6c86ab169b6034e5ad574d5d7f33f62d.svg\" width=\"96\" height=\"22\"\/> \u0437\u0430 \u0441\u0447\u0451\u0442 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N=2^k\" alt=\"N=2^k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e33\/5ad\/7ae\/e335ad7aec3aecca059f735e8231628f.svg\" width=\"62\" height=\"21\"\/>, \u0441\u0432\u043e\u0434\u044f\u0449\u0438\u0439 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a \u0434\u0432\u0443\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{k-1}\" alt=\"2^{k-1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/755\/a9e\/772\/755a9e7728a8c2e71f6913365d25c8d4.svg\" width=\"37\" height=\"21\"\/>; \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e0e\/640\/4b8\/e0e6404b85d55f6780af6a589d11d22a.svg\" width=\"10\" height=\"17\"\/> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(k\\cdot 2^k)\" alt=\"O(k\\cdot 2^k)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4fb\/d69\/2aa\/4fbd692aa8a6ef71f867effe52167d92.svg\" width=\"73\" height=\"25\"\/>.<\/p>\n<p>\u041f\u0440\u043e \u043d\u0435\u0433\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0437\u0430 \u0441\u0447\u0451\u0442 \u0447\u0435\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0434\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N)\" alt=\"O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/34a\/c41\/d14\/34ac41d14565470661dffaa68f6bfb7f.svg\" width=\"96\" height=\"22\"\/>.<\/p>\n<p>\u0414\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0438 <strong>\u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/strong> \u2014 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u043e \u0441\u043f\u0435\u043a\u0442\u0440\u0443 \u2014 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0447\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0439; \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0449\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/af8\/ad4\/e8d\/af8ad4e8df0b4afd6abaa1dd0244ad30.svg\" width=\"17\" height=\"17\"\/> \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a, \u0443\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0438 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0443, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/748\/f20\/bab\/748f20bab389890ed35a98d11785a89d.svg\" width=\"17\" height=\"17\"\/> \u0442\u043e\u0447\u043a\u0430\u0445 \u043e\u0442\u0440\u0435\u0437\u043a\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"[0, 2\\pi]\" alt=\"[0, 2\\pi]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d4\/09d\/242\/3d409d24299101cbfd2e8d92e6d6328b.svg\" width=\"50\" height=\"22\"\/> \u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9db\/658\/97d\/9db65897ddaf808ce401976b55d32bab.svg\" width=\"17\" height=\"17\"\/> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b\u0430-\u0441\u0443\u043c\u043c\u044b \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a. \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N=8\" alt=\"N=8\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2ad\/2a0\/a8a\/2ad2a0a8a802b5603e018a2dcba60a04.svg\" width=\"53\" height=\"17\"\/>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cdb\/3da\/e54\/cdb3dae54b9d13327fcc6f8849ce7fdd.png\" width=\"520\" height=\"413\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cdb\/3da\/e54\/cdb3dae54b9d13327fcc6f8849ce7fdd.png\"\/><\/figure>\n<p>\u041f\u043e\u0434\u0435\u043b\u0438\u0432 \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u043f\u043e\u043f\u043e\u043b\u0430\u043c, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0438 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fe5\/5d3\/9df\/fe55d39dfcad25188974fab1399221ca.png\" width=\"520\" height=\"413\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fe5\/5d3\/9df\/fe55d39dfcad25188974fab1399221ca.png\"\/><\/figure>\n<p>\u0412 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u043a\u0440\u0438\u0432\u044b\u0435, \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u0430; \u0432\u00a0\u043d\u0438\u0436\u043d\u0435\u0439 \u2014 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0449\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0451\u043d\u043d\u044b\u043c\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"-1\" alt=\"-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/704\/50a\/be2\/70450abe2d83d8ebd45eb88159c7083c.svg\" width=\"25\" height=\"18\"\/>. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u043e\u0436\u043d\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u0430!<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0435 \u0434\u043b\u044f \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0438 \u0441 \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/81c\/034\/557\/81c03455720f8ee995bbc5313f8b68a2.svg\" width=\"37\" height=\"22\"\/> \u0442\u043e\u0447\u0435\u043a:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/620\/dc6\/23f\/620dc623fa2ac8b3f6872cb41f19bc06.png\" width=\"515\" height=\"218\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/620\/dc6\/23f\/620dc623fa2ac8b3f6872cb41f19bc06.png\"\/><\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/043\/198\/9d1\/0431989d1654100b6f29129e0b14106e.svg\" width=\"17\" height=\"17\"\/> \u0442\u043e\u0447\u043a\u0430\u0445 \u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/795\/3e7\/a4b\/7953e7a4bfdf1de415db93c482d00c3b.svg\" width=\"17\" height=\"17\"\/> \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a\u0430\u043c \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f0d\/1ba\/4b4\/f0d1ba4b4033ec08300eed8a6068e5d4.svg\" width=\"37\" height=\"22\"\/> \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u0432\u0437\u044f\u0432 \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443) \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/402\/7d8\/090\/4027d80901a36bc0b38f98916b56c8c6.svg\" width=\"37\" height=\"22\"\/> \u0442\u043e\u0447\u043a\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/690\/0d2\/119\/6900d211928a192981c002a537636215.svg\" width=\"37\" height=\"22\"\/> \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u0442\u0430\u043a\u0436\u0435 \u0432\u0437\u044f\u0432 \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443) \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4c9\/7b9\/9c4\/4c97b99c49524db0b36b1b348af55ec7.svg\" width=\"37\" height=\"22\"\/> \u0442\u043e\u0447\u043a\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u2014 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4d0\/5c2\/aaf\/4d05c2aaf68d138234948a83d1114a08.svg\" width=\"37\" height=\"22\"\/> \u2014 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac4\/394\/14f\/ac439414f66f51d40c8de630c67285b4.svg\" width=\"17\" height=\"17\"\/>;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u2014 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7dd\/ff1\/1a9\/7ddff11a935b7ad2bc10b8b2e283e883.svg\" width=\"37\" height=\"22\"\/> \u2014 \u0442\u043e\u0436\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u0430, \u043d\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u2014 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u043c\u0438\u043d\u0443\u0441;<\/p>\n<\/li>\n<li>\n<p>\u0434\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u043b\u043e\u0436\u0438\u0442\u044c.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0441\u0432\u0435\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/144\/b33\/32e\/144b3332e74097d39f32c39426fbcaa7.svg\" width=\"17\" height=\"17\"\/> \u043a \u0434\u0432\u0443\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\/2\" alt=\"N\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b39\/4f3\/232\/b394f32327c45cf808c61db259ad5c82.svg\" width=\"37\" height=\"22\"\/> \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N)\" alt=\"O(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b2a\/8d1\/af0\/b2a8d1af02a6c4b42f92196c74aac024.svg\" width=\"48\" height=\"22\"\/>, \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0439 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N)\" alt=\"O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/338\/1bc\/4b7\/3381bc4b74f74e6676f64ebe6608a9ee.svg\" width=\"96\" height=\"22\"\/>.<\/p>\n<p>\u0422\u0430\u043a \u043c\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0437 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%9A%D1%83%D0%BB%D0%B8_%E2%80%94_%D0%A2%D1%8C%D1%8E%D0%BA%D0%B8\" rel=\"noopener noreferrer nofollow\"><u>\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041a\u0443\u043b\u0438-\u0422\u044c\u044e\u043a\u0438<\/u><\/a>!<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0430\u043c \u2014 \u044d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431. \u0422\u0443\u0442 \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u043e\u0439 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u2014 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043c \u043a \u0447\u0438\u0441\u043b\u0430\u043c \u043e\u0442 0 \u0434\u043e 9, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u0438\u043b\u0443\u0447\u0448\u0430\u044f \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430 \u0432 \u0442\u0430\u043a\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dd3\/9e9\/938\/dd39e9938e28c370234319ecb8131aa8.svg\" width=\"17\" height=\"17\"\/>-\u0431\u0438\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0434\u043b\u0438\u043d\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log N\" alt=\"\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8d1\/196\/b51\/8d1196b514bff069096045f96fc36fcc.svg\" width=\"46\" height=\"21\"\/> \u0431\u0438\u0442.<\/p>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e <strong>\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/strong> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a.\u00a0<\/p>\n<ol>\n<li>\n<p>\u0411\u0435\u0440\u0451\u043c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c; \u0447\u0438\u0441\u043b\u0430 \u044d\u0442\u0438 \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0fb\/263\/ac1\/0fb263ac17778256c5c9d72df048b310.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0431\u00f3\u043b\u044c\u0448\u0435\u0435 \u0438\u0437 \u0447\u0438\u0441\u0435\u043b \u0438\u043c\u0435\u0435\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d08\/bf8\/152\/d08bf81521c9f4f21285b060a185b665.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\overbrace{1001010011000001}^{N} \\times \\overbrace{1100000001001110}^{N}\" alt=\"\\overbrace{1001010011000001}^{N} \\times \\overbrace{1100000001001110}^{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/009\/258\/ed9\/009258ed9b11d5597c3a3ee4f4905c4c.svg\" width=\"337\" height=\"44\"\/><\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0438\u043c \u0434\u0432\u043e\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0447\u0438\u0441\u0435\u043b \u043d\u0430 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b, \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u043b\u0438\u043d\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log N\" alt=\"\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/953\/43e\/be1\/95343ebe1f7ee542ec71bfa54e0ecf09.svg\" width=\"46\" height=\"21\"\/> \u0431\u0438\u0442:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\overbrace{\\underbrace{\\color{Red}{1001}}_{\\log N}\\underbrace{\\color{Red}{0100}}_{\\log N}\\underbrace{\\color{DarkBlue}{1100}}_{\\log N}\\underbrace{\\color{DarkBlue}{0001}}_{\\log N}}^{N} \\times  \\overbrace{\\underbrace{\\color{DarkOrange}{1100}}_{\\log N}\\underbrace{\\color{DarkOrange}{0000}}_{\\log N}\\underbrace{\\color{Magenta}{1001}}_{\\log N}\\underbrace{\\color{Magenta}{1110}}_{\\log N}}^{N}\" alt=\"\\overbrace{\\underbrace{\\color{Red}{1001}}_{\\log N}\\underbrace{\\color{Red}{0100}}_{\\log N}\\underbrace{\\color{DarkBlue}{1100}}_{\\log N}\\underbrace{\\color{DarkBlue}{0001}}_{\\log N}}^{N} \\times  \\overbrace{\\underbrace{\\color{DarkOrange}{1100}}_{\\log N}\\underbrace{\\color{DarkOrange}{0000}}_{\\log N}\\underbrace{\\color{Magenta}{1001}}_{\\log N}\\underbrace{\\color{Magenta}{1110}}_{\\log N}}^{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/608\/1e6\/fd3\/6081e6fd3cce5005faea1471d2c6e1ee.svg\" width=\"337\" height=\"76\"\/><\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u2014 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log N\" alt=\"\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ece\/fed\/dbf\/ecefeddbfa5543f55207abba378f9ca2.svg\" width=\"46\" height=\"21\"\/> \u0431\u0438\u0442 \u2014 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c: <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\left({\\color{Red}{1001}}\\!\\cdot\\!x^3 + {\\color{Red}{0100}}\\!\\cdot\\!x^2 + {\\color{DarkBlue}{1100}}\\!\\cdot\\!x + {\\color{DarkBlue}{0001}}\\right)\\times\\left({\\color{DarkOrange}{1100}}\\!\\cdot\\!x^3 + {\\color{DarkOrange}{0000}}\\!\\cdot\\!x^2 + {\\color{Magenta}{1001}}\\!\\cdot\\!x + {\\color{Magenta}{1110}}\\right)\" alt=\"\\left({\\color{Red}{1001}}\\!\\cdot\\!x^3 + {\\color{Red}{0100}}\\!\\cdot\\!x^2 + {\\color{DarkBlue}{1100}}\\!\\cdot\\!x + {\\color{DarkBlue}{0001}}\\right)\\times\\left({\\color{DarkOrange}{1100}}\\!\\cdot\\!x^3 + {\\color{DarkOrange}{0000}}\\!\\cdot\\!x^2 + {\\color{Magenta}{1001}}\\!\\cdot\\!x + {\\color{Magenta}{1110}}\\right)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/30f\/cd3\/207\/30fcd3207beba6a699412c8536d1eaf9.svg\" width=\"665\" height=\"27\"\/><\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0440\u0443\u043a\u0430\u0445 \u0434\u0432\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432. \u041a \u044d\u0442\u0438\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"FFT\\times\\begin{bmatrix} {\\color{DarkBlue}{0001}} \\\\ {\\color{DarkBlue}{1100}} \\\\  {\\color{Red}{0100}} \\\\  {\\color{Red}{1001}} \\\\  0 \\\\ 0 \\\\ 0\\end{bmatrix} ,\\quad FFT\\times\\begin{bmatrix} {\\color{Magenta}{1110}} \\\\  {\\color{Magenta}{1001}} \\\\  {\\color{DarkOrange}{0000}} \\\\  {\\color{DarkOrange}{1100}} \\\\  0 \\\\ 0 \\\\ 0\\end{bmatrix}\" alt=\"FFT\\times\\begin{bmatrix} {\\color{DarkBlue}{0001}} \\\\ {\\color{DarkBlue}{1100}} \\\\  {\\color{Red}{0100}} \\\\  {\\color{Red}{1001}} \\\\  0 \\\\ 0 \\\\ 0\\end{bmatrix} ,\\quad FFT\\times\\begin{bmatrix} {\\color{Magenta}{1110}} \\\\  {\\color{Magenta}{1001}} \\\\  {\\color{DarkOrange}{0000}} \\\\  {\\color{DarkOrange}{1100}} \\\\  0 \\\\ 0 \\\\ 0\\end{bmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/118\/af8\/533\/118af85331cea970a4fac73343707d50.svg\" width=\"309\" height=\"186\"\/><\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u043d\u0430 \u044d\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\log N)\" alt=\"O(\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/373\/252\/293\/373252293beaf6fad3025464d00a4919.svg\" width=\"76\" height=\"22\"\/> \u0431\u0438\u0442. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u044d\u0442\u0438\u043c \u0436\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043f\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435). \u0420\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u044b \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N)\" alt=\"O(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/70b\/e2a\/543\/70be2a5435efce48540084dc395234ad.svg\" width=\"48\" height=\"22\"\/> \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\log N)\" alt=\"O(\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5d5\/04c\/01b\/5d504c01b733914b364977725527c354.svg\" width=\"76\" height=\"22\"\/>; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0445 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442 (!) \u043a\u0430\u0436\u0434\u043e\u0435, \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 6.<\/p>\n<\/li>\n<li>\n<p>\u041a \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0443\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u044d\u0442\u0438\u043c \u0436\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"IFFT \\times \\left[\\!\\!\\begin{array}{r}780 \\\\ -146.17 - 93.35i \\\\ 22 - 58.43i \\\\ -217.82+41.36i \\\\ \\vdots\\qquad\\quad\\ \\end{array}\\!\\!\\right]\" alt=\"IFFT \\times \\left[\\!\\!\\begin{array}{r}780 \\\\ -146.17 - 93.35i \\\\ 22 - 58.43i \\\\ -217.82+41.36i \\\\ \\vdots\\qquad\\quad\\ \\end{array}\\!\\!\\right]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e4d\/f82\/a8f\/e4df82a8f32fcfe17166e4a7213b567c.svg\" width=\"241\" height=\"142\"\/><\/p>\n<p><\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e-\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\begin{array}{rrrrrrrr} &amp;&amp;&amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!11\\overset{\\displaystyle\\leftarrow}{10} \\\\ &amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ &amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!110&amp;\\!\\!\\!\\!\\!\\!1000 \\\\ &amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1001&amp;\\!\\!\\!\\!\\!\\!1010 \\\\  &amp;&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!0100 \\\\ &amp;11&amp;\\!\\!\\!\\!\\!\\!0000 \\\\ 110&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ \\hline 110&amp;\\!\\!\\!\\!\\!\\!1111&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!1110&amp;\\!\\!\\!\\!\\!\\!0001&amp;\\!\\!\\!\\!\\!\\!0010&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1110 \\end{array}\" alt=\"\\begin{array}{rrrrrrrr} &amp;&amp;&amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!11\\overset{\\displaystyle\\leftarrow}{10} \\\\ &amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ &amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!110&amp;\\!\\!\\!\\!\\!\\!1000 \\\\ &amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1001&amp;\\!\\!\\!\\!\\!\\!1010 \\\\  &amp;&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!0100 \\\\ &amp;11&amp;\\!\\!\\!\\!\\!\\!0000 \\\\ 110&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ \\hline 110&amp;\\!\\!\\!\\!\\!\\!1111&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!1110&amp;\\!\\!\\!\\!\\!\\!0001&amp;\\!\\!\\!\\!\\!\\!0010&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1110 \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa3\/275\/24b\/fa327524b6d8efe129eadedd17974429.svg\" width=\"325\" height=\"232\"\/><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"schonhage-strassen-2\" id=\"schonhage-strassen-2\"><\/a><\/p>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u0430\u044f, \u0432 \u0446\u0435\u043b\u043e\u043c \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0445\u0443\u0436\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N \\log N \\log \\log N)\" alt=\"O(N \\log N \\log \\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/892\/cd4\/8ea\/892cd48eaa5323a10b7f77f96a215adc.svg\" width=\"174\" height=\"22\"\/>. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0451\u0442 \u043c\u044b\u0441\u043b\u0438 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<h2>\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/h2>\n<p>\u0425\u043e\u0442\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430 \u043a\u0440\u0443\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0443 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0440\u0430\u043d\u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u0443 \u043d\u0435\u0433\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0435\u0441\u0442\u044c \u0437\u043e\u043d\u044b \u0440\u043e\u0441\u0442\u0430. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0447\u0438\u0441\u0435\u043b \u2014 \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/959\/19f\/db0\/95919fdb026482dcd7e23f527e9c9729.svg\" width=\"17\" height=\"17\"\/> \u0434\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log N\" alt=\"\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/501\/ebf\/91b\/501ebf91b2ceb49c0b232f46ff71a96d.svg\" width=\"46\" height=\"21\"\/>. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u0430 \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u043e\u0431\u044a\u0451\u043c\u0435. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0430\u0441\u0447\u0451\u0442\u044b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0440\u0430\u0437\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u0430 \u2014 \u043c\u044b \u0432\u0441\u0435 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043a float \u0438 double, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430. (\u0417\u0434\u0435\u0441\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u0438\u0437 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e. \u041c\u043e\u0433\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u044c\u0441\u044f.)<\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430 \u043b\u0438\u0448\u0451\u043d \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440 \u0438 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438, \u0438 \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/github.com\/ryepdx\/gmp\/blob\/090b098806bc1a8f3af777b862369f58be465dd9\/mpn\/generic\/mul_fft.c\" rel=\"noopener noreferrer nofollow\"><u>GMP<\/u><\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\sqrt{N}\" alt=\"\\sqrt{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f02\/06b\/632\/f0206b632f1bb8001bed179783bde613.svg\" width=\"34\" height=\"24\"\/> \u0432\u043c\u0435\u0441\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log N\" alt=\"\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ff\/ad5\/ec3\/9ffad5ec34132c08d6970765266b4c22.svg\" width=\"46\" height=\"21\"\/>. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435\u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439: \u0434\u043b\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\sqrt{N}\\log\\sqrt{N})\" alt=\"O(\\sqrt{N}\\log\\sqrt{N})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/651\/4ae\/bab\/6514aebabd40b0f8bf9724fc625d383a.svg\" width=\"129\" height=\"25\"\/> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u0438\u0437 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\sqrt{N}\" alt=\"\\sqrt{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f67\/d17\/caa\/f67d17caa583b31592c750c83c4897d1.svg\" width=\"34\" height=\"24\"\/> \u0431\u0438\u0442; \u043a\u0430\u0436\u0434\u043e\u0435 \u0442\u0430\u043a\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c <em>\u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435<\/em> <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\sqrt{N}\\log\\sqrt{N})\" alt=\"O(\\sqrt{N}\\log\\sqrt{N})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/004\/995\/59e\/00499559e166e7a40e12271225bdd5a7.svg\" width=\"129\" height=\"25\"\/> (\u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0432\u0441\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0432\u044b\u0448\u0435 \u0441\u0442\u043e\u0438\u043b\u0438 \u0435\u0449\u0451 \u0434\u043e\u0440\u043e\u0436\u0435), \u0447\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\sqrt{N}\\log^2 N)\" alt=\"O(\\sqrt{N}\\log^2 N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4f2\/eb2\/c71\/4f2eb2c71f0466bc25ef99b39ec453dc.svg\" width=\"122\" height=\"25\"\/>, \u0447\u0442\u043e <em>\u0443\u0436\u0435<\/em> \u0445\u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0427\u0442\u043e-\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c.<\/p>\n<p><a class=\"anchor\" name=\"modular-arithmetic\" id=\"modular-arithmetic\"><\/a><\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435. \u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438! \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0424\u0443\u0440\u044c\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438, \u0442\u043e \u043d\u0430 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\sqrt{N}\\log\\sqrt{N})\" alt=\"O(\\sqrt{N}\\log\\sqrt{N})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/813\/c82\/dc7\/813c82dc7d63444cb41e00f893b5c09d.svg\" width=\"129\" height=\"25\"\/>. \u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\sqrt{N})\" alt=\"O(\\sqrt{N})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4f8\/e84\/1ba\/4f8e841ba02ce8dbd4840bc3a068d814.svg\" width=\"64\" height=\"25\"\/>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0441\u0434\u0432\u0438\u0433.<\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430?<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e<\/strong> \u2014 \u044d\u0442\u043e \u0440\u043e\u0432\u043d\u043e \u0442\u043e, \u043e \u0447\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f. \u041f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435) \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u2014 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0430 \u043d\u0435\u043a\u043e\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e p. \u0422\u0430\u043a, \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7 \u0438\u043c\u0435\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 + 2 = 4\" alt=\"2 + 2 = 4\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/894\/a76\/a5a\/894a76a5ae5bd55d3bdef3794622ac90.svg\" width=\"79\" height=\"18\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 \\cdot 3 = 6\" alt=\"2 \\cdot 3 = 6\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/118\/4ae\/350\/1184ae350a10893eae6165e618f672a6.svg\" width=\"70\" height=\"17\"\/>, \u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 \\cdot 4 = 1\" alt=\"2 \\cdot 4 = 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0c0\/9de\/a5e\/0c09dea5e1d7359928cf45643277706b.svg\" width=\"70\" height=\"17\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"4 + 5 = 2\" alt=\"4 + 5 = 2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8af\/4ac\/186\/8af4ac186f9760e61b0e90356d6da38a.svg\" width=\"79\" height=\"18\"\/>. \u041f\u0440\u0438\u043d\u044f\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"2\\cdot 4\\equiv 1 \\mod 7\" alt=\"2\\cdot 4\\equiv 1 \\mod 7\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e71\/e1d\/be6\/e71e1dbe60ddd2cad13cdcf24548d22d.svg\" width=\"149\" height=\"17\"\/><\/p>\n<p>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u043d\u0430\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c, \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043a\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0435 32-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 (\u0438\u043b\u0438 64-\u0431\u0438\u0442\u043d\u044b\u043c\u0438) \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u0434\u0435, \u0432\u044b \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{32}\" alt=\"2^{32}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ef\/edd\/fb2\/3efeddfb2ecdf2874b27a0971dc6b658.svg\" width=\"26\" height=\"21\"\/> (\u0438\u043b\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{64}\" alt=\"2^{64}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/853\/490\/26a\/85349026a06f18ed2c3eb93b647dd0f5.svg\" width=\"26\" height=\"21\"\/>).<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u043a\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435. \u041d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441\u044b.<\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e p \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u043a\u043e\u043b\u044c\u0446\u043e\u043c \u0432\u044b\u0447\u0435\u0442\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e<\/strong> <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0d1\/0c3\/28b\/0d10c328bf6450c41f7c999d188006ae.svg\" width=\"11\" height=\"15\"\/> \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathbb{Z}_p\" alt=\"\\mathbb{Z}_p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e92\/ba6\/480\/e92ba6480040ceec0129feb02083a822.svg\" width=\"22\" height=\"22\"\/>;\u00a0 \u0432 \u0421\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0445 \u041a\u043d\u0438\u0433\u0430\u0445 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathbb{Z}\/p\\mathbb{Z}\" alt=\"\\mathbb{Z}\/p\\mathbb{Z}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/faf\/b78\/ee6\/fafb78ee6103dc08070a8efbee973b46.svg\" width=\"46\" height=\"22\"\/>. \u0412 \u043d\u0451\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"0,\\ 1,\\ \\ldots,\\ p-2,\\ p-1\" alt=\"0,\\ 1,\\ \\ldots,\\ p-2,\\ p-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/101\/e96\/a99\/101e96a99ae8231c96c03e5d6574d1d5.svg\" width=\"191\" height=\"20\"\/><\/p>\n<p>\u0421\u0430\u043c\u043e \u0447\u0438\u0441\u043b\u043e p \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c93\/667\/300\/c9366730041c5604afca54e643964c48.svg\" width=\"11\" height=\"15\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u043d\u0443\u043b\u044e (\u0442\u0430\u043a\u043e\u0432 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0430\u043c\u043e \u0441\u0435\u0431\u044f); <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p+1\" alt=\"p+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/907\/7c3\/944\/9077c3944e5aaed5c974adbddff39c13.svg\" width=\"44\" height=\"20\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e 1 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u043e \u0441\u0445\u0435\u043c\u0435, \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"-1\" alt=\"-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/413\/54e\/e00\/41354ee004289307be0b32b44cecac5f.svg\" width=\"25\" height=\"18\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p-1\" alt=\"p-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad1\/e1a\/333\/ad1e1a3335c0d8c1d57084821849c5fb.svg\" width=\"44\" height=\"20\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"-2\" alt=\"-2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fdf\/faf\/b18\/fdffafb186e9ad8433835043522feeae.svg\" width=\"25\" height=\"18\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p-2\" alt=\"p-2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/018\/cd5\/461\/018cd5461be508f0a12a098da9eb60e3.svg\" width=\"44\" height=\"20\"\/> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p><strong>\u0414\u0435\u043b\u0435\u043d\u0438\u0435<\/strong> \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u044e\u0430\u043d\u0441. \u0412 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathbb{Z}_p\" alt=\"\\mathbb{Z}_p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/399\/1c8\/a4f\/3991c8a4f89e972ac984d4b497a5c856.svg\" width=\"22\" height=\"22\"\/> \u043d\u0435\u0442 \u0434\u0440\u043e\u0431\u0435\u0439; \u043a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u043d\u043e\u0435 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b, \u043d\u0435 \u0434\u0435\u043b\u044f\u0449\u0438\u0445\u0441\u044f \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430? \u041f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0434\u0435\u043b\u0435\u043d\u0438\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"a\/b\" alt=\"a\/b\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ba8\/8b9\/d50\/ba88b9d50a4feafd64c18ab8ab6066f4.svg\" width=\"29\" height=\"22\"\/> \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0447\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"b \\cdot (a\/b) = a\" alt=\"b \\cdot (a\/b) = a\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c2a\/fc0\/9cc\/c2afc09ccbb68e2e556aff18c24c34d1.svg\" width=\"103\" height=\"22\"\/>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7, \u0438\u0437 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 \\cdot 4 = 1\" alt=\"2 \\cdot 4 = 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac2\/930\/c1f\/ac2930c1f7d45793911e3f824a61b978.svg\" width=\"70\" height=\"17\"\/> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{array}{l}1\/4\\equiv 2\\mod 7,\\\\1\/2\\equiv 4\\mod 7.\\end{array}\" alt=\"\\begin{array}{l}1\/4\\equiv 2\\mod 7,\\\\1\/2\\equiv 4\\mod 7.\\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c6d\/b85\/5ca\/c6db855cad1bc67fbdd420631d2cb70c.svg\" width=\"150\" height=\"52\"\/><\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u042d\u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043d\u044e\u0430\u043d\u0441 \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e! \u0422\u0430\u043a, \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 6 \u0438\u043c\u0435\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2\\cdot 3\\equiv 0\\mod 6\" alt=\"2\\cdot 3\\equiv 0\\mod 6\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/388\/e79\/e75\/388e79e755fa82afb0a1872683e29ca0.svg\" width=\"149\" height=\"17\"\/>. \u0422\u0430\u043a\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%94%D0%B5%D0%BB%D0%B8%D1%82%D0%B5%D0%BB%D1%8C_%D0%BD%D1%83%D0%BB%D1%8F\" rel=\"noopener noreferrer nofollow\"><u>\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0443\u043b\u044f<\/u><\/a> \u0438 \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043d\u0438\u0445 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u0421\u0430\u043c\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"1\/2\" alt=\"1\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/322\/dc8\/792\/322dc8792c16ff2400546d62764b3eac.svg\" width=\"29\" height=\"22\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"1\/3\" alt=\"1\/3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b1b\/591\/3b5\/b1b5913b5ec5df07bbe3da723fa73d95.svg\" width=\"29\" height=\"22\"\/> \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 6 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u043b\u043e \u0431\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0430\u043a\u0441\u0438\u043e\u043c\u0430\u043c; \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043d\u043e\u043b\u044c. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043d\u0430 \u0440\u043e\u043b\u044c \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u0435\u043b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442:<\/p>\n<pre><code class=\"python\">Z_6 = range(6) [(x * 2) % 6 for x in Z_6] # [0, 2, 4, 0, 2, 4] \u2014 \u043d\u0435\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u044b [(x * 3) % 6 for x in Z_6] # [0, 3, 0, 3, 0, 3] \u2014 \u043d\u0435\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u044b<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b, <strong>\u043d\u0435<\/strong> \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0443\u043b\u044f, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u043a\u043e\u043b\u044c\u0446\u0430 \u0432\u044b\u0447\u0435\u0442\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e<\/strong> p \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathbb{Z}_p^*\" alt=\"\\mathbb{Z}_p^*\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1e3\/205\/128\/1e320512843ae98841ff980cf4011ed9.svg\" width=\"22\" height=\"25\"\/>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p = 6\" alt=\"p = 6\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bbc\/dc7\/1e9\/bbcdc71e9b4433884addcba66a6bc9cb.svg\" width=\"46\" height=\"20\"\/> \u0438\u043c\u0435\u0435\u043c <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\mathbb{Z}_6^*=\\{1,5\\}\" alt=\"\\mathbb{Z}_6^*=\\{1,5\\}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b87\/0d7\/9b1\/b870d79b10388e34abac692050a91cbd.svg\" width=\"96\" height=\"23\"\/><\/p>\n<p>\u2014 \u0432\u0435\u0434\u044c \u043a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e, 2 \u0438 3 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0443\u043b\u044f; \u043a\u0440\u0430\u0442\u043d\u0430\u044f \u0434\u0432\u043e\u0439\u043a\u0435 \u0447\u0435\u0442\u0432\u0451\u0440\u043a\u0430 \u2014 \u0442\u043e\u0436\u0435: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"4\\cdot 3=2\\cdot 2\\cdot 3 = 2\\cdot 0 = 0\" alt=\"4\\cdot 3=2\\cdot 2\\cdot 3 = 2\\cdot 0 = 0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/915\/6b5\/12f\/9156b512f0dc890fb5d3ebf6c9e5d920.svg\" width=\"213\" height=\"17\"\/>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u043a\u0442 \u043f\u0440\u043e \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u2014 \u043b\u044e\u0431\u044b\u0435 \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 \u0432 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0438 \u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430, \u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u044d\u0442\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b. \u0422\u0430\u043a, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"5\\cdot 5\\equiv 1\\mod 6\" alt=\"5\\cdot 5\\equiv 1\\mod 6\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/58e\/2d6\/df1\/58e2d6df1a5a269286cc5cf163a8a66a.svg\" width=\"149\" height=\"17\"\/>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 \u043d\u0443\u043b\u044f \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u043b\u044e\u0431\u044b\u0435 \u0447\u0438\u0441\u043b\u0430. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathbb{Z}_p\" alt=\"\\mathbb{Z}_p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53c\/21a\/2a3\/53c21a2a3fdc1f48a746c0019b746e1f.svg\" width=\"22\" height=\"22\"\/>, \u043a\u0440\u043e\u043c\u0435 \u043d\u0443\u043b\u044f:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\mathbb{Z}_7^*=\\{1,2,3,4,5,6\\}\" alt=\"\\mathbb{Z}_7^*=\\{1,2,3,4,5,6\\}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f95\/ece\/db5\/f95ecedb54e6b6825907d599418b8185.svg\" width=\"170\" height=\"23\"\/><\/p>\n<p>\u041a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u043d\u043e\u0435 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c? \u0417\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u043a\u0442 \u0438\u0437 \u0430\u043b\u0433\u0435\u0431\u0440\u044b: \u0435\u0441\u043b\u0438 \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/38b\/e0a\/0a6\/38be0a0a63ac842a326eb6b32e5a3b63.svg\" width=\"12\" height=\"12\"\/> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0435\u0451 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6a3\/876\/f36\/6a3876f36e29dadbfdea613951d34214.svg\" width=\"12\" height=\"12\"\/> \u0440\u0430\u0432\u0435\u043d \u0435\u0434\u0438\u043d\u0438\u0446\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430 \u043f\u0430\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<pre><code class=\"python\">Z_7_mul = range(1, 7) [pow(x, 6, 7) for x in Z_7_mul] # [1, 1, 1, 1, 1, 1]  Z_8_mul = [1, 3, 5, 7] [pow(x, 4, 8) for x in Z_8_mul] # [1, 1, 1, 1]<\/code><\/pre>\n<p>\u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"x \\cdot x^{n-1} \\equiv x^n \\equiv 1\\mod p\" alt=\"x \\cdot x^{n-1} \\equiv x^n \\equiv 1\\mod p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/62f\/44f\/48a\/62f44f48ae954bb7f53a817edcc8d1b9.svg\" width=\"227\" height=\"24\"\/><\/p>\n<p>\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"1\/x\\equiv x^{n-1}\\mod p\" alt=\"1\/x\\equiv x^{n-1}\\mod p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dca\/338\/048\/dca3380485b807a374a2fe788c8dd498.svg\" width=\"175\" height=\"25\"\/>. \u0412\u043e\u0437\u0432\u0435\u0441\u0442\u0438 \u0447\u0438\u0441\u043b\u043e \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(n-1)\" alt=\"(n-1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/05f\/d32\/327\/05fd32327c094b8a0d1aef5eab247fce.svg\" width=\"61\" height=\"22\"\/>-\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\log n)\" alt=\"O(\\log n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0dc\/4d1\/7f0\/0dc4d17f0860797708b47db7db4cd513.svg\" width=\"70\" height=\"22\"\/> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC%D1%8B_%D0%B1%D1%8B%D1%81%D1%82%D1%80%D0%BE%D0%B3%D0%BE_%D0%B2%D0%BE%D0%B7%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D1%8F_%D0%B2_%D1%81%D1%82%D0%B5%D0%BF%D0%B5%D0%BD%D1%8C\" rel=\"noopener noreferrer nofollow\"><u>\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c<\/u><\/a>.<\/p>\n<p>\u041e\u0442\u0441\u044e\u0434\u0430 \u043d\u044e\u0430\u043d\u0441 \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 <em>\u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430<\/em> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u044f\u043c\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6ab\/40c\/0d4\/6ab40c0d49ca68ebd526733493a5261d.svg\" width=\"12\" height=\"12\"\/>! \u042d\u0442\u0438 \u043a\u043e\u0440\u043d\u0438 \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u043e\u0440\u043d\u044f\u043c \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435, \u0438 \u0434\u043b\u044f \u043d\u0438\u0445 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435. <\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0435: \u0441\u0430\u043c\u0430\u044f \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043a\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0447\u0435\u0442\u0430\u043b\u0438 \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430: \u0431\u044b\u043b\u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438 \u0434\u0432\u043e\u0439\u043a\u0438 \u2014 \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430 \u043d\u0438\u0445 \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c, \u0438 \u0431\u044b\u043b\u0438 \u043a\u043e\u0440\u043d\u044f\u043c\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u2014 \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u0417\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c n-\u0431\u0438\u0442\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u2014 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^n\" alt=\"2^n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a0f\/d86\/277\/a0fd86277c18ac003b12046bac75327b.svg\" width=\"20\" height=\"18\"\/>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043b\u044e\u0431\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438 \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u043b\u044c \u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u043c \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b:<\/p>\n<pre><code class=\"python\">num_bits = 5 [pow(2, i, 2**num_bits) for i in range(2*num_bits)] # [1, 2, 4, 8, 16, 0, 0, 0, 0, 0]<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043a\u0440\u0430\u0442\u043d\u043e \u0434\u0432\u0443\u043c, \u043d\u043e \u043d\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438, \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u043e\u043b\u044c, \u043d\u043e \u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u0443:<\/p>\n<pre><code class=\"python\">mod = 6 [pow(2, i, mod) for i in range(2*mod)] # [1, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2]<\/code><\/pre>\n<p>\u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u0432\u043e\u0439\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u043d\u0443\u043b\u044f (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0442\u0440\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 0 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 6) \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u043b\u0435\u043d\u043e\u043c \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b.<\/p>\n<p>\u0413\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435 \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441 \u0434\u0432\u043e\u0439\u043a\u043e\u0439: <\/p>\n<pre><code class=\"python\">mod = 5 [pow(2, i, mod) for i in range(2*mod)] # [1, 2, 4, 3, 1, 2, 4, 3, 1, 2]<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0432\u043e\u0439\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435, \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0441\u0442\u0435\u043f\u0435\u043d\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0435\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 1 \u2014 \u0438 \u044d\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0430\u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u043d\u0430\u043f\u0435\u0440\u0451\u0434 \u0441 \u0437\u0430\u043f\u0430\u0441\u043e\u043c \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430\u2026 \u041d\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u043e\u0434\u0443\u043b\u044e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043d\u0430 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0430 \u044d\u0442\u043e <em>\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e<\/em>.<\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u0434\u043b\u044f <strong>\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/strong> \u2014 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043d\u0443\u0436\u0434 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^n+1\" alt=\"2^n+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/263\/d6d\/cc7\/263d6dcc7394957c007e4afe934cd9ef.svg\" width=\"54\" height=\"19\"\/>. \u042d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441 \u0434\u0432\u043e\u0439\u043a\u043e\u0439 (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435\u0447\u0451\u0442\u043d\u043e\u0435), \u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u043b\u0435\u0433\u043a\u043e \u0431\u0440\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041a\u0430\u043a?<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0443\u043c\u043d\u043e\u0436\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e x \u043d\u0430 \u043d\u0435\u043a\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^y\" alt=\"2^y\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/159\/d5a\/7cf\/159d5a7cf52c56dc020b9429afb5262c.svg\" width=\"19\" height=\"18\"\/>, \u0441\u0434\u0435\u043b\u0430\u0432 \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0441\u0434\u0432\u0438\u0433. \u0415\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043c\u0435\u0441\u0442\u0438\u043b\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u044b\u0435 n \u0431\u0438\u0442, \u0432\u0441\u0451 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0415\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u0435\u043d <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^n\" alt=\"2^n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84d\/232\/fb6\/84d232fb6bc986085421758ad3b76d00.svg\" width=\"20\" height=\"18\"\/>, \u0442\u043e\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u0415\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u2014 \u0432\u0441\u0435 \u0431\u0438\u0442\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(n+1)\" alt=\"(n+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a49\/ab1\/39c\/a49ab139c8c2afb6b176c86636a6de3a.svg\" width=\"61\" height=\"22\"\/>-\u0433\u043e, \u043d\u0430\u0434\u043e \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c. \u0418 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c!\u00a0<\/p>\n<p>\u0412 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^n+1\" alt=\"2^n+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d50\/013\/39c\/d5001339c7400878930c26784c6d56d0.svg\" width=\"54\" height=\"19\"\/> \u0438\u043c\u0435\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^n\\equiv-1\\mod(2^n+1)\" alt=\"2^n\\equiv-1\\mod(2^n+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/213\/aac\/ffc\/213aacffc85d43bb108f1b2e1dff4b68.svg\" width=\"206\" height=\"22\"\/>. \u0414\u043e\u043c\u043d\u043e\u0436\u0430\u044f \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^k\" alt=\"2^k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/455\/ba1\/4fd\/455ba14fd31af6fa1e8fac9c61d45a9e.svg\" width=\"19\" height=\"21\"\/>, \u043f\u043e\u043b\u0443\u0447\u0438\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{n+k}\\equiv-2^k\\mod(2^n+1)\" alt=\"2^{n+k}\\equiv-2^k\\mod(2^n+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c36\/34e\/f57\/c3634ef57bfab5f47991cae221fbf1ad.svg\" width=\"234\" height=\"25\"\/>. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u043b\u0438\u0448\u043d\u0438\u0439 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(n+k)\" alt=\"(n+k)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/605\/441\/ac9\/605441ac9f8074d6fb6f37ba306d74d5.svg\" width=\"61\" height=\"22\"\/>-\u0439 \u0431\u0438\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0432 <em>\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435<\/em><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0a0\/8a7\/ec4\/0a08a7ec44109e4cf08046a715cac224.svg\" width=\"10\" height=\"17\"\/>-\u0433\u043e \u0431\u0438\u0442\u0430. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e \u0431\u0438\u0442\u0430\u043c \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0434\u043e \u0432\u044b\u0447\u0435\u0441\u0442\u044c, \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u2014 \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u043e\u0438\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(n)\" alt=\"O(n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/deb\/c13\/b91\/debc13b91110614cf183a19cd626ddfd.svg\" width=\"42\" height=\"22\"\/>. Et voil\u00e0!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{array}{crl} &amp; {\\color{Red}{1010}}\\overbrace{101001}^{n} \\\\  &amp; \\downarrow\\quad \\\\  &amp; \\begin{matrix} -\\!\\!\\!\\!\\!\\! &amp; \\begin{array}{r} 101001 \\\\[-2mm] {\\color{Red}{1010}} \\end{array} \\end{matrix} \\\\ &amp; \\downarrow\\quad \\\\  &amp; 011111 \\end{array}\" alt=\"\\begin{array}{crl} &amp; {\\color{Red}{1010}}\\overbrace{101001}^{n} \\\\  &amp; \\downarrow\\quad \\\\  &amp; \\begin{matrix} -\\!\\!\\!\\!\\!\\! &amp; \\begin{array}{r} 101001 \\\\[-2mm] {\\color{Red}{1010}} \\end{array} \\end{matrix} \\\\ &amp; \\downarrow\\quad \\\\  &amp; 011111 \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e56\/10a\/b95\/e5610ab95d21d98f0ec6f61c9afb9f1f.svg\" width=\"124\" height=\"173\"\/><\/p>\n<p>\u0418 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0444\u0430\u043a\u0442: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{2n}=-2^n=+1\" alt=\"2^{2n}=-2^n=+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d96\/b4d\/c63\/d96b4dc630fead3d1e7435632fda355a.svg\" width=\"139\" height=\"22\"\/>. \u0414\u0432\u043e\u0439\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u043c \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043d\u0430\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2n\" alt=\"2n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/48d\/bed\/2a1\/48dbed2a132103f9e215daa998f98b85.svg\" width=\"22\" height=\"17\"\/>.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043c \u0441 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u043e\u0439?<\/h3>\n<p>\u041e\u043a\u0435\u0439, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u0441\u0432\u043e\u0434\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^n+1\" alt=\"2^n+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/819\/36d\/f5a\/81936df5a64e4b15927874d4efc5b495.svg\" width=\"54\" height=\"19\"\/> \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435. \u0411\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u0434\u043b\u0438\u043d\u043e\u0439 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8e6\/b7c\/a3e\/8e6b7ca3e44b61b3f8633fc22d394406.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442, \u043c\u044b \u0434\u0435\u043b\u0438\u043c \u0438\u0445 \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m\" alt=\"m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/13c\/19d\/981\/13c19d981ca37081663fa2dfc582884e.svg\" width=\"17\" height=\"12\"\/> \u0447\u0430\u0441\u0442\u0435\u0439 \u043f\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/189\/e7c\/062\/189e7c062dc2d2025af320b2a56660b0.svg\" width=\"12\" height=\"12\"\/> \u0431\u0438\u0442, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N = m\\cdot n\" alt=\"N = m\\cdot n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/761\/3db\/04d\/7613db04d533c006932a85261ee520d4.svg\" width=\"87\" height=\"17\"\/>, \u043f\u043e \u0443\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0439 \u043d\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\overbrace{\\underbrace{\\color{Red}{1001}}_{n}\\underbrace{\\color{Red}{0100}}_{n}\\underbrace{\\color{DarkBlue}{1100}}_{n}\\underbrace{\\color{DarkBlue}{0001}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}} \\times  \\overbrace{\\underbrace{\\color{DarkOrange}{1100}}_{n}\\underbrace{\\color{DarkOrange}{0000}}_{n}\\underbrace{\\color{Magenta}{0100}}_{n}\\underbrace{\\color{Magenta}{1110}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}}\" alt=\"\\overbrace{\\underbrace{\\color{Red}{1001}}_{n}\\underbrace{\\color{Red}{0100}}_{n}\\underbrace{\\color{DarkBlue}{1100}}_{n}\\underbrace{\\color{DarkBlue}{0001}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}} \\times  \\overbrace{\\underbrace{\\color{DarkOrange}{1100}}_{n}\\underbrace{\\color{DarkOrange}{0000}}_{n}\\underbrace{\\color{Magenta}{0100}}_{n}\\underbrace{\\color{Magenta}{1110}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/564\/588\/098\/5645880981828d93feaffcc67eb3ec60.svg\" width=\"337\" height=\"85\"\/><\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0445 \u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m-1\" alt=\"m-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae6\/76c\/f1d\/ae676cf1d4858238285425da38706ec6.svg\" width=\"51\" height=\"18\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\left({\\color{Red}{1001}}\\!\\cdot\\!x^3 + {\\color{Red}{0100}}\\!\\cdot\\!x^2 + {\\color{DarkBlue}{1100}}\\!\\cdot\\!x + {\\color{DarkBlue}{0001}}\\right)\\times\\left({\\color{DarkOrange}{1100}}\\!\\cdot\\!x^3 + {\\color{DarkOrange}{0000}}\\!\\cdot\\!x^2 + {\\color{Magenta}{0100}}\\!\\cdot\\!x + {\\color{Magenta}{1110}}\\right)\" alt=\"\\left({\\color{Red}{1001}}\\!\\cdot\\!x^3 + {\\color{Red}{0100}}\\!\\cdot\\!x^2 + {\\color{DarkBlue}{1100}}\\!\\cdot\\!x + {\\color{DarkBlue}{0001}}\\right)\\times\\left({\\color{DarkOrange}{1100}}\\!\\cdot\\!x^3 + {\\color{DarkOrange}{0000}}\\!\\cdot\\!x^2 + {\\color{Magenta}{0100}}\\!\\cdot\\!x + {\\color{Magenta}{1110}}\\right)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f2\/b49\/86b\/5f2b4986b2e58773cef62fbb0163006a.svg\" width=\"665\" height=\"27\"\/><\/p>\n<p>\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u044d\u0442\u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{n'}+1\" alt=\"2^{n'}+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/812\/5b8\/555\/8125b85553ad65144c02d0f9fe2dd91b.svg\" width=\"58\" height=\"23\"\/>, \u0433\u0434\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n'\\approx\u00a0 2n+\\log m\" alt=\"n'\\approx\u00a0 2n+\\log m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d0\/dd7\/428\/9d0dd7428a494a23ea3ae826c5195741.svg\" width=\"135\" height=\"23\"\/> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0441\u0443\u043c\u043c\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m\" alt=\"m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ec\/141\/168\/8ec141168b455870b1d55f82d27594e9.svg\" width=\"17\" height=\"12\"\/> \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d7\/c09\/069\/1d7c0906951bbae390db2eec6f64be5d.svg\" width=\"12\" height=\"12\"\/> \u0431\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c_{m-1} = \\underbrace{{\\color{DarkBlue}{a_0}}{\\color{DarkOrange}{b_{m-1}}} + {\\color{DarkBlue}{a_1}}{\\color{DarkOrange}{b_{m-2}}} + \\ldots + {\\color{Red}{a_{m-1}}}{\\color{Magenta}{b_0}}}_{m\\ \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445}\\le m\\cdot 2^{n}\\cdot 2^n\" alt=\"c_{m-1} = \\underbrace{{\\color{DarkBlue}{a_0}}{\\color{DarkOrange}{b_{m-1}}} + {\\color{DarkBlue}{a_1}}{\\color{DarkOrange}{b_{m-2}}} + \\ldots + {\\color{Red}{a_{m-1}}}{\\color{Magenta}{b_0}}}_{m\\ \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445}\\le m\\cdot 2^{n}\\cdot 2^n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/278\/ea6\/9d4\/278ea69d464abf81a8ebd1437adb9014.svg\" width=\"451\" height=\"58\"\/><\/p>\n<p>\u041c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u0435\u0441\u0442\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043a \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2m-1\" alt=\"2m-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fe3\/9c0\/d63\/fe39c0d63d9f0933687cae23200904bf.svg\" width=\"61\" height=\"18\"\/> \u0447\u0438\u0441\u0435\u043b \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\mathbb{Z}_{2^{n'}+1}\" alt=\"\\mathbb{Z}_{2^{n'}+1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/88e\/9ce\/e6f\/88e9cee6f21af2c83921cf2194e941ac.svg\" width=\"51\" height=\"25\"\/> \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435; \u044d\u0442\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u0438\u043c \u0436\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c, \u0430 \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{n'}+1\" alt=\"2^{n'}+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/27b\/0a7\/524\/27b0a7524327347a22cfe6fa8ee5144a.svg\" width=\"58\" height=\"23\"\/>, \u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e. \u0421\u0430\u043c\u043e \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u0441 \u0431\u044b\u0441\u0442\u0440\u044b\u043c\u0438 \u043a\u043e\u0440\u043d\u044f\u043c\u0438 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u2014 \u043e\u0431\u043e\u0439\u0434\u0451\u0442\u0441\u044f \u043d\u0430\u043c \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(m\\log m)\" alt=\"O(m\\log m)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f9\/53f\/545\/5f953f54535716c99042399b5c8bc955.svg\" width=\"96\" height=\"22\"\/> \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(n')\" alt=\"O(n')\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ce\/bf5\/f4a\/9cebf5f4a38df60842eceabcf0aafbfd.svg\" width=\"48\" height=\"23\"\/>, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(m\\log m\\cdot n') = O(mn\\log m) = O(N\\log m)\" alt=\"O(m\\log m\\cdot n') = O(mn\\log m) = O(N\\log m)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f4f\/437\/bf5\/f4f437bf5f9f572786c6b96b6fd0768c.svg\" width=\"384\" height=\"23\"\/> \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0418\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"C(N)\" alt=\"C(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/265\/65a\/363\/26565a3633db36e4ae8d8ccccdc5c48c.svg\" width=\"47\" height=\"22\"\/> \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) = (2m-1)\\cdot C(2n+\\log m) + O(N\\log m)\" alt=\"C(N) = (2m-1)\\cdot C(2n+\\log m) + O(N\\log m)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/144\/02e\/2f8\/14402e2f83a17b1b3964eb2c6fcccda9.svg\" width=\"405\" height=\"22\"\/><\/p>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0443\u0442\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c? \u0421\u0435\u0439\u0447\u0430\u0441 \u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0443 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u00ab\u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445\u00bb; \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 [5].<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\\approx m\\approx\\sqrt{N}\" alt=\"n\\approx m\\approx\\sqrt{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/822\/f2f\/4fd\/822f2f4fd619c9be328159410f7ff637.svg\" width=\"115\" height=\"24\"\/> \u0438 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log m\" alt=\"\\log m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b54\/685\/aba\/b54685aba4b32063a11375c9f006585d.svg\" width=\"45\" height=\"21\"\/> \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2n\" alt=\"2n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eb0\/798\/ff7\/eb0798ff7a21d4a38d2d9cf89d4dea5b.svg\" width=\"22\" height=\"17\"\/>, \u0438\u043c\u0435\u0435\u043c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) \\approx 2\\sqrt{N}\\cdot C(2\\sqrt{N}) + O(N\\log N)\" alt=\"C(N) \\approx 2\\sqrt{N}\\cdot C(2\\sqrt{N}) + O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ee\/6bf\/485\/9ee6bf4854feae7f7370ade43841ac41.svg\" width=\"325\" height=\"25\"\/><\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0432 \u0437\u0430\u043c\u0435\u043d\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"C(N)=c(N)\\cdot N\\log N\" alt=\"C(N)=c(N)\\cdot N\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5aa\/d6f\/dec\/5aad6fdecdd77f22586c9842d234a29e.svg\" width=\"195\" height=\"22\"\/>, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u0443:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N)\\cdot N\\log N \\approx 2{\\color{Magenta}{\\sqrt{N}}}\\cdot c(2\\sqrt{N})\\cdot 2{\\color{Magenta}{\\sqrt{N}}}\\log{{\\color{DarkGreen}{2}}\\color{Red}{\\sqrt{{\\color{Black}{N}}}}} + O(N\\log N)\" alt=\"c(N)\\cdot N\\log N \\approx 2{\\color{Magenta}{\\sqrt{N}}}\\cdot c(2\\sqrt{N})\\cdot 2{\\color{Magenta}{\\sqrt{N}}}\\log{{\\color{DarkGreen}{2}}\\color{Red}{\\sqrt{{\\color{Black}{N}}}}} + O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/842\/c85\/967\/842c85967383345b74a96915b8f79f06.svg\" width=\"525\" height=\"25\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N)\\cdot N\\log N \\approx 2{\\color{Magenta}{N}}\\cdot c(2\\sqrt{N})\\cdot \\not{2}\\cdot {\\color{Red}{\\frac{1}{\\not{2}}}}\\log N + \\underbrace{O(N\\log N)}_{+...\\,\\cdot {\\color{DarkGreen} \\log 2}}\" alt=\"c(N)\\cdot N\\log N \\approx 2{\\color{Magenta}{N}}\\cdot c(2\\sqrt{N})\\cdot \\not{2}\\cdot {\\color{Red}{\\frac{1}{\\not{2}}}}\\log N + \\underbrace{O(N\\log N)}_{+...\\,\\cdot {\\color{DarkGreen} \\log 2}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/10f\/61e\/f86\/10f61ef86bae1cac130e54f7e5c9ceef.svg\" width=\"488\" height=\"66\"\/><\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fcf\/e29\/792\/fcfe2979223daf63f05c4a641cbf0552.png\" width=\"453\" height=\"37\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fcf\/e29\/792\/fcfe2979223daf63f05c4a641cbf0552.png\"\/><\/figure>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N) \\approx 2\\cdot c(2\\sqrt{N}) + \\mathrm{const}\" alt=\"c(N) \\approx 2\\cdot c(2\\sqrt{N}) + \\mathrm{const}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/719\/3fc\/e88\/7193fce8802a5a55f744be910650a25a.svg\" width=\"227\" height=\"25\"\/><\/p>\n<p>\u0422\u0430\u043a, \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435. \u041e\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/158\/1ed\/7af\/1581ed7af9bef6873c313e23c77ae647.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2\\sqrt N\" alt=\"2\\sqrt N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/868\/f01\/a5e\/868f01a5e40794c42680f22fe6b15185.svg\" width=\"43\" height=\"24\"\/>, \u043f\u043e\u0442\u043e\u043c \u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2\\sqrt 2\\sqrt[4]{N}\" alt=\"2\\sqrt 2\\sqrt[4]{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a07\/7d9\/118\/a077d911823161e83341d26c7b5d7be4.svg\" width=\"70\" height=\"24\"\/>, \u043f\u043e\u0442\u043e\u043c \u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2\\sqrt 2\\sqrt[4] 2\\sqrt[8]{N}\" alt=\"2\\sqrt 2\\sqrt[4] 2\\sqrt[8]{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a5f\/784\/8ec\/a5f7848ec9c373de273a8ef5f93ef5d2.svg\" width=\"96\" height=\"24\"\/> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.\u00a0\u0420\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/83c\/668\/a1a\/83c668a1a227173ac2363f8ad78c3469.svg\" width=\"10\" height=\"17\"\/> \u0440\u0430\u0437, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N) \\approx 2^k c(2\\sqrt{2}\\sqrt[4]{2}\\ldots\\!\\!\\!\\sqrt[2^{k-1}]{2}\\sqrt[2^k]{N}) + \\ldots + 4\\cdot \\mathrm{const} + 2\\cdot \\mathrm{const} + \\mathrm{const}\" alt=\"c(N) \\approx 2^k c(2\\sqrt{2}\\sqrt[4]{2}\\ldots\\!\\!\\!\\sqrt[2^{k-1}]{2}\\sqrt[2^k]{N}) + \\ldots + 4\\cdot \\mathrm{const} + 2\\cdot \\mathrm{const} + \\mathrm{const}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/932\/dbc\/fa7\/932dbcfa764a21b0f75f6e14c296fc00.svg\" width=\"565\" height=\"28\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\sqrt[2^k]{N}\" alt=\"\\sqrt[2^k]{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c22\/fbd\/06d\/c22fbd06dd6c3c5ca1917b39610bb602.svg\" width=\"34\" height=\"27\"\/> \u0443\u0431\u044b\u0432\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e, \u0438 \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0434\u043e\u0439\u0434\u0451\u043c \u0434\u043e \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f. \u041a\u0430\u043a\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438? \u041c\u043e\u0436\u0435\u043c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/273\/ae4\/479\/273ae4479cc112f63f802c55da4978ad.svg\" width=\"10\" height=\"17\"\/>-\u043c \u0448\u0430\u0433\u0435 \u0434\u043b\u0438\u043d\u0430 \u0447\u0438\u0441\u0435\u043b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e, \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"{\\color{DarkGreen}{2}} {\\color{DarkRed}{\\sqrt{2}}} {\\color{DarkBlue}{\\sqrt[4]{2}}} \\ldots\\!\\!\\! {\\color{Teal}{\\sqrt[2^{k-1}]{2}}}\\, \\sqrt[2^k]{N} = \\underbrace{\\,2^{\\displaystyle\\Bigl(\\overbrace{{\\color{DarkGreen}{1}} + {\\color{DarkRed}{\\frac{1}{2}}} + {\\color{DarkBlue}{\\frac{1}{4}}} + \\ldots + {\\color{Teal}{\\frac{1}{2^{k-1}}}}}^{\\displaystyle\\overset{2}{\\uparrow}}\\Bigl)}}_{\\displaystyle\\underset{4}{\\downarrow}}\\cdot\\,N^{\\frac{1}{2^k}}\" alt=\"{\\color{DarkGreen}{2}} {\\color{DarkRed}{\\sqrt{2}}} {\\color{DarkBlue}{\\sqrt[4]{2}}} \\ldots\\!\\!\\! {\\color{Teal}{\\sqrt[2^{k-1}]{2}}}\\, \\sqrt[2^k]{N} = \\underbrace{\\,2^{\\displaystyle\\Bigl(\\overbrace{{\\color{DarkGreen}{1}} + {\\color{DarkRed}{\\frac{1}{2}}} + {\\color{DarkBlue}{\\frac{1}{4}}} + \\ldots + {\\color{Teal}{\\frac{1}{2^{k-1}}}}}^{\\displaystyle\\overset{2}{\\uparrow}}\\Bigl)}}_{\\displaystyle\\underset{4}{\\downarrow}}\\cdot\\,N^{\\frac{1}{2^k}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b5\/bfa\/665\/1b5bfa6653a64717949c37cd4b3f9494.svg\" width=\"483\" height=\"148\"\/><\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0435\u0448\u0430\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N^{\\frac{1}{2^k}}=\\mathrm{const}\" alt=\"N^{\\frac{1}{2^k}}=\\mathrm{const}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d1\/da3\/14b\/9d1da314be0705b758c18df06ff21199.svg\" width=\"109\" height=\"28\"\/>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\\approx\\log\\log N\" alt=\"k\\approx\\log\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/10c\/119\/1d4\/10c1191d45ad359014365ccb38a9b588.svg\" width=\"110\" height=\"21\"\/>. \u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438 \u043e\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0434\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log\\log N\" alt=\"\\log\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3a0\/6cc\/bd7\/3a06ccbd7d8702a173016b192a0c20ac.svg\" width=\"74\" height=\"21\"\/> (\u0432 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0435 \u0432\u044b\u0448\u0435 \u043e\u043d\u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u044e\u0442\u0441\u044f \u043d\u0430 const), \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"c(N) = \\log N\" alt=\"c(N) = \\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bef\/dd5\/848\/befdd58480c51d8df49d1fecb55d4114.svg\" width=\"113\" height=\"22\"\/> \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) = O({\\color{Red}{N\\cdot\\log^2 N}})\" alt=\"C(N) = O({\\color{Red}{N\\cdot\\log^2 N}})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3da\/a63\/bf1\/3daa63bf1aa682935beee7b60cbb0274.svg\" width=\"190\" height=\"25\"\/><\/p>\n<p>\u0418 \u044d\u0442\u043e <em>\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e<\/em>! \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430 \u043c\u044b \u0443\u0436\u0435 \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0447\u0443\u0442\u044c \u0445\u0443\u0436\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N\\log\\log N)\" alt=\"O(N\\log N\\log\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ccc\/89b\/c6a\/ccc89bc6a7bd264af3a786711b809928.svg\" width=\"174\" height=\"22\"\/>. \u041d\u0443\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0435\u0449\u0451.<\/p>\n<h3>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u043e\u0435: \u0441\u0430\u043c\u044b\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b<\/h3>\n<p>\u0412 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438, \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0449\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N) \\approx 2^k c(2\\sqrt{2}\\sqrt[4]{2}\\ldots\\!\\!\\!\\sqrt[2^{k-1}]{2}\\sqrt[2^k]{N}) + \\ldots + 4\\cdot \\mathrm{const} + 2\\cdot \\mathrm{const} + \\mathrm{const}\" alt=\"c(N) \\approx 2^k c(2\\sqrt{2}\\sqrt[4]{2}\\ldots\\!\\!\\!\\sqrt[2^{k-1}]{2}\\sqrt[2^k]{N}) + \\ldots + 4\\cdot \\mathrm{const} + 2\\cdot \\mathrm{const} + \\mathrm{const}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef6\/3f5\/5f0\/ef63f55f0c3d7a9312548d5a87edce91.svg\" width=\"565\" height=\"28\"\/><\/p>\n<p>\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u043d\u043e\u0441\u044f\u0442 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438-\u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u041e\u043d\u0438 \u0442\u0430\u043c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044f \u0447\u0438\u0441\u043b\u043e \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m\" alt=\"m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3af\/d24\/dd2\/3afd24dd2484a168fa172671096ad733.svg\" width=\"17\" height=\"12\"\/> \u0447\u0430\u0441\u0442\u0435\u0439, \u043c\u044b \u0441\u0432\u043e\u0434\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\approx 2m\" alt=\"\\approx 2m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b56\/642\/f39\/b56642f3946dfda4abf92b30019e60a5.svg\" width=\"48\" height=\"17\"\/> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/66c\/591\/002\/66c591002a14ba1afc59bfc977bedefe.svg\" width=\"10\" height=\"17\"\/>-\u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(2k-1)\" alt=\"(2k-1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ef\/182\/325\/3ef182325feebd930bddb6f7a8176120.svg\" width=\"69\" height=\"22\"\/>-\u0431\u0438\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<\/p>\n<p>\u041d\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(2k-1)\" alt=\"(2k-1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5fb\/09f\/995\/5fb09f9955ef2b9e542b10f677400aae.svg\" width=\"69\" height=\"22\"\/>-\u0431\u0438\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438, \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^k+1\" alt=\"2^k+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b64\/4fe\/508\/b644fe508b0518a91887fdd33187ae86.svg\" width=\"53\" height=\"22\"\/>. \u0410 \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0434\u043b\u0438\u043d\u0430 \u0447\u0438\u0441\u0435\u043b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f! \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043a\u0430\u043a-\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u0434\u0432\u043e\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u044b \u0438 \u0432\u0437\u044f\u0442\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0440\u0430\u0441\u0447\u0451\u0442\u0430\u043c\u0438 \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k\" alt=\"k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/267\/238\/4a4\/2672384a441a677a9dc33b8373f2548d.svg\" width=\"10\" height=\"17\"\/> \u0431\u0438\u0442\u0430\u0445?<\/p>\n<p><a class=\"anchor\" name=\"polynomial-modular-arithmetic\" id=\"polynomial-modular-arithmetic\"><\/a><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435, \u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043c\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u0415\u0441\u0442\u044c \u043b\u0438 \u0432 \u043c\u0438\u0440\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u0447\u0442\u043e-\u0442\u043e, \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e? \u0415\u0441\u0442\u044c!<\/p>\n<details class=\"spoiler\">\n<summary>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e???<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0436\u0438\u0437\u043d\u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u043d\u043e \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0435 \u0442\u0443\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432. \u041d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0432 \u043d\u0435\u0439 \u043d\u0435\u0442; \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430\u043c\u0438 \u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043d\u0430 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e.<\/p>\n<p>\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u043c\u044b \u0443\u0436\u0435 \u0443\u043c\u0435\u0435\u043c \u2014 \u0442\u0430\u043c \u0432\u0441\u0451 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e. \u041c\u0435\u043d\u0435\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 <em>\u0434\u0435\u043b\u0438\u0442\u044c \u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c<\/em> \u2014 \u043f\u0440\u0438\u0447\u0451\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043e\u0442 \u043f\u0440\u044f\u043c\u043e \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1a2\/5cb\/2d6\/1a25cb2d6058982fa98ecfebd8d63b6f.png\" width=\"404\" height=\"162\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1a2\/5cb\/2d6\/1a25cb2d6058982fa98ecfebd8d63b6f.png\"\/><\/figure>\n<p>\u041c\u043e\u0436\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432 SymPy, \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e:<\/p>\n<pre><code class=\"python\">import sympy  x = sympy.Symbol(\"x\") f = 5*x**5 + 4*x**4 + 3*x**3 + 2*x**2 + x g = x**2 + 2*x + 3 sympy.div(f, g, domain=\"Q\") # (5*x**3 - 6*x**2 + 20, -39*x - 60)<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e; \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0447\u0438\u0441\u043b\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/52c\/957\/284\/52c9572843b57b13f4e792a161587cf0.svg\" width=\"11\" height=\"15\"\/>, \u0430 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p(x)\" alt=\"p(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/634\/27d\/e3f\/63427de3f061c210007311ca45a4ea2a.svg\" width=\"37\" height=\"22\"\/>. \u041f\u043e\u0434\u043e\u0431\u043d\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443, \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044f, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0447\u0438\u0441\u043b\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dca\/fba\/d77\/dcafbad77b71c5bff9451f4c6a01965b.svg\" width=\"11\" height=\"15\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u043d\u0443\u043b\u044e, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p(x)\" alt=\"p(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e5f\/974\/2ca\/e5f9742caca5d691ed1e3d108e4b3553.svg\" width=\"37\" height=\"22\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u043d\u0443\u043b\u044e. \u041c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p(x) + 1\" alt=\"p(x) + 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b93\/572\/e9a\/b93572e9a94dea42af03379a59e095a1.svg\" width=\"71\" height=\"22\"\/> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"1\" alt=\"1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/78f\/764\/5a0\/78f7645a01c39ee8229fe423a491c0a5.svg\" width=\"10\" height=\"17\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p(x) + x\" alt=\"p(x) + x\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/20a\/e21\/cc2\/20ae21cc29f5be6caaec6c83b010bbe5.svg\" width=\"72\" height=\"22\"\/> \u2014 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(x) = x\" alt=\"f(x) = x\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a24\/9f6\/834\/a249f68348677086f3b759706a1bedb1.svg\" width=\"74\" height=\"22\"\/> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8bf\/f53\/e1c\/8bff53e1cdf116d25a3030e84be6b550.jpg\" width=\"604\" height=\"490\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8bf\/f53\/e1c\/8bff53e1cdf116d25a3030e84be6b550.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u043c\u0435\u043d\u044f\u0435\u043c \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432, \u0437\u0430\u043c\u0435\u043d\u044f\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u043d\u0430\u043c \u0446\u0435\u043b\u044b\u0435 \u0438\u043b\u0438 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c40\/03c\/902\/c4003c902019830680fcdd5593265c60.svg\" width=\"11\" height=\"15\"\/>. \u0412\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0441\u043a\u0430\u0434 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439: \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d \u2014 \u044d\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0438\u043a\u0441\u0430 \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430; \u043d\u0435\u0432\u0430\u0436\u043d\u043e, \u043a\u0430\u043a\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u044d\u0442\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c, \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0438 (\u0438\u043d\u043e\u0433\u0434\u0430) \u0434\u0435\u043b\u0438\u0442\u044c. \u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0430\u043c\u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p(x)\" alt=\"p(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2cd\/170\/7ef\/2cd1707efff0b44445269ea12ad98ff0.svg\" width=\"37\" height=\"22\"\/>. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0436\u0438\u0432\u0443\u0442 \u0441\u0432\u043e\u0435\u0439 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e.<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043f\u0440\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m\" alt=\"x^m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/25c\/f12\/bce\/25cf12bcec0f4cf4de676edb28615e77.svg\" width=\"25\" height=\"18\"\/> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u0438\u0442\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(m\\cdot n)\" alt=\"(m\\cdot n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8de\/1c8\/a10\/8de1c8a109761798236b97f930c6ceed.svg\" width=\"58\" height=\"22\"\/>-\u0433\u043e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0430\u0441\u0447\u0451\u0442\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m+1\" alt=\"x^m+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e46\/d6b\/11d\/e46d6b11d5bc00ece71456e5b334af54.svg\" width=\"59\" height=\"19\"\/>, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043f\u0440\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m\" alt=\"x^m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b80\/ad3\/a10\/b80ad3a104a049a8752353b6f27ffa6f.svg\" width=\"25\" height=\"18\"\/> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0443 (\u043f\u0440\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^0\" alt=\"x^0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2b3\/1ff\/9bd\/2b31ff9bd0e5844b35d2ea9ed73996f4.svg\" width=\"20\" height=\"21\"\/>) \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u043c\u0438\u043d\u0443\u0441:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"x^m + 1\\equiv 0 \\mod(x^m+1) \\\\  \\Downarrow \\\\ x^m\\equiv-1\\mod(x^m+1) \\\\  \\Downarrow \\\\ ax^m\\equiv-a\\mod(x^m+1)\" alt=\"x^m + 1\\equiv 0 \\mod(x^m+1) \\\\  \\Downarrow \\\\ x^m\\equiv-1\\mod(x^m+1) \\\\  \\Downarrow \\\\ ax^m\\equiv-a\\mod(x^m+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2d6\/460\/c7a\/2d6460c7a1d39d7aa1d696b44fecc8cf.svg\" width=\"697\" height=\"130\"\/><\/p>\n<p>\u0410 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{mn}+1\" alt=\"2^{mn}+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f72\/270\/178\/f72270178a49ba9cd7790b75e344e7c5.svg\" width=\"66\" height=\"19\"\/> <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(m\\cdot n)\" alt=\"(m\\cdot n)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/531\/6e3\/589\/5316e358910c0690e5709c80b8da8a22.svg\" width=\"58\" height=\"22\"\/>-\u0439 \u0431\u0438\u0442\u2026 \u0442\u043e\u0436\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0431\u0438\u0442\u0443 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u043c\u0438\u043d\u0443\u0441!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"2^{mn}\\equiv-1\\mod(2^{mn}+1)\" alt=\"2^{mn}\\equiv-1\\mod(2^{mn}+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/909\/a0e\/7e9\/909a0e7e9168e6cc95c469800a9973e8.svg\" width=\"231\" height=\"22\"\/><\/p>\n<p>\u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043d\u0430\u0448\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 <strong>\u0432\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435<\/strong>: \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m+1\" alt=\"x^m+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/132\/600\/8fc\/1326008fcd8ed7b13eb2b64426f30eb2.svg\" width=\"59\" height=\"19\"\/> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044e \u0447\u0438\u0441\u0435\u043b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{mn}\" alt=\"2^{mn}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4c6\/ce1\/def\/4c6ce1defa983ffd578bdbde9aefd5c1.svg\" width=\"32\" height=\"18\"\/>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m\" alt=\"m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/111\/ef5\/4df\/111ef54df3c192be66aedd27f0bf2a30.svg\" width=\"17\" height=\"12\"\/> \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432. \u041d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441: \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e, \u0444\u0440\u0430\u0437\u0430 <em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x\" alt=\"x\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/28a\/bad\/97b\/28abad97be36420c54c0005e281c47c5.svg\" width=\"11\" height=\"12\"\/><\/em> \u0442\u0435\u0440\u044f\u0435\u0442 \u0441\u043c\u044b\u0441\u043b. \u041c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m+1\" alt=\"x^m+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f32\/fcc\/ddf\/f32fccddf6d12bb5cf82cd8cfde20a7a.svg\" width=\"59\" height=\"19\"\/> \u2014 \u044d\u0442\u043e \u043d\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(x)\" alt=\"f(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c5\/632\/7d9\/3c56327d9544a00bd6531d14020db51c.svg\" width=\"37\" height=\"22\"\/>, \u0430 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0438\u0434\u0430<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(x)+(d_0+d_1x+d_2x^2+\\ldots)\\cdot(x^m+1)\" alt=\"f(x)+(d_0+d_1x+d_2x^2+\\ldots)\\cdot(x^m+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/125\/e04\/4ed\/125e044edf04eb8664f8c80940fcf39a.svg\" width=\"348\" height=\"25\"\/><\/p>\n<p>\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"d_i\" alt=\"d_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/06a\/78b\/f40\/06a78bf40434bb2ec006cc01f59a51f5.svg\" width=\"17\" height=\"20\"\/> \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438, \u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0430\u0445.<\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u0448 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e, \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0440\u0435\u0437\u0430\u0432 \u0434\u043b\u0438\u043d\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0442\u043e\u0447\u0435\u043a \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442.<\/p>\n<pre><code class=\"python\"># \u0411\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 4 \u043a\u0443\u0441\u043a\u0430 \u043f\u043e 2 \u0431\u0438\u0442\u0430. m = 4 n_ = 4  # n' \u0441 \u0437\u0430\u043f\u0430\u0441\u043e\u043c  # \u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432: mod = 2**n_ + 1  # 17  # \u0414\u0432\u0430 8-\u0431\u0438\u0442\u043d\u044b\u0445 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f: a_coefs = [0b01, 0b01, 0b10, 0b01]  # 101 b_coefs = [0b01, 0b11, 0b00, 0b01]  # 77   def construct_vandermonde_matrix_and_inverse(xs: List[int]):     # \u0421\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430 \"\u0432 \u043b\u043e\u0431\",     # \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430:     v = np.array([         [pow(xs[i], j, mod) for j in range(m)]         for i in range(m)     ])      # \u0414\u0430\u043b\u044c\u0448\u0435 \u0445\u0438\u0442\u0440\u044b\u0439 \u0444\u043e\u043a\u0443\u0441, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443     # \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435. \u0414\u0430, \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u043b\u0435\u043d\u044c \u043f\u0438\u0441\u0430\u0442\u044c     # \u043c\u0435\u0442\u043e\u0434 \u0413\u0430\u0443\u0441\u0441\u0430 \u0438\u043b\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0438\u0437 sympy.     det = int(round(np.linalg.det(v)))     det_inv = pow(det, mod - 2, mod)     v_inv_real = np.linalg.inv(v) * det * det_inv     v_inv = np.array(np.round(v_inv_real), dtype=int) % mod      # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c      # \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435:     assert np.all((v @ v_inv) % mod == np.eye(m, dtype=int))      return v, v_inv   # \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0442\u043e\u0447\u0435\u043a: for xs in [     [2, 8, 15, 9],     [2, 4, 8, 16],     [3, 5, 7, 11],     [5, 7, 11, 13], ]:     v, v_inv = construct_vandermonde_matrix_and_inverse(xs)     a_y = (v @ a_coefs) % mod     b_y = (v @ b_coefs) % mod     c_y = (a_y * b_y) % mod     c_coefs = (v_inv @ c_y) % mod     print(c_coefs)  # [14  2  4  8] # [ 2 10  4 16] # [ 4  4  0  8] # [ 0  6  4 13]<\/code><\/pre>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f! \u041d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0440\u0430\u0437\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u043d\u0435 \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u2014 \u0443\u0436 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0442\u043e\u0447\u043d\u043e.<\/p>\n<p>\u0414\u0435\u043b\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0443\u0447\u043b\u0438 \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e \u043c\u044b \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m+1\" alt=\"x^m+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/54e\/1a1\/268\/54e1a1268445e0b90b39fdc464817e0e.svg\" width=\"59\" height=\"19\"\/>. \u041a\u0430\u043a \u044d\u0442\u043e \u0443\u0447\u0435\u0441\u0442\u044c?<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u0440\u0430\u0437 \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(x)+(d_0+d_1x+d_2x^2+\\ldots)\\cdot(x^m+1)\" alt=\"f(x)+(d_0+d_1x+d_2x^2+\\ldots)\\cdot(x^m+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/537\/971\/f16\/537971f1602ddb42f94a4470c9600052.svg\" width=\"348\" height=\"25\"\/><\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 <em>\u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u043a<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0440\u0430\u0437\u0430 <em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435<\/em> \u043d\u0435 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0430. \u042d\u0442\u0438 \u0442\u043e\u0447\u043a\u0438 \u2014 \u043a\u043e\u0440\u043d\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x^m+1\" alt=\"x^m+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2b0\/d7a\/67c\/2b0d7a67cb2049e6ca7fcb6b70425911.svg\" width=\"59\" height=\"19\"\/>! \u0412 \u044d\u0442\u0438\u0445 \u0442\u043e\u0447\u043a\u0430\u0445 \u00ab\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0430\u044f\u00bb \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u043b\u044c, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041a\u0430\u043a\u0438\u0435 \u044d\u0442\u043e \u0442\u043e\u0447\u043a\u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435?\u00a0<\/p>\n<pre><code class=\"python\">def xmp1(x):     return (pow(x, m, mod) + 1) % mod  {i: xmp1(i) for i in range(mod)}  # { 0:  1, #   1:  2, #   2:  0,   &lt;-- #   3: 14, #   4:  2, #   5: 14, #   6:  5, #   7:  5, #   8:  0,   &lt;-- #   9:  0,   &lt;-- #  10:  5, #  11:  5, #  12: 14, #  13:  2, #  14: 14, #  15:  0,   &lt;-- #  16:  2}<\/code><\/pre>\n<p>\u0410 \u044d\u0442\u043e \u2014 \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438, \u0432\u0437\u044f\u0442\u044b\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e:<\/p>\n<pre><code class=\"python\">[pow(2, i, mod) for i in range(1, mod, 2)] # [2, 8, 15, 9, 2, 8, 15, 9]<\/code><\/pre>\n<p>\u0412 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0447\u0438\u0441\u043b\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\omega=2^{n'\/m}: \\omega, \\omega^3, \\ldots\" alt=\"\\omega=2^{n'\/m}: \\omega, \\omega^3, \\ldots\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5aa\/5d5\/612\/5aa5d5612055f3180fdd7e6f8d00bac8.svg\" width=\"171\" height=\"25\"\/>.<\/p>\n<p>\u041d\u0435\u0447\u0451\u0442\u043d\u044b\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435. \u0422\u0443\u0442 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u2014 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0412\u0430\u043d\u0434\u0435\u0440\u043c\u043e\u043d\u0434\u0430 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\omega, \\omega^3, \\ldots\" alt=\"\\omega, \\omega^3, \\ldots\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/667\/c47\/22a\/667c4722aea8924cd8a4fed1d4c699c1.svg\" width=\"74\" height=\"24\"\/>, \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0432 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0424\u0443\u0440\u044c\u0435 \u0438 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 \u043d\u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\" \\begin{bmatrix} 1 &amp; \\omega &amp; \\omega^2 &amp; \\omega^3 &amp; \\ldots \\\\  1 &amp; \\omega^3 &amp; \\omega^6 &amp; \\omega^9 &amp; \\ldots \\\\  1 &amp; \\omega^5 &amp; \\omega^{10} &amp; \\omega^{15} &amp; \\ldots \\\\  1 &amp; \\omega^7 &amp; \\omega^{14} &amp; \\omega^{21} &amp; \\ldots \\\\ \\vdots &amp; \\vdots &amp; \\vdots &amp; \\vdots &amp; \\ddots \\end{bmatrix}  =  \\begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; 1 &amp; \\ldots \\\\  1 &amp; \\omega^2 &amp; \\omega^4 &amp; \\omega^6 &amp; \\ldots \\\\  1 &amp; \\omega^4 &amp; \\omega^8 &amp; \\omega^{12} &amp; \\ldots \\\\  1 &amp; \\omega^6 &amp; \\omega^{12} &amp; \\omega^{18} &amp; \\ldots \\\\ \\vdots &amp; \\vdots &amp; \\vdots &amp; \\vdots &amp; \\ddots \\end{bmatrix} \\times  \\begin{bmatrix} 1 &amp;  &amp;  &amp;  &amp; \\\\ &amp; \\omega &amp;  &amp;  &amp; \\\\  &amp;  &amp; \\omega^2 &amp;  &amp; \\\\ &amp;  &amp;  &amp; \\omega^3 &amp; \\\\ &amp;  &amp;  &amp;  &amp; \\ddots \\end{bmatrix}\" alt=\" \\begin{bmatrix} 1 &amp; \\omega &amp; \\omega^2 &amp; \\omega^3 &amp; \\ldots \\\\  1 &amp; \\omega^3 &amp; \\omega^6 &amp; \\omega^9 &amp; \\ldots \\\\  1 &amp; \\omega^5 &amp; \\omega^{10} &amp; \\omega^{15} &amp; \\ldots \\\\  1 &amp; \\omega^7 &amp; \\omega^{14} &amp; \\omega^{21} &amp; \\ldots \\\\ \\vdots &amp; \\vdots &amp; \\vdots &amp; \\vdots &amp; \\ddots \\end{bmatrix}  =  \\begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; 1 &amp; \\ldots \\\\  1 &amp; \\omega^2 &amp; \\omega^4 &amp; \\omega^6 &amp; \\ldots \\\\  1 &amp; \\omega^4 &amp; \\omega^8 &amp; \\omega^{12} &amp; \\ldots \\\\  1 &amp; \\omega^6 &amp; \\omega^{12} &amp; \\omega^{18} &amp; \\ldots \\\\ \\vdots &amp; \\vdots &amp; \\vdots &amp; \\vdots &amp; \\ddots \\end{bmatrix} \\times  \\begin{bmatrix} 1 &amp;  &amp;  &amp;  &amp; \\\\ &amp; \\omega &amp;  &amp;  &amp; \\\\  &amp;  &amp; \\omega^2 &amp;  &amp; \\\\ &amp;  &amp;  &amp; \\omega^3 &amp; \\\\ &amp;  &amp;  &amp;  &amp; \\ddots \\end{bmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e84\/a87\/770\/e84a8777035ab6352f4c73bf75fa35c6.svg\" width=\"695\" height=\"149\"\/><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u2014 \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2m-1\" alt=\"2m-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/426\/ef2\/1de\/426ef21de7bb35f372b7cef4bf258b3a.svg\" width=\"61\" height=\"18\"\/> \u043a \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m-1\" alt=\"m-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4c7\/b5f\/e8b\/4c7b5fe8bed26efb952a500965c20afa.svg\" width=\"51\" height=\"18\"\/>, \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c 2 \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438\u0441\u0447\u0435\u0437\u0430\u0435\u0442:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N) \\approx {\\color{Gray}{\\not{2}}}\\cdot c(2\\sqrt{N}) + \\mathrm{const}\" alt=\"c(N) \\approx {\\color{Gray}{\\not{2}}}\\cdot c(2\\sqrt{N}) + \\mathrm{const}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1e9\/588\/9e5\/1e95889e5165fd58f87cbddf84ba1bf2.svg\" width=\"232\" height=\"25\"\/><\/p>\n<p>\u0413\u043b\u0443\u0431\u0438\u043d\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log\\log N\" alt=\"\\log\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/018\/a2b\/b43\/018a2bb4319a2a3937cb9c4165e876d3.svg\" width=\"74\" height=\"21\"\/>, \u043d\u043e \u0431\u0435\u0437 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f-\u0434\u0432\u043e\u0439\u043a\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"c(N)\" alt=\"c(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/119\/9b3\/705\/1199b37057be227a6606754638206d81.svg\" width=\"41\" height=\"22\"\/> \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\log\\log N\" alt=\"\\log\\log N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84c\/d94\/a7f\/84cd94a7f9d2310eefdc9793a4903267.svg\" width=\"74\" height=\"21\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"c(N) \\approx \\underbrace{{\\color{Gray}{\\not{2^k}}} \\cdot c(2\\sqrt{2}\\sqrt[4]{2}\\ldots\\!\\!\\!\\sqrt[2^{k-1}]{2}\\sqrt[2^k]{N}) + \\ldots + {\\color{Gray}{\\not{4}}}\\cdot \\mathrm{const} + {\\color{Gray}{\\not{2}}}\\cdot \\mathrm{const} + \\mathrm{const}}_{\\log\\log N\\mbox{ \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445}}\" alt=\"c(N) \\approx \\underbrace{{\\color{Gray}{\\not{2^k}}} \\cdot c(2\\sqrt{2}\\sqrt[4]{2}\\ldots\\!\\!\\!\\sqrt[2^{k-1}]{2}\\sqrt[2^k]{N}) + \\ldots + {\\color{Gray}{\\not{4}}}\\cdot \\mathrm{const} + {\\color{Gray}{\\not{2}}}\\cdot \\mathrm{const} + \\mathrm{const}}_{\\log\\log N\\mbox{ \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d2\/662\/beb\/3d2662beb5749c86ba6de2124235c6d3.svg\" width=\"596\" height=\"72\"\/><\/p>\n<p>\u0421\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"C(N) = O({\\color{DarkGreen}{N\\cdot\\log N\\cdot\\log\\log N}})\" alt=\"C(N) = O({\\color{DarkGreen}{N\\cdot\\log N\\cdot\\log\\log N}})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/73e\/ed6\/927\/73eed69279b99d0ea21afac7c3624ee1.svg\" width=\"269\" height=\"22\"\/><\/p>\n<p>\u0427\u0442\u043e \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430!<\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h3>\n<p>\u0418\u0442\u0430\u043a! \u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<ol>\n<li>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u0447\u0443 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^N+1\" alt=\"2^N+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/222\/000\/931\/22200093181f6debc09c3c65a8e95869.svg\" width=\"58\" height=\"22\"\/>. \u041a\u0430\u043a\u0438\u0435 \u0431\u044b \u0443 \u043d\u0430\u0441 \u043d\u0438 \u0431\u044b\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0447\u0438\u0441\u043b\u0430, \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/138\/a96\/224\/138a96224e2b2ad01252e2b9c15d718b.svg\" width=\"17\" height=\"17\"\/> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043b\u0435\u0437 \u0432 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/067\/e14\/e04\/067e14e0441c469cf4eb7c983d058163.svg\" width=\"17\" height=\"17\"\/> \u0431\u0438\u0442. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N\" alt=\"N\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f57\/3b8\/f42\/f573b8f420a20c769910c0e101859bdb.svg\" width=\"17\" height=\"17\"\/> \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\overbrace{1001010011000001}^{N = \\,2^k\\mbox{ \u0431\u0438\u0442}} \\times \\overbrace{1100000001001110}^{N = \\,2^k\\mbox{ \u0431\u0438\u0442}} \\mod (2^N+1)\" alt=\"\\overbrace{1001010011000001}^{N = \\,2^k\\mbox{ \u0431\u0438\u0442}} \\times \\overbrace{1100000001001110}^{N = \\,2^k\\mbox{ \u0431\u0438\u0442}} \\mod (2^N+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/420\/7db\/22c\/4207db22ce9e7b50d66a6e85144d130b.svg\" width=\"477\" height=\"61\"\/><\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m\" alt=\"m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/87b\/66a\/2fc\/87b66a2fc448ce8c940d8e1a78869b91.svg\" width=\"17\" height=\"12\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b9e\/915\/104\/b9e91510472f50f47150cd677cf060c1.svg\" width=\"12\" height=\"12\"\/> \u0442\u0430\u043a\u0438\u0435, \u0447\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N = m\\cdot n\" alt=\"N = m\\cdot n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a82\/37b\/db5\/a8237bdb557200c2d61e8ad9b49ba516.svg\" width=\"87\" height=\"17\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m, n \\approx \\sqrt{N}\" alt=\"m, n \\approx \\sqrt{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b01\/96e\/c04\/b0196ec04cb4a0679e05aba5c7e789b9.svg\" width=\"97\" height=\"24\"\/>. \u0415\u0441\u0442\u044c \u0445\u0438\u0442\u0440\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430, \u044f \u0438\u0445 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443; \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 [5]. \u0414\u0435\u043b\u0438\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c, \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m\" alt=\"m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/256\/100\/097\/256100097a81b978d68f4263f8df4da1.svg\" width=\"17\" height=\"12\"\/> \u0447\u0430\u0441\u0442\u0435\u0439 \u043f\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n\" alt=\"n\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/623\/099\/414\/6230994144e18ca3ad344d005886899b.svg\" width=\"12\" height=\"12\"\/> \u0431\u0438\u0442.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\overbrace{\\underbrace{\\color{Red}{1001}}_{n}\\underbrace{\\color{Red}{0100}}_{n}\\underbrace{\\color{DarkBlue}{1100}}_{n}\\underbrace{\\color{DarkBlue}{0001}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}} \\times  \\overbrace{\\underbrace{\\color{DarkOrange}{1100}}_{n}\\underbrace{\\color{DarkOrange}{0000}}_{n}\\underbrace{\\color{Magenta}{0100}}_{n}\\underbrace{\\color{Magenta}{1110}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}}\\mod (2^N+1)\" alt=\"\\overbrace{\\underbrace{\\color{Red}{1001}}_{n}\\underbrace{\\color{Red}{0100}}_{n}\\underbrace{\\color{DarkBlue}{1100}}_{n}\\underbrace{\\color{DarkBlue}{0001}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}} \\times  \\overbrace{\\underbrace{\\color{DarkOrange}{1100}}_{n}\\underbrace{\\color{DarkOrange}{0000}}_{n}\\underbrace{\\color{Magenta}{0100}}_{n}\\underbrace{\\color{Magenta}{1110}}_{n}}^{N = \\,m\\cdot n\\mbox{ \u0431\u0438\u0442}}\\mod (2^N+1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1d\/1ca\/e7d\/d1d1cae7dc687df36c09b8fa61f3b8ba.svg\" width=\"477\" height=\"85\"\/><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n'\\approx\u00a0 2n+\\log m\" alt=\"n'\\approx\u00a0 2n+\\log m\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c87\/b67\/0be\/c87b670be38b7d2f45d9aaf418a5a157.svg\" width=\"135\" height=\"23\"\/> \u0431\u0438\u0442, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0431\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(\\underbrace{00\\color{Red}{1001}}_{n'}\\cdot\\,x^3 + \\underbrace{00\\color{Red}{0100}}_{n'}\\cdot\\,x^2 + \\ldots) \\times (\\underbrace{00\\color{DarkOrange}{1100}}_{n'}\\cdot\\,x^3 + \\underbrace{00\\color{DarkOrange}{0000}}_{n'}\\cdot\\,x^2 + \\ldots)\" alt=\"(\\underbrace{00\\color{Red}{1001}}_{n'}\\cdot\\,x^3 + \\underbrace{00\\color{Red}{0100}}_{n'}\\cdot\\,x^2 + \\ldots) \\times (\\underbrace{00\\color{DarkOrange}{1100}}_{n'}\\cdot\\,x^3 + \\underbrace{00\\color{DarkOrange}{0000}}_{n'}\\cdot\\,x^2 + \\ldots)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/edb\/b02\/a94\/edbb02a94e4b2ad25a672902c455f62c.svg\" width=\"581\" height=\"51\"\/><\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0440\u0443\u043a\u0430\u0445 \u0434\u0432\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432. \u0412\u0435\u043a\u0442\u043e\u0440\u044b \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m + 1\" alt=\"m + 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/475\/585\/74f\/47558574fff7069592fe851a1d04d5d2.svg\" width=\"51\" height=\"18\"\/>, \u0447\u0438\u0441\u043b\u0430 \u0432 \u043d\u0438\u0445 \u0434\u043b\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"n'\" alt=\"n'\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/258\/c91\/4b3\/258c914b3f269945edede1f7103a7291.svg\" width=\"18\" height=\"19\"\/> \u0431\u0438\u0442. \u042d\u0442\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0441\u043f\u0435\u0440\u0432\u0430 \u043d\u0430 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 (\u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u0445 \u0432\u044b\u0448\u0435) \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(m\\cdot n') = O(N)\" alt=\"O(m\\cdot n') = O(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/03e\/e12\/7cb\/03ee127cb635d16db4d6ba53b5327459.svg\" width=\"153\" height=\"23\"\/>, \u043f\u043e\u0442\u043e\u043c \u0434\u0435\u043b\u0430\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(m\\cdot n'\\cdot \\log m) = O(N\\log N)\" alt=\"O(m\\cdot n'\\cdot \\log m) = O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/820\/90c\/529\/82090c529a0538a874ccb1f060c125c4.svg\" width=\"261\" height=\"23\"\/>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"FFT \\times \\begin{bmatrix} 1 &amp;  &amp;  &amp;  &amp; \\\\ &amp; \\omega &amp;  &amp;  &amp; \\\\  &amp;  &amp; \\omega^2 &amp;  &amp; \\\\ &amp;  &amp;  &amp; \\omega^3 &amp; \\\\ &amp;  &amp;  &amp;  &amp; \\ddots \\end{bmatrix} \\times \\begin{bmatrix} 00{\\color{DarkBlue}{0001}} \\\\  00{\\color{DarkBlue}{1100}} \\\\  00{\\color{Red}{0100}} \\\\  00{\\color{Red}{1001}} \\\\  \\vdots \\end{bmatrix},\\quad FFT \\times \\begin{bmatrix}\\ldots\\end{bmatrix} \\times \\begin{bmatrix} 00{\\color{Magenta}{1110}} \\\\  00{\\color{Magenta}{0100}} \\\\  00{\\color{DarkOrange}{0000}} \\\\  00{\\color{DarkOrange}{1100}} \\\\  \\vdots \\end{bmatrix}\" alt=\"FFT \\times \\begin{bmatrix} 1 &amp;  &amp;  &amp;  &amp; \\\\ &amp; \\omega &amp;  &amp;  &amp; \\\\  &amp;  &amp; \\omega^2 &amp;  &amp; \\\\ &amp;  &amp;  &amp; \\omega^3 &amp; \\\\ &amp;  &amp;  &amp;  &amp; \\ddots \\end{bmatrix} \\times \\begin{bmatrix} 00{\\color{DarkBlue}{0001}} \\\\  00{\\color{DarkBlue}{1100}} \\\\  00{\\color{Red}{0100}} \\\\  00{\\color{Red}{1001}} \\\\  \\vdots \\end{bmatrix},\\quad FFT \\times \\begin{bmatrix}\\ldots\\end{bmatrix} \\times \\begin{bmatrix} 00{\\color{Magenta}{1110}} \\\\  00{\\color{Magenta}{0100}} \\\\  00{\\color{DarkOrange}{0000}} \\\\  00{\\color{DarkOrange}{1100}} \\\\  \\vdots \\end{bmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/286\/a32\/ca1\/286a32ca1d7aaff17509d48361ca3daa.svg\" width=\"635\" height=\"148\"\/><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043f\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{n'}+1\" alt=\"2^{n'}+1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5e5\/394\/18b\/5e539418bd0b18165703d6864eacd77e.svg\" width=\"58\" height=\"23\"\/> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u044d\u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435). \u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(\\log\\log N)\" alt=\"O(\\log\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c96\/cac\/7f8\/c96cac7f83d0a791b3bfcecced7a75a7.svg\" width=\"104\" height=\"22\"\/>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\begin{array}{c} \\underbrace{[ \\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad ]}_{N}\\ \\times\\ \\underbrace{[ \\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad ]}_{N} \\\\ \\downarrow \\\\[5mm] \\qquad\\qquad\\quad\\underbrace{[ \\qquad\\qquad\\qquad ]}_{\\sqrt{N}}\\,\\times\\,\\underbrace{[ \\qquad\\qquad\\qquad ]}_{\\sqrt{N}} \\qquad\\sqrt{N}\\mbox{ \u0440\u0430\u0437} \\\\ \\downarrow \\\\[5mm] \\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\underbrace{[ \\qquad ]}_{\\sqrt[4]{N}}\\,\\times\\,\\underbrace{[ \\qquad ]}_{\\sqrt[4]{N}} \\qquad\\sqrt{N}\\cdot\\sqrt[4]{N} = N^{3\/4}\\mbox{ \u0440\u0430\u0437} \\\\ \\downarrow \\\\[5mm] \\cdots \\end{array}\" alt=\"\\begin{array}{c} \\underbrace{[ \\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad ]}_{N}\\ \\times\\ \\underbrace{[ \\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad ]}_{N} \\\\ \\downarrow \\\\[5mm] \\qquad\\qquad\\quad\\underbrace{[ \\qquad\\qquad\\qquad ]}_{\\sqrt{N}}\\,\\times\\,\\underbrace{[ \\qquad\\qquad\\qquad ]}_{\\sqrt{N}} \\qquad\\sqrt{N}\\mbox{ \u0440\u0430\u0437} \\\\ \\downarrow \\\\[5mm] \\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\underbrace{[ \\qquad ]}_{\\sqrt[4]{N}}\\,\\times\\,\\underbrace{[ \\qquad ]}_{\\sqrt[4]{N}} \\qquad\\sqrt{N}\\cdot\\sqrt[4]{N} = N^{3\/4}\\mbox{ \u0440\u0430\u0437} \\\\ \\downarrow \\\\[5mm] \\cdots \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d35\/b16\/66b\/d35b1666b6e4ccc0c28b8dd3445ec8ce.svg\" width=\"688\" height=\"376\"\/><\/p>\n<\/li>\n<li>\n<p>\u041a \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0443\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N)\" alt=\"O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/931\/c47\/f42\/931c47f4245b7478471415abb931eb21.svg\" width=\"96\" height=\"22\"\/>, \u043f\u043e\u0442\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N)\" alt=\"O(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4e5\/433\/00e\/4e543300eb7ee0884f52ae9528d313e9.svg\" width=\"48\" height=\"22\"\/>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\begin{bmatrix} 1 &amp;  &amp;  &amp;  &amp; \\\\ &amp; \\omega^{-1} &amp;  &amp;  &amp; \\\\  &amp;  &amp; \\omega^{-2} &amp;  &amp; \\\\ &amp;  &amp;  &amp; \\omega^{-3} &amp; \\\\ &amp;  &amp;  &amp;  &amp; \\ddots \\end{bmatrix} \\times IFFT \\times \\left[\\!\\!\\begin{array}{r}001001 \\\\ 110111 \\\\ 1000000 \\\\ 011001 \\\\ \\vdots \\end{array}\\!\\!\\right]\" alt=\"\\begin{bmatrix} 1 &amp;  &amp;  &amp;  &amp; \\\\ &amp; \\omega^{-1} &amp;  &amp;  &amp; \\\\  &amp;  &amp; \\omega^{-2} &amp;  &amp; \\\\ &amp;  &amp;  &amp; \\omega^{-3} &amp; \\\\ &amp;  &amp;  &amp;  &amp; \\ddots \\end{bmatrix} \\times IFFT \\times \\left[\\!\\!\\begin{array}{r}001001 \\\\ 110111 \\\\ 1000000 \\\\ 011001 \\\\ \\vdots \\end{array}\\!\\!\\right]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aba\/60b\/bed\/aba60bbed3f616690ff9bba769f97c30.svg\" width=\"430\" height=\"148\"\/><\/p>\n<p>(\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 1000000 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e \u0440\u043e\u0432\u043d\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2^{n'}\" alt=\"2^{n'}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa9\/842\/34a\/fa984234a02745f9a04ea673deae1c8d.svg\" width=\"24\" height=\"22\"\/>, \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e, \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u043e\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u043e\u0439!)<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e-\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N)\" alt=\"O(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c8\/11c\/427\/2c811c427240093fe561cf2e2a4c4e9d.svg\" width=\"48\" height=\"22\"\/>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\begin{array}{rrrrrrrr} &amp;&amp;&amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!11\\overset{\\displaystyle\\leftarrow}{10} \\\\ &amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ &amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!110&amp;\\!\\!\\!\\!\\!\\!1000 \\\\ &amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1001&amp;\\!\\!\\!\\!\\!\\!1010 \\\\  &amp;&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!0100 \\\\ &amp;11&amp;\\!\\!\\!\\!\\!\\!0000 \\\\ 110&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ \\hline 110&amp;\\!\\!\\!\\!\\!\\!1111&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!1110&amp;\\!\\!\\!\\!\\!\\!0001&amp;\\!\\!\\!\\!\\!\\!0010&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1110 \\end{array}\" alt=\"\\begin{array}{rrrrrrrr} &amp;&amp;&amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!11\\overset{\\displaystyle\\leftarrow}{10} \\\\ &amp;&amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ &amp;&amp;&amp;&amp;\\!\\!\\!\\!\\!\\!110&amp;\\!\\!\\!\\!\\!\\!1000 \\\\ &amp;&amp;&amp;\\!\\!\\!\\!\\!\\!1001&amp;\\!\\!\\!\\!\\!\\!1010 \\\\  &amp;&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!0100 \\\\ &amp;11&amp;\\!\\!\\!\\!\\!\\!0000 \\\\ 110&amp;\\!\\!\\!\\!\\!\\!1100 \\\\ \\hline 110&amp;\\!\\!\\!\\!\\!\\!1111&amp;\\!\\!\\!\\!\\!\\!1011&amp;\\!\\!\\!\\!\\!\\!1110&amp;\\!\\!\\!\\!\\!\\!0001&amp;\\!\\!\\!\\!\\!\\!0010&amp;\\!\\!\\!\\!\\!\\!1100&amp;\\!\\!\\!\\!\\!\\!1110 \\end{array}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0d4\/cbd\/11a\/0d4cbd11a949344e5a309426112bbed7.svg\" width=\"325\" height=\"232\"\/><\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451! \u0412\u0441\u0435 \u0433\u0435\u043d\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0451\u043c\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430 \u043b\u0435\u0436\u0430\u0442 \u0443 \u043d\u0430\u0441 \u043f\u0435\u0440\u0435\u0434 \u0433\u043b\u0430\u0437\u0430\u043c\u0438. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0451\u043c\u043e\u0432; \u043d\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u0434\u0435\u0439\u043d\u043e\u043c \u043c\u044b \u043e\u0441\u0432\u043e\u0438\u043b\u0438 \u0435\u0433\u043e \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p>\u0412 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0442\u0430\u043a\u043e\u043c \u0443\u0436 \u0434\u0430\u043b\u0451\u043a\u043e\u043c 1960 \u0433\u043e\u0434\u0443 \u0410\u043d\u0434\u0440\u0435\u0439 \u041a\u043e\u043b\u043c\u043e\u0433\u043e\u0440\u043e\u0432, \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0435\u043b\u0438\u0447\u0430\u0439\u0448\u0438\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0432 \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0432\u044b\u0434\u0432\u0438\u043d\u0443\u043b \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/212\/cd9\/09b\/212cd909b9dd6ad8080e0a8edc198db9.svg\" width=\"57\" height=\"25\"\/>. \u0418 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0438\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430, \u0447\u0435\u043c \u044d\u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u043e\u0441\u043d\u043e\u0432\u043e\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043e\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/866\/071\/690\/8660716901e9081630efcdf750eb87a0.svg\" width=\"57\" height=\"25\"\/> \u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N\\log\\log N)\" alt=\"O(N\\log N\\log\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d16\/85d\/6d0\/d1685d6d03bdbd7ceb03ad38d2bb2475.svg\" width=\"174\" height=\"22\"\/>; \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0424\u0443\u0440\u044c\u0435, \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0435 \u0438 \u0430\u043b\u0433\u0435\u0431\u0440\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432.<\/p>\n<p>\u0417\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0441\u0442\u0430\u043b\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%A4%D1%8E%D1%80%D0%B5%D1%80%D0%B0\" rel=\"noopener noreferrer nofollow\"><u>\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0424\u044e\u0440\u0435\u0440\u0430<\/u><\/a> \u0438 \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 2020-\u043c \u0433\u043e\u0434\u0443 [6] \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O(N\\log N)\" alt=\"O(N\\log N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a4\/bf5\/059\/8a4bf5059cdbafbbf740a18fafca3e54.svg\" width=\"96\" height=\"22\"\/>; \u0435\u0441\u043b\u0438 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0438 \u0438\u0445.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<h3>P. S.<\/h3>\n<p>\u042d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e, \u0438\u0437\u0431\u0435\u0433\u0430\u044f \u043f\u0440\u0438\u0441\u0443\u0449\u0435\u0439 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0430\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u0433\u043e\u0441\u0442\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b, \u0433\u0434\u0435-\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043e\u0439\u0442\u0438 \u0431\u0435\u0437 \u043d\u0438\u0445 (\u043c\u0430\u043b\u043e \u0433\u0434\u0435); \u0432 \u0438\u0445 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043e\u043d\u0438 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0441 \u0445\u043e\u0434\u0443, \u0431\u0435\u0437 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0441 \u0431\u0443\u043c\u0430\u0436\u043a\u043e\u0439 \u0438 \u0440\u0443\u0447\u043a\u043e\u0439 (\u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u043c, \u0437\u0430\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d); \u0442\u0430\u043a\u0436\u0435 \u044f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e (\u00ab\u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u00ab\u0432 \u043a\u043e\u043b\u044c\u0446\u0435 \u0432\u044b\u0447\u0435\u0442\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e\u00bb). \u0421\u0443\u0434\u044c\u0451\u0439 \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u044f \u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u0443\u0434\u0430\u043b\u0430\u0441\u044c, \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u0431\u0435, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c; \u043c\u043d\u0435 \u0436\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0432\u0435\u0436\u0438\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443, \u043e\u0431\u044b\u0447\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0437\u0432\u044b\u0448\u0435\u043d\u043d\u043e-\u0442\u0440\u0443\u0434\u043d\u043e\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e.<\/p>\n<h2>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430<\/h2>\n<ol>\n<li>\n<p>Pan, Victor. &#171;How can we speed up matrix multiplication?.&#187; SIAM review 26.3 (1984): 393-415. <a href=\"http:\/\/comet.lehman.cuny.edu\/vpan\/pdf\/PanSIAMReview84.pdf\" rel=\"noopener noreferrer nofollow\">PDF<\/a><\/p>\n<\/li>\n<li>\n<p>Pan, Victor. &#171;Strassen&#8217;s algorithm is not optimal trilinear technique of aggregating, uniting and canceling for constructing fast algorithms for matrix operations.&#187; 19th Annual Symposium on Foundations of Computer Science (sfcs 1978). IEEE, 1978.<\/p>\n<\/li>\n<li>\n<p>Pan, Victor. &#171;How bad are Vandermonde matrices?.&#187; SIAM Journal on Matrix Analysis and Applications 37.2 (2016): 676-694. <a href=\"https:\/\/arxiv.org\/pdf\/1504.02118.pdf\" rel=\"noopener noreferrer nofollow\">PDF<\/a><\/p>\n<\/li>\n<li>\n<p>Pharr, Matt, and Randima Fernando. GPU Gems 2: Programming techniques for high-performance graphics and general-purpose computation (gpu gems). Addison-Wesley Professional, 2005. <a href=\"https:\/\/developer.nvidia.com\/gpugems\/gpugems2\/part-vi-simulation-and-numerical-algorithms\/chapter-48-medical-image-reconstruction#:~:text=The%20FFT%20is%20a%20heavily,from%20the%20acquired%20raw%20data\" rel=\"noopener noreferrer nofollow\">HTML<\/a><\/p>\n<\/li>\n<li>\n<p>Kruppa, Alexander. &#171;A GMP-based implementation of Schonhage-Strassen\u2019s large integer multiplication algorithm.&#187; <a href=\"https:\/\/hal.inria.fr\/inria-00126462v1\/document\" rel=\"noopener noreferrer nofollow\">PDF<\/a><\/p>\n<\/li>\n<li>\n<p>Harvey, David, and Joris Van Der Hoeven. &#171;Integer multiplication in time O (n log n).&#187;\u00a0<em>Annals of Mathematics<\/em>\u00a0193.2 (2021): 563-617. <a href=\"https:\/\/hal.science\/hal-02070778v2\/file\/nlogn.pdf\" rel=\"noopener noreferrer nofollow\">PDF<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h2>\n<ol>\n<li>\n<p><a href=\"https:\/\/numpy.org\/\" rel=\"noopener noreferrer nofollow\">NumPy<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.sympy.org\/en\/index.html\" rel=\"noopener noreferrer nofollow\">SymPy<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/gmplib.org\/\" rel=\"noopener noreferrer nofollow\">GMP<\/a> \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0430\u0441\u044c \u043a\u0430\u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0440 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll-container\">\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/post\/719648\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0446\u0435\u043d\u0438\u0442\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0431\u044b\u043b\u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             66.67%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043c\u0435\u0440\u0435<\/span> <span class=\"tm-article-poll__answer-votes\">             16           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:66.67%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             33.33%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u043e<\/span> <span class=\"tm-article-poll__answer-votes\">             8           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:33.33%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 24 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.           \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 2 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.      <\/div>\n<\/div>\n<\/div>\n<p> \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\/post\/719648\/\"> https:\/\/habr.com\/ru\/post\/719648\/<\/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<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043c\u044b \u0440\u0435\u0434\u043a\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0442\u0435 \u0438\u043b\u0438\u00a0\u0438\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c. \u0420\u0430\u0434\u0438 \u044d\u0442\u043e\u0433\u043e \u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043a\u0430\u0441\u043a\u0430\u0434 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439: \u043d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u043c \u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u00a0\u0433\u043e\u043b\u043e\u0432\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u0441\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u00a0\u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0418 \u0443\u0436 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 a * b \u043c\u044b \u043d\u0435\u00a0\u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u0435\u043b a \u0438 b \u0432\u00a0\u043d\u0430\u0448\u0435\u043c \u044f\u0437\u044b\u043a\u0435. \u041a\u0430\u043a\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0435\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f? \u042d\u0442\u043e \u043a\u0430\u043a\u0430\u044f\u2011\u0442\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430?<\/p>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u0441\u00a0\u043d\u0443\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432\u00a0\u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u00a0\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u0438\u0451\u043c\u0430\u043c\u0438, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438.<\/p>\n<h3>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h3>\n<ol>\n<li>\n<p><a href=\"#table\" rel=\"noopener noreferrer nofollow\">\u0415\u0433\u043e \u0432\u0435\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0438\u043a<\/a><br \/>    \u2022 <a href=\"#o-notation\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u041e-\u043d\u043e\u0442\u0430\u0446\u0438\u044e<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#karatsuba\" rel=\"noopener noreferrer nofollow\">\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0439 \u0438 \u0432\u043b\u0430\u0441\u0442\u0432\u0443\u0439: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#schonhage-strassen\" rel=\"noopener noreferrer nofollow\">\u041c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b vs \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/a><br \/>    \u2022 <a href=\"#fourier-transform\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#schonhage-strassen-2\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u0435\u043d\u0445\u0430\u0433\u0435-\u0428\u0442\u0440\u0430\u0441\u0441\u0435\u043d\u0430<\/a><br \/>    \u2022 <a href=\"#modular-arithmetic\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u0447\u0438\u0441\u0435\u043b<\/a><br \/>    \u2022 <a href=\"#polynomial-modular-arithmetic\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u0417\u0430\u0447\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430?<\/h2>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u0430. \u041f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f 32-\u0431\u0438\u0442\u043d\u044b\u0445, 64-\u0431\u0438\u0442\u043d\u044b\u0445, \u0430\u00a0\u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432\u00a0\u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u043e\u2011\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<u> <\/u>\u043c\u0438\u043a\u0440\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432; \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043f\u0435\u0439 \u0434\u043b\u044f\u00a0\u043a\u0440\u0435\u043c\u043d\u0438\u044f\u00a0\u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u0430\u044f \u043d\u0430\u0443\u043a\u0430. \u041d\u043e\u00a0\u043d\u0435\u00a0\u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0445\u0432\u0430\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f\u00a0\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b (\u0432\u0440\u043e\u0434\u0435 \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/RSA\" rel=\"noopener noreferrer nofollow\"><u>RSA<\/u><\/a>) \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0434\u043b\u0438\u043d\u043e\u0439 \u0432\u00a0\u0442\u044b\u0441\u044f\u0447\u0438 \u0431\u0438\u0442. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0432\u043e\u0434\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 4096-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043a\u00a0\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u043d\u0430\u0434 64-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u00a0\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0437\u0430  \u0438  \u0443\u0436\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u044c \u0440\u0430\u0437!<\/p>\n<p>\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 <a href=\"https:\/\/blog.segger.com\/algorithms-for-division-part-3-using-multiplication\/\" rel=\"noopener noreferrer nofollow\"><u>\u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u00a0\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044e<\/u><\/a>; \u0432\u00a0\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f\u00a0\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f. <\/p>\n<p><a class=\"anchor\" name=\"table\" id=\"table\"><\/a><\/p>\n<p>\u041d\u043e\u00a0\u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c: \u043d\u0435\u00a0\u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b\u00a0\u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b \u0434\u043b\u044f\u00a0\u0448\u0438\u0440\u043e\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u00a0\u2014 \u043f\u043e\u00a0\u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043d\u0430\u00a0\u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c. \u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u0434\u0435\u0441\u044c \u0441\u0438\u043b\u0451\u043d \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441. \u041a\u0430\u043a\u00a0\u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f? \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e\u00a0\u0431\u044b\u0441\u0442\u0440\u043e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u041c\u043e\u0436\u0435\u043c\u00a0\u043b\u0438 \u043c\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438 \u0447\u0435\u043c\u0443 \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0432\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0438\u0441\u043a\u0430?<\/p>\n<h2>\u0415\u0433\u043e \u0432\u0435\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0438\u043a<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430-\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0432\u043d\u043e \u043c\u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u043b\u0430\u0437\u0430 <a href=\"https:\/\/www.youtube.com\/watch?v=VJf8XAhC550\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0438\u0434\u0435\u043e<\/u><\/a> \u0441 \u043a\u0440\u0438\u0447\u0430\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;How to Multiply&#187;, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u044f\u043f\u043e\u043d\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. \u0427\u0442\u043e \u043c\u0435\u043d\u044f \u0443\u0434\u0438\u0432\u0438\u043b\u043e \u2014 \u0442\u0430\u043a \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u0430\u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a, \u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043b\u0438\u0441\u0442\u0430 \u0431\u0443\u043c\u0430\u0433\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435!<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u0430-\u0434\u0430, \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c. \u041c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0451 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u043e\u0439:<\/p>\n<figure class=\"\"><\/figure>\n<p>92 \u2014 \u044d\u0442\u043e \u0434\u0432\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043d\u0438\u0436\u043d\u0435-\u043f\u0440\u0430\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438. 23 \u2014 \u0434\u0432\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430 \u0432\u0435\u0440\u0445\u043d\u0435-\u043b\u0435\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0435, \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u044b, \u043f\u043e\u0442\u043e\u043c \u0441\u043b\u043e\u0436\u0438\u0442\u044c, \u0438 \u043f\u043e\u0442\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u2014 \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435 \u0438 <em>\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/em> \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439 \u0432 \u0441\u0435\u0431\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0435 \u0434\u043e XX \u0432\u0435\u043a\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0437\u0430 \u0440\u0435\u0434\u043a\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u043e\u0434\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%95%D0%B3%D0%B8%D0%BF%D0%B5%D1%82%D1%81%D0%BA%D0%B8%D0%B5_%D0%B4%D1%80%D0%BE%D0%B1%D0%B8\" rel=\"noopener noreferrer nofollow\"><u>\u0435\u0433\u0438\u043f\u0435\u0442\u0441\u043a\u0438\u0445 \u0434\u0440\u043e\u0431\u0435\u0439<\/u><\/a>.<\/p>\n<p>\u0410\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0432 \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442  \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0433\u0434\u0435  \u0438  \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0432 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437  \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437  \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0435\u0441\u044f  \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0447\u0438\u0441\u0435\u043b (\u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432) \u0441\u043b\u043e\u0436\u0438\u0442\u044c.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0443 \u0447\u0438\u0441\u0435\u043b \u0440\u0430\u0437\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432, \u044d\u0442\u043e \u0432\u0435\u0440\u043d\u043e. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0432 \u0447\u0438\u0441\u043b\u0435 x \u0440\u0430\u0432\u043d\u043e \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u2014  (\u0441\u043a\u043e\u0431\u043a\u0438-\u0443\u0433\u043e\u043b\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0432\u0432\u0435\u0440\u0445). \u041d\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u044b \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u043c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u043c:<\/p>\n<p>\u0410 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0438.<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"o-notation\" id=\"o-notation\"><\/a><\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434  \u0438  \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <em>\u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0445<\/em> \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432, \u0430 \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u044b; \u0442\u043e\u0433\u0434\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f \u0434\u043e .<\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c O(N\u00b2)?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u041e-\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0443\u0447\u0438\u0442 \u0443\u043b\u0438\u0446\u0430 \u2014 \u043e\u043d\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u0439 \u0441\u0440\u0430\u0437\u0443 \u0432 \u043e\u0446\u0435\u043d\u043a\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u043e \u041e-\u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0438 \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0441\u043c\u044b\u0441\u043b, \u043f\u0440\u0438\u0447\u0451\u043c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f  \u2014 \u0432 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u044d\u0442\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435  \u0431\u0438\u0442 \u2014 \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c  \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 C \u0442\u0430\u043a\u0430\u044f, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/em>, \u0447\u0435\u043c N^2.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u0430 \u0437\u0430\u043f\u0438\u0441\u044c  \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <em>\u043a\u043b\u0430\u0441\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/em>, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435. \u0412 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u043a\u043e-\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a  \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0445\u043e\u0434\u0438\u0442 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0440\u0430\u0441\u0442\u0443\u0449\u0438\u0445 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u0433\u043e-\u0442\u043e \u0442\u0430\u043c.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u0442\u043e\u043c, \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0438 <em>\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435<\/em>, \u0447\u0435\u043c . \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0431\u0435\u0437 \u0437\u0430\u0437\u0440\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c  \u2014 \u0438 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0431\u044b\u043b\u0438 \u0431\u044b \u043f\u0440\u0430\u0432\u044b. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c . \u041f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043b\u0438 \u044d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f? \u041d\u0435 \u043e\u0447\u0435\u043d\u044c.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u00ab\u0440\u0430\u0432\u043d\u0430\u00bb \u0440\u0430\u0437\u043d\u044b\u043c ; \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u043e\u043c \u044d\u0442\u0438  \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b:<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u2014 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u2014 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e.  \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u043c\u0435\u0434\u043b\u0435\u043d\u0435\u0435<\/em>, \u0447\u0435\u043c ; \u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0430 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0438\u0445 \u0447\u0430\u0441\u0442\u043d\u043e\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441 \u0440\u043e\u0441\u0442\u043e\u043c  \u0432\u0441\u0451 \u0431\u043b\u0438\u0436\u0435 \u0438 \u0431\u043b\u0438\u0436\u0435 \u043a \u043d\u0443\u043b\u044e:<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043c\u0430\u0442\u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0437\u0430\u043f\u0438\u0441\u044c , \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u0441\u0442\u0440\u0435\u043c\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u043d\u0443\u043b\u044e. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 \u0442\u0430\u043c \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430; \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c  \u0438 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0440\u043d\u043e. \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0432\u0430\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e. \u0422\u043e\u0433\u0434\u0430 \u043f\u0438\u0448\u0443\u0442 ,  \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. <\/p>\n<p>\u0414\u0440\u0443\u0433\u0430\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f  \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0442\u0451\u0442 <em>\u0442\u043e\u0447\u043d\u043e<\/em> \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e , \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b  \u0438  \u0442\u0430\u043a\u0438\u0435, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0432\u044b\u0448\u0435, \u043a\u043b\u0430\u0441\u0441\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0438\u0441\u044c <\/p>\n<p>\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0432\u043d\u0430  \u043f\u043b\u044e\u0441 \u043d\u0435\u0447\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435, \u0441\u0442\u0440\u0435\u043c\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u043d\u0443\u043b\u044e \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 . \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442  \u0438\u043b\u0438 , \u044d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u0438  \u2014 \u0440\u043e\u0432\u043d\u043e  \u0438 \u0432\u0441\u0451 \u0442\u0443\u0442.<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u043f\u0440\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445) \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0432 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430\u0445. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 , \u043e\u0431\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443:<\/p>\n<p> \u0441\u044a\u0435\u0434\u0430\u0435\u0442 \u043b\u044e\u0431\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c. \u0410 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 :<\/p>\n<p>\u041d\u0435-\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0443\u0448\u043b\u0430 \u0432\u043d\u0443\u0442\u0440\u044c  \u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e.<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"karatsuba\" id=\"karatsuba\"><\/a><\/p>\n<h2>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0439 \u0438 \u0432\u043b\u0430\u0441\u0442\u0432\u0443\u0439: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u044b<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043d\u0430 \u043f\u0443\u0442\u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u0432 1960-\u043c \u0433\u043e\u0434\u0443 \u0441\u043e\u0432\u0435\u0442\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a \u0410\u043d\u0430\u0442\u043e\u043b\u0438\u0439 \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u0430. \u041e\u043d \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<p>\u0422\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c <em>\u0442\u0440\u0435\u043c\u044f<\/em> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u044d\u0442\u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430, \u0430 \u043d\u0435 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c. \u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 , \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c  \u0438 \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0447\u0438\u0441\u043b\u0430  \u0438 , \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0438 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u043c \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<p>\u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043d\u0435 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u2014 \u043a\u0430\u043a \u0438 \u0434\u0432\u0430 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443. \u041f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u0447\u0438\u0441\u0435\u043b \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0439\u0434\u0451\u043c \u0434\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0438\u043b\u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0435\u0440\u0435\u0437 lookup table.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0434\u0435\u043b\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0442\u0440\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 (\u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0431\u0438\u0442) \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u0438\u043d\u044b  \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u044b  \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e  \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u0447\u0438\u0441\u0435\u043b \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0434\u043b\u0438\u043d\u044b; \u043e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 <\/p>\n<blockquote>\n<p>\u0417\u0430\u043d\u044f\u0442\u043d\u044b\u0439 \u0444\u0430\u043a\u0442 \u2014 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u043a\u0443\u0441\u044b \u0441 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0435\u0439 \u0437\u0430 \u0441\u0447\u0451\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0435\u0449\u0451 \u0432 \u0440\u044f\u0434\u0435 \u043c\u0435\u0441\u0442. \u0422\u0430\u043a, \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430  \u0438  \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0437\u0430 \u0442\u0440\u0438 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0451\u0445, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0432 ,  \u0438 . \u0410 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041f\u0430\u043d\u0430 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043f\u0430\u0440 \u043c\u0430\u0442\u0440\u0438\u0446  \u0438  \u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, \u0447\u0435\u043c \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 [1, 2]. \u041d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430  \u2014 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430  \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432.<\/p>\n<\/blockquote>\n<p><a class=\"anchor\" name=\"toom\" id=\"toom\"><\/a><\/p>\n<h2>\u0427\u0438\u0441\u043b\u0430 vs \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0422\u043e\u043e\u043c\u0430-\u041a\u0443\u043a\u0430<\/h2>\n<p>\u041f\u0440\u0438 \u0432\u0438\u0434\u0435 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u0430\u043a-\u0442\u043e \u0441\u0430\u043c \u0441\u043e\u0431\u043e\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438 \u043d\u0430 \u0431\u00f3\u043b\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0447\u0430\u0441\u0442\u0435\u0439 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u00f3\u043b\u044c\u0448\u0443\u044e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044e?<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u2014 \u0434\u0430; \u0438 \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u0430\u0440\u0430\u0446\u0443\u0431\u044b \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u041d\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0444\u043e\u043a\u0443\u0441.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0442\u0440\u0438 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0441\u043a\u043e\u0431\u043e\u043a:<\/p>\n<p>\u0422\u043e (\u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043e\u043f\u044b\u0442\u0430 \u0432 \u0430\u043b\u0433\u0435\u0431\u0440\u0435) \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u043c\u044b \u0442\u0430\u043a\u043e\u0435 \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432! <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b a \u0438 b \u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432  \u0438  \u043f\u0440\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u0445, \u0447\u0438\u0441\u043b\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u044b\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0447\u0435\u043c \u0438\u043d\u044b\u043c, \u043a\u0430\u043a \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u0430 :<\/p>\n<p>\u0421\u0430\u043c\u0438 \u0436\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432 \u043f\u0443\u0442\u0451\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u041a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0441\u0432\u0435\u043b\u0438 \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a \u0434\u0440\u0443\u0433\u043e\u0439. \u0412 \u0447\u0451\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043e\u0432? \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 <em>\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/em>; \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c  \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043e\u0431\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0438\u0445. \u0415\u0441\u043b\u0438 \u0431\u044b \u044f \u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b, \u044f \u0431\u044b \u0438 \u0432\u043e\u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u0435\u043d\u0438\u0432\u044b\u043c.<\/p>\n<p>\u041d\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-346240","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346240","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=346240"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346240\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}