I don't have a good answer, but I noticed this:
s =: 3 }. 0j1000 ": 1r17
s e. 15 {. s
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 ...
s e. 16 {. s
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
*./s e. 15 {. s
0
*./s e. 16 {. s
1
So, just counting up until that test succeeds:
rpt =: monad : '($: >:)`]@.([: *./ y e. y {.~ ]) 1'
rpt s
16
ext =: [: 3&}. 0j1000&":
rpt ext 1r17
16
rpt ext 1r3
1
rpt ext 2r7
6
but it also gets wrong answers like
rpt ext 1r4
2
On Sat, 2020-01-11 at 19:22 -0600, Skip Cave wrote:
> Beautiful! Thank you Roger.
>
> Now, how can I find the number of digits in each repeating cycle of a
> rational number?
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
>
>
> On Sat, Jan 11, 2020 at 7:03 PM Roger Hui <[email protected]>
> wrote:
>
> > 0j1000 ": 1r17
> >
> > 0.05882352941176470588235294117647058823529411764705882352941176470
> > 5882352941176470588235294117647058823529411764705882352941176470588
> > 2352941176470588235294117647058823529411764705882352941176470588235
> > 2941176470588235294117647058823529411764705882352941176...
> >
> > _100 ]\ 0j1000 ": 1r17
> >
> > 0.05882352941176470588235294117647058823529411764705882352941176470
> > 588235294117647058823529411764705
> >
> > 8823529411764705882352941176470588235294117647058823529411764705882
> > 352941176470588235294117647058823
> >
> > 5294117647058823529411764705882352941176470588235294117647058823529
> > 411764705882352941176470588235294
> >
> > 1176470588235294117647058823529411764705882352941176470588235294117
> > 647058823529411764705882352941176
> >
> > 4705882352941176470588235294117647058823529411764705882352941176470
> > 588235294117647058823529411764705
> >
> > 8823529411764705882352941176470588235294117647058823529411764705882
> > 352941176470588235294117647058823
> >
> > 5294117647058823529411764705882352941176470588235294117647058823529
> > 411764705882352941176470588235294
> >
> > 1176470588235294117647058823529411764705882352941176470588235294117
> > 647058823529411764705882352941176
> >
> > 4705882352941176470588235294117647058823529411764705882352941176470
> > 588235294117647058823529411764705
> >
> > 8823529411764705882352941176470588235294117647058823529411764705882
> > 352941176470588235294117647058823
> > 53
> >
> > _16 ]\ 3}. 0j1000 ": 1r17
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882352941176470
> > 5882353
> >
> >
> > On Sat, Jan 11, 2020 at 4:31 PM Skip Cave <[email protected]>
> > wrote:
> >
> > > How can I use J get the decimal expansion of the rational number
> > > 1r17 to
> > > 100 digits? 1000 digits?
> > >
> > > Skip
> > >
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > > ---------------------------------------------------------------
> > > -------
> > > For information about J forums see
> > > http://www.jsoftware.com/forums.htm
> > >
> > -----------------------------------------------------------------
> > -----
> > For information about J forums see
> > http://www.jsoftware.com/forums.htm
> >
> -------------------------------------------------------------------
> ---
> For information about J forums see
> http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm