%I #12 Sep 24 2017 02:30:55
%S 1,2,5,11,17,26,37,50,67,82,101,122,145,171,197,226,257,290,327,362,
%T 401,442,485,531,577,626,677,730,787,842,901,962,1025,1091,1157,1226,
%U 1297,1370,1447,1522,1601,1682,1765,1851,1937,2026,2117,2210,2307,2402,2501
%N a(0)=1. a(n) = the smallest integer coprime to a(n-1) and greater than n^2.
%H Harvey P. Dale, <a href="/A157421/b157421.txt">Table of n, a(n) for n = 0..1000</a>
%e a(7) = 50, and 8^2 is 64. So for a(8) we want the smallest integer that is both coprime to 50 and is > 64. Checking: 65 is not coprime to 50. 66 is not coprime to 50. But 67 is coprime to 50, so a(8) = 67.
%t nxt[{n_,a_}]:=Module[{k=(n+1)^2+1},While[!CoprimeQ[a,k],k++];{n+1,k}]; Transpose[NestList[nxt,{0,1},50]][[2]] (* _Harvey P. Dale_, Dec 28 2015 *)
%t FoldList[Function[{k, m}, SelectFirst[m^2 + Range@ 30, CoprimeQ[k, #] &]], 1, Range@ 50] (* _Michael De Vlieger_, Sep 23 2017 *)
%Y Cf. A157419, A157420.
%K nonn
%O 0,2
%A _Leroy Quet_, Feb 28 2009
%E Extended by _Ray Chandler_, Jun 19 2009
|