A016069 Numbers k such that k^2 contains exactly 2 distinct digits.
4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 20, 21, 22, 26, 30, 38, 88, 100, 109, 173, 200, 212, 235, 264, 300, 1000, 2000, 3000, 3114, 10000, 20000, 30000, 81619, 100000, 200000, 300000, 1000000, 2000000, 3000000, 10000000, 20000000, 30000000, 100000000, 200000000, 300000000
Offset: 1
Examples
26 is in the sequence because 26^2 = 676 contains exactly 2 distinct digits.
References
- R. K. Guy, Unsolved Problems in Number Theory, F24.
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..81
- Eric Weisstein's World of Mathematics, Square Number
Programs
-
Haskell
import Data.List (nub) a016069 n = a016069_list !! (n-1) a016069_list = filter ((== 2) . length . nub . show . (^ 2)) [0..] -- Reinhard Zumkeller, Apr 14 2011
-
Magma
[n: n in [0..20000000] | #Set(Intseq(n^2)) eq 2]; // Vincenzo Librandi, Nov 04 2014
-
Mathematica
Join[Select[Range[90000],Count[DigitCount[#^2],?(#!=0&)]==2&],Flatten[ NestList[ 10#&,{100000,200000,300000},5]]] (* _Harvey P. Dale, Mar 09 2013 *) Select[Range[20000000], Length[Union[IntegerDigits[#^2]]]==2&] (* Vincenzo Librandi, Nov 04 2014 *)
-
PARI
/* needs version >= 2.6 */ for (n=1, 10^9, if ( #Set(digits(n^2))==2, print1(n,", ") ) ); /* Joerg Arndt, Mar 09 2013 */
-
Python
from gmpy2 import is_square, isqrt from itertools import combinations, product A016069_list = [] for g in range(2,10): n = 2**g-1 for x in combinations('0123456789',2): for i,y in enumerate(product(x,repeat=g)): if i > 0 and i < n and y[0] != '0': z = int(''.join(y)) if is_square(z): A016069_list.append(int(isqrt(z))) A016069_list = sorted(A016069_list) # Chai Wah Wu, Nov 03 2014
Formula
a(n) = ((n-1) mod 3 + 1)*10^(ceiling(n/3)-7) for n >= 34 (conjectured). - Chai Wah Wu, Dec 17 2021
Comments