A124652 a(1)=1. a(n) = smallest positive integer not occurring earlier in the sequence such that every positive integer <= and coprime to (sum{k=1 to n-1} a(k)) is also coprime to a(n).
1, 2, 3, 4, 5, 9, 6, 8, 16, 12, 11, 7, 14, 28, 18, 24, 21, 27, 32, 31, 81, 10, 20, 13, 169, 22, 33, 19, 17, 39, 26, 49, 37, 44, 36, 48, 54, 64, 25, 35, 40, 29, 41, 15, 45, 30, 50, 80, 58, 52, 60, 72, 47, 1369, 42, 56, 98, 59, 57, 38, 76, 62, 116, 128, 75, 87, 23, 115, 46, 91
Offset: 1
Keywords
Examples
The sum of the first 7 terms of the sequence is 30. The positive integers <= 30 and coprime to 30 are 1,7,11,13,17,19,23,29. The smallest positive integer not occurring among the first 7 terms of the sequence which is coprime to 1,7,11,13,17,19,23,29 is 8. (7 does not occur among the first 7 terms of {a(k)}, but 7 is not coprime to 7.) So a(8) = 8.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
f[n_] := Select[Range[n], GCD[ #, n] == 1 &];g[l_List] := Block[{k = 1, t = f[Plus @@ l]},While[MemberQ[l, k] || Times @@ GCD[t, k] > 1, k++ ];Append[l, k]];Nest[g, {1}, 70] (* Ray Chandler, Dec 24 2006 *)
Extensions
Extended by Ray Chandler, Dec 24 2006
Comments