I was reading this question and it wanted to know how to FunctionCompile this:
Function[x,
If[IntegerQ @ Sqrt[80892036 + 17994 x (1 + x) (-5995 + 5998 x)], x,
Nothing] /@ Range[6694300, 31072325]
I don't know much about FunctionCompile, if it can handle Nothing, if bags work for within them, and if so what Types would they be?
This obviously won’t work, but is a jumping off point:
na = NumericArray[Range[6694300, 31072325], "UnsignedInteger32"];
doit = FunctionCompile[
Function[{Typed[arg,
TypeSpecifier["NumericArray"]["UnsignedInteger32", 1]]},
Module[{
f =
Typed[Function[Typed[x, "UnsignedInteger32"],
Sqrt[80892036 + 17994 x (1 + x) (-5995 + 5998 x)]],
"UnsignedInteger32" -> "Real64"];
iq =
Typed[KernelFunction[IntegerQ[f[#]] &], {"Real64"} ->
"Boolean"]},
If[iq@#, #, Nothing] & /@ arg
]]];
doit[na]