%I #35 Apr 29 2017 22:12:03
%S 2,15,138,255,186,289,418,2619,1846,1532,2551,3142,3235,10567,5755,
%T 14083,10481,10399,18565,11703,33933,17668,36766,38724,37841,35933,
%U 67309,83236,69451,57508,107027,52016,38672,118132,138785,84636,112234,131131,138087,152719
%N Least number x such that x^n has n digits equal to k. Case k = 2.
%H Martin Gossow, <a href="/A285449/b285449.txt">Table of n, a(n) for n = 1..100</a>
%e a(4) = 255 because 255^4 = 4228250625 has 4 digits '2' and is the least number to have this property.
%p P:=proc(q,h) local a,j,k,n,t; for n from 1 to q do for k from 1 to q do
%p a:=convert(k^n,base,10); t:=0; for j from 1 to nops(a) do if a[j]=h then t:=t+1; fi; od;
%p if t=n then print(k); break; fi; od; od; end: P(10^9,2);
%t Table[x = 1; While[DigitCount[x^n, 10, 2] != n, x++]; x, {n, 40}] (* _Michael De Vlieger_, Apr 25 2017 *)
%o (PARI) A285449vec=(n, {k=2})->{my(L:list, c); L=List(); for(t=1, n, forstep(y=1, +oo, 1, c=digits(y^t); if(sum(j=1, #c, c[j]==k)==t, listput(L, y); break()))); return(Vec(L))} \\ _R. J. Cano_, Apr 29 2017
%K nonn,base
%O 1,1
%A _Paolo P. Lava_, Apr 19 2017