OFFSET
1,3
COMMENTS
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
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
{0, 1, 3, 4, 9} = digits of a(10) = 10493 and of 10493^2 = 110103049;
{0, 1, 2, 5, 6} = digits of a(100) = 162025 and of 162025^2 = 26252100625;
{0, 1, 3, 4, 6, 7, 8} = digits of a(1000) = 1764380 and of 1764380^2 = 3113036784400;
{1, 2, 3, 4, 7, 8, 9} = digits of a(10000) = 14872239 and of 14872239^2 = 221183492873121.
MAPLE
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
MATHEMATICA
digitSet[n_] := Union[IntegerDigits[n]]; Select[Range[0, 99000], digitSet[#] == digitSet[#^2] &] (* Jayanta Basu, Jun 02 2013 *)
PROG
(Haskell)
import Data.List (nub, sort)
a029793 n = a029793_list !! (n-1)
a029793_list = filter (\x -> digs x == digs (x^2)) [0..]
where digs = sort . nub . show
-- Reinhard Zumkeller, Jun 27 2011
(Magma) [ n: n in [0..10^5] | Set(Intseq(n)) eq Set(Intseq(n^2)) ]; // Bruno Berselli, Jun 28 2011
(PARI) isA029793(n)=Set(Vec(Str(n)))==Set(Vec(Str(n^2))) \\ Charles R Greathouse IV, Jun 28 2011
(Scala) (0L to 99999L).filter(n => n.toString.toCharArray.toSet == (n * n).toString.toCharArray.toSet) // Alonso del Arte, Jan 19 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved