login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A243977
a(n) is the largest run of identical digits that n^k can end with for some k, or 0 if there is no limit to such runs.
3
3, 1, 2, 1, 1, 1, 3, 1, 0, 2, 3, 3, 2, 1, 1, 5, 1, 2, 0, 1, 3, 1, 1, 1, 1, 1, 3, 1, 0, 3, 1, 4, 2, 1, 1, 3, 3, 3, 0, 1, 3, 1, 2, 1, 1, 1, 3, 1, 0, 1, 3
OFFSET
2,1
COMMENTS
a(10*n) = 0 for all n > 0.
a(54) > 30 or 0. The sequence continues for 54 < n < 100 {2, 2, 1, 1, 3, 2, 0, 1, 3, 1, 2, 1, 2, 1, 1, 1, 0, ?, 3, 3, 1, 1, 1, ?, 3, 4, 0, 1, 1, 1, 2, 1, 1, 1, 3, 1, 0, 2, 3, 1, 2, 1, 1, 4, 3, 2} where the question marks represent a(71) and a(77). a(71) > 44 or 0 and a(77) > 16 or 0.
a(53), a(71) and a(77) are conjectured to be infinite. See A244187.
EXAMPLE
For a(1), 2^k ends in 1 identical digit when k = 1, 2 identical digits when k = 18, and 3 identical digits when k = 39. 2^k doesn't end in 4 identical digits for any k. Thus a(1) = 3.
PROG
(PARI) a(n, p)=lst=[]; for(c=0, 10^p, m=n^c%10^p; if(vecsearch(vecsort(lst), m), for(i=1, #lst, if(vecextract(lst, 2^(i-1), )==[m], return([c, c-i+1])))); if(!vecsearch(vecsort(lst), m), lst=concat(lst, m)))
hup(n)=if(n%10==0, return(0)); ww=[]; p=2; for(ii=1, a(n, p)[1], ww=concat(ww, ii)); while(p<100, v=ww; w=[]; for(q=1, #v, h=digits(n^v[q]%10^p); if(#h==p&&(vecmin(h)==vecmax(h)), w=concat(w, v[q]))); if(w, ww=[]; for(k=1, #w, j=w[k]; while(j<=a(n, p+1)[1], ww=concat(ww, j); j+=a(n, p)[2])); ww=vecsort(ww, , 8); p++); if(!w, return(p-1)))
n=2; while(n<100, print1(hup(n), ", "); n++)
(Python)
def a(n, p):
..lst = []
..for c in range(10**p+1):
....m = n**c%10**p
....if m in lst:
......return [c, c-lst.index(m)]
....else:
......lst.append(m)
def cou(n):
..if n % 10 == 0:
....return 0
..ww = []
..p = 2
..aa = a(n, p)[0]
..ww.extend(range(aa))
..while p < 100:
....newlst = ww
....w = []
....for i in newlst:
......m = n**i%10**p
......if len(str(m))==p and m%int('1'*p)==0:
........w.append(i)
....if w:
......ww = []
......for k in w:
........j = k
........while j <= a(n, p+1)[0]:
..........ww.append(j)
..........j += a(n, p)[1]
......ww.sort()
......p += 1
....else:
......return p-1
n = 2
while n < 100:
..if cou(n):
....print(cou(n), end=', ')
..else:
....print(0, end=', ')
..n += 1
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jun 16 2014
EXTENSIONS
Programs corrected and improved by Derek Orr, Aug 18 2014
STATUS
approved