# Need this Function Explained

I'm working on a personal project and I did a search for an integer sequence on the site listed below. I found the sequence I was looking for with a short description of the function defining the sequence. However, no matter how much I struggle to get the function to work, I cannot. If you could clarify the description at the link for me (maybe even provide an example or two) that would great. Thanks for any help!

Here is the link to the description: http://oeis.org/A039739

And here is the link to the sequence: http://oeis.org/A039739/list

-
I don't get it either, since I can't see how $p(n)$ is defined, and $p(n)$ is used in the description of the sequence. –  coffeemath Nov 4 '12 at 2:07
Maybe $p(n)$ is the $n$th prime? –  ronno Nov 4 '12 at 2:10
@ronno nope, it appears not –  Benjamin Dickman Nov 4 '12 at 2:12
$n$th odd prime, it appears. –  Gerry Myerson Nov 4 '12 at 2:51

"$a(n)=2q-p(n)$, where $q$ is the prime $\lt p(n)$ for which $p(n) \bmod q$ is maximal."
I think $p(n)$ is the $n$th (odd) prime. So to find, say, $a(5)$, you look at $p(5)$, the 5th odd prime, which is $13$, then you calculate $13\bmod q$ for $q=3,5,7,11$, getting $1,3,6,2$, of which the largest is the $6$ you get from $q=7$. So, $a(5)=2\times7-13=1$.
The sequence at oeis starts 1, 1, 3, 3, 1, 5, 3, 3, 5, 3, 1, so $a(5)$ is the 5th term in that sequence, which is 1, not 3. The link does not count 1 as a prime, nor 2 --- just odd primes, as I wrote. –  Gerry Myerson Nov 4 '12 at 2:51