# A question regarding 1 divided 243

Here is a problem due to Feynman. If you take 1 divided by 243 you get 0.004115226337 .... It goes a little cockeyed after 559 when you're carrying out the decimal expansion, but it soon straightens itself out and repreats itself nicely. Now I want to see how many times it repeats itself. Does it do this indefinitely, or does it stop after certain number of repititions? Can you write a simple Mathematica program to verify one conjecture or the other?

-
Is this a homework problem? What have you tried so far? Where did you get stuck? –  Szabolcs Jun 25 '14 at 14:36
What do you mean by "how many times it repeats itself"? 1/243 is a fraction whose denominator does not contain any power of 2 or 5, so its decimal expansion is indeed periodic and infinite. –  Massimo Ortolano Jun 25 '14 at 15:31
–  Mr.Wizard Jun 25 '14 at 22:54

RealDigits[1/243]
(*
{{{4, 1, 1, 5, 2, 2, 6, 3, 3, 7, 4, 4, 8, 5, 5, 9, 6, 7, 0, 7, 8, 1, 8, 9, 3, 0, 0}}, -2}
*)

-
Vote held until you explain the significance of this for those to whom it is not apparent. –  Mr.Wizard Jun 25 '14 at 15:46
@Mr.Wizard I think the necessary explanation is already written in the RealDigits[] docs. Feel free to retain your vote. –  belisarius Jun 25 '14 at 18:18
NumberForm[N[1/243,135],DigitBlock->27]


0.004115226337448559670781893 004115226337448559670781893 004115226337448559670781893 004115226337448559670781893 004115226337448559670781893 00

let x = 0.004115226337448559670781893... then for it to repeat forever would require that

eqn = (10^27  -1) x == 4115226337448559670781893;

Solve[eqn, x]


{{x->1/243}}

Hence it repeats forever.

-

Since belisarius specifically refused to expound on his answer, which arguably would make my editing it for such purpose tantamount to vandalism, I shall post my own.

Regarding RealDigits:

For integers and rational numbers with terminating digit expansions, RealDigits[x] returns an ordinary list of digits. For rational numbers with non-terminating digit expansions it yields a list of the form {a1,a2,...,{b1,b2,...}} representing the digit sequence consisting of the ai followed by infinite cyclic repetitions of the bi.  »

Therefore we can use RealDigits to find the non-terminating cyclic digits of a fraction. The output syntax is of the form {{___, r : {__}}, _} where r is the list of repeating digits. The digits are easily extracted using that pattern, or more tersely Level:

RealDigits[1/243] ~Level~ {3}

{4, 1, 1, 5, 2, 2, 6, 3, 3, 7, 4, 4, 8, 5, 5, 9, 6, 7, 0, 7, 8, 1, 8, 9, 3, 0, 0}


For comparison a number with a terminating decimal expansion:

RealDigits[1/4] ~Level~ {3}

{}

-
referring to Belisarius' answer: What does the last -2 stand for? –  eldo Jun 25 '14 at 22:42
@eldo The position of the decimal point, which here is two to the left of the first listed digit, i.e. .004115226... –  Mr.Wizard Jun 25 '14 at 22:49
I don't want to steal your time: But why doesn't return ReturnDigits {0,0,4,...3} ? Wouldn't that be clearer ? –  eldo Jun 25 '14 at 23:00
Just to clarify: I refused to edit my answer because I think it isn't necessary, but I would NEVER call you a vandal, no matter how you edit my posts. –  belisarius Jun 26 '14 at 3:26
@Mr.Wizard In case it wasn't clear enough. I know the vandals quite well en.wikipedia.org/wiki/Vandals#The_turbulent_end :) –  belisarius Jun 26 '14 at 3:34

For this particular case (could be easily extended):

Count[#, Max@#] &[ StringLength /@ Rest@StringSplit[ToString@N[1/243, 10^6], "00"]]

37037


With 10^6 digits after the decimal point there are 37037 repetitions.

-

You can also call WolframAlpha["1/243"].

-