OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
Example: 2357^2 = 5555449.
MAPLE
R:= NULL: count:= 0:
for d from 1 while count < 100 do
for i from 1 to 9 do
L:= i*1111*10^d;
X:= [$ceil(sqrt(L)) .. floor(sqrt(L+10^d-1))];
m:= nops(X);
if m > 0 then
count:= count+nops(X);
R:= R, op(X);
fi
od od:
R; # Robert Israel, Mar 12 2021
MATHEMATICA
Select[Range[10, 50000], Length[Union[Take[IntegerDigits[ #^2], 4]]] == 1 & ]
(* or *)
(* Here's a more generic Mathematica program that calculates the first q terms of squares starting with n identical digits *)
n=4; q=30; t=Table[(10^n-1)*i/9, {i, 1, 9}]; u=Sqrt[Union[t, 10*t]];
v=Sqrt[Union[t+1, 10*(t+1)]]; k=1; While[s=Sort[Flatten[Table[Union
[Table[Range[Ceiling[10^j*u[[i]]], f=10^j*v[[i]]; If[IntegerQ[f],
f=f-1]; Floor[f]], {i, 1, 18}]], {j, 0, k}]]]; Length[s]<q, k++ ]; Take[s, q]
(* Hans Havermann, Aug 30 2007 *)
PROG
(Python)
def aupto(limit):
alst = []
for m in range(34, limit+1):
if len(set(str(m*m)[:4])) == 1: alst.append(m)
return alst
print(aupto(33333)) # Michael S. Branicky, Mar 12 2021
KEYWORD
AUTHOR
Jonathan Vos Post, Aug 29 2007
STATUS
approved