login
A339501
a(n) = smallest prime number between prime(n) and 2*prime(n) such that the arithmetic progression (prime(n), a(n), ...) and which contains only primes has the maximum length.
2
3, 5, 7, 13, 17, 17, 29, 31, 41, 41, 37, 67, 47, 61, 59, 71, 83, 67, 97, 131, 127, 103, 131, 101, 139, 197, 193, 137, 151, 173, 139, 191, 167, 151, 233, 181, 307, 271, 197, 233, 263, 211, 317, 283, 359, 211, 241, 373, 239, 271, 311, 359, 277
OFFSET
1,1
EXAMPLE
a(4) = 13 since 7, 13 and 19 are primes in arithmetic progression, 7 is the fourth prime number, and there is no longer one starting with 7 than another prime less than 2*7 = 14.
a(12) = 67 since prime(12) = 37 and 67, 97, 127 and 157 are also primes in arithmetic progression of common difference 30.
PROG
(PARI) A339501(n)= {
my(p=prime(n), bp, bk);
forprime(np=p+1, 2*p, for(k=2, +oo, if(!isprime(p+k*(np-p)), if(k>bk, bk=k; bp=np; ); break); ); );
return(bp);
}
CROSSREFS
Sequence in context: A188574 A247458 A355424 * A008996 A261089 A264988
KEYWORD
nonn,easy
AUTHOR
François Marques, Dec 07 2020
STATUS
approved