OFFSET
1,2
COMMENTS
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
with(numtheory):
b:= proc(n) is(n=1) end: h:= 2:
g:= proc(n) option remember; global h; local k, t;
if n=1 then 1 else t:=g(n-1);
for k from h while b(k) or bigomega(t+k)<>2
do od; b(k):=true; while b(h) do h:=h+1 od; k
fi
end:
a:= proc(n) option remember; local k;
for k from 1+`if`(n=1, 0, a(n-1)) do
if g(k)=k then break fi
od: k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Oct 17 2015
MATHEMATICA
b[n_] := n == 1;
h = 2;
g[n_] := g[n] = Module[{k, t}, If[n == 1, 1, t = g[n - 1]; For[k = h, b[k] || PrimeOmega[t + k] != 2, k++]; b[k] = True; While[b[h], h++]; k]];
a[n_] := a[n] = Module[{k}, For[k = 1 + If[n == 1, 0, a[n - 1]], True, k++, If[g[k] == k, Break[]]]; k];
Array[a, 100] (* Jean-François Alcover, Nov 23 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 16 2015
STATUS
approved