pi=: _1&p: + 1&p:


----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Saturday, April 5, 2008 20:14
Subject: Re: [Jgeneral] How readable is J?
To: General forum <[email protected]>

> You may like 2!1+m instead of 2%~m*1+m .
> I also found a neater expression for the pi function:
> pi=: p:^:_1 + 1&p:
> 
> 
> 
> ----- Original Message -----
> From: John Randall <[EMAIL PROTECTED]>
> Date: Saturday, April 5, 2008 18:09
> Subject: Re: [Jgeneral] How readable is J?
> To: General forum <[email protected]>
> 
> > Roger Hui wrote:
> > > Something is still amiss in the formula.  For
> > >   [[latex($$\sum_{p\in P} \left(\pi(n/p)-
> > \pi(p)\right)=\sum_{p\in P}
> > > \pi(n/p)- \frac{m(m-1)}2$$)]]
> > > to be true, it must be that
> > >   [[latex($$\sum_{p\in P}\pi(p)=\frac{m(m-1)}2$$)]]
> > > But:
> > >
> > >    pi=: p:^:_1@(+ 1&p:)
> > >    ] p=: p: i.m=: 5
> > > 2 3 5 7 11
> > >    pi p
> > > 1 2 3 4 5
> > >    +/ pi p
> > > 15
> > >    2 %~ m*m-1
> > > 10
> > 
> > I think I was seduced by +/ @ i. @ # .  It should be 2 %~ 
> > m*m+1 .
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to