# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a220426 Showing 1-1 of 1 %I A220426 #27 Apr 18 2020 11:14:23 %S A220426 2,5,5,6,8,8,8,18,18,18,1652,2135,40332,40332,78740,80661,165389, %T A220426 165389,239008,686015,4260196,5018507,5018507,5018507,5018507, %U A220426 43624023,43624023,43624023,43624023,43624023,1801833064,1801833064,1801833064,1801833064,1801833064 %N A220426 Least nonsquare whose square root starts with at least n even decimal digits. %H A220426 Giovanni Resta, Table of n, a(n) for n = 0..43 %e A220426 a(0) = 2 because sqrt(2) = 1.41... starts with 0 even digits, and is the smallest nonsquare for which this is the case. %e A220426 a(1) = a(2) = 5 because sqrt(5) = 2.23... starts with at least 1 even digit, in fact 2 even digits, whereas sqrt(3) starts off with an odd digit. %e A220426 a(3) = 6 because sqrt(6) = 2.449... starts off with 3 even digits. %p A220426 nexteven:= proc(x) %p A220426 local d; %p A220426 for d from 0 while x mod 10^(d+1) = 8*(10^(d+1)-1)/9 do od: %p A220426 x - 8*(10^(d)-1)/9 + 2*10^(d) %p A220426 end proc; %p A220426 evendigits:= proc(x) %p A220426 local n0, n, d, s; %p A220426 n0:= ilog10(x); %p A220426 if type(n0,odd) then n0:= n0-1 end if; %p A220426 for n from 0 do %p A220426 d:= floor(x/10^(n0-2*n)); %p A220426 s:= floor(sqrt(d)); %p A220426 while not type(s,integer) do %p A220426 Digits:= Digits+2; s:= floor(sqrt(d)) %p A220426 end do; %p A220426 if type(s mod 10,odd) then return n end if; %p A220426 end do; %p A220426 end proc; %p A220426 y:= 2: bsf:= 0: R[0]:= 2: %p A220426 while bsf < 20 do %p A220426 for x from y^2+1 to (y+1)^2-1 do %p A220426 v:= evendigits(x); %p A220426 if v > bsf then %p A220426 for j from bsf+1 to v do R[j]:= x end do; %p A220426 bsf:= v; %p A220426 end if; %p A220426 end do; %p A220426 y:= nexteven(y); %p A220426 end do: %p A220426 seq(R[n],n=0..bsf); %t A220426 f[n_] := Block[{s = Split[ Boole[ EvenQ@# & /@ RealDigits[Sqrt@ n, 10, 32][[1]]]][[1]]}, If[IntegerQ@ Sqrt@ n || Union@ s == {0}, -1, Length@ s]] (* _Robert G. Wilson v_, Dec 15 2012 *) %o A220426 (PARI) a(n) = {my(g=10^(n-1), v); for(k=2, oo, if(setintersect([0, 2, 4, 6, 8], v=Set(digits(floor(sqrt(k)*g))[1..n]))==v && !issquare(k), return(k))); } \\ _Jinyuan Wang_, Apr 16 2020 %Y A220426 Cf. A210492. %K A220426 nonn,base %O A220426 0,1 %A A220426 _Robert Israel_, Dec 14 2012 %E A220426 a(21)-a(29) from _Robert G. Wilson v_, Dec 15 2012 %E A220426 a(30)-a(34) from _Jinyuan Wang_, Apr 16 2020 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE