[go: up one dir, main page]

login
A268330
Least squarefree number differing by more than n from any other squarefree number.
6
1, 17, 26, 2526, 5876126, 8061827, 8996188226, 2074150570370
OFFSET
0,2
COMMENTS
1.8*10^12 < a(7) <= 10735237201449 - Robert Israel, Mar 18 2016
a(8) > 5*10^12. - Giovanni Resta, Apr 11 2016
EXAMPLE
a(2) = 26 because 26 is squarefree but 24,25,27,28 are not.
MATHEMATICA
(* implementation assumes a(n) is increasing *)
nsfRun[n_]:=Module[{i=n}, While[!SquareFreeQ[i], i++]; i-n]
a268330[{low_, high_}, width_]:=Module[{k=width, i, next, r, s, list={}}, For[i=low, i<=high, i+=next, r=nsfRun[i]; If[r<k, next=r+1, s=nsfRun[i+r+1]; If[s<k, next=r+s+2, If[s==k, next=r+s+2, next=r+1]; AppendTo[list, {i, i+r, i+r+s}]; k++]]]; list] /; width>0 (* Hartmut F. W. Hoft, Mar 15 2016 *)
a268330[{0, 10000000}, 1]]] (* computes a(1)...a(5) *)
PROG
(MATLAB)
B = 10^8; % blocks of size B
nB = 1000; % nB blocks
A = [1];
P = primes(floor(sqrt(nB*B)));
mmax = 1;
i0 = 1;
for k = 0:nB-1 % search squarefrees from i0+1 to i0 + B
V = true(1, B);
for i = 1:numel(P)
p = P(i);
V([(p^2 - mod(i0, p^2)):p^2:B]) = false;
end
SF = find(V) + i0;
DSF = SF(2:end) - SF(1:end-1);
i0 = SF(end-2);
M = min(DSF(1:end-1), DSF(2:end));
newmax = max(mmax, max(M));
for i = mmax+1:newmax
A(i) = SF(1 + find(M>=i, 1, 'first'));
end
mmax = newmax;
end
for i=1:mmax
fprintf('%d ', A(i));
end
fprintf('\n'); % Robert Israel, Mar 16 2016
CROSSREFS
KEYWORD
nonn,more
AUTHOR
EXTENSIONS
a(6) from Hartmut F. W. Hoft, Mar 15 2016
a(7) from Giovanni Resta, Apr 11 2016
STATUS
approved