OFFSET
1,1
MATHEMATICA
p = 8; f[n_, z_] := FindInstance[x > 0 && y > 0 && p*x^2 - n*y^2 == z, {x, y}, Integers, 1]; a[n_] := For[z = 0, z <= p, z = z + GCD[n, p], Which[n == 49, z = 4; fz = $Aborted, n == 81, z = 8; fz = $Aborted, n == 83, z = 5; fz = $Aborted, n == 101, z = 3; fz = $Aborted, True, fz = TimeConstrained[f[n, z], 300]]; fz = If[fz === $Aborted, {{x -> Null, y -> Null}}, fz]; If[fz =!= {}, Print["a(", n, ") = ", z, " {x, y} = ", {x, y} /. fz[[1]]]; Return[z]]]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Oct 11 2016 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved