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)))
(Magma) [n: n in [0..20000000] | #Set(Intseq(n^2)) eq 2]; // Vincenzo Librandi, Nov 04 2014
CROSSREFS
KEYWORD
nonn,base,nice
AUTHOR
STATUS
approved