Yes, I should have explained the output,  and stress that
it's really for large scalars >= 2^31,  but you can force it to
use its procedure for smallish numbers, eg

   0 primepi 100  NB. might not align...

100 50 33 25 20 16 14 12 11 10 9 8 7 6 5 4 3 2 1

 25 15 11  9  8  6  6  5  5  4 4 4 4 3 3 2 2 1 0


So you get primepi for n and for a number of
sieve values < n,  eg pi(33) = 11 etc.


I've left the table output as being of potential
use,  although one's principal interest is in
{.{:primepi n

0 primepi each 2 3 4

+---+-----+-----+

|2 1|3 2 1|4 2 1|

|1 0|2 1 0|2 1 0|

+---+-----+-----+

shows the results a bit better than the zero rank version.


Pascal Jasmin (is it?) points out that a <.@%: b is
preferable to <. a % b. Oversight, sorry!

Thanks, both,

Mike

On 25/02/2015 17:03, Raul Miller wrote:
I tried your primepi, and I'm not certain I understand it. It seems to
me that its behavior above the threshold is very different from that
of pi:

    pi i. 10
0 0 1 2 2 3 3 4 4 4
    pi 2 3 4
1 2 2
    primepi 2 3 4
1 2 2
    1 primepi 2 3 4
|length error: primepi
|   V=.<.n    %i=.>:i.r
    1 primepi("0) 2 3 4
2 1 0
1 0 0

3 2 1
2 1 0

4 2 1
2 1 0

Was this the code that you meant to post?

Thanks,



---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to