Re: Prog Challenge

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: Prog Challenge
De : Physfitfreak (at) *nospam* gmail.com (Physfitfreak)
Groupes : comp.os.linux.advocacy
Date : 08. Mar 2024, 21:06:57
Autres entêtes
Message-ID : <usfnkh$13n9o$1@solani.org>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
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

Date Sujet#  Auteur
7 Mar 24 * Prog Challenge19Nuxxie
8 Mar 24 `* Re: Prog Challenge18Physfitfreak
8 Mar 24  +- Re: Prog Challenge1Physfitfreak
8 Mar 24  +* Re: Prog Challenge10Nuxxie
8 Mar 24  i+* Re: Prog Challenge7Nuxxie
8 Mar 24  ii`* Re: Prog Challenge6Nuxxie
8 Mar 24  ii +* Re: Prog Challenge4Nuxxie
8 Mar 24  ii i`* Re: Prog Challenge3Physfitfreak
8 Mar 24  ii i `* Re: Prog Challenge2Physfitfreak
11 Mar 24  ii i  `- Re: Prog Challenge1Physfitfreak
3 May 24  ii `- Re: Prog Challenge1DFS
8 Mar 24  i+- Re: Prog Challenge1Physfitfreak
9 Mar 24  i`- Re: Prog Challenge1DFS
8 Mar 24  +* Re: Prog Challenge5rbowman
8 Mar 24  i+* Re: Prog Challenge2DFS
9 Mar 24  ii`- Re: Prog Challenge1rbowman
8 Mar 24  i`* Re: Prog Challenge2Physfitfreak
9 Mar 24  i `- Re: Prog Challenge1rbowman
8 Mar 24  `- Re: Prog Challenge1DFS

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal