Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Cyclic decimal periods.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21478] Cyclic decimal periods.
  • From: "Alan W.Hopper" <awhopper at hermes.net.au>
  • Date: Tue, 11 Jan 2000 04:17:56 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Greetings Mathworld people,


I would like to contribute my Mathematica notebook,
PeriodicDecimalCycles.nb ,
(located in the attachment file, I hope), and I would like to offer the
use of this
notebook or the code from it, to be a part of the
mathworld.wolfram.com/notebooks/
site, if you want it.

I used Mathematica 3.0  ;

In[1]:= $Version

Out[2]=  Power Macintosh 3.0 (December 1, 1996)

The idea is to form all decimal cycles associated with the reciprocals
of all prime and
some some composite numbers into a pair of adjacent rows (folded for
long periods),
where the top row is the actual cycle and the bottom being the correct
decimal period.
When displayed you can then read off any decimal fraction for the
appropriate denominator
by starting with the digit immediately below the numerator.

Mathematica's list handling capabilities ensure that all the correct
periods within
individual cycles are displayed.


My congratulations to Eric and all the other contributers for this great
internet maths
encyclopedia project, keep up the good work!

Since Eric's comprehensive Mathematica notebooks are now on the Wolfram
site,
I hope that something like tutorial notebooks, can someday complement
the basic package files.


yours sincerely,

Alan W. Hopper.

Katoomba, Australia.

awhopper at hermes.net.au




 filename="PeriodicDecimalCycles.nb"

(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 3.0,
MathReader 3.0, or any compatible application. The data for the notebook 
starts with the line of stars above.

To get the notebook into a Mathematica-compatible application, do one of 
the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode.  Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the 
word CacheID, otherwise Mathematica-compatible applications may try to 
use invalid cache data.

For more information on notebooks and Mathematica-compatible 
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info at wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from 
Wolfram Research.
***********************************************************************)

(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[     24255,        707]*)
(*NotebookOutlinePosition[     25122,        735]*)
(*  CellTagsIndexPosition[     25078,        731]*)
(*WindowFrame->Normal*)



Notebook[{

Cell[CellGroupData[{
Cell[" Periodic Decimal Cycles", "Subtitle"],

Cell[TextData[StyleBox[" Alan W. Hopper :  January 2000.",
  FontSlant->"Italic"]], "Text"],

Cell[TextData[{
  " Utilising ",
  StyleBox["Mathematica",
    FontSlant->"Italic"],
  "  in forming and displaying the complete set of decimal cycles\nfor any \
denominator ",
  StyleBox["d ,  ",
    FontSlant->"Italic"],
  "prime or composite (not divisible by 2 or 5).\n\n",
  StyleBox["cycleStats",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  StyleBox["  ",
    FontWeight->"Bold"],
  "details the period length, the number of cycles and relatively prime \
numerators.\n\n",
  StyleBox["allCycles",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  "  produces an aligned pair of tables for each cycle, so that any \
individual decimal period can be read off from the respective cycle, by \
starting with the digit immediately below the desired numerator."
}], "Text"],

Cell[CellGroupData[{

Cell[" Implementation", "Section"],

Cell[BoxData[
    \(\(\ Off[General::spell1]\)\)], "Input"],

Cell[BoxData[{
    \(\ \ \ \ \ \ \ \ \ \ \ \n\ \ 
    cycs[d_] := 
      If[Mod[d, 5] \[NotEqual] 0\  && \ Mod[d, 2] \[NotEqual] 0, 
        Module[{a = 1, b, c, x, y, n, p, cp, g = {}}, \n\t\t
          cp = Select[Range[d], \((GCD[d, #] == 1)\)&]; \n\t\t
          b = Select[Divisors[x = EulerPhi[d]], Mod[10\^#, d] == 1\ &, 1]; \n
          \t\ \ \ c = \t
            \(Flatten[x/b, 1]\)\[LeftDoubleBracket]1\[RightDoubleBracket]; \n
          \t\tDo[\n\t\tn = Flatten[Mod[a\ 10\^Range[0, b - 1], d]]; \n\t\t
            p = Flatten[Quotient[10\ n, d]]; \n\t\tcp = Complement[cp, n]; \n
            \t\t\tIf[Length[cp] > 0, 
              a = cp\[LeftDoubleBracket]1\[RightDoubleBracket]]; \n\t\t
            AppendTo[g, {n, p}], {c}]; g]]\n\), 
    \(\ \ \ tb[pl_] := TableForm[pl, TableSpacing -> {1, 0.5}]\n\), 
    \(tb2[s_] := 
      TableForm[Transpose[Partition[s, Length[s]]], \n\t\t
        TableSpacing -> {2, 0.5}]\n\ \ \), 
    \(\ cols15[L_List /; Length[L] <= 15] := L\n\), 
    \(cols15[L_List /; IntegerQ[Length[L]/15]] := Partition[L, 15]\n\), 
    \(cols15[L_List] := 
      Append[Partition[L, 15], Take[L, \(-Mod[Length[L], 15]\)]]\n\), 
    \(\ \ xc2[z_] := 
      Module[{ls, ls2, dc, hg = {}}, 
        Do[\ \ \ \ \n\ 
          ls = cols15[z\[LeftDoubleBracket]a, 1\[RightDoubleBracket]]; \n
          ls2 = cols15[z\[LeftDoubleBracket]a, 2\[RightDoubleBracket]]; \n
          dc = tb[Flatten[
                Table[{ls\[LeftDoubleBracket]n\[RightDoubleBracket], 
                    ls2\[LeftDoubleBracket]n\[RightDoubleBracket]}, {n, 
                    Length[ls]}], 1]]; AppendTo[hg, dc], {a, 1, Length[z]}]; 
        hg]\n\), 
    \(cycleStats[d_] := 
      Module[{a, n, q}, \n\t\t
        a = Select[Divisors[q = EulerPhi[d]], Mod[10\^#, d] == 1\ &, 1]; \n
        \t\tn = q/a; 
        TableForm[{a, n, q}, TableAlignments -> {Right}, 
          TableHeadings
             -> {{"\<Period length\>", "\<Cycles\>", 
                "\<Co-prime numerators\>"}, None}]]\n\), 
    \(\ allCycles[s_] := 
      If[Length[\(cycs[s]\)\[LeftDoubleBracket]1, 1\[RightDoubleBracket]] 
          \[LessEqual] 15, \ntb2[cycs[s]]\t, xc2[cycs[s]]]\)}], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(cycleStats[77]\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {\("Period length"\), "6"},
          {\("Cycles"\), "10"},
          {\("Co-prime numerators"\), "60"}
          },
        RowSpacings->1,
        ColumnSpacings->3,
        RowAlignments->Baseline,
        ColumnAlignments->{Right}],
      TableForm[
       {{6}, {10}, 60}, TableAlignments -> {Right}, TableHeadings -> {{
        "Period length", "Cycles", "Co-prime numerators"}, None}]]], "Output"]
}, Closed]],

Cell[CellGroupData[{

Cell[BoxData[
    \(allCycles[77]\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {GridBox[{
                {"1", "10", "23", "76", "67", "54"},
                {"0", "1", "2", "9", "8", "7"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"2", "20", "46", "75", "57", "31"},
                {"0", "2", "5", "9", "7", "4"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"3", "30", "69", "74", "47", "8"},
                {"0", "3", "8", "9", "6", "1"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"4", "40", "15", "73", "37", "62"},
                {"0", "5", "1", "9", "4", "8"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"5", "50", "38", "72", "27", "39"},
                {"0", "6", "4", "9", "3", "5"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"6", "60", "61", "71", "17", "16"},
                {"0", "7", "7", "9", "2", "2"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"9", "13", "53", "68", "64", "24"},
                {"1", "1", "6", "8", "8", "3"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"12", "43", "45", "65", "34", "32"},
                {"1", "5", "5", "8", "4", "4"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"18", "26", "29", "59", "51", "48"},
                {"2", "3", "3", "7", "6", "6"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"19", "36", "52", "58", "41", "25"},
                {"2", "4", "6", "7", "5", "3"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]}
          },
        RowSpacings->2,
        ColumnSpacings->0.5,
        RowAlignments->Baseline,
        ColumnAlignments->{Left}],
      TableForm[
       {{{{1, 10, 23, 76, 67, 54}, {0, 1, 2, 9, 8, 7}}}, {{{2, 20, 46, 75, 57,
         31}, {0, 2, 5, 9, 7, 4}}}, {{{3, 30, 69, 74, 47, 8}, {0, 3, 8, 9, 6, 
        1}}}, {{{4, 40, 15, 73, 37, 62}, {0, 5, 1, 9, 4, 8}}}, {{{5, 50, 38, 
        72, 27, 39}, {0, 6, 4, 9, 3, 5}}}, {{{6, 60, 61, 71, 17, 16}, {0, 7, 
        7, 9, 2, 2}}}, {{{9, 13, 53, 68, 64, 24}, {1, 1, 6, 8, 8, 3}}}, {{{12,
         43, 45, 65, 34, 32}, {1, 5, 5, 8, 4, 4}}}, {{{18, 26, 29, 59, 51, 
        48}, {2, 3, 3, 7, 6, 6}}}, {{{19, 36, 52, 58, 41, 25}, {2, 4, 6, 7, 5,
         3}}}}, TableSpacing -> {2, 0.5}]]], "Output"]
}, Closed]],

Cell["\<\
 
Checking the last cycle ;\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    \(Mod[19*10\^Range[0, 5], 77]\)], "Input"],

Cell[BoxData[
    \({19, 36, 52, 58, 41, 25}\)], "Output"]
}, Closed]],

Cell[CellGroupData[{

Cell[BoxData[
    \(N[%/77, 8] // ColumnForm\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {
            StyleBox["0.246753246753246768`",
              StyleBoxAutoDelete->True,
              PrintPrecision->8]},
          {
            StyleBox["0.46753246753246751`",
              StyleBoxAutoDelete->True,
              PrintPrecision->8]},
          {
            StyleBox["0.675324675324675283`",
              StyleBoxAutoDelete->True,
              PrintPrecision->8]},
          {
            StyleBox["0.753246753246753275`",
              StyleBoxAutoDelete->True,
              PrintPrecision->8]},
          {
            StyleBox["0.5324675324675324`",
              StyleBoxAutoDelete->True,
              PrintPrecision->8]},
          {
            StyleBox["0.324675324675324672`",
              StyleBoxAutoDelete->True,
              PrintPrecision->8]}
          },
        GridBaseline->{Baseline, {1, 1}},
        ColumnAlignments->{Left}],
      ColumnForm[
       {0.24675324675324675, 0.46753246753246752, 0.67532467532467533, 
        0.75324675324675328, 0.53246753246753242, 0.32467532467532467}],
      Editable->False]], "Output"]
}, Closed]],

Cell[TextData[{
  " \nAn alternative to my ",
  StyleBox["cycleStats",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  " code is ",
  StyleBox["cycleStats2",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  " which utilises ",
  StyleBox["HauptExponent, ",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  "copied from a recent version of Eric's IntegerSequences.m package.\n\nThe \
",
  StyleBox["Partition15",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  " code segment in ",
  StyleBox["allCycles",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  " was adapted from ",
  StyleBox["Partition10 ",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  "in IntegerSequences.m , too."
}], "Text"],

Cell[BoxData[{
    \(\ \ \ 
    HauptExponent[p_, b_:  10] := 
      Module[{e = 1, mx = p}, \n\t\t
        While[PowerMod[b, e, p] != 1\  && \ \(e++\)\  < mx]; \n\t\t
        If[e < mx, e, 0]]\n\), 
    \(\ cycleStats2[d_] := 
      Module[{a, n, q}, \n\t\ta = HauptExponent[d]; \n\t\tq = EulerPhi[d]; \n
        \t\tn = q/a; 
        TableForm[{a, n, q}, TableAlignments -> {Right}, \n\ \ \ \ \ \ 
          TableHeadings
             -> {{"\<Period length\>", "\<Cycles\>", 
                "\<Coprime numerators\>"}, None}]]\)}], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(\(\ cycleStats2[77]\)\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {\("Period length"\), "6"},
          {\("Cycles"\), "10"},
          {\("Coprime numerators"\), "60"}
          },
        RowSpacings->1,
        ColumnSpacings->3,
        RowAlignments->Baseline,
        ColumnAlignments->{Right}],
      TableForm[
       {6, 10, 60}, TableAlignments -> {Right}, TableHeadings -> {{
        "Period length", "Cycles", "Coprime numerators"}, None}]]], "Output"]
}, Closed]]
}, Closed]],

Cell[CellGroupData[{

Cell["More examples ", "Section"],

Cell[" One of the simplest cycle set is that of 9 ;", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    \(\(\ cycleStats[9]\)\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {\("Period length"\), "1"},
          {\("Cycles"\), "6"},
          {\("Co-prime numerators"\), "6"}
          },
        RowSpacings->1,
        ColumnSpacings->3,
        RowAlignments->Baseline,
        ColumnAlignments->{Right}],
      TableForm[
       {{1}, {6}, 6}, TableAlignments -> {Right}, TableHeadings -> {{
        "Period length", "Cycles", "Co-prime numerators"}, None}]]], "Output"]
}, Closed]],

Cell[CellGroupData[{

Cell[BoxData[
    \(\(\ allCycles[9]\)\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {GridBox[{
                {"1"},
                {"1"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"2"},
                {"2"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"4"},
                {"4"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"5"},
                {"5"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"7"},
                {"7"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]},
          {GridBox[{
                {"8"},
                {"8"}
                },
              RowSpacings->0.25,
              ColumnSpacings->1,
              RowAlignments->Baseline,
              ColumnAlignments->{Left}]}
          },
        RowSpacings->2,
        ColumnSpacings->0.5,
        RowAlignments->Baseline,
        ColumnAlignments->{Left}],
      TableForm[
       {{{{1}, {1}}}, {{{2}, {2}}}, {{{4}, {4}}}, {{{5}, {5}}}, {{{7}, {7}}},
         {{{8}, {8}}}}, TableSpacing -> {2, 0.5}]]], "Output"]
}, Closed]],

Cell["\<\
 
An example of a set of longer cycles,  folded for more convenient display ;\
\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    \(cycleStats[127]\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {\("Period length"\), "42"},
          {\("Cycles"\), "3"},
          {\("Co-prime numerators"\), "126"}
          },
        RowSpacings->1,
        ColumnSpacings->3,
        RowAlignments->Baseline,
        ColumnAlignments->{Right}],
      TableForm[
       {{42}, {3}, 126}, TableAlignments -> {Right}, TableHeadings -> {{
        "Period length", "Cycles", "Co-prime numerators"}, None}]]], "Output"]
}, Closed]],

Cell[CellGroupData[{

Cell[BoxData[
    \(allCycles[127]\)], "Input"],

Cell[BoxData[
    RowBox[{"{", 
      RowBox[{
        InterpretationBox[GridBox[{
             
               {"1", "10", "100", "111", "94", "51", "2", "20", "73", "95", 
                "61", "102", "4", "40", "19"},
             
               {"0", "0", "7", "8", "7", "4", "0", "1", "5", "7", "4", "8", 
                "0", "3", "1"},
             
               {"63", "122", "77", "8", "80", "38", "126", "117", "27", "16", 
                "33", "76", "125", "107", "54"},
             
               {"4", "9", "6", "0", "6", "2", "9", "9", "2", "1", "2", "5", 
                "9", "8", "4"},
             
               {"32", "66", "25", "123", "87", "108", "64", "5", "50", "119", 
                "47", "89", \(""\), \(""\), \(""\)},
             
               {"2", "5", "1", "9", "6", "8", "5", "0", "3", "9", "3", "7", 
                \(""\), \(""\), \(""\)}
              },
            RowSpacings->1,
            ColumnSpacings->0.5,
            RowAlignments->Baseline,
            ColumnAlignments->{Left}],
          TableForm[
           {{1, 10, 100, 111, 94, 51, 2, 20, 73, 95, 61, 102, 4, 40, 19}, {0, 
            0, 7, 8, 7, 4, 0, 1, 5, 7, 4, 8, 0, 3, 1}, {63, 122, 77, 8, 80, 
            38, 126, 117, 27, 16, 33, 76, 125, 107, 54}, {4, 9, 6, 0, 6, 2, 9,
             9, 2, 1, 2, 5, 9, 8, 4}, {32, 66, 25, 123, 87, 108, 64, 5, 50, 
            119, 47, 89}, {2, 5, 1, 9, 6, 8, 5, 0, 3, 9, 3, 7}}, TableSpacing
             -> {1, 0.5}]], ",", 
        InterpretationBox[GridBox[{
             
               {"3", "30", "46", "79", "28", "26", "6", "60", "92", "31", 
                "56", "52", "12", "120", "57"},
             
               {"0", "2", "3", "6", "2", "2", "0", "4", "7", "2", "4", "4", 
                "0", "9", "4"},
             
               {"62", "112", "104", "24", "113", "114", "124", "97", "81", 
                "48", "99", "101", "121", "67", "35"},
             
               {"4", "8", "8", "1", "8", "8", "9", "7", "6", "3", "7", "7", 
                "9", "5", "2"},
             
               {"96", "71", "75", "115", "7", "70", "65", "15", "23", "103", 
                "14", "13", \(""\), \(""\), \(""\)},
             
               {"7", "5", "5", "9", "0", "5", "5", "1", "1", "8", "1", "1", 
                \(""\), \(""\), \(""\)}
              },
            RowSpacings->1,
            ColumnSpacings->0.5,
            RowAlignments->Baseline,
            ColumnAlignments->{Left}],
          TableForm[
           {{3, 30, 46, 79, 28, 26, 6, 60, 92, 31, 56, 52, 12, 120, 57}, {0, 
            2, 3, 6, 2, 2, 0, 4, 7, 2, 4, 4, 0, 9, 4}, {62, 112, 104, 24, 113,
             114, 124, 97, 81, 48, 99, 101, 121, 67, 35}, {4, 8, 8, 1, 8, 8, 
            9, 7, 6, 3, 7, 7, 9, 5, 2}, {96, 71, 75, 115, 7, 70, 65, 15, 23, 
            103, 14, 13}, {7, 5, 5, 9, 0, 5, 5, 1, 1, 8, 1, 1}}, TableSpacing
             -> {1, 0.5}]], ",", 
        InterpretationBox[GridBox[{
             
               {"9", "90", "11", "110", "84", "78", "18", "53", "22", "93", 
                "41", "29", "36", "106", "44"},
             
               {"0", "7", "0", "8", "6", "6", "1", "4", "1", "7", "3", "2", 
                "2", "8", "3"},
             
               {"59", "82", "58", "72", "85", "88", "118", "37", "116", "17", 
                "43", "49", "109", "74", "105"},
             
               {"4", "6", "4", "5", "6", "6", "9", "2", "9", "1", "3", "3", 
                "8", "5", "8"},
             
               {"34", "86", "98", "91", "21", "83", "68", "45", "69", "55", 
                "42", "39", \(""\), \(""\), \(""\)},
             
               {"2", "6", "7", "7", "1", "6", "5", "3", "5", "4", "3", "3", 
                \(""\), \(""\), \(""\)}
              },
            RowSpacings->1,
            ColumnSpacings->0.5,
            RowAlignments->Baseline,
            ColumnAlignments->{Left}],
          TableForm[
           {{9, 90, 11, 110, 84, 78, 18, 53, 22, 93, 41, 29, 36, 106, 44}, {0,
             7, 0, 8, 6, 6, 1, 4, 1, 7, 3, 2, 2, 8, 3}, {59, 82, 58, 72, 85, 
            88, 118, 37, 116, 17, 43, 49, 109, 74, 105}, {4, 6, 4, 5, 6, 6, 9,
             2, 9, 1, 3, 3, 8, 5, 8}, {34, 86, 98, 91, 21, 83, 68, 45, 69, 55,
             42, 39}, {2, 6, 7, 7, 1, 6, 5, 3, 5, 4, 3, 3}}, TableSpacing -> {
            1, 0.5}]]}], "}"}]], "Output"]
}, Closed]],

Cell["\<\
 
The prime 97 has a full period and thus a single cycle ;\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    \(\(\ cycleStats[97]\)\)], "Input"],

Cell[BoxData[
    InterpretationBox[GridBox[{
          {\("Period length"\), "96"},
          {\("Cycles"\), "1"},
          {\("Co-prime numerators"\), "96"}
          },
        RowSpacings->1,
        ColumnSpacings->3,
        RowAlignments->Baseline,
        ColumnAlignments->{Right}],
      TableForm[
       {{96}, {1}, 96}, TableAlignments -> {Right}, TableHeadings -> {{
        "Period length", "Cycles", "Co-prime numerators"}, None}]]], "Output"]
}, Closed]],

Cell[CellGroupData[{

Cell[BoxData[
    \(\(\ allCycles[97]\)\)], "Input"],

Cell[BoxData[
    RowBox[{"{", 
      InterpretationBox[GridBox[{
           
             {"1", "10", "3", "30", "9", "90", "27", "76", "81", "34", "49", 
              "5", "50", "15", "53"},
           
             {"0", "1", "0", "3", "0", "9", "2", "7", "8", "3", "5", "0", "5",
               "1", "5"},
           
             {"45", "62", "38", "89", "17", "73", "51", "25", "56", "75", 
              "71", "31", "19", "93", "57"},
           
             {"4", "6", "3", "9", "1", "7", "5", "2", "5", "7", "7", "3", "1",
               "9", "5"},
           
             {"85", "74", "61", "28", "86", "84", "64", "58", "95", "77", 
              "91", "37", "79", "14", "43"},
           
             {"8", "7", "6", "2", "8", "8", "6", "5", "9", "7", "9", "3", "8",
               "1", "4"},
           
             {"42", "32", "29", "96", "87", "94", "67", "88", "7", "70", "21",
               "16", "63", "48", "92"},
           
             {"4", "3", "2", "9", "8", "9", "6", "9", "0", "7", "2", "1", "6",
               "4", "9"},
           
             {"47", "82", "44", "52", "35", "59", "8", "80", "24", "46", "72",
               "41", "22", "26", "66"},
           
             {"4", "8", "4", "5", "3", "6", "0", "8", "2", "4", "7", "4", "2",
               "2", "6"},
           
             {"78", "4", "40", "12", "23", "36", "69", "11", "13", "33", "39",
               "2", "20", "6", "60"},
           
             {"8", "0", "4", "1", "2", "3", "7", "1", "1", "3", "4", "0", "2",
               "0", "6"},
           
             {"18", "83", "54", "55", "65", "68", \(""\), \(""\), \(""\), 
              \(""\), \(""\), \(""\), \(""\), \(""\), \(""\)},
           
             {"1", "8", "5", "5", "6", "7", \(""\), \(""\), \(""\), \(""\), 
              \(""\), \(""\), \(""\), \(""\), \(""\)}
            },
          RowSpacings->1,
          ColumnSpacings->0.5,
          RowAlignments->Baseline,
          ColumnAlignments->{Left}],
        TableForm[
         {{1, 10, 3, 30, 9, 90, 27, 76, 81, 34, 49, 5, 50, 15, 53}, {0, 1, 0, 
          3, 0, 9, 2, 7, 8, 3, 5, 0, 5, 1, 5}, {45, 62, 38, 89, 17, 73, 51, 
          25, 56, 75, 71, 31, 19, 93, 57}, {4, 6, 3, 9, 1, 7, 5, 2, 5, 7, 7, 
          3, 1, 9, 5}, {85, 74, 61, 28, 86, 84, 64, 58, 95, 77, 91, 37, 79, 
          14, 43}, {8, 7, 6, 2, 8, 8, 6, 5, 9, 7, 9, 3, 8, 1, 4}, {42, 32, 29,
           96, 87, 94, 67, 88, 7, 70, 21, 16, 63, 48, 92}, {4, 3, 2, 9, 8, 9, 
          6, 9, 0, 7, 2, 1, 6, 4, 9}, {47, 82, 44, 52, 35, 59, 8, 80, 24, 46, 
          72, 41, 22, 26, 66}, {4, 8, 4, 5, 3, 6, 0, 8, 2, 4, 7, 4, 2, 2, 6},
           {78, 4, 40, 12, 23, 36, 69, 11, 13, 33, 39, 2, 20, 6, 60}, {8, 0, 
          4, 1, 2, 3, 7, 1, 1, 3, 4, 0, 2, 0, 6}, {18, 83, 54, 55, 65, 68}, {
          1, 8, 5, 5, 6, 7}}, TableSpacing -> {1, 0.5}]], "}"}]], "Output"]
}, Closed]]
}, Closed]],

