{"id":463400,"date":"2025-06-14T21:00:46","date_gmt":"2025-06-14T21:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463400"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463400","title":{"rendered":"<span>The Billiard Fractals<\/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-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/un\/7d\/u5\/un7du5h6vq5moklkm3jz4h7jgos.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/un\/7d\/u5\/un7du5h6vq5moklkm3jz4h7jgos.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/un\/7d\/u5\/un7du5h6vq5moklkm3jz4h7jgos.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Complex systems often appear chaotic or incomprehensible, yet closer examination reveals that such complexity can frequently be reduced to a simple underlying mechanism. By systematically removing layers of emergent behavior, one can uncover a fundamental rule or equation from which the entire system originates.<\/p>\n<p><a name=\"habracut\"><\/a> <\/p>\n<p>The work presented here is a translation and adaptation of my articles (<a href=\"https:\/\/habr.com\/en\/articles\/194406\/\">Part 1<\/a>, <a href=\"https:\/\/habr.com\/en\/articles\/441516\/\">Part 2<\/a>, <a href=\"https:\/\/habr.com\/en\/articles\/447326\/\">Part 3<\/a>, <a href=\"https:\/\/habr.com\/en\/articles\/595433\/\">Part 4<\/a>)<br \/> GitHub repository: <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\" rel=\"nofollow noopener noreferrer\">billiard-fractals<\/a><\/p>\n<p> <\/p>\n<h1 id=\"the-billiard-fractals\">The Billiard Fractals<\/h1>\n<p> <\/p>\n<p>While the system described in this article may appear trivial at first glance, the resulting patterns exhibit quasi-fractal behavior that can be analyzed, encoded, and even predicted through symbolic methods. The work presented here was developed independently through direct observation, rather than derived from prior literature.<\/p>\n<p> <\/p>\n<p>A useful way to motivate this exploration is by analogy with a common physical phenomenon \u2014 wave interference. Consider waves on the surface of a river: a wavefront moves toward the shore, reflects, and overlaps with itself. Do these reflections contain an underlying order? Is it possible to extract structure from the interference?<\/p>\n<p> <\/p>\n<p>To investigate this, we simplify the system. Rather than modeling the full wave, we consider only the motion vector \u2014 essentially, a ray. We also smooth the \u201cshoreline\u201d and discretize the environment into a rectangular grid. From this setup emerges the core construction of this article.<\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">simplest \u201cchaotic\u201d system<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>The example of waves on the surface of a river serves as a real, intuitive starting point \u2014 an accessible physical system that demonstrates how simple rules, such as reflection and interference, can produce complex behavior. It illustrates the central idea: that what appears chaotic often emerges from deterministic structure.<\/p>\n<p> <\/p>\n<p>The initial motivation was driven by the conviction that apparent disorder is not randomness, but the result of unresolved or hidden structure. Any system that seems chaotic is governed by rules \u2014 its complexity a consequence of perspective, not unpredictability.<\/p>\n<p> <\/p>\n<p>To explore this further, attention turned to constructing the simplest possible system that could look chaotic yet remain fully deterministic.<\/p>\n<p> <\/p>\n<p>One such system involved a sine wave originating from the corner of a rectangle and reflecting off its boundaries. The nonlinearity of the sine function causes it to intersect itself in complex and unintuitive ways. However, due to limited tools available at the time, the model was simplified even further.<\/p>\n<p> <\/p>\n<p>Instead of a sine wave, a straight line was used. The line was made periodic (dashed), and the system was designed to be reproducible using only a pencil and a sheet of graph paper. Despite its simplicity, this construction revealed intricate and structured patterns-forming the foundation of what would later be described as the \u201cbilliard fractals.\u201d<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<h2 id=\"visualizing-the-billiard-algorithm\">Visualizing the Billiard Algorithm<\/h2>\n<p> <\/p>\n<p>The following sequence illustrates the core mechanism of the discrete billiard system:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_u\/jk\/70\/_ujk70amyxj8pkzozpw8uie0jos.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/_u\/jk\/70\/_ujk70amyxj8pkzozpw8uie0jos.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/_u\/jk\/70\/_ujk70amyxj8pkzozpw8uie0jos.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>An animated version:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/co\/bd\/wr\/cobdwrsev4r6sivww1spyyfzxa0.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/co\/bd\/wr\/cobdwrsev4r6sivww1spyyfzxa0.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/co\/bd\/wr\/cobdwrsev4r6sivww1spyyfzxa0.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Output pattern:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/an\/f0\/rl\/anf0rloqedzj3rnbnthlsjpf4xw.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/an\/f0\/rl\/anf0rloqedzj3rnbnthlsjpf4xw.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/an\/f0\/rl\/anf0rloqedzj3rnbnthlsjpf4xw.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>A selection of patterns generated from rectangles with various dimensions:<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/j8\/f3\/uz\/j8f3uz1swa8_zmwlgqdgw_wl2v8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/j8\/f3\/uz\/j8f3uz1swa8_zmwlgqdgw_wl2v8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/j8\/f3\/uz\/j8f3uz1swa8_zmwlgqdgw_wl2v8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1j\/qy\/rl\/1jqyrlhelps7_rbaquxjpdgxlds.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/1j\/qy\/rl\/1jqyrlhelps7_rbaquxjpdgxlds.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/1j\/qy\/rl\/1jqyrlhelps7_rbaquxjpdgxlds.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yi\/an\/ud\/yianud8ed9il2spoofhqshj1hka.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yi\/an\/ud\/yianud8ed9il2spoofhqshj1hka.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yi\/an\/ud\/yianud8ed9il2spoofhqshj1hka.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/kc\/hz\/sqkchzrqztaw2jo65bhua9thvse.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/sq\/kc\/hz\/sqkchzrqztaw2jo65bhua9thvse.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/kc\/hz\/sqkchzrqztaw2jo65bhua9thvse.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vn\/fm\/-c\/vnfm-c4zpzezc3bomqu3akuzv-u.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/vn\/fm\/-c\/vnfm-c4zpzezc3bomqu3akuzv-u.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/vn\/fm\/-c\/vnfm-c4zpzezc3bomqu3akuzv-u.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lf\/xu\/n1\/lfxun1isnhnnsp2yzaswschej_y.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/lf\/xu\/n1\/lfxun1isnhnnsp2yzaswschej_y.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/lf\/xu\/n1\/lfxun1isnhnnsp2yzaswschej_y.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/jb\/qf\/sqjbqfgymu7avje9rbvkwz3kqfa.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/sq\/jb\/qf\/sqjbqfgymu7avje9rbvkwz3kqfa.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/jb\/qf\/sqjbqfgymu7avje9rbvkwz3kqfa.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mo\/_u\/2m\/mo_u2m_hgz5icitm4uqysxz5y_k.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/mo\/_u\/2m\/mo_u2m_hgz5icitm4uqysxz5y_k.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/mo\/_u\/2m\/mo_u2m_hgz5icitm4uqysxz5y_k.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fv\/bw\/cg\/fvbwcgk28qenmowlz6czcllycs8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/fv\/bw\/cg\/fvbwcgk28qenmowlz6czcllycs8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/fv\/bw\/cg\/fvbwcgk28qenmowlz6czcllycs8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/xd\/lc\/yj\/xdlcyjgk70f5fms2za3gagq5pkg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/xd\/lc\/yj\/xdlcyjgk70f5fms2za3gagq5pkg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/xd\/lc\/yj\/xdlcyjgk70f5fms2za3gagq5pkg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/4f\/0d\/x8\/4f0dx8tbnmsk4ka_oga78xs4fmo.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/4f\/0d\/x8\/4f0dx8tbnmsk4ka_oga78xs4fmo.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/4f\/0d\/x8\/4f0dx8tbnmsk4ka_oga78xs4fmo.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/iv\/zm\/cx\/ivzmcxcs_l0c8z5u2pvptknve7w.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/iv\/zm\/cx\/ivzmcxcs_l0c8z5u2pvptknve7w.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/iv\/zm\/cx\/ivzmcxcs_l0c8z5u2pvptknve7w.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/pattern.html\" rel=\"nofollow noopener noreferrer\">JavaScript implementation of this algorithm<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/pattern.js\" rel=\"nofollow noopener noreferrer\"><code>pattern.js<\/code><\/a> \u2014 source code<\/p>\n<p> <\/p>\n<h2 id=\"fibonacci-numbers-and-pattern-refinement\">Fibonacci Numbers and Pattern Refinement<\/h2>\n<p> <\/p>\n<p>The patterns generated by this system exhibit fractal structure: they are self-similar across scales, recursive in construction, and can be compressed symbolically. As the rectangle dimensions increase following the Fibonacci sequence, the patterns reveal increasingly detailed versions of the same underlying structure.<\/p>\n<p> <\/p>\n<p>This refinement process is simple: given rectangle dimensions <code>(m, n)<\/code>, new dimensions are generated by Fibonacci summation. For example, starting with 8\u00d713:<\/p>\n<p> <\/p>\n<ul>\n<li>13 + 8 \u2192 21 \u2192 becomes 13\u00d721<\/li>\n<li>Then 21 + 13 \u2192 34 \u2192 becomes 21\u00d734, and so on<\/li>\n<\/ul>\n<p> <\/p>\n<p>Each step increases resolution while preserving the underlying structure.<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>8\u00d713<\/th>\n<th>13\u00d721<\/th>\n<th>21\u00d734<\/th>\n<th>34\u00d755<\/th>\n<th>55\u00d789<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nv\/yn\/ec\/nvynecdkkp3_bvrb5rixb4g6s-y.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/nv\/yn\/ec\/nvynecdkkp3_bvrb5rixb4g6s-y.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/nv\/yn\/ec\/nvynecdkkp3_bvrb5rixb4g6s-y.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ez\/bm\/t5\/ezbmt53levz6lifxdh39yuu3tfo.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ez\/bm\/t5\/ezbmt53levz6lifxdh39yuu3tfo.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ez\/bm\/t5\/ezbmt53levz6lifxdh39yuu3tfo.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/9s\/ic\/vd\/9sicvdry-pohvdlhp8_5r9h1aiy.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/9s\/ic\/vd\/9sicvdry-pohvdlhp8_5r9h1aiy.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/9s\/ic\/vd\/9sicvdry-pohvdlhp8_5r9h1aiy.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ez\/ot\/sm\/ezotsmet3kgfb772dhsy_6aoouc.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ez\/ot\/sm\/ezotsmet3kgfb772dhsy_6aoouc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ez\/ot\/sm\/ezotsmet3kgfb772dhsy_6aoouc.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zc\/dq\/ik\/zcdqik_zxrymfc6zqaz50zpg96e.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zc\/dq\/ik\/zcdqik_zxrymfc6zqaz50zpg96e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zc\/dq\/ik\/zcdqik_zxrymfc6zqaz50zpg96e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">233\u00d7377 preview comparison<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>The article\u2019s header image corresponds to the 233\u00d7377 pattern. Its structure can be directly compared with the earlier 13\u00d721 case.<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<p>When constructing these patterns using Fibonacci-based dimensions, we are effectively approximating a rectangle with side lengths in the golden ratio \u2014 that is, a ratio approaching (1: \u03c6). With each step, the approximation improves, and the pattern gains additional structure and resolution.<\/p>\n<p> <\/p>\n<p>Although the overall structure of the pattern remains consistent during Fibonacci-based refinement, certain symmetries within the pattern depend on the parity of the rectangle&#8217;s side lengths. Specifically, when both the width and height are odd integers, the resulting pattern exhibits clear diagonal, horizontal, and vertical symmetry. This occurs because the billiard path, under these conditions, terminates in the corner diagonally opposite from its starting point. In contrast, when one or both sides are even, the path terminates elsewhere, and the resulting pattern loses this precise symmetry \u2014 although the underlying recursive structure remains unchanged.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"boundary-analysis-and-recursive-symmetry\">Boundary Analysis and Recursive Symmetry<\/h2>\n<p> <\/p>\n<p>To understand why the structure persists under Fibonacci expansion, consider cutting a square from the pattern. The boundary behavior reveals that the path (i.e., the \u201cbilliard ball\u201d) always returns to its entry point:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/c_\/wk\/oa\/c_wkoalydjxcka4cgjkm8t15qa0.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/c_\/wk\/oa\/c_wkoalydjxcka4cgjkm8t15qa0.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/c_\/wk\/oa\/c_wkoalydjxcka4cgjkm8t15qa0.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Moreover, the path always (except for diagonal cases) crosses an even number of cells. This ensures that the pattern remains consistent across such subdivisions.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/y_\/ii\/yv\/y_iiyvcezs47nqf0rhesrellg9q.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/y_\/ii\/yv\/y_iiyvcezs47nqf0rhesrellg9q.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/y_\/ii\/yv\/y_iiyvcezs47nqf0rhesrellg9q.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>By recursively separating square regions from the larger pattern, the symbolic seed of the system can be exposed:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/pc\/yp\/40\/pcyp40nyisv1dxtchjqpw5yj9mw.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/pc\/yp\/40\/pcyp40nyisv1dxtchjqpw5yj9mw.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/pc\/yp\/40\/pcyp40nyisv1dxtchjqpw5yj9mw.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"binary-representation-and-symbolic-extraction\">Binary Representation and Symbolic Extraction<\/h2>\n<p> <\/p>\n<p>The path traced by the billiard ball through the grid can be encoded as a binary sequence. As the ball moves from cell to cell, its internal state alternates according to a fixed rule. We can label these alternating states with binary values \u2014 for example, assigning 0 to one state and 1 to the other. This produces a binary field that can be visualized directly.<\/p>\n<p> <\/p>\n<p>For example:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/dn\/6b\/5b\/dn6b5bbaorgqdwi6hej0qedxxs4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/dn\/6b\/5b\/dn6b5bbaorgqdwi6hej0qedxxs4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/dn\/6b\/5b\/dn6b5bbaorgqdwi6hej0qedxxs4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vp\/dn\/qu\/vpdnqusx_metx6gq2-ij7u7ixsk.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/vp\/dn\/qu\/vpdnqusx_metx6gq2-ij7u7ixsk.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/vp\/dn\/qu\/vpdnqusx_metx6gq2-ij7u7ixsk.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The top row of the binary field can be viewed as a symbolic boundary \u2014 a compact representation of the billiard system&#8217;s behavior along a single edge. By studying the structure of the full 2D pattern and recursively extracting square sections from it, we arrive at symbolic generation rules. These rules allow us to reconstruct the boundary sequences using only binary operations.<\/p>\n<p> <\/p>\n<p>Two core recursive generators are presented below:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">function invers(array) {     var temp = [];     for (let i = 0; i &lt; array.length; i++)         temp[i] = array[i] === 0 ? 1 : 0;     return temp; }  function revers(array, s) {     var temp = [];     for (let i = 0; i &lt; s; i++)         temp[i] = array[array.length - i - 1];     return temp; }  function seqence(fn, fn1) {     if (fn1 === 3) return [1];     fn1 = fn - fn1;     fn = fn - fn1;     var array = seqence(fn, fn1);     var a0 = invers(array);     var a1 = (fn1 % 2 === 0) ? [1] : [];     var a2 = revers(array, Math.floor((fn - fn1) \/ 2));     return a0.concat(a1, a2); }  function seqenceFibonacci(iterations) {     let f0a = [0];     let f1a = [0];     for (let i = 0; i &lt; iterations; i++) {         let f0 = f0a.length;         let a2 = revers(f1a, f0);         if (f1a.length % 2 === 0) a2[0] ^= 1;         f0a = f1a;         f1a = f1a.concat(a2);     }     let array = [];     for (let i = 0; i &lt; Math.floor(f1a.length \/ 2); i++)         array[i] = f1a[i * 2];     return array; }<\/code><\/pre>\n<p> <\/p>\n<p>These constructions reproduce the symbolic edges of Fibonacci-based patterns and can be interpreted as recursive encoding schemes derived directly from the observed geometry.<\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Toward Generalization<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>While the above generators are constructed specifically for Fibonacci-sized rectangles, preliminary experiments suggest that similar structures may emerge for other co-prime pairs. These systems may obey different symbolic transformation rules, but exhibit comparable recursive or compressible traits. A formal generalization of these behaviors remains an open area of exploration.<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<p>One of the central challenges that motivated the progression from the original 2013 construction to the deeper analysis in 2019 was the question of irrational proportions: what happens when the rectangle\u2019s side lengths form a truly irrational ratio, such as (1: \u03c6), rather than an integer-based approximation like 13: 21?<\/p>\n<p> <\/p>\n<p>While recursive generators such as <code>seqence(fn, fn1)<\/code> accurately reproduced the symbolic boundary sequences for Fibonacci-based rectangles, they were inherently tied to integer dimensions. The challenge was clear: how can one generate the same structures when no exact grid alignment is possible \u2014 when the trajectory no longer closes?<\/p>\n<p> <\/p>\n<p>This question defines the next stage of the investigation. To answer it, we will analyze the boundary sequences themselves \u2014 the so-called <em>fractal sequences<\/em> \u2014 and show how they encode the entire 2D pattern. We will show that these sequences \u2014 far from being edge artifacts \u2014 contain enough information to deterministically reconstruct the entire 2D pattern. This finding enables a powerful dimensional reduction: the entire billiard system can be expressed as a 1D sequence.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"binary-billiards\">Binary Billiards<\/h2>\n<p> <\/p>\n<p>We now shift from the dashed-line visualization to a binary representation. Instead of drawing the trajectory, we color the cells the ball passes through, alternating black (0) and white (1) with each step.<\/p>\n<p> <\/p>\n<p>Given a rectangle with side lengths <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a49\/b4d\/813\/a49b4d813a8ca0ce6d302beeb9795f92.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a49\/b4d\/813\/a49b4d813a8ca0ce6d302beeb9795f92.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a49\/b4d\/813\/a49b4d813a8ca0ce6d302beeb9795f92.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4d5\/fb6\/0ad\/4d5fb60ad33c64480fb217499f8b2275.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4d5\/fb6\/0ad\/4d5fb60ad33c64480fb217499f8b2275.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4d5\/fb6\/0ad\/4d5fb60ad33c64480fb217499f8b2275.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, the ball is launched from a corner and follows diagonal motion, reflecting off the walls. Each step alternates the internal binary state.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/q8\/q1\/dm\/q8q1dmpklx695gzwf0m82uuvkxa.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/q8\/q1\/dm\/q8q1dmpklx695gzwf0m82uuvkxa.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/q8\/q1\/dm\/q8q1dmpklx695gzwf0m82uuvkxa.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/wm\/ct\/lb\/wmctlblg15sjbjbw1uxptzfiffi.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/wm\/ct\/lb\/wmctlblg15sjbjbw1uxptzfiffi.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/wm\/ct\/lb\/wmctlblg15sjbjbw1uxptzfiffi.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The reflection rule causes the pattern to shift by one cell after each bounce. This alternation creates a consistent visual structure.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/z4\/lf\/j5\/z4lfj5_bk9qb12pmv0rcys3r2ia.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/z4\/lf\/j5\/z4lfj5_bk9qb12pmv0rcys3r2ia.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/z4\/lf\/j5\/z4lfj5_bk9qb12pmv0rcys3r2ia.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/tl\/sc\/fh\/tlscfhguia7kbft-mvjxdxxivj4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/tl\/sc\/fh\/tlscfhguia7kbft-mvjxdxxivj4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/tl\/sc\/fh\/tlscfhguia7kbft-mvjxdxxivj4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>When <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c3d\/cab\/545\/c3dcab5453548f3d302fd27a2077c962.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c3d\/cab\/545\/c3dcab5453548f3d302fd27a2077c962.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c3d\/cab\/545\/c3dcab5453548f3d302fd27a2077c962.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f80\/85f\/4eb\/f8085f4eb315ad77f77bb2534246fb1a.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f80\/85f\/4eb\/f8085f4eb315ad77f77bb2534246fb1a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f80\/85f\/4eb\/f8085f4eb315ad77f77bb2534246fb1a.svg 781w\" loading=\"lazy\" decode=\"async\"\/> are coprime, the trajectory visits every cell exactly once:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/-r\/oq\/zu\/-roqzus71qoc5z750waqbkft-kg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/-r\/oq\/zu\/-roqzus71qoc5z750waqbkft-kg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/-r\/oq\/zu\/-roqzus71qoc5z750waqbkft-kg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/binarypattern\/\" rel=\"nofollow noopener noreferrer\">JavaScript implementation<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/binarypattern.js\" rel=\"nofollow noopener noreferrer\"><code>binarypattern.js<\/code><\/a><\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Gif<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/h_\/my\/oa\/h_myoazdcmc8ohb6tld9i2nopd4.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/h_\/my\/oa\/h_myoazdcmc8ohb6tld9i2nopd4.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/h_\/my\/oa\/h_myoazdcmc8ohb6tld9i2nopd4.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/binarypattern\/binarypattern_point.html\" rel=\"nofollow noopener noreferrer\">JavaScript implementation<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/binarypattern_point.js\" rel=\"nofollow noopener noreferrer\"><code>binarypattern_point.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<p>If the dimensions share a common divisor (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/66d\/493\/3f3\/66d4933f3be6c6d3fe036c0c3d4a9f49.svg\" alt=\"$gcd(M, N) &gt; 1$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/66d\/493\/3f3\/66d4933f3be6c6d3fe036c0c3d4a9f49.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/66d\/493\/3f3\/66d4933f3be6c6d3fe036c0c3d4a9f49.svg 781w\" loading=\"lazy\" decode=\"async\"\/>), the trajectory terminates at a corner before filling all cells:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gd\/aj\/gw\/gdajgw1vexspkzo7lknlwf3oj20.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/gd\/aj\/gw\/gdajgw1vexspkzo7lknlwf3oj20.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/gd\/aj\/gw\/gdajgw1vexspkzo7lknlwf3oj20.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>In this case, the system is equivalent to a billiard in a reduced rectangle with dimensions (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3bb\/3a8\/48f\/3bb3a848f91a9e15caa2fd1cd63014db.svg\" alt=\"$\\frac{M}{GCD}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3bb\/3a8\/48f\/3bb3a848f91a9e15caa2fd1cd63014db.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3bb\/3a8\/48f\/3bb3a848f91a9e15caa2fd1cd63014db.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5f0\/b83\/40b\/5f0b8340b9632dba0bfbec8130d017f4.svg\" alt=\"$\\frac{N}{GCD}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5f0\/b83\/40b\/5f0b8340b9632dba0bfbec8130d017f4.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5f0\/b83\/40b\/5f0b8340b9632dba0bfbec8130d017f4.svg 781w\" loading=\"lazy\" decode=\"async\"\/>):<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qd\/2b\/rx\/qd2brxygjy0p2vvxlwiomslpnhy.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/qd\/2b\/rx\/qd2brxygjy0p2vvxlwiomslpnhy.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/qd\/2b\/rx\/qd2brxygjy0p2vvxlwiomslpnhy.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<h3 id=\"boundary-behavior-and-symmetry\">Boundary Behavior and Symmetry<\/h3>\n<p> <\/p>\n<p>In the coprime case, the ball crosses every row and column. Notably, each pass between the top and left walls consists of an <strong>even<\/strong> number of steps.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vu\/xh\/vv\/vuxhvvfl7dj0uuo99bkd4xiabb8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/vu\/xh\/vv\/vuxhvvfl7dj0uuo99bkd4xiabb8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/vu\/xh\/vv\/vuxhvvfl7dj0uuo99bkd4xiabb8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zc\/me\/6c\/zcme6cosjnmwn-wuojrh183ox6c.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zc\/me\/6c\/zcme6cosjnmwn-wuojrh183ox6c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zc\/me\/6c\/zcme6cosjnmwn-wuojrh183ox6c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>From this, we can observe a critical symmetry: the <strong>left column<\/strong> contains the inverted bits of the <strong>top row<\/strong>, excluding the initial bit.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_g\/iw\/h8\/_giwh8sscush_rdxapv3r5-g9vi.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/_g\/iw\/h8\/_giwh8sscush_rdxapv3r5-g9vi.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/_g\/iw\/h8\/_giwh8sscush_rdxapv3r5-g9vi.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Furthermore, every second bit (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/19c\/dcf\/a96\/19cdcfa96d2a5062962fb97f71cee271.svg\" alt=\"$2_{n-1}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/19c\/dcf\/a96\/19cdcfa96d2a5062962fb97f71cee271.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/19c\/dcf\/a96\/19cdcfa96d2a5062962fb97f71cee271.svg 781w\" loading=\"lazy\" decode=\"async\"\/>) in the top sequence is the inverted version of its neighbor (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f72\/681\/553\/f7268155310d8ce100af72d93922cbeb.svg\" alt=\"$2_{n}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f72\/681\/553\/f7268155310d8ce100af72d93922cbeb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f72\/681\/553\/f7268155310d8ce100af72d93922cbeb.svg 781w\" loading=\"lazy\" decode=\"async\"\/>). Therefore, we can discard every second bit and retain full pattern information:<\/p>\n<p> <\/p>\n<p>Halved sequence<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yl\/tv\/c6\/yltvc6hnnlxvpwwccwycg4jb2ng.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yl\/tv\/c6\/yltvc6hnnlxvpwwccwycg4jb2ng.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yl\/tv\/c6\/yltvc6hnnlxvpwwccwycg4jb2ng.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>For example, with dimensions <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e50\/dc5\/fdc\/e50dc5fdc3e8285c14d472958a1cdbd0.svg\" alt=\"$M=21, N=13$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e50\/dc5\/fdc\/e50dc5fdc3e8285c14d472958a1cdbd0.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e50\/dc5\/fdc\/e50dc5fdc3e8285c14d472958a1cdbd0.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, the resulting sequence is: 1010010110<\/p>\n<p> <\/p>\n<p>This sequence is <strong>unique<\/strong> for every coprime pair <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/570\/d4f\/98f\/570d4f98f36303cc5a72cc9fda575a8c.svg\" alt=\"$(M, N)$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/570\/d4f\/98f\/570d4f98f36303cc5a72cc9fda575a8c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/570\/d4f\/98f\/570d4f98f36303cc5a72cc9fda575a8c.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. It encodes all necessary information about the pattern.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"sequence-interpretation\">Sequence Interpretation<\/h3>\n<p> <\/p>\n<p>The trajectory between two reflections from the upper wall is always <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/326\/e3b\/ce9\/326e3bce9108d48007ae64fa7c88a008.svg\" alt=\"$2N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/326\/e3b\/ce9\/326e3bce9108d48007ae64fa7c88a008.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/326\/e3b\/ce9\/326e3bce9108d48007ae64fa7c88a008.svg 781w\" loading=\"lazy\" decode=\"async\"\/> cells long. Each such pass begins with a black cell (bit = 0) and ends with a white cell (bit = 1):<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/m0\/qu\/jj\/m0qujj7-k6gfgnvbymlx16i-m0a.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/m0\/qu\/jj\/m0qujj7-k6gfgnvbymlx16i-m0a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/m0\/qu\/jj\/m0qujj7-k6gfgnvbymlx16i-m0a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>More formally: <\/p>\n<p> <\/p>\n<ul>\n<li>A bit of <code>1<\/code> indicates that the ball arrived from a reflection off the <strong>right wall<\/strong><\/li>\n<li>A bit of <code>0<\/code> indicates it came from the <strong>left wall<\/strong><\/li>\n<\/ul>\n<p> <\/p>\n<p>This mapping gives the sequence its meaning. In the diagram below, the trajectory is colored black when moving right and white when moving left:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/9t\/de\/dd\/9tdedd_8hln5b5ehk4lipauz3aq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/9t\/de\/dd\/9tdedd_8hln5b5ehk4lipauz3aq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/9t\/de\/dd\/9tdedd_8hln5b5ehk4lipauz3aq.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Encoding Rational Division via Billiards<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>A curious side effect of the billiard construction is that it naturally encodes binary division of two numbers. Specifically, by tracking the direction of the billiard ball\u2019s movement at each wall collision, and sampling this information at exponentially increasing intervals, one can extract the binary digits of a rational fraction.<\/p>\n<p> <\/p>\n<p>Let the billiard table have side lengths <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/57e\/edb\/fd8\/57eedbfd84f98720a3c6e8535129d8c7.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/57e\/edb\/fd8\/57eedbfd84f98720a3c6e8535129d8c7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/57e\/edb\/fd8\/57eedbfd84f98720a3c6e8535129d8c7.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/841\/d6a\/39b\/841d6a39b3b4f31badd77e8558d13f9c.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/841\/d6a\/39b\/841d6a39b3b4f31badd77e8558d13f9c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/841\/d6a\/39b\/841d6a39b3b4f31badd77e8558d13f9c.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, and let the ball bounce between corners. At each collision with the top or bottom wall:<\/p>\n<p> <\/p>\n<p>If the ball is moving to the right, record a 0<\/p>\n<p> <\/p>\n<p>If moving to the left, record a 1<\/p>\n<p> <\/p>\n<p>Then, at every <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d8a\/aac\/ae4\/d8aaacae48a4ffa56cfee1a8f04542ac.svg\" alt=\"$2^n$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d8a\/aac\/ae4\/d8aaacae48a4ffa56cfee1a8f04542ac.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d8a\/aac\/ae4\/d8aaacae48a4ffa56cfee1a8f04542ac.svg 781w\" loading=\"lazy\" decode=\"async\"\/>-th collision (i.e., 1st, 2nd, 4th, 8th, \u2026), we record the state.<\/p>\n<p> <\/p>\n<p>Example: for a table of size <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/dbe\/622\/5c9\/dbe6225c9ec9d891d324a083df43b555.svg\" alt=\"$M=21, N=13$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/dbe\/622\/5c9\/dbe6225c9ec9d891d324a083df43b555.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/dbe\/622\/5c9\/dbe6225c9ec9d891d324a083df43b555.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, we obtain:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/rj\/6u\/4_\/rj6u4_q8rx1ixua8pqlxud97gi0.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/rj\/6u\/4_\/rj6u4_q8rx1ixua8pqlxud97gi0.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/rj\/6u\/4_\/rj6u4_q8rx1ixua8pqlxud97gi0.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<pre><code class=\"plaintext\">1st  (bottom, \u2192): 0   2nd  (top, \u2190):    1   4th  (top, \u2192):    0   8th  (top, \u2192):    0   16th (top, \u2190):    1   32nd (top, \u2190):    1   ...<\/code><\/pre>\n<p> <\/p>\n<p>This produces the binary expansion:<\/p>\n<p> <\/p>\n<p>0.1001111001111001111\u2026 Which is precisely the binary representation of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7d7\/354\/6e6\/7d73546e6c9c1742c8a1c1f732d1e615.svg\" alt=\"$\\frac{13}{21}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7d7\/354\/6e6\/7d73546e6c9c1742c8a1c1f732d1e615.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7d7\/354\/6e6\/7d73546e6c9c1742c8a1c1f732d1e615.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"reconstruction-from-the-sequence\">Reconstruction from the Sequence<\/h3>\n<p> <\/p>\n<p>The full billiard pattern can be reconstructed from this single boundary sequence. Even extrapolation beyond the grid is possible.<\/p>\n<p> <\/p>\n<p>Let us begin by placing the bits along the top edge of a square grid of width <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/34d\/7f2\/d01\/34d7f2d01cdc0b5033393a4946a84064.svg\" alt=\"$M$$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/34d\/7f2\/d01\/34d7f2d01cdc0b5033393a4946a84064.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/34d\/7f2\/d01\/34d7f2d01cdc0b5033393a4946a84064.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. Bits are spaced every 2 cells \u2014 these are the points where the ball would hit the upper wall:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/-x\/tm\/oq\/-xtmoqqdbu1ah2qpjx8t60tx-t4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/-x\/tm\/oq\/-xtmoqqdbu1ah2qpjx8t60tx-t4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/-x\/tm\/oq\/-xtmoqqdbu1ah2qpjx8t60tx-t4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Then:<\/p>\n<p> <\/p>\n<ul>\n<li>If the bit is <code>1<\/code>, we extend a diagonal to the <strong>left<\/strong><\/li>\n<li>If the bit is <code>0<\/code>, we extend it to the <strong>right<\/strong><\/li>\n<\/ul>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ad\/3a\/mw\/ad3amwwfsbtw5-usbxxnxrqpdwa.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ad\/3a\/mw\/ad3amwwfsbtw5-usbxxnxrqpdwa.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ad\/3a\/mw\/ad3amwwfsbtw5-usbxxnxrqpdwa.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The first bit (bit 0) is treated specially \u2014 it begins the pattern:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/74\/0y\/z8\/740yz8ych-80fk0p_615wb0rqws.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/74\/0y\/z8\/740yz8ych-80fk0p_615wb0rqws.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/74\/0y\/z8\/740yz8ych-80fk0p_615wb0rqws.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The reconstruction produces the exact original pattern:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zb\/qg\/eg\/zbqgegwot1zywuomdevkk2w7jzq.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/zb\/qg\/eg\/zbqgegwot1zywuomdevkk2w7jzq.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/zb\/qg\/eg\/zbqgegwot1zywuomdevkk2w7jzq.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ml\/qx\/7a\/mlqx7aeqopsgt-g83if9sbc1us8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ml\/qx\/7a\/mlqx7aeqopsgt-g83if9sbc1us8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ml\/qx\/7a\/mlqx7aeqopsgt-g83if9sbc1us8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/binarypattern\/visualizer\/\" rel=\"nofollow noopener noreferrer\">JavaScript implementation<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/visualizer.js\" rel=\"nofollow noopener noreferrer\"><code>visualizer.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<p>This result shows that the 1D sequence contains <strong>complete information<\/strong> about the original 2D billiard pattern.<\/p>\n<p> <\/p>\n<p>But we&#8217;re not done.<\/p>\n<p> <\/p>\n<p>From the surface of the river, we reduced the system to a rectangular billiard with a dashed diagonal trajectory. Then we reduced it further \u2014 to a binary field generated by alternating internal states. Now, we push the reduction one step further: we collapse the entire 2D billiard into a one-dimensional rule. A symbolic system with no geometry left \u2014 only structure.<\/p>\n<p> <\/p>\n<p>This is where we begin to uncover the origin of these fractals.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"one-dimensional-billiards\">One-dimensional billiards<\/h2>\n<p> <\/p>\n<p>On the <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ae7\/d8f\/3ea\/ae7d8f3ea7e6fde53a761783dabfd9d2.svg\" alt=\"$X$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ae7\/d8f\/3ea\/ae7d8f3ea7e6fde53a761783dabfd9d2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ae7\/d8f\/3ea\/ae7d8f3ea7e6fde53a761783dabfd9d2.svg 781w\" loading=\"lazy\" decode=\"async\"\/> number axis, we take two points: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/496\/549\/7c2\/4965497c2479306907c4afbd48706ddd.svg\" alt=\"$0$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/496\/549\/7c2\/4965497c2479306907c4afbd48706ddd.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/496\/549\/7c2\/4965497c2479306907c4afbd48706ddd.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c07\/a5d\/f3a\/c07a5df3a95d00a43f85acf30fd9c210.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c07\/a5d\/f3a\/c07a5df3a95d00a43f85acf30fd9c210.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c07\/a5d\/f3a\/c07a5df3a95d00a43f85acf30fd9c210.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ey\/nj\/tu\/eynjtu819jtj84bntbovcxg7s68.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ey\/nj\/tu\/eynjtu819jtj84bntbovcxg7s68.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ey\/nj\/tu\/eynjtu819jtj84bntbovcxg7s68.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Moving from one point to another, we measure the distances <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8b6\/496\/50e\/8b649650e29273a7c8a5e5fecac95a3f.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8b6\/496\/50e\/8b649650e29273a7c8a5e5fecac95a3f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8b6\/496\/50e\/8b649650e29273a7c8a5e5fecac95a3f.svg 781w\" loading=\"lazy\" decode=\"async\"\/>:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fm\/yi\/oh\/fmyiohaeo6bat1zlhlw3vfkkg3o.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/fm\/yi\/oh\/fmyiohaeo6bat1zlhlw3vfkkg3o.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/fm\/yi\/oh\/fmyiohaeo6bat1zlhlw3vfkkg3o.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>We marked a point. We continue to measure the distance from this point, maintaining the direction. If we reach point <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/730\/d7f\/19f\/730d7f19fc2a32bd31e3802a8f146f2a.svg\" alt=\"$0$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/730\/d7f\/19f\/730d7f19fc2a32bd31e3802a8f146f2a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/730\/d7f\/19f\/730d7f19fc2a32bd31e3802a8f146f2a.svg 781w\" loading=\"lazy\" decode=\"async\"\/> or <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e52\/427\/54e\/e5242754eedb25058fe71e53a223b782.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e52\/427\/54e\/e5242754eedb25058fe71e53a223b782.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e52\/427\/54e\/e5242754eedb25058fe71e53a223b782.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, we change the direction:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/k7\/nl\/xa\/k7nlxadkkmf0tedy19a6mad2uzo.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/k7\/nl\/xa\/k7nlxadkkmf0tedy19a6mad2uzo.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/k7\/nl\/xa\/k7nlxadkkmf0tedy19a6mad2uzo.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>As you can see in the pictures above, the first point shows the place where the ball touches the bottom wall of the billiard table. We are not interested in this point. We will only mark the points <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/371\/2f3\/50e\/3712f350e76e5adf21bdd24a660b7597.svg\" alt=\"$2kN$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/371\/2f3\/50e\/3712f350e76e5adf21bdd24a660b7597.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/371\/2f3\/50e\/3712f350e76e5adf21bdd24a660b7597.svg 781w\" loading=\"lazy\" decode=\"async\"\/> for <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b7c\/cfa\/446\/b7ccfa44646ef8dd693cd5a14b38130a.svg\" alt=\"$k=0,1,2,\u2026$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b7c\/cfa\/446\/b7ccfa44646ef8dd693cd5a14b38130a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b7c\/cfa\/446\/b7ccfa44646ef8dd693cd5a14b38130a.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<p>How to mark these points? Let&#8217;s unfold our billiard table on the <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/82a\/d7f\/783\/82ad7f783bd17ffefe40e707ebaacddd.svg\" alt=\"$X$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/82a\/d7f\/783\/82ad7f783bd17ffefe40e707ebaacddd.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/82a\/d7f\/783\/82ad7f783bd17ffefe40e707ebaacddd.svg 781w\" loading=\"lazy\" decode=\"async\"\/> axis. Let&#8217;s mark the points <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f5e\/ef5\/324\/f5eef5324a770ccb3a57e545f4692df2.svg\" alt=\"$0, M, 2M, 3M,\u2026$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f5e\/ef5\/324\/f5eef5324a770ccb3a57e545f4692df2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f5e\/ef5\/324\/f5eef5324a770ccb3a57e545f4692df2.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. Now, having reached point <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1e8\/36a\/022\/1e836a0222b9c968add0876350c2897f.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1e8\/36a\/022\/1e836a0222b9c968add0876350c2897f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1e8\/36a\/022\/1e836a0222b9c968add0876350c2897f.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, we do not change the direction of movement, but continue moving to point <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6a0\/c50\/250\/6a0c502501e73e2c967278f83c42ec06.svg\" alt=\"$2M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6a0\/c50\/250\/6a0c502501e73e2c967278f83c42ec06.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6a0\/c50\/250\/6a0c502501e73e2c967278f83c42ec06.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/w3\/6o\/ra\/w36orai2_c0n1g6a5lcezjhaspo.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/w3\/6o\/ra\/w36orai2_c0n1g6a5lcezjhaspo.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/w3\/6o\/ra\/w36orai2_c0n1g6a5lcezjhaspo.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Points that are multiples of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6be\/ec7\/c93\/6beec7c9370fa0d54fb010c4e6b5bc2c.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6be\/ec7\/c93\/6beec7c9370fa0d54fb010c4e6b5bc2c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6be\/ec7\/c93\/6beec7c9370fa0d54fb010c4e6b5bc2c.svg 781w\" loading=\"lazy\" decode=\"async\"\/> divide our axis into segments. We will conditionally mark these segments with ones and zeros (alternating). On the segments marked with zeros, the ball (in rectangular billiards) moves from left to right. On the segments marked with ones, it moves from right to left. Or more simply: the ball moves from left to right if <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/426\/ea4\/a14\/426ea4a1482206d85fd714ce3e297fda.svg\" alt=\"$Q_k=0$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/426\/ea4\/a14\/426ea4a1482206d85fd714ce3e297fda.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/426\/ea4\/a14\/426ea4a1482206d85fd714ce3e297fda.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, for<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6dc\/bca\/edb\/6dcbcaedb5cf382e48c5da917d803ee8.svg\" alt=\"$Q_k=\\lfloor \\frac{2kN}{M} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad k=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6dc\/bca\/edb\/6dcbcaedb5cf382e48c5da917d803ee8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6dc\/bca\/edb\/6dcbcaedb5cf382e48c5da917d803ee8.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>It is easy to see that the point at which the ball touched the upper wall of the billiard table is the remainder of dividing <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/717\/b40\/698\/717b40698c7bd2539692c7279afa5ab7.svg\" alt=\"$2kN$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/717\/b40\/698\/717b40698c7bd2539692c7279afa5ab7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/717\/b40\/698\/717b40698c7bd2539692c7279afa5ab7.svg 781w\" loading=\"lazy\" decode=\"async\"\/> by <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7a3\/59e\/5ca\/7a359e5ca92245a49e9d303e00d61c20.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7a3\/59e\/5ca\/7a359e5ca92245a49e9d303e00d61c20.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7a3\/59e\/5ca\/7a359e5ca92245a49e9d303e00d61c20.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. In this case, we don&#8217;t need to record the movement of the ball in the opposite direction. We take the integer part of dividing <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2e7\/a32\/525\/2e7a325253f0eb6eefd36fc9caaf6cfd.svg\" alt=\"$2kN$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2e7\/a32\/525\/2e7a325253f0eb6eefd36fc9caaf6cfd.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2e7\/a32\/525\/2e7a325253f0eb6eefd36fc9caaf6cfd.svg 781w\" loading=\"lazy\" decode=\"async\"\/> by <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/959\/824\/c84\/959824c8408140a75e0fad6d19e245dc.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/959\/824\/c84\/959824c8408140a75e0fad6d19e245dc.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/959\/824\/c84\/959824c8408140a75e0fad6d19e245dc.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, if it is even \u2014 we calculate the remainder of dividing <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f20\/25a\/b22\/f2025ab22b95888b02c3706f6a098103.svg\" alt=\"$2kN$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f20\/25a\/b22\/f2025ab22b95888b02c3706f6a098103.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f20\/25a\/b22\/f2025ab22b95888b02c3706f6a098103.svg 781w\" loading=\"lazy\" decode=\"async\"\/> by <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0dc\/202\/1cb\/0dc2021cb6238196ec5a10fa8ac7a508.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0dc\/202\/1cb\/0dc2021cb6238196ec5a10fa8ac7a508.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0dc\/202\/1cb\/0dc2021cb6238196ec5a10fa8ac7a508.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. We divide the resulting remainder by 2 (the distance between adjacent touch points is two cells). This gives us the indices of the array elements that correspond to rightward motion (zeros). All other entries \u2014 representing leftward trajectories \u2014 are filled with ones.<\/p>\n<p> <\/p>\n<p>Sequence length = <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c2e\/7a2\/ac1\/c2e7a2ac1823ebb541cf3d168ef4634c.svg\" alt=\"$\\frac{M}{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c2e\/7a2\/ac1\/c2e7a2ac1823ebb541cf3d168ef4634c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c2e\/7a2\/ac1\/c2e7a2ac1823ebb541cf3d168ef4634c.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">function sequence(m,n){     var md=m\/2;     var array=[];     for(var k=0;k&lt;md;k++) array[k]=1;     for(var k=0;k&lt;md;k++) if(Math.floor(2*k*n\/m)%2==0) array[((2*k*n)%m)\/2]=0;     return array; }<\/code><\/pre>\n<p> <\/p>\n<p>Now we can build a binary sequence for billiards with any sides <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2b1\/012\/b46\/2b1012b460cc35b633ec70609a2f9bb2.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2b1\/012\/b46\/2b1012b460cc35b633ec70609a2f9bb2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2b1\/012\/b46\/2b1012b460cc35b633ec70609a2f9bb2.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e55\/c3b\/f64\/e55c3bf64c6c8624392929ee5c5e4639.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e55\/c3b\/f64\/e55c3bf64c6c8624392929ee5c5e4639.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e55\/c3b\/f64\/e55c3bf64c6c8624392929ee5c5e4639.svg 781w\" loading=\"lazy\" decode=\"async\"\/> (natural numbers). Some examples: 144&#215;89 (Fibonacci numbers): 010100101101001011010110100101101001010010110101001011010100101<\/p>\n<p> <\/p>\n<p>169&#215;70 (Pell numbers): 010101101010010101101010010101101010100101011010101001010110101001010101010010101101010010<\/p>\n<p> <\/p>\n<p>233&#215;55 (odd Fibonacci numbers <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2c7\/efa\/a01\/2c7efaa01eb54688783185cb2ac628d7.svg\" alt=\"$F_n$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2c7\/efa\/a01\/2c7efaa01eb54688783185cb2ac628d7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2c7\/efa\/a01\/2c7efaa01eb54688783185cb2ac628d7.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4a0\/9aa\/138\/4a09aa138da9b932f505c9f6c9d6c2a5.svg\" alt=\"$F_{n-3}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4a0\/9aa\/138\/4a09aa138da9b932f505c9f6c9d6c2a5.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4a0\/9aa\/138\/4a09aa138da9b932f505c9f6c9d6c2a5.svg 781w\" loading=\"lazy\" decode=\"async\"\/>): 010010011011011001001101101100100100110110010010011011001001001101101100100110110110010010011011001001001101100100100<\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">This is dope<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>Very curious graphs are obtained if you take a billiard table with width <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b43\/c6c\/daa\/b43c6cdaa66ea4c8a63fc8e3ca207863.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b43\/c6c\/daa\/b43c6cdaa66ea4c8a63fc8e3ca207863.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b43\/c6c\/daa\/b43c6cdaa66ea4c8a63fc8e3ca207863.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and construct sequences for each <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5d2\/910\/1ab\/5d29101ab022f2f7cbe227167b79a7c7.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5d2\/910\/1ab\/5d29101ab022f2f7cbe227167b79a7c7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5d2\/910\/1ab\/5d29101ab022f2f7cbe227167b79a7c7.svg 781w\" loading=\"lazy\" decode=\"async\"\/> from <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/738\/f49\/674\/738f496748404e5495815be523e31559.svg\" alt=\"$0$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/738\/f49\/674\/738f496748404e5495815be523e31559.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/738\/f49\/674\/738f496748404e5495815be523e31559.svg 781w\" loading=\"lazy\" decode=\"async\"\/> to <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8e0\/fe9\/c71\/8e0fe9c7107a99798e536e5bbb5a37c0.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8e0\/fe9\/c71\/8e0fe9c7107a99798e536e5bbb5a37c0.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8e0\/fe9\/c71\/8e0fe9c7107a99798e536e5bbb5a37c0.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. Then these sequences are stacked.<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">    var array;     for(var y=1;y&lt;m;y++){         array=sequence(m,y);         for(var x=0;x&lt;array.length;x++){             if(array[x]==0) context.fillRect (x, y, 1, 1);         }     }<\/code><\/pre>\n<p> <\/p>\n<p>Some examples.<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>M=610<\/th>\n<th>M=611<\/th>\n<th>M=612<\/th>\n<th>M=613<\/th>\n<th>M=614<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ge\/v8\/7f\/gev87fnksb-exn82mmrw33cardg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ge\/v8\/7f\/gev87fnksb-exn82mmrw33cardg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ge\/v8\/7f\/gev87fnksb-exn82mmrw33cardg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_g\/9s\/iz\/_g9sizbwuclzm3zarfb_mgw3_ko.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/_g\/9s\/iz\/_g9sizbwuclzm3zarfb_mgw3_ko.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/_g\/9s\/iz\/_g9sizbwuclzm3zarfb_mgw3_ko.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lx\/ml\/_s\/lxml_s1gvaqionwjvym4gwymfkg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/lx\/ml\/_s\/lxml_s1gvaqionwjvym4gwymfkg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/lx\/ml\/_s\/lxml_s1gvaqionwjvym4gwymfkg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ut\/hc\/kd\/uthckdx32-okvu7xg-ugpaewjee.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ut\/hc\/kd\/uthckdx32-okvu7xg-ugpaewjee.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ut\/hc\/kd\/uthckdx32-okvu7xg-ugpaewjee.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qw\/ay\/me\/qwaymewmcxx1kpwromky_x3gtya.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/qw\/ay\/me\/qwaymewmcxx1kpwromky_x3gtya.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/qw\/ay\/me\/qwaymewmcxx1kpwromky_x3gtya.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p><a href=\"http:\/\/xcont.com\/binarypattern\/sequences\/\" rel=\"nofollow noopener noreferrer\">JavaScript implementation<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/sequences.js\" rel=\"nofollow noopener noreferrer\"><code>sequences.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<p>We have sequences. How else can we visualize binary sequences? With Turtle graphics.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"turtle-graphics\">Turtle graphics<\/h3>\n<p> <\/p>\n<p>The sequence length determines the complexity of the curve. The more irrational the ratio between <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ff3\/667\/591\/ff36675916dcf20c95f5777e0d1d8b48.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ff3\/667\/591\/ff36675916dcf20c95f5777e0d1d8b48.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ff3\/667\/591\/ff36675916dcf20c95f5777e0d1d8b48.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/349\/343\/ee2\/349343ee2a811fd1a6973531e7039e9f.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/349\/343\/ee2\/349343ee2a811fd1a6973531e7039e9f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/349\/343\/ee2\/349343ee2a811fd1a6973531e7039e9f.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, the more non-periodic and fractal \u2014 like the structure becomes.<\/p>\n<p> <\/p>\n<p>Draw a segment. Then take bits from our sequence one by one. If bit = 1 \u2014 rotate the segment relative to the previous one by <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b5b\/381\/401\/b5b381401ccbbcf02da980e759731c50.svg\" alt=\"$60^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b5b\/381\/401\/b5b381401ccbbcf02da980e759731c50.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b5b\/381\/401\/b5b381401ccbbcf02da980e759731c50.svg 781w\" loading=\"lazy\" decode=\"async\"\/> (clockwise). If bit = 0 \u2014 rotate the segment by <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/71f\/e93\/056\/71fe93056066ba2b49e0e79d8bd7fc86.svg\" alt=\"$-60^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/71f\/e93\/056\/71fe93056066ba2b49e0e79d8bd7fc86.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/71f\/e93\/056\/71fe93056066ba2b49e0e79d8bd7fc86.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. The beginning of the next segment is the end of the previous one.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yn\/4x\/uz\/yn4xuzstc3jx6gbcmpffc5kkwbc.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yn\/4x\/uz\/yn4xuzstc3jx6gbcmpffc5kkwbc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yn\/4x\/uz\/yn4xuzstc3jx6gbcmpffc5kkwbc.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Take two large enough Fibonacci numbers: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6ea\/8cf\/b26\/6ea8cfb2605c1f56e85a396e89927876.svg\" alt=\"$F_{29}=514229$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6ea\/8cf\/b26\/6ea8cfb2605c1f56e85a396e89927876.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6ea\/8cf\/b26\/6ea8cfb2605c1f56e85a396e89927876.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e0e\/8ac\/3f5\/e0e8ac3f5b7714cbb7bac6e60f648e12.svg\" alt=\"$F_{28}=317811$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e0e\/8ac\/3f5\/e0e8ac3f5b7714cbb7bac6e60f648e12.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e0e\/8ac\/3f5\/e0e8ac3f5b7714cbb7bac6e60f648e12.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. This ensures that the pattern is long enough for the fractal structure to become apparent, but still bounded enough for visualization.<\/p>\n<p> <\/p>\n<p>We built the sequence: 0010110100101101001010010110100101101010010110100101101001010010110100101\u2026 (257114 symbols plus a zero bit).<\/p>\n<p> <\/p>\n<p>Visualize using turtle graphics. The size of the initial segment is 1 pixels (the initial segment is in the lower right corner):<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/9y\/q6\/-j\/9yq6-jaclmxp7qavbiruxigtlr4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/9y\/q6\/-j\/9yq6-jaclmxp7qavbiruxigtlr4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/9y\/q6\/-j\/9yq6-jaclmxp7qavbiruxigtlr4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The next example is <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pell_number\" rel=\"nofollow noopener noreferrer\">Pell numbers<\/a>.<\/p>\n<p> <\/p>\n<p>We take <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/9dc\/ec3\/fd7\/9dcec3fd7b69aae8315803c7442dec8b.svg\" alt=\"$P_{16}=470832$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/9dc\/ec3\/fd7\/9dcec3fd7b69aae8315803c7442dec8b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/9dc\/ec3\/fd7\/9dcec3fd7b69aae8315803c7442dec8b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/469\/35b\/cda\/46935bcdaf19d233352cc7b34be00bcb.svg\" alt=\"$P_{15}=195025$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/469\/35b\/cda\/46935bcdaf19d233352cc7b34be00bcb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/469\/35b\/cda\/46935bcdaf19d233352cc7b34be00bcb.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<p>The sequence is: 00101001010110101001010101010100101011010100101010110101001010101101 (235415 symbols plus a zero bit).<\/p>\n<p> <\/p>\n<p>The size of the initial segment is 1 pixel:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_6\/wk\/qd\/_6wkqdlsa3-anayzy9q0sg7nkxw.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/_6\/wk\/qd\/_6wkqdlsa3-anayzy9q0sg7nkxw.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/_6\/wk\/qd\/_6wkqdlsa3-anayzy9q0sg7nkxw.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Another example is the odd Fibonacci numbers <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/891\/750\/c14\/891750c14af58710d925523fc59c2dc0.svg\" alt=\"$F_n$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/891\/750\/c14\/891750c14af58710d925523fc59c2dc0.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/891\/750\/c14\/891750c14af58710d925523fc59c2dc0.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b6c\/115\/74c\/b6c11574cd84f29eb281d23a083d06a9.svg\" alt=\"$F_{n-3}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b6c\/115\/74c\/b6c11574cd84f29eb281d23a083d06a9.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b6c\/115\/74c\/b6c11574cd84f29eb281d23a083d06a9.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. Let&#8217;s take <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bc1\/d05\/fa4\/bc1d05fa4c322e5b82029b2ab5704ec4.svg\" alt=\"$F_{28}=317811$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bc1\/d05\/fa4\/bc1d05fa4c322e5b82029b2ab5704ec4.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bc1\/d05\/fa4\/bc1d05fa4c322e5b82029b2ab5704ec4.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/936\/650\/87e\/93665087e51227c6ace2c07081488249.svg\" alt=\"$F_{25}=75025$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/936\/650\/87e\/93665087e51227c6ace2c07081488249.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/936\/650\/87e\/93665087e51227c6ace2c07081488249.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. The sequence is: 00110110010010011011001001101101100100110110110010011011011001001\u2026 (158905 plus a zero bit). Instead of the angles <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1fa\/268\/1cc\/1fa2681cc6efa73b34850822138c2bb4.svg\" alt=\"$60^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1fa\/268\/1cc\/1fa2681cc6efa73b34850822138c2bb4.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1fa\/268\/1cc\/1fa2681cc6efa73b34850822138c2bb4.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/434\/968\/70b\/43496870b2046abed903f29097e1ecd4.svg\" alt=\"$-60^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/434\/968\/70b\/43496870b2046abed903f29097e1ecd4.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/434\/968\/70b\/43496870b2046abed903f29097e1ecd4.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, we will use the angles <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/eee\/bf2\/d7b\/eeebf2d7bd12d1b6f0b49520df2472ce.svg\" alt=\"$90^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/eee\/bf2\/d7b\/eeebf2d7bd12d1b6f0b49520df2472ce.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/eee\/bf2\/d7b\/eeebf2d7bd12d1b6f0b49520df2472ce.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e3a\/dff\/7c2\/e3adff7c27fec553a72645054a5aafb4.svg\" alt=\"$-90^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e3a\/dff\/7c2\/e3adff7c27fec553a72645054a5aafb4.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e3a\/dff\/7c2\/e3adff7c27fec553a72645054a5aafb4.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. The size of the initial segment is 1 pixels:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/uc\/ua\/-g\/ucua-g5zkg0dt0kzahbiihtrgzy.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/uc\/ua\/-g\/ucua-g5zkg0dt0kzahbiihtrgzy.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/uc\/ua\/-g\/ucua-g5zkg0dt0kzahbiihtrgzy.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This curve is called &#171;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Fibonacci_word_fractal\" rel=\"nofollow noopener noreferrer\">Fibonacci Word Fractal<\/a>&#171;. The Hausdorff dimension for this curve is known:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6d6\/e37\/b27\/6d6e37b27cd87f52d2ea5cd218c349f1.svg\" alt=\"$D=3{\\frac {\\log \\Phi }{\\log(1+{\\sqrt {2}})}}=1.6379; \\quad \\Phi =\\frac {1+{\\sqrt {5}}}{2}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6d6\/e37\/b27\/6d6e37b27cd87f52d2ea5cd218c349f1.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6d6\/e37\/b27\/6d6e37b27cd87f52d2ea5cd218c349f1.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/binarypattern\/turtle\/\" rel=\"nofollow noopener noreferrer\">JavaScript implementation<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/turtle.js\" rel=\"nofollow noopener noreferrer\"><code>turtle.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"the-problem-unsolved-yet\">The problem unsolved yet.<\/h3>\n<p> <\/p>\n<p>Is it possible to draw a pattern for billiards, the sides of which are incommensurable (one of the sides is an irrational number)? At first glance, the task seems impossible. Trying to solve this problem, we will face a number of questions:<\/p>\n<p> <\/p>\n<ol>\n<li>If the sides are incommensurable, we cannot tile the billiards with cells of the same size.<\/li>\n<li>If the sides are incommensurable, the ball will infinitely reflect and will never get into the corner.<\/li>\n<li>Sequences in billiards are not filled in order, but chaotically.<\/li>\n<\/ol>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nh\/kq\/vy\/nhkqvy-hfv4gzpofzwldv-lzjby.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/nh\/kq\/vy\/nhkqvy-hfv4gzpofzwldv-lzjby.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/nh\/kq\/vy\/nhkqvy-hfv4gzpofzwldv-lzjby.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The first two questions obviously have no solution. But if there were a way to fill the sequence in order, then we could, moving along the sequence from left to right, restore the pattern in the way we used above. And thus see what the pattern looks like in the upper left corner of the billiard table whose sides are incommensurable.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"o_o\">o_O<\/h3>\n<p> <\/p>\n<p>Let&#8217;s take a billiard table, the sides of which are equal to the Fibonacci numbers (this trick may not work with other numbers). Let&#8217;s throw a ball into it and record the number of times the ball touches the upper wall. We&#8217;ll paint the numbers white if the ball moved from right to left and black if the ball moved from left to right:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/-w\/ud\/ht\/-wudhtmq_g_hln8naiocxdnfrjo.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/-w\/ud\/ht\/-wudhtmq_g_hln8naiocxdnfrjo.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/-w\/ud\/ht\/-wudhtmq_g_hln8naiocxdnfrjo.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>White corresponds to the number one in the sequence, black to zero. Now let&#8217;s arrange the numbers in order:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zj\/br\/bh\/zjbrbhdgnvljwmbst-vqfk1g9a4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zj\/br\/bh\/zjbrbhdgnvljwmbst-vqfk1g9a4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zj\/br\/bh\/zjbrbhdgnvljwmbst-vqfk1g9a4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>We&#8217;ve got exactly the same sequence of ones and zeros.<\/p>\n<p> <\/p>\n<p>21(1), 13(0), 8(1), 26(0), 5(0), 16(1), 18(0), 3(1), 24(1), 10(0), 11(1), 23(0), 2(0), 19(1), 15(0), 6(1), 27(1), 7(0), 14(1), 20(0), 1(1), 22(1), 12(0), 9(1), 25(0), 4(0), 17(1)<\/p>\n<p> <\/p>\n<p>1(1), 2(0), 3(1), 4(0), 5(0), 6(1), 7(0), 8(1), 9(1), 10(0), 11(1), 12(0), 13(0), 14(1), 15(0), 16(1), 17(1), 18(0), 19(1), 20(0), 21(1), 22(1), 23(0), 24(1), 25(0), 26(0), 27(1)<\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">For other numbers<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>The origin is the upper left corner. The <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e1f\/de2\/365\/e1fde236504ab6c640410bf56cbe7851.svg\" alt=\"$X$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e1f\/de2\/365\/e1fde236504ab6c640410bf56cbe7851.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e1f\/de2\/365\/e1fde236504ab6c640410bf56cbe7851.svg 781w\" loading=\"lazy\" decode=\"async\"\/> axis is the width of the billiard table <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2e5\/9f4\/122\/2e59f41226c74c71bff4d75afe4ea2b5.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2e5\/9f4\/122\/2e59f41226c74c71bff4d75afe4ea2b5.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2e5\/9f4\/122\/2e59f41226c74c71bff4d75afe4ea2b5.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. The <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/aab\/851\/742\/aab85174257a1e56dc6eb3f97a3dafde.svg\" alt=\"$Y$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/aab\/851\/742\/aab85174257a1e56dc6eb3f97a3dafde.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/aab\/851\/742\/aab85174257a1e56dc6eb3f97a3dafde.svg 781w\" loading=\"lazy\" decode=\"async\"\/> axis is the height of the billiard table <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/253\/4c6\/61b\/2534c661bf9db0ed201a22b59efa0642.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/253\/4c6\/61b\/2534c661bf9db0ed201a22b59efa0642.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/253\/4c6\/61b\/2534c661bf9db0ed201a22b59efa0642.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. The numbers for which the sequences match are marked with white dots:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gt\/vp\/sv\/gtvpsvmohygmilbpdpjgiknj2l8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/gt\/vp\/sv\/gtvpsvmohygmilbpdpjgiknj2l8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/gt\/vp\/sv\/gtvpsvmohygmilbpdpjgiknj2l8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Numbers for which the sequence is inverted:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/av\/tv\/ia\/avtvia2u5toiylamwnrptbw99h0.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/av\/tv\/ia\/avtvia2u5toiylamwnrptbw99h0.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/av\/tv\/ia\/avtvia2u5toiylamwnrptbw99h0.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>JavaScript implementation:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/y_\/au\/hq\/y_auhqb9nma4xppu7dxrm269mik.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/y_\/au\/hq\/y_auhqb9nma4xppu7dxrm269mik.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/y_\/au\/hq\/y_auhqb9nma4xppu7dxrm269mik.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The first line is the mouse coordinates, which are used as the width and height of the billiard table.<br \/> The second line is the first 100 bits of the sequence obtained through the remainders of the division.<br \/> The third line is the first 100 bits of the sequence obtained through the parity of the integer part.<\/p>\n<p> <\/p>\n<p>Black color \u2014 Visualization of the first sequence using Turtle graphics.<br \/> Purple \u2014 visualization of the second sequence.<\/p>\n<p> <\/p>\n<p><a href=\"http:\/\/xcont.com\/binarypattern\/mouseturtle\/\" rel=\"nofollow noopener noreferrer\">JavaScript implementation<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/turtle_dynamic.js\" rel=\"nofollow noopener noreferrer\"><code>turtle_dynamic.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<p>In fact, in some cases, we do not need to take the remainder from the division. For Fibonacci numbers, it is enough to check the parity of the integer part of the division of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/82b\/69f\/c9a\/82b69fc9a5d439c252804d5ec5fbdb99.svg\" alt=\"$2kN$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/82b\/69f\/c9a\/82b69fc9a5d439c252804d5ec5fbdb99.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/82b\/69f\/c9a\/82b69fc9a5d439c252804d5ec5fbdb99.svg 781w\" loading=\"lazy\" decode=\"async\"\/> by <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0f7\/e0d\/984\/0f7e0d984adacd36ac5289e2115ecf04.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0f7\/e0d\/984\/0f7e0d984adacd36ac5289e2115ecf04.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0f7\/e0d\/984\/0f7e0d984adacd36ac5289e2115ecf04.svg 781w\" loading=\"lazy\" decode=\"async\"\/>:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/553\/105\/d74\/553105d749f2210d93bb5fd7be12db56.svg\" alt=\"$Q_k=\\lfloor \\frac{2kN}{M} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad k=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/553\/105\/d74\/553105d749f2210d93bb5fd7be12db56.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/553\/105\/d74\/553105d749f2210d93bb5fd7be12db56.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>In the numerator we have <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a93\/3b7\/8e1\/a933b78e18302859ac6e38065d0f149f.svg\" alt=\"$F_{n}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a93\/3b7\/8e1\/a933b78e18302859ac6e38065d0f149f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a93\/3b7\/8e1\/a933b78e18302859ac6e38065d0f149f.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. In the denominator \u2014 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/86b\/b9f\/be7\/86bb9fbe78c3c5cca5e77e80c3ffcd54.svg\" alt=\"$F_{n+1}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/86b\/b9f\/be7\/86bb9fbe78c3c5cca5e77e80c3ffcd54.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/86b\/b9f\/be7\/86bb9fbe78c3c5cca5e77e80c3ffcd54.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> <\/p>\n<p>As is known:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/80c\/40d\/177\/80c40d1774437346fcdfe92532c37b25.svg\" alt=\"$\\lim_{n\\to\\infty} \\frac{F_n}{F_{n+1}}= \\frac{1}{\\Phi}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/80c\/40d\/177\/80c40d1774437346fcdfe92532c37b25.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/80c\/40d\/177\/80c40d1774437346fcdfe92532c37b25.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This gives us a bridge: rational billiards (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/545\/286\/2e7\/5452862e7c8dd8675455d26ee7c6fc80.svg\" alt=\"$F_{n}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/545\/286\/2e7\/5452862e7c8dd8675455d26ee7c6fc80.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/545\/286\/2e7\/5452862e7c8dd8675455d26ee7c6fc80.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/383\/c5c\/1b6\/383c5c1b6cd7c2c3d53a9ab8038ab55b.svg\" alt=\"$F_{n+1}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/383\/c5c\/1b6\/383c5c1b6cd7c2c3d53a9ab8038ab55b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/383\/c5c\/1b6\/383c5c1b6cd7c2c3d53a9ab8038ab55b.svg 781w\" loading=\"lazy\" decode=\"async\"\/>) converge toward an irrational limit \u2014 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/590\/965\/e47\/590965e471c1ecdccdb90b1a167fed1e.svg\" alt=\"$\\Phi$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/590\/965\/e47\/590965e471c1ecdccdb90b1a167fed1e.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/590\/965\/e47\/590965e471c1ecdccdb90b1a167fed1e.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 allowing us to define an infinite symbolic sequence.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/9c5\/434\/e6e\/9c5434e6e8aa9b70287188a5f76ed205.svg\" alt=\"$\\Phi$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/9c5\/434\/e6e\/9c5434e6e8aa9b70287188a5f76ed205.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/9c5\/434\/e6e\/9c5434e6e8aa9b70287188a5f76ed205.svg 781w\" loading=\"lazy\" decode=\"async\"\/> is the Golden Ratio. An irrational number. Now we can write our formula as:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/679\/410\/000\/67941000038cf5fad68a7c78fbca6b2d.svg\" alt=\"$Q_k=\\lfloor \\frac{2k}{\\Phi} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad k=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/679\/410\/000\/67941000038cf5fad68a7c78fbca6b2d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/679\/410\/000\/67941000038cf5fad68a7c78fbca6b2d.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>We have obtained a formula with which we can fill in the sequence for a billiard table, the width of which is <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3a3\/7aa\/29f\/3a37aa29fde10470ce589284e83d801c.svg\" alt=\"$\\Phi$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3a3\/7aa\/29f\/3a37aa29fde10470ce589284e83d801c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3a3\/7aa\/29f\/3a37aa29fde10470ce589284e83d801c.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and the height is 1. The length of the sequence = <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/33b\/995\/ddb\/33b995ddb819536627d317b10b6d90cc.svg\" alt=\"$\\infty$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/33b\/995\/ddb\/33b995ddb819536627d317b10b6d90cc.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/33b\/995\/ddb\/33b995ddb819536627d317b10b6d90cc.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, but we can restore part of the pattern by moving from left to right along the sequence and looking into the upper left corner of the billiard table. It remains to figure out how to calculate <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/764\/959\/a24\/764959a24f4d7b542fda4f45c3e5fc21.svg\" alt=\"$\\Phi$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/764\/959\/a24\/764959a24f4d7b542fda4f45c3e5fc21.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/764\/959\/a24\/764959a24f4d7b542fda4f45c3e5fc21.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>One divided by the golden ratio can be rewritten as:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0cd\/fc3\/720\/0cdfc37203547a57ffbb911e49d10aa1.svg\" alt=\"$\\frac{1}{\\Phi}=\\frac {-1+{\\sqrt {5}}}{2}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0cd\/fc3\/720\/0cdfc37203547a57ffbb911e49d10aa1.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0cd\/fc3\/720\/0cdfc37203547a57ffbb911e49d10aa1.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>We can get rid of the two:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1df\/d48\/0e6\/1dfd480e6b836cc29db0bc10960fd64b.svg\" alt=\"$\\frac{2k}{\\Phi}=\\frac {2k(-1+{\\sqrt {5}})}{2}=k\\sqrt{5}-k$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1df\/d48\/0e6\/1dfd480e6b836cc29db0bc10960fd64b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1df\/d48\/0e6\/1dfd480e6b836cc29db0bc10960fd64b.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Our formula takes the form:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/fd6\/106\/374\/fd6106374ff488a9cbcc705666d802bb.svg\" alt=\"$Q_k=\\lfloor k\\sqrt{5}-k \\rfloor \\; (\\textrm{mod} \\; 2); \\quad k=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/fd6\/106\/374\/fd6106374ff488a9cbcc705666d802bb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/fd6\/106\/374\/fd6106374ff488a9cbcc705666d802bb.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Now we can draw part of the billiard pattern with sides 1 and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/39e\/721\/bae\/39e721bae07171bd77ffff7c7b9f925e.svg\" alt=\"$\\Phi$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/39e\/721\/bae\/39e721bae07171bd77ffff7c7b9f925e.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/39e\/721\/bae\/39e721bae07171bd77ffff7c7b9f925e.svg 781w\" loading=\"lazy\" decode=\"async\"\/>:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/bl\/fn\/7n\/blfn7nzfrczm2zdqx7gbvzptw5i.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/bl\/fn\/7n\/blfn7nzfrczm2zdqx7gbvzptw5i.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/bl\/fn\/7n\/blfn7nzfrczm2zdqx7gbvzptw5i.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>If we do not subtract <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bbb\/9d4\/905\/bbb9d49056dc303777cac7524c335638.svg\" alt=\"$k$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bbb\/9d4\/905\/bbb9d49056dc303777cac7524c335638.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bbb\/9d4\/905\/bbb9d49056dc303777cac7524c335638.svg 781w\" loading=\"lazy\" decode=\"async\"\/> each time, then every second bit in the sequence is inverted. We get the general formula:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/85d\/651\/942\/85d65194280c43269b3fef9849be5a45.svg\" alt=\"$Q_k=\\lfloor k\\sqrt{x} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad k=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/85d\/651\/942\/85d65194280c43269b3fef9849be5a45.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/85d\/651\/942\/85d65194280c43269b3fef9849be5a45.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Let&#8217;s build a sequence for <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4a7\/1c0\/539\/4a71c0539d45ec17beaf0cc4f9c7296c.svg\" alt=\"$k\\sqrt{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4a7\/1c0\/539\/4a71c0539d45ec17beaf0cc4f9c7296c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4a7\/1c0\/539\/4a71c0539d45ec17beaf0cc4f9c7296c.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<pre><code class=\"javascript\"> var x=2; var q=[]; for(var k=0;k&lt;256000;k++) q[k]=Math.floor(k*Math.sqrt(x))%2; <\/code><\/pre>\n<p> <\/p>\n<p>The first few bits of the sequence (<a href=\"http:\/\/oeis.org\/A083035\" rel=\"nofollow noopener noreferrer\">A083035<\/a>):<br \/> 01001101100100110011001101100100110110011001001101100100110110\u2026<\/p>\n<p> <\/p>\n<p>Angles are <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e22\/0dd\/56d\/e220dd56d76ea659068dbe63d9e37742.svg\" alt=\"$90^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e22\/0dd\/56d\/e220dd56d76ea659068dbe63d9e37742.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e22\/0dd\/56d\/e220dd56d76ea659068dbe63d9e37742.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/50d\/d49\/d34\/50dd49d34aab2cfc06209c755e9ba787.svg\" alt=\"$-90^{\\circ}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/50d\/d49\/d34\/50dd49d34aab2cfc06209c755e9ba787.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/50d\/d49\/d34\/50dd49d34aab2cfc06209c755e9ba787.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. The size of the initial segment is 5 pixels:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/hw\/wj\/v2\/hwwjv2_cuoworinwyptdj--jolo.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/hw\/wj\/v2\/hwwjv2_cuoworinwyptdj--jolo.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/hw\/wj\/v2\/hwwjv2_cuoworinwyptdj--jolo.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">This is interesting<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>From this curve, we can reconstruct the &#171;billiard pattern&#187; and see what is around the curve:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/eo\/dn\/zu\/eodnzusaufkmtyuvanqt0yehh40.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/eo\/dn\/zu\/eodnzusaufkmtyuvanqt0yehh40.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/eo\/dn\/zu\/eodnzusaufkmtyuvanqt0yehh40.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>It would be interesting to choose <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/012\/ea7\/5b6\/012ea75b6021cd52adecc70d1d4ba427.svg\" alt=\"$M$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/012\/ea7\/5b6\/012ea75b6021cd52adecc70d1d4ba427.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/012\/ea7\/5b6\/012ea75b6021cd52adecc70d1d4ba427.svg 781w\" loading=\"lazy\" decode=\"async\"\/> and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4eb\/e8f\/870\/4ebe8f870d63e5549d68afd481e5f156.svg\" alt=\"$N$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4eb\/e8f\/870\/4ebe8f870d63e5549d68afd481e5f156.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4eb\/e8f\/870\/4ebe8f870d63e5549d68afd481e5f156.svg 781w\" loading=\"lazy\" decode=\"async\"\/> for this pattern.<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">And this<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>Number of segments in the repeating part of the curve = <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/910\/026\/2a2\/9100262a2a008b919c69b9322838872b.svg\" alt=\"$P_n$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/910\/026\/2a2\/9100262a2a008b919c69b9322838872b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/910\/026\/2a2\/9100262a2a008b919c69b9322838872b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> (Pell numbers: 0, 1, 2, 5, 12, 29, 70, 169, 408, 985, 2378, \u2026 ).<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lq\/0u\/rb\/lq0urbr0k67x3zhmax5vm1q-g7e.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/lq\/0u\/rb\/lq0urbr0k67x3zhmax5vm1q-g7e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/lq\/0u\/rb\/lq0urbr0k67x3zhmax5vm1q-g7e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/dc8\/5e6\/db5\/dc85e6db5c748b94caa5246bab4cf955.svg\" alt=\"$\\sqrt{2} = \\lim_{n\\to\\infty} \\tfrac{P_{n-1}+P_n}{P_n}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/dc8\/5e6\/db5\/dc85e6db5c748b94caa5246bab4cf955.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/dc8\/5e6\/db5\/dc85e6db5c748b94caa5246bab4cf955.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<p>Someone may doubt that the parity of the integer part of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5eb\/8ec\/175\/5eb8ec1758ee80a995d12fbc09ecc0a2.svg\" alt=\"$k\\sqrt{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5eb\/8ec\/175\/5eb8ec1758ee80a995d12fbc09ecc0a2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5eb\/8ec\/175\/5eb8ec1758ee80a995d12fbc09ecc0a2.svg 781w\" loading=\"lazy\" decode=\"async\"\/> gives a fractal sequence. Let&#8217;s visualize part of this sequence with the visualizer described earlier:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zh\/bg\/3p\/zhbg3pip_al1c6qqi_uikclquvc.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zh\/bg\/3p\/zhbg3pip_al1c6qqi_uikclquvc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zh\/bg\/3p\/zhbg3pip_al1c6qqi_uikclquvc.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>For clarity, I colored the longest curve in the resulting pattern:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/6o\/zg\/cx\/6ozgcxqkvjmlu9qgmkbl8ups32q.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/6o\/zg\/cx\/6ozgcxqkvjmlu9qgmkbl8ups32q.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/6o\/zg\/cx\/6ozgcxqkvjmlu9qgmkbl8ups32q.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This curve has a name \u2014 &#171;Fibonacci word fractal&#187;.<\/p>\n<p> <\/p>\n<p>Thus, by gradually reducing billiard geometry through symbolic encodings, we arrive at a powerful realization: even irrational systems, which defy spatial tiling and corner reflection, can still produce deterministic, fractal structure \u2014 using only integer math.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"filling-the-fractal-from-symbolic-structure-to-visual-density\">Filling the Fractal: From Symbolic Structure to Visual Density<\/h2>\n<p> <\/p>\n<p>In the previous sections, we showed how symbolic sequences can generate complex boundary structures in discrete 2D space. All of these patterns \u2014 whether generated by rational billiards or floor-based symbolic systems \u2014 form enclosed regions.<br \/> Some of these regions close against the boundaries of the rectangle, while others are fully self-contained, looping within the grid. In either case, the resulting trajectories always define fully enclosed cells.<\/p>\n<p> <\/p>\n<p>Consider the following example:<\/p>\n<p> <\/p>\n<p>A binary sequence generated by the floor function:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a52\/444\/391\/a5244439123f6213173238be90f829db.svg\" alt=\"$Q_n=\\lfloor n\\sqrt{2} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad n=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a52\/444\/391\/a5244439123f6213173238be90f829db.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a52\/444\/391\/a5244439123f6213173238be90f829db.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>0100110110010011001001101100<\/p>\n<p> <\/p>\n<p>Using <a href=\"https:\/\/xcont.com\/binarypattern\/visualizer\/\" rel=\"nofollow noopener noreferrer\">the visualizer<\/a> in diagonal mode, we generate a familiar fractal boundary.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/9z\/4m\/jq\/9z4mjqogd_z2jiu5fnfzbmmod74.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/9z\/4m\/jq\/9z4mjqogd_z2jiu5fnfzbmmod74.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/9z\/4m\/jq\/9z4mjqogd_z2jiu5fnfzbmmod74.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>However, switching to horizontal\u2013vertical visualization, we invert every even-indexed bit and plot dashed lines accordingly. For bits with value 0, the lines are offset by one unit.<\/p>\n<p> <\/p>\n<p>Vertical lines:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ay\/ba\/j_\/aybaj_pgsm1w9dlmh5hf8kzvzw8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ay\/ba\/j_\/aybaj_pgsm1w9dlmh5hf8kzvzw8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ay\/ba\/j_\/aybaj_pgsm1w9dlmh5hf8kzvzw8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Horizontal lines:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ea\/4-\/ob\/ea4-obz7ijra18lauxjh7clujcu.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ea\/4-\/ob\/ea4-obz7ijra18lauxjh7clujcu.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ea\/4-\/ob\/ea4-obz7ijra18lauxjh7clujcu.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Merged:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ca\/v_\/i5\/cav_i5mgatwbanmu7seyct7ljgg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ca\/v_\/i5\/cav_i5mgatwbanmu7seyct7ljgg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ca\/v_\/i5\/cav_i5mgatwbanmu7seyct7ljgg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This technique resembles <strong>Hitomezashi stitching<\/strong>, a traditional Japanese method of generating textile patterns. While historically used to create decorative designs, this form of boundary generation bears striking similarity to the symbolic outlines produced in our system.<\/p>\n<p> <\/p>\n<p>However, <strong>Hitomezashi does not solve the filling problem<\/strong>. It provides only the <strong>skeleton<\/strong> \u2014 the structure of edges \u2014 but no mechanism for interior construction.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/9d\/eb\/yn\/9debyngywugdktysdhrw2suovei.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/9d\/eb\/yn\/9debyngywugdktysdhrw2suovei.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/9d\/eb\/yn\/9debyngywugdktysdhrw2suovei.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"a-symbolic-filling-algorithm\">A Symbolic Filling Algorithm<\/h2>\n<p> <\/p>\n<p>To solve this, we developed a symbolic method to <strong>automatically fill<\/strong> the interior regions \u2014 using only the original sequence. No region detection, no geometry, no search algorithms.<\/p>\n<p> <\/p>\n<p>The method works as follows:<\/p>\n<p> <\/p>\n<p>Construct a cumulative array a[n], based on the bitwise value of the fractal sequence:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6a9\/fee\/7be\/6a9fee7bee5ffab0f2c7c853de12866a.svg\" alt=\"$Q_n = \\lfloor n \\sqrt{x} \\rfloor \\mod 2, \\quad n = 0, 1, 2, \\dots$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6a9\/fee\/7be\/6a9fee7bee5ffab0f2c7c853de12866a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6a9\/fee\/7be\/6a9fee7bee5ffab0f2c7c853de12866a.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c86\/b04\/7dd\/c86b047dd97c72bab86342fe639704bd.svg\" alt=\"$a_n = a_{n-1} + 2 Q_n - 1$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c86\/b04\/7dd\/c86b047dd97c72bab86342fe639704bd.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c86\/b04\/7dd\/c86b047dd97c72bab86342fe639704bd.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>In code:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">var a = [0]; for (var i = 1; i &lt; size; i++) {     if (Math.floor(i * Math.sqrt(2)) % 2 == 1)         a[i] = a[i - 1] + 1;     else         a[i] = a[i - 1] - 1; }<\/code><\/pre>\n<p> <\/p>\n<p>Then, for each cell (x, y), compute:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">q = (a[x] + a[y] + 512) % 4; if (q === 0 || q === 1)     context.fillRect(x, y, 1, 1);<\/code><\/pre>\n<p> <\/p>\n<p>The result is a filled pattern \u2014 not derived from pixel analysis or region marking, but <strong>emerging directly from the same symbolic system<\/strong> that generated the boundaries.<\/p>\n<p> <\/p>\n<h3 id=\"full-algorithm\">Full Algorithm<\/h3>\n<p> <\/p>\n<pre><code class=\"javascript\">var a=[0]; for(var i=1;i&lt;size;i++){     if(Math.floor(i*Math.sqrt(2))%2==1)         a[i]=a[i-1]+1;     else         a[i]=a[i-1]-1; } for(var x=0;x&lt;size;x++){     for(var y=0;y&lt;size;y++){         q=(a[x]+a[y]+512)%4;         if(q==0 || q==1) context.fillRect(x, y, 1, 1);     } }<\/code><\/pre>\n<p> <\/p>\n<h2 id=\"examples\">Examples<\/h2>\n<p> <\/p>\n<p>Fractal fill based on:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/435\/59b\/6d6\/43559b6d6577ac1855a462440bb69df8.svg\" alt=\"$Q_n=\\lfloor n\\sqrt{2} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad n=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/435\/59b\/6d6\/43559b6d6577ac1855a462440bb69df8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/435\/59b\/6d6\/43559b6d6577ac1855a462440bb69df8.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lb\/tc\/rj\/lbtcrjeqijh1cb6fczk6ysn_oia.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/lb\/tc\/rj\/lbtcrjeqijh1cb6fczk6ysn_oia.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/lb\/tc\/rj\/lbtcrjeqijh1cb6fczk6ysn_oia.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Gif<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wq\/ap\/0d\/wqap0dchqrz7zdzzi_zrrf-omna.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/wq\/ap\/0d\/wqap0dchqrz7zdzzi_zrrf-omna.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/wq\/ap\/0d\/wqap0dchqrz7zdzzi_zrrf-omna.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<\/div><\/div>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/cea\/76f\/374\/cea76f3746c4d741d2e47c4019504f1c.svg\" alt=\"$Q_n=\\lfloor n(\\sqrt{5}+1) \\rfloor \\; (\\textrm{mod} \\; 2); \\quad n=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/cea\/76f\/374\/cea76f3746c4d741d2e47c4019504f1c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/cea\/76f\/374\/cea76f3746c4d741d2e47c4019504f1c.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>(Fibonacci-based)<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/n7\/gd\/rr\/n7gdrrpawid9aj8m7xmobm-yb_u.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/n7\/gd\/rr\/n7gdrrpawid9aj8m7xmobm-yb_u.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/n7\/gd\/rr\/n7gdrrpawid9aj8m7xmobm-yb_u.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Gif<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c7\/p6\/mp\/c7p6mp2q9-uvp22xa-a436te2is.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/c7\/p6\/mp\/c7p6mp2q9-uvp22xa-a436te2is.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/c7\/p6\/mp\/c7p6mp2q9-uvp22xa-a436te2is.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<\/div><\/div>\n<p> <\/p>\n<h3 id=\"interactive\">Interactive<\/h3>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/binarypattern\/fractal.html\" rel=\"nofollow noopener noreferrer\">Visualizer \u2014 Fractal Fill from Irrationals<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/fractal.js\" rel=\"nofollow noopener noreferrer\"><code>fractal.js<\/code><\/a><\/p>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/binarypattern\/fractal_dynamic.html\" rel=\"nofollow noopener noreferrer\">Dynamic Visualization \u2014 Using Rational Approximations<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/fractal_dynamic.js\" rel=\"nofollow noopener noreferrer\"><code>fractal_dynamic.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Perfect Shuffle Comparison (Speculative)<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>We can compare fractal sequences from floor-based systems with sequences produced by a <a href=\"https:\/\/github.com\/xcontcom\/perfect-shuffle\" rel=\"nofollow noopener noreferrer\">perfect shuffle<\/a> function.<\/p>\n<p> <\/p>\n<p>Here&#8217;s our shuffle logic:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">function shuffle(array, shiftAmount) {     let len = array.length;     let shuffled = new Array(len * 2);     for (let i = 0; i &lt; len; i++) {         shuffled[2 * i] = array[(i + shiftAmount) % len];         shuffled[2 * i + 1] = array[i];     }     return shuffled; }<\/code><\/pre>\n<p> <\/p>\n<p>We start with a base array:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">let array1 = [1, 0]; for (let i = 0; i &lt; 15; i++) {     array1 = shuffle(array1, (y + 45) * 128); }<\/code><\/pre>\n<p> <\/p>\n<p>And compare it with this floor-based sequence:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">let array2 = []; for (let i = 0; i &lt; sizexy; i++) {     array2[i] = Math.floor(i * (y + 45) \/ 128) % 2; }<\/code><\/pre>\n<p> <\/p>\n<p>Both arrays are then visualized using our bit-pattern analysis:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">for (let y = 0; y &lt; sizexy; y++) {     \/\/ generate array1 or array2      let digit;     let bits = [];     for (let i = 0; i &lt; len; i++) {         digit = 0;         for (let j = 0; j &lt; bitLength; j++) {             digit |= array[i + j] &lt;&lt; (bitLength - 1 - j);         }         if (!bits.includes(digit)) {             bits.push(digit);         }     }     for (let i = 0; i &lt; bits.length; i++) {         context.fillRect(bits[i] * size, y * size, size, size);     } }<\/code><\/pre>\n<p> <\/p>\n<p>Here are the results:<\/p>\n<p> <\/p>\n<p>Perfect shuffle:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/aa\/0a\/bv\/aa0abvr6cfd_b7fz-ike__a7vbe.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/aa\/0a\/bv\/aa0abvr6cfd_b7fz-ike__a7vbe.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/aa\/0a\/bv\/aa0abvr6cfd_b7fz-ike__a7vbe.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Floor-based sequence:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ps\/zd\/r_\/pszdr_u1pu31zmww45hx2w4pgyi.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ps\/zd\/r_\/pszdr_u1pu31zmww45hx2w4pgyi.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ps\/zd\/r_\/pszdr_u1pu31zmww45hx2w4pgyi.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The two patterns are visually identical.<\/p>\n<p> <\/p>\n<p>This suggests that in some cases, perfect shuffle systems and irrational-floor systems may produce the same fractal binary sequences \u2014 or at least structurally equivalent ones.<\/p>\n<p> <\/p>\n<p>We don\u2019t yet have a formal proof or a unifying theory. But the match is too precise to ignore.<\/p>\n<p> <\/p>\n<p>More analysis is needed to determine whether these overlaps are coincidence, mathematical identity, or reflections of a deeper shared structure. For now, we consider this a visually compelling anomaly \u2014 worth future investigation.<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"nonlinear-functions-and-symbolic-surface-slicing\">Nonlinear Functions and Symbolic Surface Slicing<\/h2>\n<p> <\/p>\n<h3 id=\"symbolic-rotation-and-the-circle-representation\">Symbolic Rotation and the Circle Representation<\/h3>\n<p> <\/p>\n<p>The binary sequence generated by<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4c8\/c4d\/e59\/4c8c4de5961123445da63c592af64016.svg\" alt=\"$\\left\\lfloor k \\sqrt{2} \\right\\rfloor \\bmod 2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4c8\/c4d\/e59\/4c8c4de5961123445da63c592af64016.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4c8\/c4d\/e59\/4c8c4de5961123445da63c592af64016.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>can be interpreted geometrically as a rotation on the unit circle. At each step $k$, we rotate by an irrational angle (e.g., $\\sqrt{2}$) and assign a 0 or 1 depending on which half of the circle the point lands in.<\/p>\n<p> <\/p>\n<p>An alternative but mathematically equivalent formulation is:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f16\/5fd\/7b1\/f165fd7b1feb7b5f58e59ac251be7ae9.svg\" alt=\"$\\sin\\left( \\pi k \\sqrt{2} \\right) &gt; 0$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f16\/5fd\/7b1\/f165fd7b1feb7b5f58e59ac251be7ae9.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f16\/5fd\/7b1\/f165fd7b1feb7b5f58e59ac251be7ae9.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>The sine function is positive in one half of the circle and negative in the other \u2014 effectively producing the same binary threshold.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1e\/y3\/yy\/1ey3yyka3aeqoourf41oltd6s-s.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/1e\/y3\/yy\/1ey3yyka3aeqoourf41oltd6s-s.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/1e\/y3\/yy\/1ey3yyka3aeqoourf41oltd6s-s.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This circular diagram shows the orbit of<\/p>\n<p> <\/p>\n<p>$$k \\sqrt{2} \\bmod 1$$<\/p>\n<p> <\/p>\n<p>projected onto the unit circle. The points rotate continuously and never repeat. Each crossing of the horizontal axis (i.e., sign change of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e8e\/af2\/4f1\/e8eaf24f1828b7ac676b6e169fa0d298.svg\" alt=\"$\\sin\\left( \\pi k \\sqrt{2} \\right)$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e8e\/af2\/4f1\/e8eaf24f1828b7ac676b6e169fa0d298.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e8e\/af2\/4f1\/e8eaf24f1828b7ac676b6e169fa0d298.svg 781w\" loading=\"lazy\" decode=\"async\"\/>) causes a binary switch. The result is a Sturmian sequence \u2014 a symbolic encoding of irrational rotation \u2014 visualized as a point traveling clockwise and recording its hemisphere.<\/p>\n<p> <\/p>\n<p>Interestingly, even a sequence like<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/193\/eee\/fd0\/193eeefd063a927e15b39419a95337ff.svg\" alt=\"$\\sin\\left( k \\right) &gt; 0$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/193\/eee\/fd0\/193eeefd063a927e15b39419a95337ff.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/193\/eee\/fd0\/193eeefd063a927e15b39419a95337ff.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>generates a similarly complex structure. Though the function seems simple, stepping by exactly 1 radian per iteration is irrational with respect to the sine wave\u2019s natural period of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/585\/2c3\/73c\/5852c373c6759d5d43ae31e45450f8b9.svg\" alt=\"$2 \\pi$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/585\/2c3\/73c\/5852c373c6759d5d43ae31e45450f8b9.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/585\/2c3\/73c\/5852c373c6759d5d43ae31e45450f8b9.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. Thus:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/507\/eaa\/d6b\/507eaad6b1f9b4247659c6bfa564e2f3.svg\" alt=\"$\\sin(k) &gt; 0 \\quad \\Longleftrightarrow \\quad \\left\\lfloor \\frac{k}{\\pi} \\right\\rfloor \\bmod 2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/507\/eaa\/d6b\/507eaad6b1f9b4247659c6bfa564e2f3.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/507\/eaa\/d6b\/507eaad6b1f9b4247659c6bfa564e2f3.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Which means: irrational step size alone is enough to create symbolic fractals. It\u2019s not the shape of the function \u2014 it\u2019s the incommensurability that matters.<\/p>\n<p> <\/p>\n<p>Geometric Interpretation of Linear Discretization<br \/> We begin with a geometric interpretation of the function<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/527\/54c\/77d\/52754c77d8389f6c680cd8abb7e92aaf.svg\" alt=\"$\\left\\lfloor k \\sqrt{2} \\right\\rfloor \\bmod 2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/527\/54c\/77d\/52754c77d8389f6c680cd8abb7e92aaf.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/527\/54c\/77d\/52754c77d8389f6c680cd8abb7e92aaf.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This can be visualized as a straight line <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/607\/c54\/4d5\/607c544d5320d86b18241f510d3a8206.svg\" alt=\"$y=k \\sqrt{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/607\/c54\/4d5\/607c544d5320d86b18241f510d3a8206.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/607\/c54\/4d5\/607c544d5320d86b18241f510d3a8206.svg 781w\" loading=\"lazy\" decode=\"async\"\/> traversing a periodic 2D space where the <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1bc\/22b\/c18\/1bc22bc185fd5ddd20ab6ba549db5af2.svg\" alt=\"$y$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1bc\/22b\/c18\/1bc22bc185fd5ddd20ab6ba549db5af2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1bc\/22b\/c18\/1bc22bc185fd5ddd20ab6ba549db5af2.svg 781w\" loading=\"lazy\" decode=\"async\"\/>-axis alternates between bands labeled 0 and 1. The value of the function at each step depends on the integer part of <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/925\/2fd\/c6b\/9252fdc6b7b46f9f17b5b5f669dcc848.svg\" alt=\"$k\\sqrt{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/925\/2fd\/c6b\/9252fdc6b7b46f9f17b5b5f669dcc848.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/925\/2fd\/c6b\/9252fdc6b7b46f9f17b5b5f669dcc848.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, determining whether the line intersects an even or odd band.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/eb\/z3\/bb\/ebz3bbbgbivtp6u-gcbkf96eveg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/eb\/z3\/bb\/ebz3bbbgbivtp6u-gcbkf96eveg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/eb\/z3\/bb\/ebz3bbbgbivtp6u-gcbkf96eveg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Alternatively, we may interpret the system as a function <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ba4\/991\/5d4\/ba49915d45ad3f6e41c657261ddd8ca7.svg\" alt=\"$y=x$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ba4\/991\/5d4\/ba49915d45ad3f6e41c657261ddd8ca7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ba4\/991\/5d4\/ba49915d45ad3f6e41c657261ddd8ca7.svg 781w\" loading=\"lazy\" decode=\"async\"\/> with <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/182\/9d5\/2e2\/1829d52e20994b61e25dfd2e7440091c.svg\" alt=\"$\\sqrt{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/182\/9d5\/2e2\/1829d52e20994b61e25dfd2e7440091c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/182\/9d5\/2e2\/1829d52e20994b61e25dfd2e7440091c.svg 781w\" loading=\"lazy\" decode=\"async\"\/> acting as a discretization step along the vertical axis. This perspective reduces the behavior of the original billiard system to a symbolic sampling of a continuous linear function.<\/p>\n<p> <\/p>\n<p>Both<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1e1\/a3c\/a40\/1e1a3ca404c4183ddcd1115af22b07ae.svg\" alt=\"$\\left\\lfloor k \\sqrt{2} \\right\\rfloor \\bmod 2 \\quad \\text{and} \\quad \\sin\\left( \\pi k \\sqrt{2} \\right) &gt; 0$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1e1\/a3c\/a40\/1e1a3ca404c4183ddcd1115af22b07ae.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1e1\/a3c\/a40\/1e1a3ca404c4183ddcd1115af22b07ae.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>serve as symbolic discretization methods \u2014 one yielding binary values via integer floor division, the other through sign thresholding on a continuous sinusoid.<\/p>\n<p> <\/p>\n<h3 id=\"transition-to-quadratic-functions\">Transition to Quadratic Functions<\/h3>\n<p> <\/p>\n<p>Having reduced the system to a linear function and its discretization, we now explore the effects of replacing the base function <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e86\/e77\/fcb\/e86e77fcb1a5e2267b10392648370248.svg\" alt=\"$y=x$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e86\/e77\/fcb\/e86e77fcb1a5e2267b10392648370248.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e86\/e77\/fcb\/e86e77fcb1a5e2267b10392648370248.svg 781w\" loading=\"lazy\" decode=\"async\"\/> with a nonlinear alternative.<\/p>\n<p> <\/p>\n<p>Linear rotation yields symbolic Sturmian sequences. What happens if we increase the curvature? Quadratic growth is the simplest next step.<\/p>\n<p> <\/p>\n<p>We now substitute the linear function with:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/220\/b61\/281\/220b61281910e88db2ff5e544d4fedc6.svg\" alt=\"$y = x^2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/220\/b61\/281\/220b61281910e88db2ff5e544d4fedc6.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/220\/b61\/281\/220b61281910e88db2ff5e544d4fedc6.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>We construct the new sequence using:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ab7\/dfd\/a21\/ab7dfda2133e8a62afbe123d66b00bf7.svg\" alt=\"$Q_x=\\lfloor x^2\\sqrt{2} \\rfloor \\; (\\textrm{mod} \\; 2); \\quad x=0,1,2,\u2026$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ab7\/dfd\/a21\/ab7dfda2133e8a62afbe123d66b00bf7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ab7\/dfd\/a21\/ab7dfda2133e8a62afbe123d66b00bf7.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">q[x] = Math.floor(x * x * Math.sqrt(2)) % 2;<\/code><\/pre>\n<p> <\/p>\n<p>This substitution shifts us from uniform linear growth to a system governed by accelerating curvature, producing richer and more complex symbolic behavior.<\/p>\n<p> <\/p>\n<p>Visualizing this sequence with the Symbolic Filling Algorithm yields a disordered pattern.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qy\/ow\/kj\/qyowkjp1yx1lut6mudb4qitpv84.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/qy\/ow\/kj\/qyowkjp1yx1lut6mudb4qitpv84.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/qy\/ow\/kj\/qyowkjp1yx1lut6mudb4qitpv84.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Gif<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xa\/my\/b-\/xamyb-4xquw5kxi_vhzm4echveo.gif\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/webt\/xa\/my\/b-\/xamyb-4xquw5kxi_vhzm4echveo.gif 780w,&#10;       https:\/\/habrastorage.org\/webt\/xa\/my\/b-\/xamyb-4xquw5kxi_vhzm4echveo.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<\/div><\/div>\n<p> <\/p>\n<p>Similarly, applying Turtle graphics results in &#171;chaotic&#187; outputs<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/js\/vc\/fl\/jsvcflzxlyfrtojqesrc5o5yvmg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/js\/vc\/fl\/jsvcflzxlyfrtojqesrc5o5yvmg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/js\/vc\/fl\/jsvcflzxlyfrtojqesrc5o5yvmg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>suggesting that the underlying symbolic dynamics differ significantly from the linear case. This observation motivated us to try a simpler visual encoding.<\/p>\n<p> <\/p>\n<p>This prompts a reconsideration of visualization methods. Rather than relying on complex binary sequence encodings (e.g., symbolic filling or turtle graphics), we adopt a simpler approach:<\/p>\n<p> <\/p>\n<ol>\n<li>Place the first k elements of the sequence q[x] in the initial row.<\/li>\n<li>For each subsequent row along the y-axis, use q[x+ky].<\/li>\n<li>The result is a striking array of structured, interference-like patterns.<\/li>\n<\/ol>\n<p> <\/p>\n<p>This reveals that a seemingly chaotic 1D sequence can exhibit coherent spatial behavior when unfolded along two dimensions. Generalizing this, we rewrite the indexing expression as:<\/p>\n<p> <\/p>\n<pre><code class=\"javascript\">q[x] = Math.floor((x + k * y) ** 2 * Math.sqrt(2)) % 2;<\/code><\/pre>\n<p> <\/p>\n<p>Expanding the square:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8f2\/a14\/d9c\/8f2a14d9cb9a8fb33420f9e2251b19eb.svg\" alt=\"$(x + k y)^2 = x^2 + 2kxy + k^2 y^2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8f2\/a14\/d9c\/8f2a14d9cb9a8fb33420f9e2251b19eb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/8f2\/a14\/d9c\/8f2a14d9cb9a8fb33420f9e2251b19eb.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This quadratic form suggests a symbolic sampling of a 3D curved surface. We abstract this into a general expression:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c76\/fc1\/01e\/c76fc101ece1fa9754d73709498af047.svg\" alt=\"$z = a \\left( x^2 + bxy + c y^2 \\right)^d$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c76\/fc1\/01e\/c76fc101ece1fa9754d73709498af047.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c76\/fc1\/01e\/c76fc101ece1fa9754d73709498af047.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Here:<\/p>\n<p> <\/p>\n<ul>\n<li><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/02a\/3f6\/5f4\/02a3f65f47c0e34403b2dae4d440678a.svg\" alt=\"$a$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/02a\/3f6\/5f4\/02a3f65f47c0e34403b2dae4d440678a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/02a\/3f6\/5f4\/02a3f65f47c0e34403b2dae4d440678a.svg 781w\" loading=\"lazy\" decode=\"async\"\/> controls vertical scaling (the discretization frequency),<\/li>\n<li><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/424\/45c\/bf5\/42445cbf5c386cf06bb60280d8a525f1.svg\" alt=\"$b$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/424\/45c\/bf5\/42445cbf5c386cf06bb60280d8a525f1.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/424\/45c\/bf5\/42445cbf5c386cf06bb60280d8a525f1.svg 781w\" loading=\"lazy\" decode=\"async\"\/> introduces diagonal shear,<\/li>\n<li><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2b1\/c41\/982\/2b1c41982d7c3b191857e73711edc79b.svg\" alt=\"$c$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2b1\/c41\/982\/2b1c41982d7c3b191857e73711edc79b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2b1\/c41\/982\/2b1c41982d7c3b191857e73711edc79b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> modulates stretching along the <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/16b\/5be\/3b2\/16b5be3b22088f2a6891b18b8c627178.svg\" alt=\"$y$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/16b\/5be\/3b2\/16b5be3b22088f2a6891b18b8c627178.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/16b\/5be\/3b2\/16b5be3b22088f2a6891b18b8c627178.svg 781w\" loading=\"lazy\" decode=\"async\"\/>-axis,<\/li>\n<li>and <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d1f\/e2e\/559\/d1fe2e559ab72b5987a82033c6c79539.svg\" alt=\"$d$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d1f\/e2e\/559\/d1fe2e559ab72b5987a82033c6c79539.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d1f\/e2e\/559\/d1fe2e559ab72b5987a82033c6c79539.svg 781w\" loading=\"lazy\" decode=\"async\"\/> introduces curvature nonlinearity.<\/li>\n<\/ul>\n<p> <\/p>\n<p>For example, setting <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/483\/fce\/a23\/483fcea23aaab6c630b7776c55783286.svg\" alt=\"$b=0,c=1,d=1$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/483\/fce\/a23\/483fcea23aaab6c630b7776c55783286.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/483\/fce\/a23\/483fcea23aaab6c630b7776c55783286.svg 781w\" loading=\"lazy\" decode=\"async\"\/> yields:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f7d\/5cc\/e3f\/f7d5cce3f0962fdc5c49d7c9124f4bb8.svg\" alt=\"$z = a \\left( x^2 + y^2 \\right)$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f7d\/5cc\/e3f\/f7d5cce3f0962fdc5c49d7c9124f4bb8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f7d\/5cc\/e3f\/f7d5cce3f0962fdc5c49d7c9124f4bb8.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>an <strong>elliptical paraboloid<\/strong>, a classic bowl-shaped surface.<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/jo\/ks\/vt\/joksvtycb32dkqjrtnbyk2tklwq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/jo\/ks\/vt\/joksvtycb32dkqjrtnbyk2tklwq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/jo\/ks\/vt\/joksvtycb32dkqjrtnbyk2tklwq.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>We then visualize both:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1f7\/c34\/6da\/1f7c346dae5790b0a32e1f14963aed9d.svg\" alt=\"$\\left\\lfloor z \\sqrt{2} \\right\\rfloor \\bmod 2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1f7\/c34\/6da\/1f7c346dae5790b0a32e1f14963aed9d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1f7\/c34\/6da\/1f7c346dae5790b0a32e1f14963aed9d.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/341\/a1c\/0a6\/341a1c0a6700e6f1e813c60be87f83c7.svg\" alt=\"$\\sin\\left( \\pi z \\sqrt{2} \\right)$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/341\/a1c\/0a6\/341a1c0a6700e6f1e813c60be87f83c7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/341\/a1c\/0a6\/341a1c0a6700e6f1e813c60be87f83c7.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>&#8230;using this surface. Despite differing in output (binary vs. continuous), both render structurally equivalent patterns: the sine version produces smooth grayscale textures, while the floor function yields crisp binary segmentation. In either case, the resulting 2D images exhibit radial, interference-like motifs \u2014 strongly reminiscent of diffraction or holographic patterns.<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>binary<\/th>\n<th>continuous<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/xu\/cr\/ys\/xucrysv0onk3dnyyqo6vytvvlom.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/xu\/cr\/ys\/xucrysv0onk3dnyyqo6vytvvlom.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/xu\/cr\/ys\/xucrysv0onk3dnyyqo6vytvvlom.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8x\/g7\/bf\/8xg7bfq1qwzouheycdzk0do58b8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/8x\/g7\/bf\/8xg7bfq1qwzouheycdzk0do58b8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/8x\/g7\/bf\/8xg7bfq1qwzouheycdzk0do58b8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p>The sine-based rendering reveals finer gradients and smoother interference zones, but the underlying symbolic structure is identical to the binary version.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"holographic-analogy\">Holographic Analogy<\/h3>\n<p> <\/p>\n<p>In classical holography, a point source emits nested spherical wavefronts. When these are sliced by a flat recording plane, the amplitude at each (x, y) position encodes a continuous interference pattern. The spacing between wavefronts defines the wavelength \u2014 effectively a discretization step in the z-direction.<\/p>\n<p> <\/p>\n<p>Our system inverts this paradigm: instead of slicing nested curved shells with a flat surface, we intersect a single curved surface with stacked, evenly spaced binary planes \u2014 symbolic layers representing a plane wavefront. Each (x, y) coordinate samples which symbolic layer the surface intersects, producing a binary (or thresholded) value.<\/p>\n<p> <\/p>\n<p>While the components differ \u2014 continuous vs symbolic, curved emitter vs curved surface \u2014 the underlying mechanism is the same: a curved geometry intersected by layered structure, producing interference-like textures from simple spatial rules.<\/p>\n<p> <\/p>\n<p>Despite differences in physical interpretation, both systems share a core structure: curved geometry meets layered slicing \u2014 and complexity emerges.<\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<p>Our picture size is 400 pixels. We used <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5ad\/a26\/0d0\/5ada260d0d08167aa0cc997d01da2ebe.svg\" alt=\"$a=\\frac{1}{400}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5ad\/a26\/0d0\/5ada260d0d08167aa0cc997d01da2ebe.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/5ad\/a26\/0d0\/5ada260d0d08167aa0cc997d01da2ebe.svg 781w\" loading=\"lazy\" decode=\"async\"\/> for previous picture to fit the picture.<\/p>\n<p> <\/p>\n<p>Here another pattern with <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f40\/ae5\/7c8\/f40ae57c8f9b0969fd9a987321ba2f53.svg\" alt=\"$a=\\frac{1}{200}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f40\/ae5\/7c8\/f40ae57c8f9b0969fd9a987321ba2f53.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f40\/ae5\/7c8\/f40ae57c8f9b0969fd9a987321ba2f53.svg 781w\" loading=\"lazy\" decode=\"async\"\/>:<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>binary<\/th>\n<th>continuous<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zg\/xl\/_q\/zgxl_q2xg1db7eiwx3dgvmioqmu.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zg\/xl\/_q\/zgxl_q2xg1db7eiwx3dgvmioqmu.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zg\/xl\/_q\/zgxl_q2xg1db7eiwx3dgvmioqmu.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mm\/b8\/_l\/mmb8_lgsku3vlunqzgzjija0o3s.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/mm\/b8\/_l\/mmb8_lgsku3vlunqzgzjija0o3s.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/mm\/b8\/_l\/mmb8_lgsku3vlunqzgzjija0o3s.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b31\/c63\/b14\/b31c63b14f207040390e1f9f48c03f1d.svg\" alt=\"$c$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b31\/c63\/b14\/b31c63b14f207040390e1f9f48c03f1d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b31\/c63\/b14\/b31c63b14f207040390e1f9f48c03f1d.svg 781w\" loading=\"lazy\" decode=\"async\"\/> modulates stretching along the <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bbc\/149\/c32\/bbc149c32d78cedbd41144224179cf53.svg\" alt=\"$y$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bbc\/149\/c32\/bbc149c32d78cedbd41144224179cf53.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/bbc\/149\/c32\/bbc149c32d78cedbd41144224179cf53.svg 781w\" loading=\"lazy\" decode=\"async\"\/>-axis<\/p>\n<p> <\/p>\n<p>(we will use continuous patterns from now).<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/37a\/0ea\/d3c\/37a0ead3c1731639f2ba32949d1549e6.svg\" alt=\"$c=2$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/37a\/0ea\/d3c\/37a0ead3c1731639f2ba32949d1549e6.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/37a\/0ea\/d3c\/37a0ead3c1731639f2ba32949d1549e6.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/th>\n<th><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c45\/d93\/ad8\/c45d93ad8d9da08d75db13ff13b40b1e.svg\" alt=\"$c=0.2$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c45\/d93\/ad8\/c45d93ad8d9da08d75db13ff13b40b1e.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c45\/d93\/ad8\/c45d93ad8d9da08d75db13ff13b40b1e.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3m\/rg\/nq\/3mrgnq4qlqgiivgcwqyuvchpaxa.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/3m\/rg\/nq\/3mrgnq4qlqgiivgcwqyuvchpaxa.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/3m\/rg\/nq\/3mrgnq4qlqgiivgcwqyuvchpaxa.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/n1\/a5\/tj\/n1a5tjcazolv7y4tgfr-r6sjd6o.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/n1\/a5\/tj\/n1a5tjcazolv7y4tgfr-r6sjd6o.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/n1\/a5\/tj\/n1a5tjcazolv7y4tgfr-r6sjd6o.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2df\/0b5\/990\/2df0b5990a647759d886b3ec217205b6.svg\" alt=\"$b$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2df\/0b5\/990\/2df0b5990a647759d886b3ec217205b6.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2df\/0b5\/990\/2df0b5990a647759d886b3ec217205b6.svg 781w\" loading=\"lazy\" decode=\"async\"\/> introduces diagonal shear<\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/cd0\/433\/5b8\/cd04335b8a81dc74e0ae5eaada711307.svg\" alt=\"$b=-1.5$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/cd0\/433\/5b8\/cd04335b8a81dc74e0ae5eaada711307.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/cd0\/433\/5b8\/cd04335b8a81dc74e0ae5eaada711307.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/th>\n<th><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/822\/635\/f0c\/822635f0c6bad077577a7d874c9f357e.svg\" alt=\"$b=1.5$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/822\/635\/f0c\/822635f0c6bad077577a7d874c9f357e.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/822\/635\/f0c\/822635f0c6bad077577a7d874c9f357e.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/5n\/3u\/vv\/5n3uvvjfvjs0i8bxenjjpa_td0e.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/5n\/3u\/vv\/5n3uvvjfvjs0i8bxenjjpa_td0e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/5n\/3u\/vv\/5n3uvvjfvjs0i8bxenjjpa_td0e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1c\/u9\/ls\/1cu9lsa74h8vd0mko34zw053ebu.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/1c\/u9\/ls\/1cu9lsa74h8vd0mko34zw053ebu.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/1c\/u9\/ls\/1cu9lsa74h8vd0mko34zw053ebu.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p>For <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/795\/21e\/43f\/79521e43fee7a835e93599ea53d01fa9.svg\" alt=\"$b=0,c=-1,d=1$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/795\/21e\/43f\/79521e43fee7a835e93599ea53d01fa9.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/795\/21e\/43f\/79521e43fee7a835e93599ea53d01fa9.svg 781w\" loading=\"lazy\" decode=\"async\"\/> our equation becomes:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/503\/283\/3a5\/5032833a502fbaaffe18b00dacd782fb.svg\" alt=\"$z=a(x^2-y^2)$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/503\/283\/3a5\/5032833a502fbaaffe18b00dacd782fb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/503\/283\/3a5\/5032833a502fbaaffe18b00dacd782fb.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>This is a hyperbolic paraboloid \u2014 a surface with negative Gaussian curvature:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lc\/1w\/af\/lc1wafq1kvkiqf9ogmouu43xjc4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/lc\/1w\/af\/lc1wafq1kvkiqf9ogmouu43xjc4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/lc\/1w\/af\/lc1wafq1kvkiqf9ogmouu43xjc4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/300\/005\/eae\/300005eae3abb78092ab9fffb7e0a042.svg\" alt=\"$a=\\frac{1}{400}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/300\/005\/eae\/300005eae3abb78092ab9fffb7e0a042.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/300\/005\/eae\/300005eae3abb78092ab9fffb7e0a042.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/th>\n<th><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6d8\/2ef\/141\/6d82ef141cd911515c9b19522bb92a33.svg\" alt=\"$a=\\frac{1}{200}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6d8\/2ef\/141\/6d82ef141cd911515c9b19522bb92a33.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/6d8\/2ef\/141\/6d82ef141cd911515c9b19522bb92a33.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ql\/n4\/lc\/qln4lc0bq0uawohcinqot3j7cb4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ql\/n4\/lc\/qln4lc0bq0uawohcinqot3j7cb4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ql\/n4\/lc\/qln4lc0bq0uawohcinqot3j7cb4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8c\/dt\/xf\/8cdtxfcttwzhoy5ylq7tbqpnjvm.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/8c\/dt\/xf\/8cdtxfcttwzhoy5ylq7tbqpnjvm.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/8c\/dt\/xf\/8cdtxfcttwzhoy5ylq7tbqpnjvm.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p>For <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c5d\/90a\/04c\/c5d90a04cf115307c3bd3d065896cff8.svg\" alt=\"$b=0, c=1, d=1\/5$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c5d\/90a\/04c\/c5d90a04cf115307c3bd3d065896cff8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c5d\/90a\/04c\/c5d90a04cf115307c3bd3d065896cff8.svg 781w\" loading=\"lazy\" decode=\"async\"\/> our equation becomes:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0e9\/973\/4bb\/0e99734bb653d322fa362d6767d1d286.svg\" alt=\"$z=a(x^2+y^2)^{1\/5}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0e9\/973\/4bb\/0e99734bb653d322fa362d6767d1d286.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/0e9\/973\/4bb\/0e99734bb653d322fa362d6767d1d286.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1y\/zc\/by\/1yzcbyyhtvgimwvl-5kn7zmuz8a.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/1y\/zc\/by\/1yzcbyyhtvgimwvl-5kn7zmuz8a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/1y\/zc\/by\/1yzcbyyhtvgimwvl-5kn7zmuz8a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c6f\/274\/5d7\/c6f2745d7e35f779410e0168848f1fa7.svg\" alt=\"$a=1$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c6f\/274\/5d7\/c6f2745d7e35f779410e0168848f1fa7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c6f\/274\/5d7\/c6f2745d7e35f779410e0168848f1fa7.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e2b\/cef\/dd7\/e2bcefdd7793f485c83970ed184db11f.svg\" alt=\"$a=10$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e2b\/cef\/dd7\/e2bcefdd7793f485c83970ed184db11f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e2b\/cef\/dd7\/e2bcefdd7793f485c83970ed184db11f.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1f\/j_\/7z\/1fj_7zmkaoigr1sl5-oa9s0vln4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/1f\/j_\/7z\/1fj_7zmkaoigr1sl5-oa9s0vln4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/1f\/j_\/7z\/1fj_7zmkaoigr1sl5-oa9s0vln4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8f\/ij\/y7\/8fijy7p269okarcjjqs2ygadnpg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/8f\/ij\/y7\/8fijy7p269okarcjjqs2ygadnpg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/8f\/ij\/y7\/8fijy7p269okarcjjqs2ygadnpg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ad5\/19a\/e8e\/ad519ae8e01f18d1316d35ac19a4c8fe.svg\" alt=\"$a=100$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ad5\/19a\/e8e\/ad519ae8e01f18d1316d35ac19a4c8fe.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ad5\/19a\/e8e\/ad519ae8e01f18d1316d35ac19a4c8fe.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/416\/c27\/c5d\/416c27c5d397a6139724559c5b6156cb.svg\" alt=\"$a=1000$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/416\/c27\/c5d\/416c27c5d397a6139724559c5b6156cb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/416\/c27\/c5d\/416c27c5d397a6139724559c5b6156cb.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/di\/bc\/0w\/dibc0w_ig5zqgxolokmhygu70s8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/di\/bc\/0w\/dibc0w_ig5zqgxolokmhygu70s8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/di\/bc\/0w\/dibc0w_ig5zqgxolokmhygu70s8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3f\/js\/q-\/3fjsq-ycp_ahwigoycvspg0e3ig.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/3f\/js\/q-\/3fjsq-ycp_ahwigoycvspg0e3ig.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/3f\/js\/q-\/3fjsq-ycp_ahwigoycvspg0e3ig.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p>The most interesting patterns are obtained if we take a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b21\/fe2\/3cb\/b21fe23cb6be0521d79bf359d4e7f29b.svg\" alt=\"$d$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b21\/fe2\/3cb\/b21fe23cb6be0521d79bf359d4e7f29b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/b21\/fe2\/3cb\/b21fe23cb6be0521d79bf359d4e7f29b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> that differs slightly from 1. For example, for<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4c9\/9a4\/cff\/4c99a4cffa40b85d152aa9b5d25f8e6f.svg\" alt=\"$b=0, c=1, d=\\frac{1}{1.01}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4c9\/9a4\/cff\/4c99a4cffa40b85d152aa9b5d25f8e6f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4c9\/9a4\/cff\/4c99a4cffa40b85d152aa9b5d25f8e6f.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ab3\/d1e\/386\/ab3d1e3869492262c9c7c619abd12c04.svg\" alt=\"$a=\\frac{182}{58}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ab3\/d1e\/386\/ab3d1e3869492262c9c7c619abd12c04.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ab3\/d1e\/386\/ab3d1e3869492262c9c7c619abd12c04.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7c5\/cc0\/d53\/7c5cc0d536ed42e4ed15b24b863ab2e2.svg\" alt=\"$a=\\frac{173}{165}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7c5\/cc0\/d53\/7c5cc0d536ed42e4ed15b24b863ab2e2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/7c5\/cc0\/d53\/7c5cc0d536ed42e4ed15b24b863ab2e2.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nz\/az\/p9\/nzazp9yk7bnheqqzqt-gawns_-u.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/nz\/az\/p9\/nzazp9yk7bnheqqzqt-gawns_-u.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/nz\/az\/p9\/nzazp9yk7bnheqqzqt-gawns_-u.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/u0\/qa\/pd\/u0qapdyrbhmlpwj3fvidnohvba4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/u0\/qa\/pd\/u0qapdyrbhmlpwj3fvidnohvba4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/u0\/qa\/pd\/u0qapdyrbhmlpwj3fvidnohvba4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e90\/e2e\/410\/e90e2e410692f4871b089e2293f44b54.svg\" alt=\"$a=\\frac{170}{109}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e90\/e2e\/410\/e90e2e410692f4871b089e2293f44b54.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e90\/e2e\/410\/e90e2e410692f4871b089e2293f44b54.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3dc\/b81\/8a4\/3dcb818a4ab7a23bfd640a1c67cea43b.svg\" alt=\"$a=\\frac{111}{70}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3dc\/b81\/8a4\/3dcb818a4ab7a23bfd640a1c67cea43b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3dc\/b81\/8a4\/3dcb818a4ab7a23bfd640a1c67cea43b.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/rp\/wi\/ej\/rpwiejipmsi_fmvlvaqkhwgcfv8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/rp\/wi\/ej\/rpwiejipmsi_fmvlvaqkhwgcfv8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/rp\/wi\/ej\/rpwiejipmsi_fmvlvaqkhwgcfv8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/i4\/lw\/zw\/i4lwzwygvibz31zbay9yeuet1he.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/i4\/lw\/zw\/i4lwzwygvibz31zbay9yeuet1he.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/i4\/lw\/zw\/i4lwzwygvibz31zbay9yeuet1he.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e3e\/2af\/f16\/e3e2aff16169f2aad5adcd6620f94e56.svg\" alt=\"$a=\\frac{57}{178}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e3e\/2af\/f16\/e3e2aff16169f2aad5adcd6620f94e56.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/e3e\/2af\/f16\/e3e2aff16169f2aad5adcd6620f94e56.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4ea\/33b\/4ea\/4ea33b4ea51c6883c181fb2f8d274f78.svg\" alt=\"$a=\\frac{186}{119}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4ea\/33b\/4ea\/4ea33b4ea51c6883c181fb2f8d274f78.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/4ea\/33b\/4ea\/4ea33b4ea51c6883c181fb2f8d274f78.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/xi\/ez\/q0\/xiezq0ra_pequqw17w-xpswse3e.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/xi\/ez\/q0\/xiezq0ra_pequqw17w-xpswse3e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/xi\/ez\/q0\/xiezq0ra_pequqw17w-xpswse3e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/m-\/8z\/3o\/m-8z3oiowfjtcsc5pck9kzvzyk8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/m-\/8z\/3o\/m-8z3oiowfjtcsc5pck9kzvzyk8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/m-\/8z\/3o\/m-8z3oiowfjtcsc5pck9kzvzyk8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3c1\/3ec\/642\/3c13ec6421a2cd4372801ed335e37cb5.svg\" alt=\"$b=1, c=1, d=\\frac{1}{1.01}$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3c1\/3ec\/642\/3c13ec6421a2cd4372801ed335e37cb5.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3c1\/3ec\/642\/3c13ec6421a2cd4372801ed335e37cb5.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/377\/db3\/e46\/377db3e467612a0cadd0b3d94de671a4.svg\" alt=\"$a=\\frac{174}{111}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/377\/db3\/e46\/377db3e467612a0cadd0b3d94de671a4.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/377\/db3\/e46\/377db3e467612a0cadd0b3d94de671a4.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a67\/df5\/614\/a67df56141f483bf76bbca23e13cac9c.svg\" alt=\"$a=\\frac{50}{152}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a67\/df5\/614\/a67df56141f483bf76bbca23e13cac9c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/a67\/df5\/614\/a67df56141f483bf76bbca23e13cac9c.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vx\/mn\/pp\/vxmnpp3efcos95af5cp2bpuuqli.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/vx\/mn\/pp\/vxmnpp3efcos95af5cp2bpuuqli.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/vx\/mn\/pp\/vxmnpp3efcos95af5cp2bpuuqli.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<td><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sp\/dr\/gf\/spdrgfh_0utjtmllcgjqlr55ny8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/sp\/dr\/gf\/spdrgfh_0utjtmllcgjqlr55ny8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/sp\/dr\/gf\/spdrgfh_0utjtmllcgjqlr55ny8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h3 id=\"interactive-1\">Interactive<\/h3>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/billiard_dynamic\/hologram_static\/\" rel=\"nofollow noopener noreferrer\">Dynamic Visualization \u2014 static<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/hologram_s.js\" rel=\"nofollow noopener noreferrer\"><code>hologram_s.js<\/code><\/a><\/p>\n<p> <\/p>\n<p><a href=\"https:\/\/xcont.com\/billiard_dynamic\/hologram_dynamic\/\" rel=\"nofollow noopener noreferrer\">Dynamic Visualization \u2014 dynamic<\/a><br \/> <a href=\"https:\/\/github.com\/xcontcom\/billiard-fractals\/blob\/main\/js\/hologram.js\" rel=\"nofollow noopener noreferrer\"><code>hologram.js<\/code><\/a><\/p>\n<p> <\/p>\n<hr\/>\n<p> <\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p> <\/p>\n<p>This study began with a simple system: a billiard ball reflecting within a rectangular grid. By examining its trajectory and translating spatial behavior into symbolic sequences, we uncovered patterns exhibiting recursive structure, boundary self-similarity, and interference-like properties.<\/p>\n<p> <\/p>\n<p>Through progressive abstraction \u2014 from 2D reflections to 1D symbolic sequences, and eventually to nonlinear surfaces \u2014 we showed that binary patterns can emerge from discretized irrational steps alone. Formulas such as:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/89f\/4ad\/e2a\/89f4ade2ada05f675da5ac30131e5a25.svg\" alt=\"$Q_k=\\left\\lfloor k \\sqrt{x} \\right\\rfloor \\bmod 2 \\quad \\text{and} \\quad Q_k=\\sin\\left( \\pi k \\sqrt{x} \\right) &gt; 0$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/89f\/4ad\/e2a\/89f4ade2ada05f675da5ac30131e5a25.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/89f\/4ad\/e2a\/89f4ade2ada05f675da5ac30131e5a25.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>generate deterministic sequences that yield quasi-fractal geometries when visualized spatially. Though entirely discrete, these systems exhibit behaviors commonly associated with continuous wave phenomena.<\/p>\n<p> <\/p>\n<p>Further generalization using surface equations of the form:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/fbf\/6c2\/44e\/fbf6c244efc353ee016b1cae5525708b.svg\" alt=\"$z = a \\left( x^2 + bxy + c y^2 \\right)^d$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/fbf\/6c2\/44e\/fbf6c244efc353ee016b1cae5525708b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/fbf\/6c2\/44e\/fbf6c244efc353ee016b1cae5525708b.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>reveals that curvature, shear, and nonlinearity shape the resulting symbolic slices in ways reminiscent of optical interference. The resemblance between these binary patterns and holographic textures suggests a structural parallel, despite their different origins.<\/p>\n<p> <\/p>\n<p>No physical claims are made. However, the symbolic systems presented here demonstrate that simple integer-based operations, applied to irrational quantities or curved domains, can generate high-order structure with properties of both visual and mathematical interest. This offers a conceptual bridge between number theory, symbolic dynamics, and emergent spatial organization.<\/p>\n<p> <\/p>\n<p>While this study has uncovered significant insights, several open questions remain to inspire further research:<\/p>\n<p> <\/p>\n<ol>\n<li><strong>Generalization to Non-Fibonacci Ratios<\/strong>. The recursive generators presented here excel for Fibonacci-based rectangles, but can similar symbolic encoding schemes be developed for arbitrary co-prime pairs or other number sequences (e.g., Lucas numbers, Pell numbers)? What universal properties govern the resulting fractal structures?<\/li>\n<li><strong>Irrational Billiards and Sequence Ordering<\/strong>. For billiard tables with incommensurable sides (e.g., 1: \u03c6), we partially addressed pattern generation using floor-based sequences. However, can a robust method be devised to order these sequences consistently, enabling full reconstruction of the pattern in the absence of grid alignment?<\/li>\n<li><strong>Perfect Shuffle and Floor-Based Equivalence<\/strong>. The striking similarity between perfect shuffle sequences and irrational floor-based sequences suggests a potential mathematical identity. Is there a formal equivalence between these systems, or do they converge only under specific conditions? What deeper structures might unify these approaches?<\/li>\n<li><strong>Nonlinear Surface Generalizations<\/strong>. The transition to quadratic and higher-order surfaces produced rich, holographic-like patterns. How do variations in the exponent (d) or coefficients (a), (b), and \u00a9 affect the fractal dimension or complexity of the resulting patterns? Can these be analytically quantified?<\/li>\n<li><strong>Applications to Physical Systems<\/strong>. The visual resemblance to holographic interference patterns raises the question: can these symbolic systems model real-world wave phenomena, such as optical diffraction or quantum interference, in a computationally efficient way?<br \/> These questions highlight the potential for further exploration at the intersection of symbolic dynamics, fractal geometry, and computational visualization. By bridging discrete mathematics with continuous phenomena, this work offers a foundation for investigating how simple rules can encode complex, emergent behaviors \u2014 potentially extending to fields like number theory, physics, and computer graphics.<\/li>\n<\/ol>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Addendum: On Holography and Fractals<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr\/>\n<p> <\/p>\n<p>Symbolic sequences of the form:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/499\/b51\/e8c\/499b51e8c71709fec60596534f05dfe8.svg\" alt=\"$Q_k=\\left\\lfloor k \\sqrt{x} \\right\\rfloor \\bmod 2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/499\/b51\/e8c\/499b51e8c71709fec60596534f05dfe8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/499\/b51\/e8c\/499b51e8c71709fec60596534f05dfe8.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>exhibit fractal structure due to the interaction between irrational step sizes and discrete thresholds.<\/p>\n<p> <\/p>\n<p>When extended to curved functions, such as:<\/p>\n<p> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/007\/3e1\/801\/0073e1801b5087e5a0d7c7bd6839644a.svg\" alt=\"$Q_k=\\left\\lfloor k^2 \\sqrt{x} \\right\\rfloor \\bmod 2$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/007\/3e1\/801\/0073e1801b5087e5a0d7c7bd6839644a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/007\/3e1\/801\/0073e1801b5087e5a0d7c7bd6839644a.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>the resulting binary fields begin to resemble interference patterns observed in wave-based systems.<\/p>\n<p> <\/p>\n<p>Though entirely symbolic, these systems show a striking visual similarity to holographic interference textures. This suggests that certain nonlinear discretizations may encode symbolic analogs of wave behavior \u2014 hinting at a deeper structural correspondence between symbolic mathematics and wave-based physical systems.<\/p>\n<p> <\/p>\n<hr\/>\n<\/div><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/918388\/\"> https:\/\/habr.com\/ru\/articles\/918388\/<\/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-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/un\/7d\/u5\/un7du5h6vq5moklkm3jz4h7jgos.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/un\/7d\/u5\/un7du5h6vq5moklkm3jz4h7jgos.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/un\/7d\/u5\/un7du5h6vq5moklkm3jz4h7jgos.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <\/p>\n<p>Complex systems often appear chaotic or incomprehensible, yet closer examination reveals that such complexity can frequently be reduced to a simple underlying mechanism. By systematically removing layers of emergent behavior, one can uncover a fundamental rule or equation from which the entire system originates.<\/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-463400","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463400","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=463400"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463400\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}