OFFSET
1,1
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..25000
MAPLE
a:=[2];
for n from 2 to 80 do p:=ithprime(n);
if isprime((p-1)/2) then t:=(p-1)/2; elif isprime((p+1)/2) then t:=(p+1)/2 else t:=p; fi;
a:=[op(a), t];
od: a;
PROG
(PARI) a(n) = { my (p=prime(n), q); if (p%2, if (isprime(q=(p-1)/2), return (q), isprime(q=(p+1)/2), return (q))); return (p) } \\ Rémy Sigrist, Dec 11 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Dec 10 2019
STATUS
approved