Cell[CellGroupData[{

Cell[" References", "Section"],

Cell["\<\
 1/  Proceedings of the Cambridge Philosophical Society, Vol III \
(1880);
      J.W.L. Glaisher - On Circulating Decimals, P. 185-204.
      
 2/  Cycles of Recurring Decimals , Vol I (1950), Vol II (1953) , \
D.R.Kaprekar.
       (Aryabhushan Press).
       
 3/  Number Theory and its History ,  Oystein Ore,  Chapt. 13, Theory of \
Decimal Expansions,
        (Dover publications).           \
\>", "Text"]
}, Closed]]
}, Open  ]]
},
FrontEndVersion->"Macintosh 3.0",
ScreenRectangle->{{0, 640}, {0, 460}},
WindowToolbars->"EditBar",
WindowSize->{520, 365},
WindowMargins->{{20, Automatic}, {Automatic, 28}},
MacintoshSystemPageSetup->"\<\
00h0001804P000000b02<?oaonl3>@91H`85N0?N0 at 00005X0FP000003j0:l001
0 at 00I00100000@0200000BL?00400000000000000000010000000000000 at 0?ne
oj/@7 at ]500P1000000000000000001T1\>"
]


(***********************************************************************
Cached data follows.  If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of 
the file.  The cache data will then be recreated when you save this file 
from within Mathematica.
***********************************************************************)

