cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A132391 Numbers whose square starts with 4 identical digits.

This page as a plain text file.
%I A132391 #14 Mar 13 2021 00:48:26
%S A132391 2357,2582,3334,4714,5774,6667,8165,8819,9428,10541,10542,10543,10544,
%T A132391 10545,14907,14908,14909,18257,18258,18259,21081,21082,21083,23570,
%U A132391 23571,25819,25820,27888,27889,29813,29814,31622,33332,33333
%N A132391 Numbers whose square starts with 4 identical digits.
%H A132391 Robert Israel, <a href="/A132391/b132391.txt">Table of n, a(n) for n = 1..10000</a>
%e A132391 Example: 2357^2 = 5555449.
%p A132391 R:= NULL: count:= 0:
%p A132391 for d from 1 while count < 100 do
%p A132391   for i from 1 to 9 do
%p A132391     L:= i*1111*10^d;
%p A132391     X:= [$ceil(sqrt(L)) .. floor(sqrt(L+10^d-1))];
%p A132391     m:= nops(X);
%p A132391     if m > 0 then
%p A132391       count:= count+nops(X);
%p A132391       R:= R, op(X);
%p A132391     fi
%p A132391 od od:
%p A132391 R; # _Robert Israel_, Mar 12 2021
%t A132391 Select[Range[10, 50000], Length[Union[Take[IntegerDigits[ #^2], 4]]] == 1 & ]
%t A132391 (* or *)
%t A132391 (* Here's a more generic Mathematica program that calculates the first q terms of squares starting with n identical digits *)
%t A132391 n=4; q=30; t=Table[(10^n-1)*i/9, {i,1,9}]; u=Sqrt[Union[t,10*t]];
%t A132391 v=Sqrt[Union[t+1, 10*(t+1)]]; k=1; While[s=Sort[Flatten[Table[Union
%t A132391 [Table[Range[Ceiling[10^j*u[[i]]], f=10^j*v[[i]]; If[IntegerQ[f],
%t A132391 f=f-1]; Floor[f]], {i,1,18}]], {j,0,k}]]]; Length[s]<q, k++ ]; Take[s,q]
%t A132391 (* _Hans Havermann_, Aug 30 2007 *)
%o A132391 (Python)
%o A132391 def aupto(limit):
%o A132391   alst = []
%o A132391   for m in range(34, limit+1):
%o A132391     if len(set(str(m*m)[:4])) == 1: alst.append(m)
%o A132391   return alst
%o A132391 print(aupto(33333)) # _Michael S. Branicky_, Mar 12 2021
%Y A132391 Cf. A119887, A119511, A131573, A119866, A133183.
%K A132391 nonn,base,look
%O A132391 1,1
%A A132391 _Jonathan Vos Post_, Aug 29 2007