login
Let p = prime(n); a(n) = (p-1)/2 if that is prime, or (p+1)/2 if that is prime, and otherwise p itself.
2

%I #11 Dec 11 2019 10:51:56

%S 2,2,2,3,5,7,17,19,11,29,31,19,41,43,23,53,29,31,67,71,37,79,41,89,97,

%T 101,103,53,109,113,127,131,137,139,149,151,79,163,83,173,89,181,191,

%U 97,197,199,211,223,113,229,233,239,241,251,257,131,269,271,139

%N Let p = prime(n); a(n) = (p-1)/2 if that is prime, or (p+1)/2 if that is prime, and otherwise p itself.

%H Rémy Sigrist, <a href="/A330310/b330310.txt">Table of n, a(n) for n = 1..25000</a>

%p a:=[2];

%p for n from 2 to 80 do p:=ithprime(n);

%p if isprime((p-1)/2) then t:=(p-1)/2; elif isprime((p+1)/2) then t:=(p+1)/2 else t:=p; fi;

%p a:=[op(a),t];

%p od: a;

%o (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

%Y Suggested by A328686.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, Dec 10 2019