(*CellTagsOutline
CellTagsIndex->{}
*)

(*CellTagsIndex
CellTagsIndex->{}
*)

(*NotebookFileOutline
Notebook[{

Cell[CellGroupData[{
Cell[1731, 51, 44, 0, 52, "Subtitle"],
Cell[1778, 53, 91, 1, 31, "Text"],
Cell[1872, 56, 786, 22, 146, "Text"],

Cell[CellGroupData[{
Cell[2683, 82, 34, 0, 50, "Section"],
Cell[2720, 84, 59, 1, 27, "Input"],
Cell[2782, 87, 2182, 42, 773, "Input"],

Cell[CellGroupData[{
Cell[4989, 133, 47, 1, 27, "Input"],
Cell[5039, 136, 460, 12, 56, "Output"]
}, Closed]],

Cell[CellGroupData[{
Cell[5536, 153, 46, 1, 24, "Input"],
Cell[5585, 156, 3670, 95, 342, "Output"]
}, Closed]],
Cell[9270, 254, 51, 3, 43, "Text"],

Cell[CellGroupData[{
Cell[9346, 261, 60, 1, 31, "Input"],
Cell[9409, 264, 58, 1, 26, "Output"]
}, Closed]],

Cell[CellGroupData[{
Cell[9504, 270, 57, 1, 24, "Input"],
Cell[9564, 273, 1127, 32, 106, "Output"]
}, Closed]],
Cell[10706, 308, 726, 27, 110, "Text"],
Cell[11435, 337, 542, 12, 203, "Input"],

Cell[CellGroupData[{
Cell[12002, 353, 54, 1, 27, "Input"],
Cell[12059, 356, 454, 12, 70, "Output"]
}, Closed]]
}, Closed]],

Cell[CellGroupData[{
Cell[12562, 374, 33, 0, 30, "Section"],
Cell[12598, 376, 61, 0, 30, "Text"],

Cell[CellGroupData[{
Cell[12684, 380, 52, 1, 27, "Input"],
Cell[12739, 383, 456, 12, 70, "Output"]
}, Closed]],

Cell[CellGroupData[{
Cell[13232, 400, 51, 1, 24, "Input"],
Cell[13286, 403, 1728, 57, 206, "Output"]
}, Closed]],
Cell[15029, 463, 103, 4, 43, "Text"],

Cell[CellGroupData[{
Cell[15157, 471, 48, 1, 27, "Input"],
Cell[15208, 474, 462, 12, 56, "Output"]
}, Closed]],

Cell[CellGroupData[{
Cell[15707, 491, 47, 1, 24, "Input"],
Cell[15757, 494, 4374, 95, 330, "Output"]
}, Closed]],
Cell[20146, 592, 82, 3, 43, "Text"],

Cell[CellGroupData[{
Cell[20253, 599, 53, 1, 27, "Input"],
Cell[20309, 602, 460, 12, 56, "Output"]
}, Closed]],

Cell[CellGroupData[{
Cell[20806, 619, 52, 1, 24, "Input"],
Cell[20861, 622, 2864, 61, 232, "Output"]
}, Closed]]
}, Closed]],

Cell[CellGroupData[{
Cell[23774, 689, 30, 0, 30, "Section"],
Cell[23807, 691, 420, 12, 142, "Text"]
}, Closed]]
}, Open  ]]
}
]
*)




(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)






  • Prev by Date: Re: Controlling how Mathematica fits data
  • Next by Date: Mathematica Visiting Scholar Grant Program
  • Previous by thread: Re: 3D vector plots and shading
  • Next by thread: Re: Cyclic decimal periods.