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.

A016069 Numbers k such that k^2 contains exactly 2 distinct digits.

This page as a plain text file.
%I A016069 #53 Feb 16 2025 08:32:33
%S A016069 4,5,6,7,8,9,10,11,12,15,20,21,22,26,30,38,88,100,109,173,200,212,235,
%T A016069 264,300,1000,2000,3000,3114,10000,20000,30000,81619,100000,200000,
%U A016069 300000,1000000,2000000,3000000,10000000,20000000,30000000,100000000,200000000,300000000
%N A016069 Numbers k such that k^2 contains exactly 2 distinct digits.
%C A016069 10^k, 2*10^k, 3*10^k for k > 0 are terms. - _Chai Wah Wu_, Dec 17 2021
%C A016069 Subsequence of primes is A057659. - _Bernard Schott_, Jul 29 2022
%D A016069 R. K. Guy, Unsolved Problems in Number Theory, F24.
%H A016069 Robert G. Wilson v, <a href="/A016069/b016069.txt">Table of n, a(n) for n = 1..81</a>
%H A016069 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SquareNumber.html">Square Number</a>
%F A016069 a(n) = ((n-1) mod 3 + 1)*10^(ceiling(n/3)-7) for n >= 34 (conjectured). - _Chai Wah Wu_, Dec 17 2021
%e A016069 26 is in the sequence because 26^2 = 676 contains exactly 2 distinct digits.
%t A016069 Join[Select[Range[90000],Count[DigitCount[#^2],_?(#!=0&)]==2&],Flatten[ NestList[ 10#&,{100000,200000,300000},5]]] (* _Harvey P. Dale_, Mar 09 2013 *)
%t A016069 Select[Range[20000000], Length[Union[IntegerDigits[#^2]]]==2&] (* _Vincenzo Librandi_, Nov 04 2014 *)
%o A016069 (Haskell)
%o A016069 import Data.List (nub)
%o A016069 a016069 n = a016069_list !! (n-1)
%o A016069 a016069_list = filter ((== 2) . length . nub . show . (^ 2)) [0..]
%o A016069 -- _Reinhard Zumkeller_, Apr 14 2011
%o A016069 (PARI) /* needs version >= 2.6 */
%o A016069 for (n=1, 10^9, if ( #Set(digits(n^2))==2, print1(n,", ") ) );
%o A016069 /* _Joerg Arndt_, Mar 09 2013 */
%o A016069 (Python)
%o A016069 from gmpy2 import is_square, isqrt
%o A016069 from itertools import combinations, product
%o A016069 A016069_list = []
%o A016069 for g in range(2,10):
%o A016069     n = 2**g-1
%o A016069     for x in combinations('0123456789',2):
%o A016069         for i,y in enumerate(product(x,repeat=g)):
%o A016069             if i > 0 and i < n and y[0] != '0':
%o A016069                 z = int(''.join(y))
%o A016069                 if is_square(z):
%o A016069                     A016069_list.append(int(isqrt(z)))
%o A016069 A016069_list = sorted(A016069_list) # _Chai Wah Wu_, Nov 03 2014
%o A016069 (Magma) [n: n in [0..20000000] | #Set(Intseq(n^2)) eq 2]; // _Vincenzo Librandi_, Nov 04 2014
%Y A016069 Cf. A016070, A018884, A018885, A057659.
%K A016069 nonn,base,nice
%O A016069 1,1
%A A016069 _Robert G. Wilson v_