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

%I #31 Feb 13 2024 20:03:43

%S 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,

%T 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,

%U 18,3,1,3,2,70,3,1,2,2,5,6,2,0,2,80,3,0

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

%C The common digits might include leading 0's (such as at n = 43) and those 0's are included in the count.

%C 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.

%C a(-1) = 1 since (-1)^((-1)^(-1)) = (-1)^(-1) = -1 (which is a one-digit number);

%C a(0) = 0 since 0^0 = 1 and consequently 0^(0^0) = 0 and they have no digits in common.

%C a(n) = 0 if and only if n=0 or n == 2 or 18 (mod 20), see Links for details.

%C 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.

%C From _Jianing Song_, Feb 13 2024: (Start)

%C For n >= 3, n^(n^n) - n^n is divisible by 32: let vp(N) denote the p-adic valuation of N and write n^(n^n) - n^n = n^n * (n^(n*(n^(n-1)-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^(n-1)-1)) - 1) is 3*v2(n-1) + 2*v2(n+1) - 2 >= 5, with the equality holding if and only if v2(n-1) = 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 5-adic valuation of n^(n^n) - n^n. For example, for n > 1, a(n) = 1 if and only if v5(n^4-1) = 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.

%C 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^(n-1)-1) is divisible by 4 but not by 5, so v5(n^(n^n) - n^n) = v5(n^(n*(n^(n-1)-1)) - 1) = v5(n^4-1) + v5(n*(n^(n-1)-1)) = v5(n^4-1) = m. (End)

%H Jianing Song, <a href="/A369826/b369826.txt">Table of n, a(n) for n = -1..10000</a>

%H Marco Ripà and Luca Onnis, <a href="https://doi.org/10.7546/nntdm.2022.28.3.441-457">Number of stable digits of any integer tetration</a>, Notes on Number Theory and Discrete Mathematics, 2022, 28(3), 441-457.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Tetration">Tetration</a>.

%F 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)).

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

%o (PARI)

%o \\ As n^(n^n) - n^n = n^n * (n^(n*(n^(n-1)-1)) - 1), it suffices to calculate the 2-adic and the 5-adic valuations of n^(n*(n^(n-1)-1)) - 1.

%o 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);

%o v2 = if(n%2, 3*valuation(n-1,2) + 2*valuation(n+1,2) - 2, n*valuation(n,2));

%o v5 = n*valuation(n,5) + coeff[1+n%20]*valuation(n^4-1,5);

%o min(v2,v5);))

%o } \\ _Jianing Song_, Feb 13 2024

%Y Cf. A002488, A317905, A349425, A369771 (n^^3 and n^^4).

%K nonn,base,easy

%O -1,7

%A _Marco Ripà_, Feb 02 2024