p: Primes -

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary

Primes | p: 0 |

The result of`p: i` is the `i`-th prime. For example:
       p: 0
    2

       p: i. 15
    2 3 5 7 11 13 17 19 23 29 31 37 41 43 47

The inverse of`p:` is the number of primes less than the argument, often denoted by π(n):

       pi=: p:^:_1
       pi i. 15
    0 0 0 1 2 2 3 3 4 4 4 4 5 5 6

       (] , pi ,: p:@pi) i.15
    0 1 2 3 4 5 6 7  8  9 10 11 12 13 14
    0 0 0 1 2 2 3 3  4  4  4  4  5  5  6
    2 2 2 3 5 5 7 7 11 11 11 11 13 13 17

       y=: (2^31)-1

       ]a=: pi y
    105097564

       ]b=: p: a
    2147483647

       b=y
    1

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary