OFFSET
1,3
COMMENTS
If n == 2 (mod 3), then a(n) is either -1, 3, or sqrt(n-3).
If 2*n is a square, then a(n) is either -1 or sqrt(2*n)-1 (in which case a(n) must be in A005384).
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(7) = 3 because 2*7 - 3^2 = 5 is prime.
MAPLE
f:= proc(n) local p;
if n mod 3 = 2 then
if isprime(2*n-3^2) then return 3
elif issqr(2*n-3) and isprime(sqrt(2*n-3)) then return sqrt(2*n-3)
else return -1
fi fi;
p:= 1:
while p^2 < 2*n do
p:= nextprime(p);
if isprime(2*n-p^2) then return p fi
od;
-1
end proc:
map(f, [$1..100]);
CROSSREFS
KEYWORD
sign
AUTHOR
J. M. Bergot and Robert Israel, Jul 27 2022
STATUS
approved