OFFSET
1,1
COMMENTS
If the condition a(n) > prime(n) is removed, then we get sequence A032448. This differs only at n = 2 since if p <= prime(n) and p == -1 (mod prime(n)), then p must be prime(n) - 1. The only solution is p = 2, prime(n) = 3. - Michael B. Porter, Jul 01 2014 and Michel Marcus, May 28 2014
LINKS
Paolo P. Lava, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = min(p: p mod prime(n) == - 1 and p > prime(n)).
EXAMPLE
a(1) = 3, because for the first prime, 2, we have 3 mod 2 = 2 - 1.
a(2) = 5, because for the second prime, 3, we have 5 mod 3 = 3 - 1.
a(3) = 19, because for the third prime, 5, we have 19 mod 5 = 5 - 1.
PROG
(PARI) a(n) = {q = prime(n); forprime(p=q, , if (p % q == q - 1, return (p); ); ); } \\ Michel Marcus, May 28 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Torlach Rush, May 27 2014
EXTENSIONS
More terms from Michel Marcus, May 28 2014
STATUS
approved