This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A386005 #6 Jul 20 2025 15:51:58 %S A386005 0,2,3,12,7,12,7,9,-1,12,11,13,13,61,17,17,32,19,-1,22,20,22,46,78,54, %T A386005 26,27,29,-1,32,62,33,33,71,37,37,36,39,-1,42,40,84,43,92,47,46,47,98, %U A386005 -1,103,51,53,53,166,57,171,56,59,-1,62,60,62,63,396,67,66 %N A386005 Number of stable digits of the integer tetration n^^n (i.e., maximum nonnegative integer m such that n^^n is congruent modulo 10^m to n^^(n + 1)), or -1 if n is a multiple of 10. %C A386005 If n is divisible by 10, the corresponding a(n) would be too large to be include in the data section (it would be equal to the number of trailing zeros that appear at the end of n^^n). %C A386005 This sequence directly follows from the constancy of the "congruence speed" property characterizing tetration (for an explicit formula to calculate a(n) for any n not a multiple of 10, see the linked paper entitled "Number of stable digits of any integer tetration"). %D A386005 Marco Ripà, La strana coda della serie n^n^...^n, Trento, UNI Service, Nov 2011. ISBN 978-88-6178-789-6. %H A386005 Marco Ripà, <a href="https://doi.org/10.7546/nntdm.2021.27.4.43-61">The congruence speed formula</a>, Notes on Number Theory and Discrete Mathematics, 2021, 27(4), 43-61. %H A386005 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 A386005 Wikipedia, <a href="https://en.wikipedia.org/wiki/Tetration">Tetration</a> %F A386005 If n == 0 (mod 10), then a(n) = -1, and a(n) = A356946(n) otherwise. %e A386005 For n = 5, 5^5^5^5^5 is congruent to 5^5^5^5^5^5 (mod 10^12) and 5^5^5^5^5 is not congruent to 5^5^5^5^5^5 (mod 10^13). Thus, a(5) = 12. %o A386005 (Python) %o A386005 def last_k_digits_tetration(base, height, k): %o A386005 mod = 10 ** k %o A386005 result = base %o A386005 for _ in range(height - 1): %o A386005 result = pow(base, result, mod) %o A386005 return str(result).zfill(k) %o A386005 def count_stable_digits(base, k=500): %o A386005 try: %o A386005 x = last_k_digits_tetration(base, base, k) %o A386005 y = last_k_digits_tetration(base, base + 1, k) %o A386005 count = 0 %o A386005 for i in range(1, k + 1): %o A386005 if x[-i] == y[-i]: %o A386005 count += 1 %o A386005 else: %o A386005 break %o A386005 return count %o A386005 except: %o A386005 return -1 %o A386005 for n in range(2, 101): %o A386005 if n % 10 == 0: %o A386005 print(f"n = {n}: -1") %o A386005 else: %o A386005 print(f"n = {n}: {count_stable_digits(n)}") %Y A386005 Cf. A317824, A317903, A317905, A349425, A356946. %K A386005 sign,base,hard %O A386005 2,2 %A A386005 _Marco Ripà_, Jul 14 2025