Well, it can not be exactly the same formula because
the J one finds semiprimes less than n while the
MathWorld one finds those less than or equal to n .
I derived the J computation before I saw the MathWorld
one and saw that they are very similar.

As a mathematician, do you find the MathWorld formula?

pi<sup>(2)</sup>(x)=sigma(k=1,pi(sqrt(n))) [pi(n/p<sub>k</sub>-k+1]

The following are a list questions I have:

- pi<sup>(2)</pi>(x) is non-standard, at least unusual.
  Superscript usually means exponentiation.
- x should be n (I assume this is a typo)
- Square brackets sometimes mean the nearest integer.
In this case I think it just denotes grouping; the author
could have used parens.

In J, with the same reasoning, one readily derives a computation
that produces the actual semiprimes.  That is an illustration
of the power of J in dealing with arrays.



----- Original Message -----
From: John Randall <[EMAIL PROTECTED]>
Date: Saturday, April 5, 2008 6:06
Subject: Re: [Jgeneral] How readable is J?
To: General forum <[email protected]>

> Roger Hui wrote:
> 
> > The MathWorld page doesn't give the derivation
> 
> I believe the MathWorld formula is the same as the J derivation.
> 
> Primes are indexed starting at 1. You iterate over primes p_k whose
> square is less than or equal to n.  The term pi(n/p_k) 
> counts primes q
> such that n>:(p_k)*q . You subtract (k-1) to count only primes q with
> p_k<q .
> 
> Best wishes,
> 
> John
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to