%I #20 Dec 11 2021 04:30:10
%S 32,243,256,625,7776,16807,4096,31381059609,0,121,
%T 79496847203390844133441536,51185893014090757,155568095557812224,
%U 22168378200531005859375,17592186044416,118587876497,11019960576,42052983462257059
%N Smallest power of n whose decimal expansion contains n+1, or 0 if no such number exists.
%C More precisely: smallest power of n (with positive integer exponent) whose decimal expansion contains n+1 as a substring of consecutive decimal digits. This is A[n,n+1], the diagonal above the trivial main diagonal of the array A[k,n] = Smallest power of k whose decimal expansion contains n.
%C The k=2 row A[2,n] = A030001.
%C The k=3 row A[3,n] = A176763.
%C The k=4 row A[4,n] = A176764.
%C The k=5 row A[5,n] = A176765...
%C a(10^k+1) = (10^k+1)^2 for k > 0. - _Chai Wah Wu_, Feb 13 2017
%H Chai Wah Wu, <a href="/A186774/b186774.txt">Table of n, a(n) for n = 2..1999</a>
%e a(2) = 32 = A030001(3) = smallest power of 2 whose decimal expansion contains 3.
%e a(3) = 243 = A176763(4) = smallest power of 3 whose decimal expansion contains 4.
%p a:= proc(n) local t, k;
%p if type(simplify(log[10](n)), integer) then 0
%p else t:= cat(n+1);
%p for k from 2 while searchtext(t, cat(n^k))=0
%p do od; n^k
%p fi
%p end:
%p seq(a(n), n=2..40); # _Alois P. Heinz_, Feb 26 2011
%o (Python)
%o def A186774(n):
%o if sum(int(d) for d in str(n)) == 1:
%o return 0
%o sn, k = str(n+1), 1
%o while sn not in str(k):
%o k *= n
%o return k # _Chai Wah Wu_, Feb 13 2017
%Y Cf. A018856, A063565, A030001, A176763-A176773.
%K nonn,base,easy
%O 2,1
%A _Jonathan Vos Post_, Feb 26 2011
|