I'm deeply interested in number theory and want to test some of my ideas in pari/gp, but am not familiar with this software. Specifically, I want to define a 'primeorder' function that maps an integer n to what I call its primality order, which is 0 if and only if n is composite and equal to the least integer k such that the k-th iterate of the prime counting function evaluated at n is composite otherwise.
How can I define such a function in pari/gp?
Please, review this:
I highly recommend to read PARI/GP tutorial.