login
Least number k such that n^k ends in two identical digits, or 0 if no such number exists.
2

%I #5 Jun 16 2014 01:51:36

%S 18,0,9,0,0,0,6,0,2,1,2,17,3,0,0,11,0,5,2,0,1,0,0,0,0,0,14,0,2,7,0,1,

%T 7,0,0,7,2,5,2,0,3,0,1,0,0,0,9,0,2,0,18,3,9,1,0,0,6,5,2,0,2,0,3,0,1,0,

%U 0,0,2,3,7,11,0,0,0,1,14,5,2,0,0,0,7,0,0,0,1,0,2,9,3,0,11

%N Least number k such that n^k ends in two identical digits, or 0 if no such number exists.

%C For all n > 1, the 2-digit ending of n^k repeats itself after a certain k-value. Thus a(n) = 0 is definite.

%C a(10*n) = 2 for all n > 0. Thus there are infinitely many nonzero entries. a(5^n) = 0 for all n > 0. Thus there are infinitely many zero entries.

%e 2^18 = 262144 ends in two of the same digit. Thus a(2) = 18.

%o (Python)

%o def b(n,p):

%o ..lst = []

%o ..count = 0

%o ..lst1 = []

%o ..for i in range(1,5**(n+2)):

%o ....st = str(p**i)

%o ....if len(st) >= n:

%o ......if int(st[len(st)-n:len(st)]) not in lst:

%o ........lst.append(int(st[len(st)-n:len(st)]))

%o ........lst1.append(i)

%o ......else:

%o ........return len(lst)+min(lst1)

%o def a(p):

%o ..for i in range(1,b(2,p)+2):

%o ....st = str(p**i)

%o ....if int(st[len(st)-2:len(st)])%11==0:

%o ......return i

%o p = 2

%o while p < 100:

%o ..if a(p):

%o ....print(a(p),end=', ')

%o ..else:

%o ....print(0,end=', ')

%o ..p += 1

%Y Cf. A005054, A216099.

%K nonn,base

%O 2,1

%A _Derek Orr_, Jun 14 2014