{"id":5243,"date":"2023-03-25T11:20:59","date_gmt":"2023-03-25T10:20:59","guid":{"rendered":"https:\/\/eskerahn.dk\/?p=5243"},"modified":"2024-10-01T08:23:43","modified_gmt":"2024-10-01T06:23:43","slug":"numeric-facts-on-fractions-that-few-are-aware-of","status":"publish","type":"post","link":"https:\/\/eskerahn.dk\/?p=5243","title":{"rendered":"Numeric facts on fractions, that few are aware of."},"content":{"rendered":"<p>Assume a fraction k\/m, with 0\u2264k\u2264m and look at its digits written out<\/p>\n<ol>\n<li>The fraction has a finite number of digits (less m) OR is a repeated sequence with at the most m-1 digits per group<\/li>\n<li>A repeated sequence will have at the most n-1 zeroes next to each other, if the number m is below 10\u207f<\/li>\n<li>Interesting digit-structure of the sequence times m, with many 9&#8217;s <span style=\"color: #ffcc99;\">(base minus 1)<\/span> .<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<p>It is surprisingly simple to prove<\/p>\n<ol>\n<li>Any division j\/m can have reminders 0..m-1, so doing the calculus k\/m one digit at the time will either stop or get the same reminder at step m or earlier.<\/li>\n<li>The least reminder doing the repeated sequence is 1, so 10\/m will give a zero if and only if 10&lt;m, and the next can be zero if and only if 100&lt;m, et cetera<\/li>\n<li>The sequence multiplied with m will often have an interesting digit-structure, where the first and last digits added will give 10\u207f-1 for some n. and 9s between.<br \/>\nAs an example <span style=\"color: #ffcc99;\">(in base ten)<\/span> for 1\/272 = 0.0036(7647058823529411)+ here the product is\u00a0 2079999999999999792\u00a0 (where 207+792=999 obviously).<br \/>\nThis is not unexpected, as summing op the digits after multiplying should end as 0.999999&#8230;<br \/>\nIts digit-sequence does not <em>always<\/em> contain 9s though, as an example 1\/96 = 0.01041(6)+ where the product is 576<\/li>\n<\/ol>\n<p>Here a little piece of code to explore<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nint k = 1;  \/\/ for k\/m for various 1&lt;m\r\nfor (int m = 2; m&lt;=1111; m++) {\r\n    int r= k;\r\n    System.Numerics.BigInteger kTimes10to_d = k;\r\n    List&lt;int&gt; rem = new();\r\n    int ix;\r\n    int d = 0; \/\/number of digits used\r\n    do { \/\/ the division digit by digit, until repeated remainder (incl zero)\r\n        rem.Add(r);\r\n        d++;\r\n        kTimes10to_d*=10;\r\n        r=(int)(kTimes10to_d % m); \/\/less than m so plain int\r\n    }\r\n    while ((ix=rem.IndexOf(r))&lt;0); \/\/ new remaindier?\r\n    System.Numerics.BigInteger f = (kTimes10to_d-r)\/m; \/\/r was last remainders of q\/m\r\n    int leadlen = ix; \/\/First time the repeated reminder reoccurs is ix steps in \r\n    int replen = d-leadlen;\r\n    System.Numerics.BigInteger tenToReplen = 1;\r\n    for (int i = 0; i&lt;replen; i++) tenToReplen*=10; \/\/ 10^replen\r\n    System.Numerics.BigInteger rep = (tenToReplen-1)*r\/m; \/\/ we know this is integral\r\n    System.Numerics.BigInteger lead = (f-rep)\/tenToReplen; \/\/clip the repeated tail.\r\n    \/\/ (hack: C# D0 does not give empty string, so one extra and drop afterwards)\r\n    string leads = lead.ToString(&quot;D&quot;+(leadlen+1).ToString())&#x5B;1..]; \/\/leading zeroes\r\n    string reps = rep.ToString(&quot;D&quot;+replen.ToString()); \/\/leading zeroes\r\n    \/\/Strictly the conditional part is superfluous 1\/4=0.25(0)+ is not wrong.\r\n    Console.WriteLine($&quot;{k}\/{m} = {Math.Truncate((double)k\/m)}.{leads}{(r==0?&quot;&quot;:$&quot;({reps})+&quot;)}&quot;);\r\n}\r\n\r\n<\/pre>\n<p>(Where one can easily output rep*m also to study the digit-structure)<\/p>\n<p>Obviously this in not base dependant, in 3. replace &#8220;9&#8221; with (base-1) in general, e.g &#8220;F&#8221; for hex. And &#8220;10&#8221; with base.<\/p>\n<p>The first can also be used the other way round. A decimal number with repeated digit-group of length j can not be an integer fraction k\/m unless j&lt;m.<br \/>\nHere j can be upper bound as well assuming a lead with L decimals before the repetition the number is (lead+Sequence\/(10^j -1)\/10^L ), so the dividend must be a divisor in (10^j -1)*10^L. (e.g.\u00a0 12.3456456456456&#8230; three digits repeated started one decimal in, so 999*10 is a possibility :\u00a0 12.3+456\/9990 = 123333\/9990 = 41111\/3330)<\/p>\n<p>Note that it is NOT the case that a a prime divisor will give a long repeated sequence, take e.g. 1\/37=0.(027)+ with just three digits repeated, as 37 is a divisor in 10\u00b3-1 (=27*37)<\/p>\n<p>Some &#8216;pretty&#8217; ones:<\/p>\n<p>1\/3 = 0.(3)+<\/p>\n<p>1\/30 = 0.0(3)+<br \/>\n1\/33 = 0.(03)+<\/p>\n<p>1\/300 = 0.00(3)+<br \/>\n1\/303= 0.(0033)+<br \/>\n1\/330 = 0.0(03)+<br \/>\n1\/333 = 0.(003)+<\/p>\n<p>1\/3000 = 0.000(3)+<br \/>\n1\/3003 = 0.(000333)+<br \/>\n1\/3030 = 0.0(0033)+<br \/>\n1\/3300 = 0.00(03)+<br \/>\n1\/3330 = 0.0(003)+<br \/>\n1\/3333 = 0.(0003)+<\/p>\n<p>1\/30000 = 0.0000(3)+<br \/>\n1\/30003 = 0.(00003333)+<br \/>\n1\/30030 = 0.0(000333)+<br \/>\n1\/30300 = 0.00(0033)+<br \/>\n1\/30303 = 0.(000033)+<br \/>\n1\/33000 = 0.000(03)+<br \/>\n1\/33300 = 0.00(003)+<br \/>\n1\/33330 = 0.0(0003)+<br \/>\n1\/33333 = 0.(00003)+<\/p>\n<p>1\/300000 = 0.00000(3)+<br \/>\n1\/300003 = 0.(0000033333)+<br \/>\n1\/300030 = 0.0(00003333)+<br \/>\n1\/300300 = 0.00(000333)+<br \/>\n1\/303000 = 0.000(0033)+<br \/>\n1\/303030 = 0.0(000033)+<br \/>\n1\/330000 = 0.0000(03)+<br \/>\n1\/330033 = 0.(00000303)+<br \/>\n1\/333000 = 0.000(003)+<br \/>\n1\/333300 = 0.00(0003)+<br \/>\n1\/333330 = 0.0(00003)+<br \/>\n1\/333333 = 0.(000003)+<\/p>\n<p>On the other hand numbers like 1\/3033 and 1\/3303 are <em>not<\/em> &#8216;pretty&#8217;, What matter is that we by sums of 3&#215;10^i for some i combination can get\u00a0 10\u207f-1. e.g. 330033*303 = 99999999,<\/p>\n<p>Equally pretty if you multiply or divide by 3 obviously.<br \/>\nYou will get the same forms with 1s on one side and 9s on the other.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assume a fraction k\/m, with 0\u2264k\u2264m and look at its digits written out The fraction has a finite number of digits (less m) OR is a repeated sequence with at the most m-1 digits per group A repeated sequence will have at the most n-1 zeroes next to each other, if the number m is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,15],"tags":[],"class_list":["post-5243","post","type-post","status-publish","format-standard","hentry","category-math","category-pc-and-code-samples"],"_links":{"self":[{"href":"https:\/\/eskerahn.dk\/index.php?rest_route=\/wp\/v2\/posts\/5243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eskerahn.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eskerahn.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eskerahn.dk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/eskerahn.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5243"}],"version-history":[{"count":8,"href":"https:\/\/eskerahn.dk\/index.php?rest_route=\/wp\/v2\/posts\/5243\/revisions"}],"predecessor-version":[{"id":6545,"href":"https:\/\/eskerahn.dk\/index.php?rest_route=\/wp\/v2\/posts\/5243\/revisions\/6545"}],"wp:attachment":[{"href":"https:\/\/eskerahn.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eskerahn.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eskerahn.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}