{"id":320016,"date":"2021-03-22T09:00:45","date_gmt":"2021-03-22T09:00:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320016"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320016","title":{"rendered":"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 Fizzbuzz \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0435\u043e\u0440\u0435\u043c\u044b \u042d\u0439\u043b\u0435\u0440\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ql\/1f\/ke\/ql1fkebr2bf_oviayhfo9hynyjm.jpeg\" alt=\"image\"><\/div>\n<p>  FizzBuzz \u2014 \u044d\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0430\u044e\u0442 \u0432 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439. \u041e\u043d\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<blockquote><p>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0443\u044e \u0441\u043f\u0438\u0441\u043e\u043a \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 1 \u0434\u043e 100, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 3, \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abFizz\u00bb, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 5, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abBuzz\u00bb. \u0412\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 \u0438 3, 5, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abFizzBuzz\u00bb; \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p><\/blockquote>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 4 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 (\u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e):<\/p>\n<ol>\n<li>\u0418\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 3, \u043d\u043e \u043d\u0435 5<\/li>\n<li>\u0418\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 5, \u043d\u043e \u043d\u0435 3<\/li>\n<li>\u0418\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0438 3, \u0438 5<\/li>\n<li>\u041d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 3 \u0438 5<\/li>\n<\/ol>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\u00abFizz\u00bb, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eba\/110\/dde\/eba110dde3cacf02a49a6fd2beb0c937.svg\" alt=\"$n \\equiv 0 \\pmod 3$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5<\/li>\n<li>\u00abBuzz\u00bb, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0ae\/00d\/e19\/0ae00de19cfb830cf00944561db2911d.svg\" alt=\"$n \\equiv 0 \\pmod 5$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 3<\/li>\n<li>\u00abFizzBuzz\u00bb, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eba\/110\/dde\/eba110dde3cacf02a49a6fd2beb0c937.svg\" alt=\"$n \\equiv 0 \\pmod 3$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0ae\/00d\/e19\/0ae00de19cfb830cf00944561db2911d.svg\" alt=\"$n \\equiv 0 \\pmod 5$\" data-tex=\"inline\"><\/math><\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445.<\/li>\n<\/ul>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 Python:<\/p>\n<pre><code class=\"python\">[(lambda n: { 1: n, 6: &quot;Fizz&quot;, 10: &quot;Buzz&quot;, 0: &quot;FizzBuzz&quot; }[n**4%15])(n+1) for n in range(100)]<\/code><\/pre>\n<p>  \u0422\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 Ruby:<\/p>\n<pre><code class=\"ruby\">(1..100).map{|n| {1 =&gt; n, 6 =&gt; &quot;Fizz&quot;, 10 =&gt; &quot;Buzz&quot;, 0 =&gt; &quot;FizzBuzz&quot;}[n**4%15] }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u0438, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 1 \u0434\u043e 100 \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u00abFizz\u00bb, \u00abBuzz\u00bb \u0438 \u00abFizzBuzz\u00bb.<\/p>\n<p>  \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443? \u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0438\u0441\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0, 6, 10 \u0438 1? \u041f\u043e\u0447\u0435\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2d5\/f21\/72a\/2d5f2172a3d41b1ff054e54daa93be1f.svg\" alt=\"$n^4 \\mod 15$\" data-tex=\"inline\"><\/math> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 6 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 3, \u043d\u043e \u043d\u0435 5, 10 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 5, \u043d\u043e \u043d\u0435 3, 0 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 5 \u0438 3 \u0438 1 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445? \u0418 \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u2014 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043b\u0438 \u044d\u0442\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0432\u044b\u0431\u0435\u0440\u0435\u043c?<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>I. n^4 mod 15 \u0440\u0435\u0448\u0430\u0435\u0442 FizzBuzz<\/h2>\n<p>  \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u043e\u0432\u043e:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aa7\/f54\/ee8\/aa7f54ee82761ff5898ad655743f2ed8.svg\" alt=\"$n^4 \\mod {15} = \\begin{cases} 0, &amp; \\text{if $n$ is divisible by 3 and 5} \\newline 6, &amp; \\text{if $n$ is divisible by 3 and coprime to 5} \\newline 10, &amp; \\text{if $n$ is divisible by 5 and coprime to 3} \\newline 1, &amp; \\text{if $n$ is coprime to 3 and 5} \\end{cases}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u0435\u043d; \u0435\u0441\u043b\u0438 n \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0438 \u043d\u0430 3, \u0438 \u043d\u0430 5, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f n \u0432 \u043b\u044e\u0431\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/096\/ab1\/d1f\/096ab1d1f231662fc283dd50f4826361.svg\" alt=\"$\\mod 15$\" data-tex=\"inline\"><\/math> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d 0, \u0442\u0430 \u043a\u0430\u043a \u043b\u044e\u0431\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438 3 \u0438 5 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043a\u0440\u0430\u0442\u043d\u044b\u043c 15 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f05\/516\/565\/f05516565ae0d4c8b31dbea0b07c8ea8.svg\" alt=\"$(3 * 5)$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 3 \u043a\u0430\u043a \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0435\u043a\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <em>c<\/em>:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aaa\/531\/2e2\/aaa5312e255ef5c5710013100390eac9.svg\" alt=\"$3c^4 \\equiv 6 \\pmod{15}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0438\u043b\u0438<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cbd\/d63\/5ed\/cbdd635edf43b6c9f0c62b5543db287f.svg\" alt=\"$3c^4 \\mod 15 = 6$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <em>c<\/em> &gt; 0, \u0435\u0441\u043b\u0438 <em>c<\/em> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5. (\u0415\u0441\u043b\u0438 <em>c<\/em> \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0440\u043d\u0451\u0442 0.)<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4b1\/b84\/d04\/4b1b84d0431753953900245db4614637.svg\" alt=\"$c = 1$\" data-tex=\"inline\"><\/math>. \u042d\u0442\u043e \u0434\u0430\u0451\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/36e\/3fd\/b95\/36e3fdb95abfdf570947fcee8412063f.svg\" alt=\"$3^4 \\mod 15$\" data-tex=\"inline\"><\/math> \u0438\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/212\/f17\/2ec\/212f172ecf8ccec0c60def6e759f442a.svg\" alt=\"$81 \\mod 15$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0451\u0442 6: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/006\/357\/646\/006357646000043bf6f7340b3718f217.svg\" alt=\"$15 * 5 = 75$\" data-tex=\"inline\"><\/math>, \u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c 6 \u043e\u0442 81.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e <em>c<\/em> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u043c &gt; 1. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044e \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/94f\/086\/129\/94f08612952c83fbc27bbd547c2409e6.svg\" alt=\"$(ab) = (a + a(b - 1))$\" data-tex=\"inline\"><\/math>:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aa9\/5d2\/211\/aa95d2211d507b9790af3990873ebc6c.svg\" alt=\"$\\begin{aligned} 3^4c^4 &amp; \\mod 15 \\newline 81c^4 &amp; \\mod 15 \\newline (81 + 81(c^4 - 1)) &amp; \\mod 15 \\end{aligned}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f6b\/e99\/4f5\/f6be994f5b9268b22d7c9d65977fe37c.svg\" alt=\"$c^4$\" data-tex=\"inline\"><\/math>. \u0418\u0437 \u0442\u0435\u043e\u0440\u0435\u043c\u044b \u042d\u0439\u043b\u0435\u0440\u0430 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0447\u0438\u0441\u0435\u043b \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/95a\/ea6\/293\/95aea6293a209bfddce22596766e29eb.svg\" alt=\"$c^4 \\mod 5$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u043d\u043e 1; \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4bc\/18d\/359\/4bc18d3595289648c081d45f9db6215d.svg\" alt=\"$c^4 \/ 5$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u0442\u0430\u0442\u043e\u043a 1, \u0442\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/948\/957\/3cf\/9489573cfe8538a7fcfe0151a83c4825.svg\" alt=\"$c^4 - 1$\" data-tex=\"inline\"><\/math> <em>\u0440\u043e\u0432\u043d\u043e<\/em> \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 5; \u0442\u043e \u0435\u0441\u0442\u044c, \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math>, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1f7\/0b4\/26e\/1f70b426e41f28f22daeacef41b6c990.svg\" alt=\"$(c^4 - 1)$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 5. \u0414\u0440\u0443\u0433\u043e\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0435 \u0432\u0430\u0436\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1f7\/0b4\/26e\/1f70b426e41f28f22daeacef41b6c990.svg\" alt=\"$(c^4 - 1)$\" data-tex=\"inline\"><\/math> \u043a\u0430\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5a7\/d06\/7ac\/5a7d067ac4c1559e51ae306f4d79283e.svg\" alt=\"$5x$\" data-tex=\"inline\"><\/math>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u042d\u0439\u043b\u0435\u0440\u0430 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0447\u0438\u0441\u0435\u043b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u042d\u0439\u043b\u0435\u0440\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d8c\/03f\/0a1\/d8c03f0a1ec42effde98fe85c579265e.svg\" alt=\"$a^{\u03d5(n)} \\equiv 1 (\\mod n)$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math>, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1b8\/54d\/440\/1b854d44003f175d56fe476eed7a5275.svg\" alt=\"$\u03d5$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u043f\u0441\u0438-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u042d\u0439\u043b\u0435\u0440\u0430; \u043f\u0441\u0438-\u0444\u0443\u043d\u043a\u0446\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043c\u0435\u043d\u044c\u0448\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math>, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math>. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/839\/f25\/c27\/839f25c2746382debd4f08ea25ad5ecf.svg\" alt=\"$p$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/edf\/d2f\/f8d\/edfd2ff8d2d1f752b8ebfaaf54969711.svg\" alt=\"$\u03d5(p)$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a6e\/d12\/884\/a6ed12884e6e7394becdf55ccfedc2e2.svg\" alt=\"$p - 1$\" data-tex=\"inline\"><\/math>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ql\/1f\/ke\/ql1fkebr2bf_oviayhfo9hynyjm.jpeg\"><\/div>\n<p>  <i>\u041b\u0435\u043e\u043d\u0430\u0440\u0434 \u042d\u0439\u043b\u0435\u0440<\/i><\/div>\n<\/p><\/div>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/492\/69f\/566\/49269f56648c937974fc2f5649ba71ad.svg\" alt=\"$\\begin{align} (81 + 81(5x)) &amp;\\mod 15 \\newline (81 \\mod 15 + 81(5x) \\mod 15) &amp;\\mod 15 \\newline (6 + 81(5x) \\mod 15) &amp;\\mod 15 \\newline 6 \\mod 15 \\end{align}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e \u0432\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/29e\/56e\/d5c\/29e56ed5c92a77ef5c1c2830430059b7.svg\" alt=\"$(a + b) \\mod n = (a \\mod n + b \\mod n) \\mod n$\" data-tex=\"inline\"><\/math>. \u0412 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a7a\/8db\/325\/a7a8db32559689f11b9328ddcb567239.svg\" alt=\"$81(5x)$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u0438 3, \u0438 5, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6aa\/44c\/436\/6aa44c436b26535df932be0d346968d1.svg\" alt=\"$81(5x) \\mod 15 = 0$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3c0\/65f\/d60\/3c065fd60749ca1ca9758aaed1ffba1d.svg\" alt=\"$6 \\mod 15$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c 6.<\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math>, \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5 \u0438 &gt; 1, \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/78c\/27e\/2f7\/78c27e2f7e7cba42380c43ef4b8c08dd.svg\" alt=\"$3c^4 \\mod 15$\" data-tex=\"inline\"><\/math> \u0432\u0435\u0440\u043d\u0451\u0442 6.<\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/933\/6fc\/354\/9336fc3547b1ee9982f788e7b763d732.svg\" alt=\"$5c^4 \\mod 15$\" data-tex=\"inline\"><\/math> \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 10; \u043f\u0440\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4b1\/b84\/d04\/4b1b84d0431753953900245db4614637.svg\" alt=\"$c = 1$\" data-tex=\"inline\"><\/math> \u043c\u044b \u0438\u043c\u0435\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/050\/bbf\/f08\/050bbff087e7c22ab128d09c48d1594d.svg\" alt=\"$625 \\mod 15$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e \u0440\u0430\u0432\u043d\u043e 10. \u0414\u043b\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b74\/dc4\/325\/b74dc4325cee51d798d1e4ac9d4adfd3.svg\" alt=\"$c &gt; 1$\" data-tex=\"inline\"><\/math> (\u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441 3) \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/dbe\/a68\/982\/dbea689824a84fe4273323dd39d63ec1.svg\" alt=\"$(625 + 625(c^4 - 1)) \\mod 15$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u042d\u0439\u043b\u0435\u0440\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 3, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7b9\/540\/46f\/7b954046fd2b2d362ba6cd9fe1385ad8.svg\" alt=\"$c^2 \\equiv 1 \\mod 3$\" data-tex=\"inline\"><\/math>; \u043d\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f6b\/e99\/4f5\/f6be994f5b9268b22d7c9d65977fe37c.svg\" alt=\"$c^4$\" data-tex=\"inline\"><\/math>. \u041e\u0434\u043d\u0430\u043a\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f6b\/e99\/4f5\/f6be994f5b9268b22d7c9d65977fe37c.svg\" alt=\"$c^4$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/064\/7ca\/12f\/0647ca12f3892e6c58a8d2464f6e35f9.svg\" alt=\"$c^2c^2$\" data-tex=\"inline\"><\/math>, \u0430 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/99f\/8c8\/094\/99f8c809404bd75d99651529fefdf64a.svg\" alt=\"$ab \\mod n = ((a \\mod n)( b \\mod n)) \\mod n$\" data-tex=\"inline\"><\/math>, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/33f\/dd5\/f8a\/33fdd5f8a996cdc6812e9a35339eb379.svg\" alt=\"$c^4 \\mod 3$\" data-tex=\"inline\"><\/math> \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0432\u043d\u043e 1.<\/p>\n<p>  \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/589\/381\/2ec\/5893812ec4e4ab7c53bebfbf12db853b.svg\" alt=\"$c^4 \\equiv 1 (\\mod 3)$\" data-tex=\"inline\"><\/math>, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1f7\/0b4\/26e\/1f70b426e41f28f22daeacef41b6c990.svg\" alt=\"$(c^4 - 1)$\" data-tex=\"inline\"><\/math> \u043d\u0430\u0446\u0435\u043b\u043e \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 3 \u0438 \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 3. \u042d\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u043b\u0435\u043d \u0434\u043e 0, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/050\/bbf\/f08\/050bbff087e7c22ab128d09c48d1594d.svg\" alt=\"$625 \\mod 15$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u0440\u0430\u0432\u043d\u043e 10.<\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math>, \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 3 \u0438 5. \u0415\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u043d\u043e 1, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7da\/d27\/367\/7dad27367b737b19f9cea88b80b60a55.svg\" alt=\"$1 \\mod 15$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c 1.<\/p>\n<p>  \u0415\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math> &gt; 1, \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e \u043a\u0430\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6f5\/d5d\/83c\/6f5d5d83c917ed5ccca257c4821d6bda.svg\" alt=\"$(1 + (c^4 - 1)) \\mod 15$\" data-tex=\"inline\"><\/math>. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e1a\/229\/081\/e1a229081e8db6ee98dfb79797b987dd.svg\" alt=\"$c$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 3 \u0438 5, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/589\/381\/2ec\/5893812ec4e4ab7c53bebfbf12db853b.svg\" alt=\"$c^4 \\equiv 1 (\\mod 3)$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/abc\/eec\/39e\/abceec39e68b8f7acd3d56b8b210f046.svg\" alt=\"$c^4 \\equiv 1 (\\mod 5)$\" data-tex=\"inline\"><\/math>, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1f7\/0b4\/26e\/1f70b426e41f28f22daeacef41b6c990.svg\" alt=\"$(c^4 - 1)$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 3 \u0438 5.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043d\u043e\u0432\u0430:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/101\/7b9\/dc7\/1017b9dc77e274ffb876242a04ad52a2.svg\" alt=\"$\\begin{aligned} (1 + (c^4 - 1)) &amp;\\mod 15 \\newline (1 \\mod 15 + (c^4 - 1) \\mod 15) &amp;\\mod 15 \\newline (1 + 0) &amp;\\mod 15 \\newline 1 &amp;\\mod 15 \\newline 1 \\end{aligned}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2d5\/f21\/72a\/2d5f2172a3d41b1ff054e54daa93be1f.svg\" alt=\"$n^4 \\mod 15$\" data-tex=\"inline\"><\/math> \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c 0, \u0435\u0441\u043b\u0438 \u0438 3, \u0438 5 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c 6, \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f 3, \u043d\u043e \u043d\u0435 5, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c 10, \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f 5, \u043d\u043e \u043d\u0435 3, \u0438 1, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u0441 3, \u0438 \u0441 5, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0438\u0434\u0430 <code>-&gt;(n){ {1 =&gt; n, 6 =&gt; &quot;Fizz&quot;, 10 =&gt; &quot;Buzz&quot;, 0 =&gt; &quot;FizzBuzz&quot;}[n**4%15] }<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 FizzBuzz \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> (\u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e53\/d14\/f56\/e53d14f563aea8ef8a90b1375796ac77.svg\" alt=\"$n^4$\" data-tex=\"inline\"><\/math> \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0438\u0442 \u0442\u0438\u043f integer, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435).<\/p>\n<h2>II. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 FizzBuzz<\/h2>\n<p>  \u0421\u0445\u043e\u0436\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 FizzBuzz. (\u0417\u0430\u0434\u0430\u0447\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 FizzBuzz: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abFoo\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 2, \u00abBar\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 \u0442\u0440\u0451\u043c, \u00abBaz\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 5 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 2,3 \u0438 5). \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445 \u0438\u043c\u0435\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0435, \u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c FizzBuzz \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u0440\u0430\u0442\u043d\u044b\u0435 2 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 \u00abFizz\u00bb, \u0430 \u043a\u0440\u0430\u0442\u043d\u044b\u0435 4 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 \u00abBuzz\u00bb (\u0432\u043c\u0435\u0441\u0442\u043e \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 3 \u0438 5), \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c \u00abFizz\u00bb \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 2, \u00abFizzBuzz\u00bb \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 2 \u0438 4, \u043d\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u00abBuzz\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 4, \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 2.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u043d\u0438\u0436\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u0430\u043a\u043e\u0435 \u0443\u0436 \u0438 \u043e\u0431\u0449\u0435\u0435, \u043a\u0430\u043a \u044f \u0441\u043a\u0430\u0437\u0430\u043b: \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440 \u0447\u0438\u0441\u0435\u043b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442; \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435. \u041e\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0425\u043e\u0447\u0443 \u043f\u043e\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0430 <a href=\"https:\/\/blog.antfeedr.com\/posts\/fizzbuzz.html\" rel=\"nofollow noopener noreferrer\">\u044d\u0442\u043e\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<\/a>, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0433\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0431\u0449\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f FizzBuzz \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ea1\/f8b\/9c4\/ea1f8b9c42b7a3ef688809cd03646f67.svg\" alt=\"$n^{LCM(\u03d5(3),\u03d5(5))} \\mod (3 \\cdot 5)$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1b8\/54d\/440\/1b854d44003f175d56fe476eed7a5275.svg\" alt=\"$\u03d5$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u043f\u0441\u0438-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u042d\u0439\u043b\u0435\u0440\u0430, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ddd\/1e1\/24d\/ddd1e124d5ae57cd084c3614b917700e.svg\" alt=\"$LCM$\" data-tex=\"inline\"><\/math> \u2014 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043e\u0431\u0449\u0435\u0435 \u043a\u0440\u0430\u0442\u043d\u043e\u0435.<\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/16d\/a50\/7b2\/16da507b2fc389688ef0659939dcc647.svg\" alt=\"$k$\" data-tex=\"inline\"><\/math> \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a04\/e2f\/ebe\/a04e2febed711a065b5c7886891f1d12.svg\" alt=\"$n_1,n_2,..n_k$\" data-tex=\"inline\"><\/math>, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u0438\u043f\u0430 FizzBuzz, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0443:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/12b\/557\/adc\/12b557adc0873a504835655334fb2621.svg\" alt=\"$n^{LCM(\u03d5(n_1),\u03d5(n_2),..\u03d5(n_k))} \\mod \\prod_{i=1}^k n_i$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0414\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0438\u043f\u0430 FizzBuzz, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u00abFoo\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 7, \u0438 \u00abBar\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 11, \u043d\u0430\u0439\u0434\u0451\u043c:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a27\/19b\/032\/a2719b032c49765dcffb039218a6c25b.svg\" alt=\"$n^{LCM(\u03d5(7),\u03d5(11))} \\mod (7 \\cdot 11)$\" data-tex=\"display\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e2a\/723\/8d6\/e2a7238d6c078688423592d968b36c62.svg\" alt=\"$\u03d5(7)$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u043d\u043e 6, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4df\/8b0\/bf6\/4df8b0bf62037499aa444f10502004df.svg\" alt=\"$\u03d5(11)$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u043d\u043e 10, \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ddd\/1e1\/24d\/ddd1e124d5ae57cd084c3614b917700e.svg\" alt=\"$LCM$\" data-tex=\"inline\"><\/math> (\u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043e\u0431\u0449\u0435\u0435 \u043a\u0440\u0430\u0442\u043d\u043e\u0435) \u0434\u043b\u044f 6 \u0438 10 \u0440\u0430\u0432\u043d\u043e 30. \u0422\u043e \u0435\u0441\u0442\u044c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fcf\/588\/d64\/fcf588d645330e7e1e60fbb43c84f77f.svg\" alt=\"$n^{30} \\mod 77$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 Python:<\/p>\n<pre><code class=\"python\">[(lambda n: { 1: n, 7**30%77: &quot;Foo&quot;, 11**30%77: &quot;Bar&quot;, 0: &quot;FooBar&quot; }[n**30%77])(n+1) for n in range(100)]<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<blockquote><p><code>[1, 2, 3, 4, 5, 6, 'Foo', 8, 9, 10, 'Bar', 12, 13, 'Foo', 15, 16, 17, 18, 19, 20, 'Foo', 'Bar', 23, 24, 25, 26, 27, 'Foo', 29, 30, 31, 32, 'Bar', 34, 'Foo', 36, 37, 38, 39, 40, 41, 'Foo', 43, 'Bar', 45, 46, 47, 48, 'Foo', 50, 51, 52, 53, 54, 'Bar', 'Foo', 57, 58, 59, 60, 61, 62, 'Foo', 64, 65, 'Bar', 67, 68, 69, 'Foo', 71, 72, 73, 74, 75, 76, 'FooBar', 78, 79, 80, 81, 82, 83, 'Foo', 85, 86, 87, 'Bar', 89, 90, 'Foo', 92, 93, 94, 95, 96, 97, 'Foo', 'Bar', 100]<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434<\/h2>\n<p>  \u0418\u0442\u0430\u043a,<\/p>\n<p><math>$$display$$a^{LCM(\u03d5(n_1),\u03d5(n_2),..\u03d5(n_k))} \\equiv \\begin{cases} 0\\pmod {\\prod_{i=1}^k n_i}, &amp; \\text{if $n$ is divisible by every $n_1,n_2,..n_k$} \\newline r_1,r_2,..r_k\\pmod {\\prod_{i=1}^k n_i}, &amp; \\text{a distinct result for every other combination of factors in $n_1,n_2,..n_k$} \\newline 1\\pmod {\\prod_{i=1}^k n_i}, &amp; \\text{if $n$ is coprime to every $n_1,n_2,..n_k$} \\end{cases}$$display$$<\/math><\/p>\n<p>  \u2026 \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a04\/e2f\/ebe\/a04e2febed711a065b5c7886891f1d12.svg\" alt=\"$n_1, n_2,.. n_k$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438. \u0421\u043d\u043e\u0432\u0430 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0430\u0432\u0442\u043e\u0440\u0430 <a href=\"https:\/\/blog.antfeedr.com\/posts\/fizzbuzz.html\" rel=\"nofollow noopener noreferrer\">\u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<\/a> \u0437\u0430 \u0441\u0442\u043e\u043b\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0443\u044e \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>  \u042f \u043d\u0435 \u0434\u0435\u043b\u0430\u044e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0438\u043d\u043e\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b, \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 FizzBuzz \u0441 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p><\/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\/547892\/\"> https:\/\/habr.com\/ru\/post\/547892\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ql\/1f\/ke\/ql1fkebr2bf_oviayhfo9hynyjm.jpeg\" alt=\"image\"><\/div>\n<p>  FizzBuzz \u2014 \u044d\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0430\u044e\u0442 \u0432 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439. \u041e\u043d\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<blockquote><p>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0443\u044e \u0441\u043f\u0438\u0441\u043e\u043a \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 1 \u0434\u043e 100, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 3, \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abFizz\u00bb, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e 5, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abBuzz\u00bb. \u0412\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 \u0438 3, 5, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u00abFizzBuzz\u00bb; \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p><\/blockquote>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 4 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 (\u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e):<\/p>\n<ol>\n<li>\u0418\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 3, \u043d\u043e \u043d\u0435 5<\/li>\n<li>\u0418\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 5, \u043d\u043e \u043d\u0435 3<\/li>\n<li>\u0418\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0438 3, \u0438 5<\/li>\n<li>\u041d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 3 \u0438 5<\/li>\n<\/ol>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\u00abFizz\u00bb, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eba\/110\/dde\/eba110dde3cacf02a49a6fd2beb0c937.svg\" alt=\"$n \\equiv 0 \\pmod 3$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 5<\/li>\n<li>\u00abBuzz\u00bb, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0ae\/00d\/e19\/0ae00de19cfb830cf00944561db2911d.svg\" alt=\"$n \\equiv 0 \\pmod 5$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441 3<\/li>\n<li>\u00abFizzBuzz\u00bb, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eba\/110\/dde\/eba110dde3cacf02a49a6fd2beb0c937.svg\" alt=\"$n \\equiv 0 \\pmod 3$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0ae\/00d\/e19\/0ae00de19cfb830cf00944561db2911d.svg\" alt=\"$n \\equiv 0 \\pmod 5$\" data-tex=\"inline\"><\/math><\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445.<\/li>\n<\/ul>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 Python:<\/p>\n<pre><code class=\"python\">[(lambda n: { 1: n, 6: &quot;Fizz&quot;, 10: &quot;Buzz&quot;, 0: &quot;FizzBuzz&quot; }[n**4%15])(n+1) for n in range(100)]<\/code><\/pre>\n<p>  \u0422\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 Ruby:<\/p>\n<pre><code class=\"ruby\">(1..100).map{|n| {1 =&gt; n, 6 =&gt; &quot;Fizz&quot;, 10 =&gt; &quot;Buzz&quot;, 0 =&gt; &quot;FizzBuzz&quot;}[n**4%15] }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u0438, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 1 \u0434\u043e 100 \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u00abFizz\u00bb, \u00abBuzz\u00bb \u0438 \u00abFizzBuzz\u00bb.<\/p>\n<p>  \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443? \u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0438\u0441\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0, 6, 10 \u0438 1? \u041f\u043e\u0447\u0435\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2d5\/f21\/72a\/2d5f2172a3d41b1ff054e54daa93be1f.svg\" alt=\"$n^4 \\mod 15$\" data-tex=\"inline\"><\/math> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 6 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 3, \u043d\u043e \u043d\u0435 5, 10 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 5, \u043d\u043e \u043d\u0435 3, 0 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u043a\u0440\u0430\u0442\u043d\u044b\u0445 5 \u0438 3 \u0438 1 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445? \u0418 \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u2014 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043b\u0438 \u044d\u0442\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0432\u044b\u0431\u0435\u0440\u0435\u043c?  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320016","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320016","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=320016"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320016\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}