This is simple but may work:
n=.'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefg'
>:I. (<n) ({.~ -: ] {. }.~) &> >:i.10
7
0j100 ": 1r49
n=. 2}.0j100 ": 1r49
>:I. (<n) ({.~ -: ] {. }.~) &> >:i.#n
42
On Sat, Jan 11, 2020 at 11:38 PM Roger Hui <[email protected]>
wrote:
> You may want to read http://en.wikipedia.org/wiki/Repeating_decimal to see
> if you can derive a math-based solution to the size of the repetend of a
> rational number.
>
> On Sat, Jan 11, 2020 at 8:00 PM Skip Cave <[email protected]> wrote:
>
> > I'll need something like this:
> >
> > n=.'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefg'
> >
> > nc=.n="1
> >
> >
> |:n,.(1|.n),.(2|.n),.(3|.n),.(4|.n),.(5|.n),.(6|.n),.(7|.n),.(8|.n),.(9|.n),.(10|.n)
> >
> > +/"1 nc
> >
> > 42 0 0 0 0 0 0 42 0 0 0
> >
> > So it is clear, n repeats every 8 digits.
> >
> >
> > There's got to be a non-looping way to define nc more concisely.
> >
> >
> > Skip
> >
> > Skip Cave
> > Cave Consulting LLC
> >
> >
> > On Sat, Jan 11, 2020 at 9:40 PM Skip Cave <[email protected]>
> wrote:
> >
> > > If I remember my college math courses, what I need is what is
> > > typically called "autocorrelation" which finds the repetitiveness of a
> > > vector of numbers. In this case, rather than a probability statistic,
> > there
> > > should be an integer defining the exact number of digits before
> > repetition
> > > begins.
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > >
> > >
> > > On Sat, Jan 11, 2020 at 8:08 PM Julian Fondren <
> [email protected]
> > >
> > > wrote:
> > >
> > >> On Sat, 2020-01-11 at 19:55 -0600, Julian Fondren wrote:
> > >> > I don't have a good answer
> > >>
> > >> geh, I could've said that again. I only looked up e. after wondering
> > >> why exactly I got the final wrong result.
> > >>
> > >> '500500500' e. '50'
> > >> 1 1 1 1 1 1 1 1 1
> > >>
> > >> Is all ones as it's only finding either '5' or '0' in each of those
> > >> positions. So this is useless, sorry.
> > >>
> > >> > 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.058823529411764705882352941176470588235294117647058823529411764
> > >> > > > 70
> > >> > > >
> 58823529411764705882352941176470588235294117647058823529411764705
> > >> > > > 88
> > >> > > >
> 23529411764705882352941176470588235294117647058823529411764705882
> > >> > > > 35
> > >> > > > 2941176470588235294117647058823529411764705882352941176...
> > >> > > >
> > >> > > > _100 ]\ 0j1000 ": 1r17
> > >> > > >
> > >> > > >
> 0.058823529411764705882352941176470588235294117647058823529411764
> > >> > > > 70
> > >> > > > 588235294117647058823529411764705
> > >> > > >
> > >> > > >
> 88235294117647058823529411764705882352941176470588235294117647058
> > >> > > > 82
> > >> > > > 352941176470588235294117647058823
> > >> > > >
> > >> > > >
> 52941176470588235294117647058823529411764705882352941176470588235
> > >> > > > 29
> > >> > > > 411764705882352941176470588235294
> > >> > > >
> > >> > > >
> 11764705882352941176470588235294117647058823529411764705882352941
> > >> > > > 17
> > >> > > > 647058823529411764705882352941176
> > >> > > >
> > >> > > >
> 47058823529411764705882352941176470588235294117647058823529411764
> > >> > > > 70
> > >> > > > 588235294117647058823529411764705
> > >> > > >
> > >> > > >
> 88235294117647058823529411764705882352941176470588235294117647058
> > >> > > > 82
> > >> > > > 352941176470588235294117647058823
> > >> > > >
> > >> > > >
> 52941176470588235294117647058823529411764705882352941176470588235
> > >> > > > 29
> > >> > > > 411764705882352941176470588235294
> > >> > > >
> > >> > > >
> 11764705882352941176470588235294117647058823529411764705882352941
> > >> > > > 17
> > >> > > > 647058823529411764705882352941176
> > >> > > >
> > >> > > >
> 47058823529411764705882352941176470588235294117647058823529411764
> > >> > > > 70
> > >> > > > 588235294117647058823529411764705
> > >> > > >
> > >> > > >
> 88235294117647058823529411764705882352941176470588235294117647058
> > >> > > > 82
> > >> > > > 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
> > >>
> > >> ----------------------------------------------------------------------
> > >> 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
>
--
Devon McCormick, CFA
Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm