login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A016069
Numbers k such that k^2 contains exactly 2 distinct digits.
18
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
OFFSET
1,1
COMMENTS
10^k, 2*10^k, 3*10^k for k > 0 are terms. - Chai Wah Wu, Dec 17 2021
Subsequence of primes is A057659. - Bernard Schott, Jul 29 2022
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
FORMULA
a(n) = ((n-1) mod 3 + 1)*10^(ceiling(n/3)-7) for n >= 34 (conjectured). - Chai Wah Wu, Dec 17 2021
EXAMPLE
26 is in the sequence because 26^2 = 676 contains exactly 2 distinct digits.
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 *)
PROG
(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
(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
(Magma) [n: n in [0..20000000] | #Set(Intseq(n^2)) eq 2]; // Vincenzo Librandi, Nov 04 2014
CROSSREFS
KEYWORD
nonn,base,nice
STATUS
approved