login
A157421
a(0)=1. a(n) = the smallest integer coprime to a(n-1) and greater than n^2.
4
1, 2, 5, 11, 17, 26, 37, 50, 67, 82, 101, 122, 145, 171, 197, 226, 257, 290, 327, 362, 401, 442, 485, 531, 577, 626, 677, 730, 787, 842, 901, 962, 1025, 1091, 1157, 1226, 1297, 1370, 1447, 1522, 1601, 1682, 1765, 1851, 1937, 2026, 2117, 2210, 2307, 2402, 2501
OFFSET
0,2
LINKS
EXAMPLE
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.
MATHEMATICA
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 *)
FoldList[Function[{k, m}, SelectFirst[m^2 + Range@ 30, CoprimeQ[k, #] &]], 1, Range@ 50] (* Michael De Vlieger, Sep 23 2017 *)
CROSSREFS
Sequence in context: A136244 A115057 A228344 * A274830 A038390 A048210
KEYWORD
nonn
AUTHOR
Leroy Quet, Feb 28 2009
EXTENSIONS
Extended by Ray Chandler, Jun 19 2009
STATUS
approved