OFFSET
1,1
EXAMPLE
a(1) = 2, since 2 is an even squarefree number, preceded by an odd squarefree number, 3, and followed by an odd squarefree number, 3.
a(2) = 422, since 422 and 426 are two successive squarefree numbers that are even, preceded by an odd squarefree number, 421, and followed by an odd squarefree number, 427.
The first 4 terms and the corresponding sets of successive squarefree numbers are:
n | a(n) | The n successive squarefree numbers
--|---------------|------------------------------------
1 | 2 | 1
2 | 422 | 422, 426
3 | 2522 | 2522, 2526, 2530
4 | 1674274 | 1674274, 1674278, 1674282, 1674286
MATHEMATICA
seq[lim_] := Module[{sqf = Select[Range[lim], SquareFreeQ], s = {}, rem, ind}, rem = Join[{1}, Mod[sqf, 2]]; Do[ind = SequencePosition[rem, Join[{1}, Table[0, {k}], {1}], 1]; If[ind == {}, Break[]]; AppendTo[s, sqf[[ind[[1, 1]]]]], {k, 1, Infinity}]; s]; seq[2*10^6]
PROG
(PARI) lista(len, kmax = oo) = {my(v = vector(len), c = 0, k = 1, k0, i = 0); while(c < len && k < kmax, if(issquarefree(k), if(!(k % 2), i++; if(i == 1, k0 = k), if(i > 0 && i <= len && v[i] == 0, v[i] = k0; c++); i = 0)); k++); v; }
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
Amiram Eldar, Jun 09 2024
EXTENSIONS
a(6) from Bert Dobbelaere, Jun 14 2024
STATUS
approved