cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A046827 Numbers k such that k^2 contains all the digits of k with the same or higher multiplicity.

This page as a plain text file.
%I A046827 #27 Apr 03 2023 18:22:55
%S A046827 0,1,5,6,10,11,25,27,50,60,63,64,74,76,95,96,100,101,105,110,125,139,
%T A046827 142,205,250,255,261,270,275,277,278,285,305,364,371,376,405,421,441,
%U A046827 463,472,493,497,500,501,502,503,504,505,506,507,508,509,523,524,525
%N A046827 Numbers k such that k^2 contains all the digits of k with the same or higher multiplicity.
%C A046827 10^n is a term for all n. - _Amarnath Murthy_, Aug 03 2005
%e A046827 27 is a term as 27^2 = 729 contains 2 and 7.
%e A046827 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.
%p A046827 isA046827 := proc(n) local dgsn,dgsnsq,multsn,multsn2,o,i ;
%p A046827 dgsn := sort(convert(n,base,10)) ;
%p A046827 dgsnsq := sort(convert(n^2,base,10)) ;
%p A046827 multsn := [seq(0,i=0..9) ] ;
%p A046827 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
%t A046827 Join[{0}, Select[Range[525], Count[Table[DigitCount[#^2, 10, k] - DigitCount[#, 10, k], {k, Union[IntegerDigits[#]]}], _?Negative] == 0 &]] (* _Jayanta Basu_, Jun 29 2013 *)
%o A046827 (Python)
%o A046827 from itertools import count, islice
%o A046827 from collections import Counter
%o A046827 def A046827_gen(startvalue=0): # generator of terms >= startvalue
%o A046827     return filter(lambda k:Counter(str(k))<=Counter(str(k**2)),count(max(startvalue,0)))
%o A046827 A046827_list = list(islice(A046827_gen(),20)) # _Chai Wah Wu_, Apr 03 2023
%Y A046827 Cf. A046829, A029772.
%Y A046827 Cf. A064827 (essentially the same).
%K A046827 nonn,base
%O A046827 1,3
%A A046827 _David W. Wilson_
%E A046827 Edited by _N. J. A. Sloane_, Aug 23 2008 at the suggestion of _R. J. Mathar_