login
A172980
a(1)=1, a(2)=3; for n>=3, a(n) is the smallest number larger than a(n-1) such that, for every k<n, a(n) is relatively prime to a(k) iff n is relatively prime to k.
5
1, 3, 4, 9, 11, 12, 13, 15, 16, 33, 37, 42, 43, 117, 154, 159, 163, 168, 173, 231, 338, 555, 557, 558, 649, 1161, 1168, 1209, 1213, 1254, 1259, 1263, 1406, 1467, 1573, 1578, 1579, 2595, 2752, 2805, 2813, 2964, 2969, 2997, 3014, 5013, 5021, 5022, 5057, 5115
OFFSET
1,2
COMMENTS
Using the Chinese remainder theorem, it is easy to prove that the sequence is infinite.
LINKS
MAPLE
a:= proc(n) option remember;
local ok, m, k;
if n<3 then 2*n-1
else for m from a(n-1)+1 do
ok:= true;
for k from 1 to n-1 do
if igcd(n, k)=1 xor igcd(m, a(k))=1
then ok:= false; break fi
od;
if ok then break fi
od; m
fi
end:
seq (a(n), n=1..50); # Alois P. Heinz, Nov 21 2010
MATHEMATICA
a[1]=1; a[2]=3; a[n_] := a[n] = For[k = a[n-1]+1, True, k++, If[AllTrue[ Range[n-1], CoprimeQ[k, a[#]] == CoprimeQ[n, #]&], Return[k]]]; Table[ a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 25 2017 *)
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Nov 21 2010
EXTENSIONS
More terms from Alois P. Heinz, Nov 21 2010
STATUS
approved