First off, a secret key in GnuPG is unlikely to be one prime number. For RSA keys, public key contains two integers (n and e), while the private key contains four integers (d, p, q and u, in OpenPGP's terminology; p and q are primes and their product is equal to n). For ElGamal or DSA keys, the public key contains three or four integers (p, q, g, y) and the private key is one integer (x) which is not necessarily prime (primality of the private ElGamal key has no significance).
The actual format is described at length in the standard. If you implement some code to parse files as described in this standard, then you will get all the information you want. To speed up the effort (faster result, at the expense of less understanding -- implementing a protocol from scratch is a great way to learn it !), you may want to use some existing libraries which will do the parsing for you. For instance Bouncy Castle (in Java), or GnuPG (in C).