login
Least number x such that x^n has n digits equal to k. Case k=5.
3

%I #13 May 06 2017 09:23:15

%S 5,75,136,273,435,725,715,1696,1205,2965,3705,1692,1953,4508,5915,

%T 10948,10124,13734,14696,20727,17653,22122,35855,24016,27643,33171,

%U 34153,64855,62667,81285,97193,45112,98735,88505,123345,98556,80633,157034,102908,28383,176175

%N Least number x such that x^n has n digits equal to k. Case k=5.

%H Martin Gossow, <a href="/A285452/b285452.txt">Table of n, a(n) for n = 1..100</a>

%e a(4) = 273 because 273^4 = 5554571841 has 4 digits '5' 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,5);

%t With[{k = 5}, Table[x = 1; While[DigitCount[x^n, 10, k] != n, x++]; x, {n, 41}]] (* _Michael De Vlieger_, May 01 2017 *)

%o (PARI) A285452vec=(n, {k=5})->{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 30 2017

%K nonn,base,easy

%O 1,1

%A _Paolo P. Lava_, Apr 19 2017