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.

A018885 Squares using no more than two distinct digits.

This page as a plain text file.
%I A018885 #50 Feb 16 2025 08:32:33
%S A018885 0,1,4,9,16,25,36,49,64,81,100,121,144,225,400,441,484,676,900,1444,
%T A018885 7744,10000,11881,29929,40000,44944,55225,69696,90000,1000000,4000000,
%U A018885 9000000,9696996,100000000,400000000,900000000,6661661161,10000000000
%N A018885 Squares using no more than two distinct digits.
%C A018885 Is 6661661161 the largest term not of the form 10^k, 4*10^k or 9*10^k? Any larger ones must have >= 22 digits. - _Robert Israel_, Dec 03 2015
%H A018885 Shawn A. Broyles, <a href="/A018885/b018885.txt">Table of n, a(n) for n = 1..85</a>
%H A018885 Alexandru Gica and Laurentiu Panaitopol, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL6/Panaitopol/panaitopol41.html">On Oblath's Problem</a>, J. Integer Seqs., Vol. 6(3), 2003, article 03.3.5.
%H A018885 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SquareNumber.html">Square Number</a>
%F A018885 For n > 4, a(n) = A016069(n-4)^2.
%p A018885 F:= proc(r, a, b, m)
%p A018885 # get all squares starting with r, with at most m further digits, all from {a,b} where a < b
%p A018885 local res,Ls,Us,L,U,looking;
%p A018885 if issqr(r) then res:= r else res:= NULL fi;
%p A018885 if m = 0 then return res fi;
%p A018885 Ls:= r*10^m + a*(10^m-1)/9;
%p A018885 Us:= r*10^m + b*(10^m-1)/9;
%p A018885 L:= isqrt(Ls);
%p A018885 if L^2 > Ls then L:= L-1 fi;
%p A018885 U:= isqrt(Us);
%p A018885 if U^2 < Us then U:= U+1 fi;
%p A018885 if L > U then res
%p A018885 else res, procname(10*r+a,a,b,m-1), procname(10*r+b,a,b,m-1)
%p A018885 fi
%p A018885 end proc:
%p A018885 S2:= {seq(i^2 mod 100, i=0..99)}:
%p A018885 prs:= map(t -> `if`(t < 10, {0,t},{(t mod 10),(t - (t mod 10))/10}), S2):
%p A018885 prs:= map(p -> `if`(nops(p)=1, seq(p union {s},s={$0..9} minus p), p), prs):
%p A018885 Res:= NULL:
%p A018885 for p in prs do
%p A018885   a:= min(p); b:= max(p);
%p A018885   if a > 0 then
%p A018885      Res:= Res, F(a,a,b,14);
%p A018885   fi;
%p A018885   Res:= Res, F(b,a,b,14);
%p A018885 od:
%p A018885 sort(convert({0,Res},list)); # _Robert Israel_, Dec 03 2015
%t A018885 Select[Range[0, 10^5]^2, Length@ Union@ IntegerDigits@ # <= 2 &] (* _Michael De Vlieger_, Dec 03 2015 *)
%t A018885 Select[Range[0,100000]^2,Count[DigitCount[#],0]>7&] (* _Harvey P. Dale_, Jul 25 2020 *)
%o A018885 (PARI) for (n=0, 10^6, if ( #Set(digits(n^2))<=2, print1(n^2, ", ") ) ); \\ _Michel Marcus_, May 21 2015
%Y A018885 Cf. A016069, A016070, A018884.
%K A018885 nonn,base
%O A018885 1,3
%A A018885 _David W. Wilson_
%E A018885 0 inserted and definition edited by _Jon E. Schoenfield_, Jan 15 2014