A338351 Lexicographically earliest infinite sequence {a(n)} of distinct odd positive numbers such that, for n>2, a(n) has a common factor with a(n-1) but not with a(n-2).
1, 3, 15, 35, 77, 33, 39, 65, 55, 99, 21, 91, 143, 165, 51, 119, 133, 57, 45, 85, 187, 209, 95, 75, 63, 161, 115, 135, 87, 203, 175, 155, 93, 69, 253, 275, 105, 111, 407, 319, 145, 185, 259, 147, 117, 221, 323, 171, 123, 205, 215, 129, 141, 235, 245, 189, 153, 391, 299, 195, 159, 371
Offset: 1
Keywords
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..10000
Programs
-
Maple
with(numtheory); N:= 10^3: # to get a(1) to a(n) where a(n+1) is the first term > N B:= Vector(N, datatype=integer[1]): A[1]:=1; A[2]:=3; for n from 3 do for k from 5 to N by 2 do if B[k] = 0 and igcd(k, A[n-1]) > 1 and igcd(k, A[n-2]) = 1 then if nops(factorset(k) minus factorset(A[n-1])) > 0 then A[n]:= k; B[k]:= 1; break; fi; fi; od: if k > N then break; fi; od: s1:=[seq(A[i], i=1..n-1)];
-
PARI
a338351(upto)={my(v=[1,3]);for(n=1,upto,forstep(k=5,oo,2,if(!vecsearch(vecsort(v),k),if(gcd(k,v[#v])>1&&gcd(k,v[#v-1])==1,if(#setminus(Set(factor(k)[,1]),Set(factor(v[#v])[,1]))>0,v=concat(v,[k]);break)))));v}; a338351(60) \\ Hugo Pfoertner, Oct 30 2020
Comments