login
A220426
Least nonsquare whose square root starts with at least n even decimal digits.
3
2, 5, 5, 6, 8, 8, 8, 18, 18, 18, 1652, 2135, 40332, 40332, 78740, 80661, 165389, 165389, 239008, 686015, 4260196, 5018507, 5018507, 5018507, 5018507, 43624023, 43624023, 43624023, 43624023, 43624023, 1801833064, 1801833064, 1801833064, 1801833064, 1801833064
OFFSET
0,1
LINKS
EXAMPLE
a(0) = 2 because sqrt(2) = 1.41... starts with 0 even digits, and is the smallest nonsquare for which this is the case.
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.
a(3) = 6 because sqrt(6) = 2.449... starts off with 3 even digits.
MAPLE
nexteven:= proc(x)
local d;
for d from 0 while x mod 10^(d+1) = 8*(10^(d+1)-1)/9 do od:
x - 8*(10^(d)-1)/9 + 2*10^(d)
end proc;
evendigits:= proc(x)
local n0, n, d, s;
n0:= ilog10(x);
if type(n0, odd) then n0:= n0-1 end if;
for n from 0 do
d:= floor(x/10^(n0-2*n));
s:= floor(sqrt(d));
while not type(s, integer) do
Digits:= Digits+2; s:= floor(sqrt(d))
end do;
if type(s mod 10, odd) then return n end if;
end do;
end proc;
y:= 2: bsf:= 0: R[0]:= 2:
while bsf < 20 do
for x from y^2+1 to (y+1)^2-1 do
v:= evendigits(x);
if v > bsf then
for j from bsf+1 to v do R[j]:= x end do;
bsf:= v;
end if;
end do;
y:= nexteven(y);
end do:
seq(R[n], n=0..bsf);
MATHEMATICA
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 *)
PROG
(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
CROSSREFS
Cf. A210492.
Sequence in context: A130856 A004095 A145434 * A117899 A120839 A332525
KEYWORD
nonn,base
AUTHOR
Robert Israel, Dec 14 2012
EXTENSIONS
a(21)-a(29) from Robert G. Wilson v, Dec 15 2012
a(30)-a(34) from Jinyuan Wang, Apr 16 2020
STATUS
approved