%I #16 Aug 17 2024 14:21:17
%S -1,-1,1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,
%T -1,1,1,1,-1,-1,-1,3,1,-1,-1,-1,1,-1,-1,1,-1,9,1,3,-1,3,1,1,1,1,-1,-1,
%U -1,-1,-1,1,1,3,1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,3,1,3,-1,-1,-1,-1
%N a(n) is the greatest odd number k such that n^2 + j is a semiprime for all odd numbers j from 1 to k.
%C a(n) = -1 if n^2 + 1 is not a semiprime.
%C a(n) <= 1 if n is odd, since n^2 + 3 is divisible by 4.
%C a(n) <= 15 since one of n^2 + 1, n^2 + 3, ..., n^2 + 17 is divisible by 9.
%C First occurrences of values: a(3) = 1, a(34) = 3, a(152) = 5, a(102) = 7, a(44) = 9, a(824264) = 11, a(21394) = 13, a(121364) = 15.
%H Robert Israel, <a href="/A375391/b375391.txt">Table of n, a(n) for n = 1..10000</a>
%e a(44) = 9 since 44^2 + 1 = 1937 = 13 * 149, 44^2 + 3 = 1939 = 7 * 277, 44^2 + 5 = 1941 = 3 * 647, 44^2 + 7 = 1943 = 29 * 67 and 44^2 + 9 = 1945 = 5 * 389 are all semiprimes but 44^2 + 11 = 1947 = 3 * 11 * 59 is not a semiprime.
%p f:= proc(n) local i;
%p for i from 1 by 2 while numtheory:-bigomega(n^2+i) = 2 do od:
%p i-2
%p end proc:
%p map(f, [$1..100]);
%Y Cf. A001358, A085722, A242331, A242333, A375390.
%K sign
%O 1,34
%A _Robert Israel_, Aug 15 2024