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!)
A029793 Numbers k such that k and k^2 have the same set of digits. 17

%I #35 Sep 08 2022 08:44:50

%S 0,1,10,100,1000,4762,4832,10000,10376,10493,11205,12385,12650,14829,

%T 22450,23506,24605,26394,34196,36215,47620,48302,48320,49827,64510,

%U 68474,71205,72510,72576,74510,74528,79286,79603,79836,94583,94867,96123,98376

%N Numbers k such that k and k^2 have the same set of digits.

%C This sequence has density 1: almost all numbers k have all 10 digits in both k and k^2. - _Franklin T. Adams-Watters_, Jun 28 2011

%H Reinhard Zumkeller, <a href="/A029793/b029793.txt">Table of n, a(n) for n = 1..10000</a>

%e {0, 1, 3, 4, 9} = digits of a(10) = 10493 and of 10493^2 = 110103049;

%e {0, 1, 2, 5, 6} = digits of a(100) = 162025 and of 162025^2 = 26252100625;

%e {0, 1, 3, 4, 6, 7, 8} = digits of a(1000) = 1764380 and of 1764380^2 = 3113036784400;

%e {1, 2, 3, 4, 7, 8, 9} = digits of a(10000) = 14872239 and of 14872239^2 = 221183492873121.

%p seq(`if`(convert(convert(n,base,10),set) = convert(convert(n^2,base,10),set), n, NULL), n=0..100000); # _Nathaniel Johnston_, Jun 28 2011

%t digitSet[n_] := Union[IntegerDigits[n]]; Select[Range[0, 99000], digitSet[#] == digitSet[#^2] &] (* _Jayanta Basu_, Jun 02 2013 *)

%o (Haskell)

%o import Data.List (nub, sort)

%o a029793 n = a029793_list !! (n-1)

%o a029793_list = filter (\x -> digs x == digs (x^2)) [0..]

%o where digs = sort . nub . show

%o -- _Reinhard Zumkeller_, Jun 27 2011

%o (Magma) [ n: n in [0..10^5] | Set(Intseq(n)) eq Set(Intseq(n^2)) ]; // _Bruno Berselli_, Jun 28 2011

%o (PARI) isA029793(n)=Set(Vec(Str(n)))==Set(Vec(Str(n^2))) \\ _Charles R Greathouse IV_, Jun 28 2011

%o (Scala) (0L to 99999L).filter(n => n.toString.toCharArray.toSet == (n * n).toString.toCharArray.toSet) // _Alonso del Arte_, Jan 19 2020

%Y Cf. A029795, A029797, A030091; A178501 is a subsequence, A054038, A171102, A232659-A232662.

%K nonn,base

%O 1,3

%A _Patrick De Geest_

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 April 25 11:39 EDT 2024. Contains 371969 sequences. (Running on oeis4.)