OFFSET
1,1
MAPLE
b:= proc(n, k) option remember; local ok, m, i;
if k=1 then 1
elif k=2 then ithprime(n)
else for m from b(n, k-1)+1 do
ok:= true;
for i from 1 to k-1 do
if igcd(k, i)=1 xor igcd(m, b(n, i))=1
then ok:= false; break fi
od;
if ok then break fi
od; m
fi
end:
a:= n-> b(n, ithprime(n+1));
seq(a(n), n=1..10); # Alois P. Heinz, Nov 22 2010
MATHEMATICA
b[n_, k_] := b[n, k] = Module[{ok, m, i}, Which[k==1, 1, k==2, Prime[n], True, For[m = b[n, k - 1] + 1, True, m++, ok = True; For[i = 1, i <= k - 1, i++, If[Xor[GCD[k, i]==1, GCD[m, b[n, i]]==1], ok = False; Break[]]]; If[ok, Break[]]]; m]];
a[n_] := b[n, Prime[n + 1]];
Array[a, 10] (* Jean-François Alcover, Nov 28 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Nov 22 2010
EXTENSIONS
More terms from Alois P. Heinz, Nov 22 2010
STATUS
approved