A268330 Least squarefree number differing by more than n from any other squarefree number.
1, 17, 26, 2526, 5876126, 8061827, 8996188226, 2074150570370
Offset: 0
Examples
a(2) = 26 because 26 is squarefree but 24,25,27,28 are not.
Programs
-
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
-
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
0 (* Hartmut F. W. Hoft, Mar 15 2016 *) a268330[{0,10000000},1] (* computes a(1)...a(5) *)
Extensions
a(6) from Hartmut F. W. Hoft, Mar 15 2016
a(7) from Giovanni Resta, Apr 11 2016
Comments