|
MATHEMATICA
|
start = {1}; primes = Table[Prime[n], {n, 1, 40000}];
f[x_, y_] := If[MemberQ[primes, x^2 + y^2 + 1], x^2 + y^2 + 1]
b[x_] :=
Block[{w = x},
Select[Union[
Flatten[AppendTo[w,
Table[f[w[[i]], w[[j]]], {i, 1, Length[w]}, {j, 1, i}]]]], # <
200000 &]];
t = FixedPoint[b, start] (* A192591 *)
|