Considering mathematica code
range = Range[4 10^6];
Position[Mod[10^5 NestList[Mod[ 10^6 #, 1355297] &, 10^6,Length[#] - 1] - (54 # + 46), 1355297], 0] &[range]
(* {{2331259}, {3776127}} *)
which works as expected I intend (performance issue)to compile the code. All the functions involved are compilable as
Compile`CompilerFunctions[] // Sort
shows but the approach
fu = Compile[{{range, _Integer, 1}},Position[Mod[10^5 NestList[Mod[ 10^6 range, 1355297] &, 10^6,Length[range] - 1] - (54 range + 46), 1355297], 0]]
(*Compile::cset: Variable Compile`Variable$630 of type
{_Integer,0} encountered in assignment of type {_Integer,1}. *)
doesn't work. Checking the compiled code
Needs["CompiledFunctionTools`"]
CompilePrint[fu]
I recognize, that NestList doesn't appear!!
My questions: Is NestList compilable ? Is there a workaround to make the compile-code run? Thanks