OFFSET
1,2
EXAMPLE
a(1) = 1, since 1 is the least squarefree number, it is odd, and it is followed by an even squarefree number, 2.
a(2) = 3, since 3 and 5 are two successive squarefree numbers that are odd, preceded by an even squarefree number, 2, and followed by an even squarefree number, 6.
The first 7 terms and the corresponding sets of successive squarefree numbers are:
n | a(n) | The n successive squarefree numbers
--|--------|-----------------------------------------
1 | 1 | 1
2 | 3 | 3, 5
3 | 95 | 95, 97, 101
4 | 15 | 15, 17, 19, 21
5 | 47 | 47, 51, 53, 55, 57
6 | 483 | 483, 485, 487, 489, 491, 493
7 | 5045 | 5045, 5051, 5053, 5055, 5057, 5059, 5061
MATHEMATICA
seq[lim_] := Module[{sqf = Select[Range[lim], SquareFreeQ], s = {}, rem, ind}, rem = Join[{0}, Mod[sqf, 2]]; Do[ind = SequencePosition[rem, Join[{0}, Table[1, {k}], {0}], 1]; If[ind == {}, Break[]]; AppendTo[s, sqf[[ind[[1, 1]]]]], {k, 1, Infinity}]; s]; seq[10^7]
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(17)-a(19) from Bert Dobbelaere, Jun 14 2024
STATUS
approved