OFFSET
1,3
FORMULA
a(m) = 0 for m>0 in A037040, the corresponding odd composites being in A016754\{1}. - Michel Marcus, May 19 2017
EXAMPLE
The third odd composite number is A071904(3) = 21. and 21+2^2 = 25 = 5^2, so a(3) = 2.
MATHEMATICA
q[n_] := SelectFirst[Range[0, (n-1)/2], IntegerQ@ Sqrt[#^2 + n] &]; q /@ Select[Range[1, 300, 2], CompositeQ] (* Giovanni Resta, May 18 2017 *)
PROG
(Python)
from sympy import primepi, divisors
from sympy.ntheory.primetest import is_square
def A287016(n):
if n == 1: return 0
m, k = n, primepi(n) + n + (n>>1)
while m != k:
m, k = k, primepi(k) + n + (k>>1)
return 0 if is_square(int(m)) else -(d:=divisors(m))[l:=(len(d)>>1)-1]+d[l+1]>>1 # Chai Wah Wu, Aug 02 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Zhandos Mambetaliyev, Jean-François Alcover, May 18 2017
EXTENSIONS
More terms from Giovanni Resta, May 18 2017
STATUS
approved