A353239 Lexicographically earliest infinite sequence of distinct positive numbers such that, for n > 2, a(n) has either a common factor with a(n-1) but not with a(n-2), or with a(n-2) but not with a(n-1).
1, 2, 3, 4, 9, 8, 10, 5, 6, 14, 7, 12, 15, 16, 21, 20, 22, 11, 18, 26, 13, 24, 27, 28, 32, 35, 25, 42, 33, 34, 17, 30, 36, 55, 38, 19, 40, 44, 45, 39, 50, 46, 23, 48, 51, 52, 56, 49, 54, 57, 58, 29, 60, 62, 31, 64, 66, 63, 68, 69, 70, 65, 72, 74, 37, 76, 78, 75, 82, 41, 80, 84, 77, 81, 87, 116
Offset: 1
Keywords
Examples
a(4) = 4 as a(2) = 2, a(3) = 3, and 4 is the smallest unused number that has a common factor with 2 but not with 3. a(5) = 9 as a(3) = 3, a(4) = 4, and 9 is the smallest unused number that is coprime to 4 but not to 3. Note that 8 also meets the selection criteria, but its only prime factor, 2, is shared with a(4) = 4, so 8 cannot be chosen as a(5) because then a(6) would not exist.
Links
- Scott R. Shannon, Table of n, a(n) for n = 1..10000
- Scott R. Shannon, Image of the first 100000 terms. The green line is y = n.
Programs
-
MATLAB
function a = A353239( max_n ) a = [1 2 3]; m = [1:max_n]; b = cell(1,max_n); b{1} = [1]; b{2} = [2]; b{3} = [3]; for n = 4:max_n j = 4; k = m(j); f = factor(k); while ((isempty(intersect(b{n-2},f)) ~= ~isempty(intersect(b{n-1},f)))... ||isequal(unique(b{n-1}),unique(f))) j = j+1; k = m(j); f = factor(k); end a(n) = k; b{n} = f; m(m==k) = []; m(end+1) = m(end)+1; end end % Thomas Scheuerle, Apr 12 2022
Comments