%I
%S 53,71,77,133,177,213,231,237,273,311,317,373,391,397,453,471,477,497,
%T 533,613,631,637,711,717,773,791,797,817,853,871,877,913,933,1013,
%U 1031,1037,1111,1117,1137,1173,1191,1197,1233,1253,1271,1277,1333,1413,1431,1437,1511,1517,1553,1573,1591,1597,1653,1671,1677,1733,1777,1813,1831,1837,1873,1911,1917,1973,1991,1997
%N Numbers n not divisible by 10 such that, for some k, n^k can end in a repdigit of any length.
%C Trivially, (10*m)^k can end in any number of zeros. Thus numbers divisible by 10 are not included in this sequence.
%C This sequence contains only numbers that end in a 1, 3, or 7.
%C Those that end in 1 are congruent to {71, 231, 311, 391} (mod 400).
%C Those that end in 3 are congruent to {53, 133, 213, 373} (mod 400) or are a subsequence of 273 mod 320 (for n < 2000, only 593 == 273 (mod 320) but it is not a term of this sequence).
%C Those that end in 7 are congruent to {77, 237, 317, 397} (mod 400) or are a subsequence of 177 (mod 320) (for n < 2000, only 1457 == 177 (mod 320) but it is not a term of this sequence).
%C If a(n) ends in a 1, then a(n+1) ends in a 7 and a(n+1) = a(n)+6. Note that the converse is not true.
%C Fix an M large enough. There exist infinitely many k such that a(n)^k ends in M of the same digit. Those k values can be given as X mod Y for some X and Y. Take two consecutive powers k and k' that satisfy this. Let the digit immediately before the repeating digit in a(n)^k be called D and the digit immediately before the repeating digit in a(n)^k' be called D'. D  D' will always be odd for large enough M. Example: M = 4 and a(n) = 71. 71^k ends in 4 ones for k = 13, 263, 513, 763, ... == 13 (mod 250). Taking k = 13 and k' = 263, 71^13 ends in 31111 and 71^263 ends in 61111. Thus, D = 3 and D' = 6, and we see 3  6 is odd.
%e 53^9 ends in 33. 53^29 ends in 333. 53^529 ends in 3333. 53^4529 ends in 33333. 53^49529 ends in 333333. This can continue for any number of 3's, where the exponent of 53 is some function based on how many 3's are at the end. We see f(2) = 9, f(3) = 29, f(4) = 529, f(5) = 4529, f(6) = 49529, and so on. Thus 53 is a term of this sequence.
%o (PARI)
%o a1(n,p,m)=hh=0;for(i=1,10^p,st=(n^i)%10^p;w=digits(st);sb=(n^i)%10^(p+1);if(#w==p&&vecmin(w)==vecmax(w),hh++);if(hh==m,return((sbst)/10^p)))
%o a2(n,p)=for(i=1,10^p,v=digits((n^i)%10^p);if(#v==p&&vecmin(v)==vecmax(v),return(vecmin(v))))
%o seq(n)={p=3;while(p<10,if(!a2(n,p),return(0));aa=a1(n,p,3);di1=aaa1(n,p,2);di2=aaa2(n,p);if(di1==Mod(0,2)&&di2==Mod(1,2),return(0));if(di1==Mod(0,2)&&di2==Mod(0,2),p++);if(di1==Mod(1,2),return(1)))}
%o n=1;while(n<2000,if(seq(n),print1(n,", "));n++)
%Y Cf. A243977.
%K nonn,base
%O 1,1
%A _Derek Orr_, Jun 21 2014
