

A369826


Number of the rightmost decimal digits of n^n that are the same as those of n^(n^n).


9



1, 0, 1, 0, 1, 1, 4, 3, 2, 1, 2, 10, 3, 1, 2, 1, 9, 3, 2, 0, 2, 20, 3, 0, 1, 2, 9, 6, 1, 1, 2, 30, 3, 2, 2, 1, 5, 3, 2, 0, 2, 40, 3, 0, 2, 1, 6, 3, 1, 1, 4, 50, 5, 1, 2, 1, 7, 3, 6, 0, 2, 60, 3, 0, 1, 1, 18, 3, 1, 3, 2, 70, 3, 1, 2, 2, 5, 6, 2, 0, 2, 80, 3, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,7


COMMENTS

The common digits might include leading 0's (such as at n = 43) and those 0's are included in the count.
Common digits do not extend beyond the most significant digit of n^n, so that for instance a(5) = 4 stops at all digits of n^n = 3125.
a(1) = 1 since (1)^((1)^(1)) = (1)^(1) = 1 (which is a onedigit number);
a(0) = 0 since 0^0 = 1 and consequently 0^(0^0) = 0 and they have no digits in common.
a(n) = 0 if and only if n=0 or n == 2 or 18 (mod 20), see Links for details.
For n = k*10^c with c >= 1 and k != 0 (mod 10), a(n) = c*n which is the rightmost 0's of n^n.
For n >= 3, n^(n^n)  n^n is divisible by 32: let vp(N) denote the padic valuation of N and write n^(n^n)  n^n = n^n * (n^(n*(n^(n1)1))  1). For even n >= 4, we have v2(n^(n^n)  n^n) = v2(n^n) = n*v2(n) >= 5. For odd n, we have v2(n^(n^n)  n^n) = v2(n^(n*(n^(n1)1))  1) is 3*v2(n1) + 2*v2(n+1)  2 >= 5, with the equality holding if and only if v2(n1) = 1 and v2(n+1) = 2, i.e., n == 3 (mod 8). As a result, for most n, the number of common digits is completely determined by the 5adic valuation of n^(n^n)  n^n. For example, for n > 1, a(n) = 1 if and only if v5(n^41) = 1 and n == 3, 4, 7, 8, 12, 14 (mod 20), namely n being congruent to 3, 4, 8, 12, 14, 23, 27, 28, 34, 44, 47, 48, 52, 54, 63, 64, 67, 72, 83, 84, 87, 88, 92, 94 modulo 100.
Every number appears infinitely many times in this sequence: for a given m >= 1, let n be a solution to n == 0 (mod 2^max{m,2}) and n == 1 (mod 5^m), then n^(n^n)  n^n is divisible by 2^m. On the other hand, n*(n^(n1)1) is divisible by 4 but not by 5, so v5(n^(n^n)  n^n) = v5(n^(n*(n^(n1)1))  1) = v5(n^41) + v5(n*(n^(n1)1)) = v5(n^41) = m. (End)


LINKS



FORMULA

For any n > 1 and n <> 5, a(n) is such that n^n == n^(n^n) (mod 10^(a(n))) and n^n !== n^(n^n) (mod 10^(a(n)+1)).


EXAMPLE

For n=5, a(n)=4 since 5^5 = 3125 and 5^(5^5) == 203125 (mod 10^6).


PROG

(PARI)
\\ As n^(n^n)  n^n = n^n * (n^(n*(n^(n1)1))  1), it suffices to calculate the 2adic and the 5adic valuations of n^(n*(n^(n1)1))  1.
a(n) = {if(n<=1, abs(n), if(n==5, 4, my(coeff = [0, 3, 0, 1, 1, 0, 3, 1, 1, 2, 0, 3, 1, 2, 1, 0, 3, 2, 0, 2], v2, v5);
v2 = if(n%2, 3*valuation(n1, 2) + 2*valuation(n+1, 2)  2, n*valuation(n, 2));
v5 = n*valuation(n, 5) + coeff[1+n%20]*valuation(n^41, 5);
min(v2, v5); ))


CROSSREFS



KEYWORD

nonn,base,easy


AUTHOR



STATUS

approved



