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.
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, 26, 27, 29, -1, 32, 62, 33, 33, 71, 37, 37, 36, 39, -1, 42, 40, 84, 43, 92, 47, 46, 47, 98, -1, 103, 51, 53, 53, 166, 57, 171, 56, 59, -1, 62, 60, 62, 63, 396, 67, 66
Offset: 2
Examples
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.
References
- Marco Ripà, La strana coda della serie n^n^...^n, Trento, UNI Service, Nov 2011. ISBN 978-88-6178-789-6.
Links
- Marco Ripà, The congruence speed formula, Notes on Number Theory and Discrete Mathematics, 2021, 27(4), 43-61.
- Marco Ripà and Luca Onnis, Number of stable digits of any integer tetration, Notes on Number Theory and Discrete Mathematics, 2022, 28(3), 441-457.
- Wikipedia, Tetration
Programs
-
Python
def last_k_digits_tetration(base, height, k): mod = 10 ** k result = base for _ in range(height - 1): result = pow(base, result, mod) return str(result).zfill(k) def count_stable_digits(base, k=500): try: x = last_k_digits_tetration(base, base, k) y = last_k_digits_tetration(base, base + 1, k) count = 0 for i in range(1, k + 1): if x[-i] == y[-i]: count += 1 else: break return count except: return -1 for n in range(2, 101): if n % 10 == 0: print(f"n = {n}: -1") else: print(f"n = {n}: {count_stable_digits(n)}")
Formula
If n == 0 (mod 10), then a(n) = -1, and a(n) = A356946(n) otherwise.
Comments