login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Digitally delicate square numbers (changing any one decimal digit always produces a nonsquare).
0

%I #25 Apr 05 2021 04:01:54

%S 25,121,144,169,196,256,289,324,1024,1089,1156,1296,1369,1444,1521,

%T 1681,1764,1849,1936,2500,3136,3249,3364,3481,3721,3844,3969,4096,

%U 4356,4489,4624,4761,5041,5184,6084,6241,6561,6724,6889,7056,7396

%N Digitally delicate square numbers (changing any one decimal digit always produces a nonsquare).

%C If k is the count of digitally delicate square numbers <= n, then empirically lim_{n->oo} k/n = sqrt(5)/3.

%e n = 25, changing the digit 2 in 25 to d5, d from {0,1,3,4,5,6,7,8,9} gives no square, changing the digit 5 in 25 to 2d, d from {0,1,2,3,4,6,7,8,9} gives no square. Thus n = 25 is a member of the sequence.

%t changes[n_] := Module[{d = IntegerDigits[n]}, FromDigits @ ReplacePart[d, First[#] -> Last[#]] & /@ Tuples[{Range[Length[d]], Range[0, 9]}]]; q[n_] := AllTrue[changes[n], # == n || ! IntegerQ @ Sqrt[#] &]; Select[Range[100]^2, q] (* _Amiram Eldar_, Apr 04 2021 *)

%o (Python)

%o from sympy import integer_nthroot

%o def is_square(n): return integer_nthroot(n, 2)[1]

%o def change1(n):

%o s = str(n)

%o for i in range(len(s)):

%o for d in set("0123456789") - {s[i]}:

%o yield int(s[:i] + d + s[i+1:])

%o def ok(sqr): return not any(is_square(t) for t in change1(sqr))

%o print(list(filter(ok, (k*k for k in range(87))))) # _Michael S. Branicky_, Apr 04 2021

%Y Cf. A000290, A050249.

%K nonn,base

%O 1,1

%A _Ctibor O. Zizka_, Apr 04 2021