OFFSET
1,3
COMMENTS
10^n is a term for all n. - Amarnath Murthy, Aug 03 2005
EXAMPLE
27 is a term as 27^2 = 729 contains 2 and 7.
255 is a term as 255^2 = 65025 which contains the digits 2,5,5. 502 is a term as 502^2 = 252004 which contains 5, 0, 2.
MAPLE
isA046827 := proc(n) local dgsn, dgsnsq, multsn, multsn2, o, i ;
dgsn := sort(convert(n, base, 10)) ;
dgsnsq := sort(convert(n^2, base, 10)) ;
multsn := [seq(0, i=0..9) ] ;
multsn2 := [seq(0, i=0..9) ] ; for i from 1 to nops(dgsn) do o := op(1+op(i, dgsn), multsn) ; multsn := subsop( 1+op(i, dgsn)=o+1, multsn ) ; od: for i from 1 to nops(dgsnsq) do o := op(1+op(i, dgsnsq), multsn2) ; multsn2 := subsop( 1+op(i, dgsnsq)=o+1, multsn2 ) ; od: for i from 1 to 10 do if op(i, multsn2) < op(i, multsn) then RETURN(false) ; fi ; od: RETURN(true) ; end: for n from 1 to 700 do if isA046827(n) then printf("%d, ", n) ; fi ; od; # R. J. Mathar, Feb 11 2008
MATHEMATICA
Join[{0}, Select[Range[525], Count[Table[DigitCount[#^2, 10, k] - DigitCount[#, 10, k], {k, Union[IntegerDigits[#]]}], _?Negative] == 0 &]] (* Jayanta Basu, Jun 29 2013 *)
PROG
(Python)
from itertools import count, islice
from collections import Counter
def A046827_gen(startvalue=0): # generator of terms >= startvalue
return filter(lambda k:Counter(str(k))<=Counter(str(k**2)), count(max(startvalue, 0)))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Edited by N. J. A. Sloane, Aug 23 2008 at the suggestion of R. J. Mathar
STATUS
approved