login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A016069 Numbers k such that k^2 contains exactly 2 distinct digits. 18

%I #49 Sep 08 2022 08:44:40

%S 4,5,6,7,8,9,10,11,12,15,20,21,22,26,30,38,88,100,109,173,200,212,235,

%T 264,300,1000,2000,3000,3114,10000,20000,30000,81619,100000,200000,

%U 300000,1000000,2000000,3000000,10000000,20000000

%N Numbers k such that k^2 contains exactly 2 distinct digits.

%C 10^k, 2*10^k, 3*10^k for k > 0 are terms. - _Chai Wah Wu_, Dec 17 2021

%C Subsequence of primes is A057659. - _Bernard Schott_, Jul 29 2022

%D R. K. Guy, Unsolved Problems in Number Theory, F24.

%H Robert G. Wilson v, <a href="/A016069/b016069.txt">Table of n, a(n) for n = 1..81</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SquareNumber.html">Square Number</a>

%F a(n) = ((n-1) mod 3 + 1)*10^(ceiling(n/3)-7) for n >= 34 (conjectured). - _Chai Wah Wu_, Dec 17 2021

%e 26 is in the sequence because 26^2 = 676 contains exactly 2 distinct digits.

%t Join[Select[Range[90000],Count[DigitCount[#^2],_?(#!=0&)]==2&],Flatten[ NestList[ 10#&,{100000,200000,300000},5]]] (* _Harvey P. Dale_, Mar 09 2013 *)

%t Select[Range[20000000], Length[Union[IntegerDigits[#^2]]]==2&] (* _Vincenzo Librandi_, Nov 04 2014 *)

%o (Haskell)

%o import Data.List (nub)

%o a016069 n = a016069_list !! (n-1)

%o a016069_list = filter ((== 2) . length . nub . show . (^ 2)) [0..]

%o -- _Reinhard Zumkeller_, Apr 14 2011

%o (PARI) /* needs version >= 2.6 */

%o for (n=1, 10^9, if ( #Set(digits(n^2))==2, print1(n,", ") ) );

%o /* _Joerg Arndt_, Mar 09 2013 */

%o (Python)

%o from gmpy2 import is_square, isqrt

%o from itertools import combinations, product

%o A016069_list = []

%o for g in range(2,10):

%o n = 2**g-1

%o for x in combinations('0123456789',2):

%o for i,y in enumerate(product(x,repeat=g)):

%o if i > 0 and i < n and y[0] != '0':

%o z = int(''.join(y))

%o if is_square(z):

%o A016069_list.append(int(isqrt(z)))

%o A016069_list = sorted(A016069_list) # _Chai Wah Wu_, Nov 03 2014

%o (Magma) [n: n in [0..20000000] | #Set(Intseq(n^2)) eq 2]; // _Vincenzo Librandi_, Nov 04 2014

%Y Cf. A016070, A018884, A018885, A057659.

%K nonn,base,nice

%O 1,1

%A _Robert G. Wilson v_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)