Sure... (hopefully I've copied this correctly...):

tdig=:1 :0
:
  NB. b: m, p: x, q: y
  q=. y%x+.y
  (>.m^.q)%0=#q-.&q:m
)

For example,
   12 (10 tdig) 150

-- 
Raul

Thanks,

-- 
Raul
On Jul 23, 2014 8:23 AM, "Don Guinn" <[email protected]> wrote:

> ​​
> Why not extend the question a bit? Given p, q and b, how many digits of
> base b will be required in the repeat? The answer could be an infinite
> number.
>
>
> On Wed, Jul 23, 2014 at 5:15 AM, Raul Miller <[email protected]>
> wrote:
>
> > OK, rereading the original post, I guess I should assume that we are not
> > only interested in the decimal case.
> >
> > That said, I'm not certain that it makes sense to assume that the least
> > common denominator has been factored out of p and q, either.
> >
> > --
> > Raul
> > On Jul 23, 2014 1:28 AM, "greg heil" <[email protected]> wrote:
> >
> > > Raul
> > >
> > > >Well the way i read Dans query only q and b are important... so if
> > >    bq=:([:q:])-.([:q:[)
> > > then a null result would be finite, eg
> > >    3 bq 3
> > >    10 bq 3
> > > 3
> > >
> > > greg
> > > ~krsnadas.org
> > >
> > > --
> > >
> > > from: Raul Miller <[email protected]>
> > > reply-to: [email protected]
> > > to: Chat forum <[email protected]>
> > > date: 22 July 2014 20:42
> > > subject: Re: [Jchat] Repeating decimals
> > >
> > > That's an interesting point.
> > >
> > > >Nevertheless, given the subject line of this thread, I think that
> maybe
> > > the base has already been determined.
> > >
> > > Thanks,
> > >
> > > --
> > > Raul
> > >
> > > --
> > >
> > > from: greg heil <[email protected]>
> > > to: Chat forum <[email protected]>
> > > date: 22 July 2014 19:42
> > > subject: Re: [Jchat] Repeating decimals
> > >
> > > >What ever formula would also depend on b ... eg the division of 1 by 3
> > > has a finite representation in base 3 of 0.1. (although its
> > representation
> > > in base 10 is infinite)
> > >
> > > greg
> > > ~krsnadas.org
> > >
> > > --
> > >
> > > from: Raul Miller <[email protected]>
> > > to: Chat forum <[email protected]>
> > > date: 22 July 2014 10:18
> > > subject: Re: [Jchat] Repeating decimals
> > >
> > >    $p(2 5-.~[:q:]%+.)q
> > > 0
> > >
> > > >Assuming p and q are rank 0, of course. (And this is a reasonable
> > > assumption, since the problem statement suggests no use for
> dimensions).
> > >
> > > Thanks,
> > >
> > > --
> > > Raul
> > >
> > > --
> > >
> > > from: Dan Bron <[email protected]>
> > > to: [email protected]
> > > date: 22 July 2014 08:25
> > > subject: [Jchat] Repeating decimals
> > >
> > > >Given 3 positive integers p,q and b, where p and q represent the
> > > numerator and denominator of a rational number (respectively), and b a
> > > numerical base (or radix), how can we know if p%q has a finite (or not)
> > > representation in b?
> > >
> > > >In other words, if p%q can be represented by a finite
> > > (non-infinitely-repeating) decimal in base b, then what do we know
> about
> > > the relationship of p to q or p%q to b ?
> > >
> > > >You may allow p to take on the value 0 if needed for generality, but q
> > is
> > > strictly > 0 (obviously) and b is strictly > 1 (probably?).
> > >
> > > -Dan
> > > ----------------------------------------------------------------------
> > > 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

Reply via email to