Deutsch English Français Italiano |
<usfnkh$13n9o$1@solani.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Physfitfreak <Physfitfreak@gmail.com> Newsgroups: comp.os.linux.advocacy Subject: Re: Prog Challenge Date: Fri, 8 Mar 2024 13:06:57 -0600 Message-ID: <usfnkh$13n9o$1@solani.org> References: <17ba8df1ac0783cb$104093$1054558$802601b3@news.usenetexpress.com> <use0es$12qgm$1@solani.org> <17bacfe9ea8cf1b9$13872$3298354$802601b3@news.usenetexpress.com> <17bad1c8e19520b7$8$821545$802601b3@news.usenetexpress.com> <17bad47b58d27fdc$49069$1507308$802601b3@news.usenetexpress.com> <17bad5a0f333db18$120726$3000918$802601b3@news.usenetexpress.com> <usfk5n$13lc3$1@solani.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 8 Mar 2024 19:06:57 -0000 (UTC) Injection-Info: solani.org; logging-data="1170744"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:OWOPLpn452G1Ei+ICod7xleQy8g= Content-Language: en-US X-Antivirus: Avast (VPS 240308-0, 3/7/2024), Outbound message X-Antivirus-Status: Clean X-User-ID: eJwFwYEBwDAEBMCVqH9iHCL2H6F3NFe/AaeDy83UqKtd20WeHYWgU6beGp5zb0Tkt++DKaIpkzVWp1v89A9mxhXz In-Reply-To: <usfk5n$13lc3$1@solani.org> Bytes: 5990 Lines: 136 On 3/8/2024 12:07 PM, Physfitfreak wrote: > On 3/8/2024 10:04 AM, Nuxxie wrote: >> On Fri, 08 Mar 2024 15:43:54 +0000, Nuxxie wrote: >> >>> >>> 1/37252902384619140625 >>> >>> >>> The decimal expansion will begin with 11 digits followed by a repeating >>> porion of length 54,494,498,496. >>> >>> This number would need 64 GiB of memory, but we could write it out to a >>> file using Maxima or bc or GMP. >>> >> >> Someone please write out this number to a file. As 1 byte per character >> it should be about 55 GiB in size. >> >> Then verify that the decimals start with 11 digits and then repeat >> after 54,494,498,496 + 11 digits. Just verify that the first 100 or >> so digits are the same. >> >> Y'all have big, fat mouths. Let's see if that can translate into >> serious computing action. >> >> The first to do it will receive a BIG PRIZE. >> > > > Again, you're turning the spoon twice around your head before placing it > in your mouth to eat your soup. > > If you're after _proving_, mathematically, that a method will give the > repeating decimals, that's another matter. And I'm not good at that and > am not interested in stuff and degree of precise logic that > mathematicians are accustomed to and apply in their proofs. My > background is not math. That's why. > > But if you're only interested in the answer, then method of nines is the > simplest and fastest way of getting it. > > If you haven't seen it, then what kind of numerical methods class did > you attend? You must be way younger than me. I'm thinking the generation > after me with access to much better computers didn't need all that nitty > gritty to get by, and therefore profs simply omitted a bulk of such > material from the courses. > > With an almost two lines of program, one can find a number consisting > only of digits of 9, for which the denominator of the fraction is a > divisor. Then with one more line of code, the fraction is rewritten with > that denominator consisting of 9's. The numerator thus obtained will be > the decimals that get repeated. As simple as that. > > How many lines of code is that? 3 ? At most 4. > > Example. Say we want to find the repeating decimals of 14/33 without > actually dividing the two numbers to visually find that out, but by > knowing in advance what those repeating decimals will be. > > 1- find the smallest number consisting of only digits of 9 that 33 is a > divisor for: > > 33 x 3 = 99 > > 2. apply this factor of 3 to the fraction: > > 14/33 x 3/3 = 42/99 > > 3. therefore the repeating decimals are 42. > > That's how you have your soup :) > > The cases involving other numbers appearing in the decimals before > repeating decimals begin are quite similar. You first convert the > fraction to different pieces to separate the repeating part of decimals > from the rest. This turns the term with repeating decimals to have a > bunch of zeros coming before the repeating part begins. Then you use a > slightly different form of method of nines (called method of nines with > zeros) to find the repeating decimals. > > > > Method of nines have some more detail than just that. The example and method I mentioned above applies only to cases where numerator and denominator are of the same order of magnitude. If denominator is of a magnitude of order n more than the numerator, then n zeros appear in the repeating decimals before nonzeros in them begin. Example: 1/13 (i.e. there will be one repeating zero before non-zero repeating decimals begin) 1. find the nines: (a two liner loop) 13 x 76923 = 999999 2. apply the factor: 1/13 x 76923/76923 = 76923/999999 3. therefore the repeating decimals are 076923 (not 76923). Now let's take the example you brought earlier: 1/31 1. There will be one repeating zero before non-zero digits of repeating decimals begin. 2. get the nines: 31 x 32258064516129 = 999999999999999 3. apply the factor: 1/31 x 32258064516129/32258064516129 = 32258064516129/999999999999999 4. therefore the repeating decimals will be 032258064516129 Note that the zeros coming before non-zero digits begin, are not a case of zeros after radix that are _not_ part of the repeating decimals. The latter cases are handled by method of nines with zeros which is slightly different from method of nines, and I won't go into it. Those interested can dig it themselves. -- This email has been checked for viruses by Avast antivirus software. www.avast.com